Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Base install Perl - getting cpan to work through proxy authentication

by mikeraz (Friar)
on Jul 18, 2012 at 18:07 UTC ( [id://982508]=perlquestion: print w/replies, xml ) Need Help??

mikeraz has asked for the wisdom of the Perl Monks concerning the following question:

This is actually a rant based on recent frustration. It also includes the answer, so I don't have a question but am instead posting the Q&A so it's here and findable via search.

To begin, I posted the following on <mumble mumble/>:

I have a Linux box in a corporate environment in which web access is gated through a proxy which requires authentication.
 
During a first run of cpan it auto configures everything that it normally does:

Autoconfigured everything but 'urllist'. Please call 'o conf init +urllist' to configure your CPAN server(s) now! commit: wrote '/usr/lib/perl5/5.10.0/CPAN/Config.pm'

Knowing that I have a proxy to navigate, and having read the docs and several pages on the web about proxy and cpan I:

cpan[1]> o conf init /proxy/ If you're accessing the net via proxies, you can specify them in t +he CPAN configuration or via environment variables. The variable in t +he $CPAN::Config takes precedence. Your ftp_proxy? [] Your http_proxy? [] 10.12.8.9:3128 Your no_proxy? [] If your proxy is an authenticating proxy, you can store your usern +ame permanently. If you do not want that, just press RETURN. You will + then be asked for your username in every future session. Your proxy user id? [] my_net_id Your password for the authenticating proxy can also be stored perm +anently on disk. If this violates your security policy, just press RE +TURN. You will then be asked for the password in every future session +. CPAN: Term::ReadKey loaded ok (v2.30) Your proxy password? Please +remember to call 'o conf commit' to make the config permanent! cpan[2]> o conf commit commit: wrote '/usr/lib/perl5/5.10.0/CPAN/C +onfig.pm'

All should be good now, right? So I wish,

cpan[3]> i /Some::Module/ CPAN: Storable loaded ok (v2.18) I would like to connect to one of the following sites to get 'auth +ors/01mailrc.txt.gz': http://www.perl.org/CPAN/ ftp://ftp.perl.org/pub/CPAN/ Is it OK to try to connect to the Internet? [yes] LWP not availabl +e Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get ht +tp://www.perl.org/CPAN/authors/01mailrc.txt.gz curl: (22) The request +ed URL returned error: 407 System call "/usr/bin/curl -L -f -s -S --netrc-optional "http://ww +w.perl.org/CPAN/authors/01mailrc.txt.gz" > /root/.cpan/sources/author +s/01mailrc.txt.tmp29726" returned status 22 (wstat 5632) Warning: exp +ected file [/root/.cpan/sources/authors/01mailrc.txt.gz.tmp29726] doe +sn't exist Trying with "/usr/bin/wget -O /root/.cpan/sources/authors/01mailrc +.txt.tmp29726" to get http://www.perl.org/CPAN/authors/01mailrc.txt.g +z --2012-07-17 15:57:38-- http://www.perl.org/CPAN/authors/01mailrc.t +xt.gz Connecting to 10.12.8.9:3128... connected. Proxy request sent, +awaiting response... 301 Moved Permanently Location: http://www.cpan. +org/authors/01mailrc.txt.gz [following] --2012-07-17 15:57:38-- http: +//www.cpan.org/authors/01mailrc.txt.gz Connecting to 10.12.8.9:3128.. +. connected. Proxy request sent, awaiting response... 407 Proxy Authe +ntication Required 2012-07-17 15:57:38 ERROR 407: Proxy Authenticatio +n Required.

So where's the password prompt?
What am I missing to configure cpan to access the internet through the corporate proxy with authentication?

Perhaps you've been here also: new box, proxy to navigate through, check the internet to review and confirm how to configure cpan to navigate the proxy, and then ... failure.

Here is the solution: install LWP

But wait, isn't that a module you'd normally install with cpan or cpanplus or cpanminus? Yeah it is. It's time to get old school and download and install by hand.

Before you go there, LWP has a few dependencies. The complete kit you will need is:

Compress-Raw-Bzip2-2.049.tar.gz Compress-Raw-Zlib-2.051.tar.gz Digest-MD5-2.51.tar.gz Encode-Locale-1.03.tar.gz HTML-Form-6.02.tar.gz HTML-Parser-3.69.tar.gz HTML-Tagset-3.20.tar.gz HTTP-Cookies-6.01.tar.gz HTTP-Date-6.01.tar.gz HTTP-Message-6.03.tar.gz HTTP-Negotiate-6.01.tar.gz IO-Compress-2.049.tar.gz libnet-1.22.tar.gz libwww-perl-6.04.tar.gz LWP-MediaTypes-6.02.tar.gz MIME-Base64-3.13.tar.gz Net-HTTP-6.03.tar.gz URI-1.59.tar.gz WWW-RobotRules-6.02.tar.gz
The sequence of what needs to be installed in what order is left as an exercise for the reader.


Be Appropriate && Follow Your Curiosity

Replies are listed 'Best First'.
Re: Base install Perl - getting cpan to work through proxy authentication
by Anonymous Monk on Jul 19, 2012 at 00:28 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://982508]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-24 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found