I'm trying to add the ppa repository (as a root) with the following command:
export HTTP_PROXY="http://firstname.surname@xxx.com:my_pass@165.x.x.232:8080"
add-apt-repository ppa:nilarimogard/webupd8
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 125, in <module>
ppa_info = get_ppa_info_from_lp(user, ppa_name)
File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 84, in get_ppa_info_from_lp
curl.perform()
pycurl.error: (56, 'Received HTTP code 407 from proxy after CONNECT')
Unfortunately it doesn't work. Looks like curl is connecting to the proxy, but the proxy says that Authentication is Required.
I've tried with .curlrc, http_proxy env instead, but it doesn't work.
strace -e network,write -s1000 add-apt-repository ppa:nilarimogard/webupd8
socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 4
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(8080), sin_addr=inet_addr("165.x.x.232")}, 16) = -1 EINPROGRESS (Operation now in progress)
getsockopt(4, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
getpeername(4, {sa_family=AF_INET, sin_port=htons(8080), sin_addr=inet_addr("165.x.x.232")}, [16]) = 0
getsockname(4, {sa_family=AF_INET, sin_port=htons(46025), sin_addr=inet_addr("161.20.75.220")}, [16]) = 0
sendto(4, "CONNECT launchpad.net:443 HTTP/1.1\r\nHost: launchpad.net:443\r\nUser-Agent: PycURL/7.22.0\r\nProxy-Connection: Keep-Alive\r\nAccept: application/json\r\n\r\n", 146, MSG_NOSIGNAL, NULL, 0) = 146
recvfrom(4, "HTTP/1.1 407 Proxy Authentication Required\r\nProxy-Authenticate: BASIC realm=\"proxy\"\r\nCache-Control: no-cache\r\nPragma: no-cache\r\nContent-Type: text/html; charset=utf-8\r\nProxy-Connection: close\r\nSet-Cookie: BCSI-CS-91b9906520151dad=2; Path=/\r\nConnection: close\
Maybe it's because there is @ sign in the username? Wget works with proxy fine.
Related:
How do I add a repository from behind a proxy?
Environment
Ubuntu 12.04
curl 7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
curl Features: GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
UPDATE
When added credentials into .curlrc
cat ~/.curlrc
proxy = 165.x.x.232:8080
proxy-user = name.surname@xxx.com:mypass0
It seems to work for the plain curl.
curl www.google.com | head
* Proxy auth using Basic with user 'name.surname@xxx.com'
GET HTTP://www.google.com HTTP/1.1
Proxy-Authorization: Basic cmFmYWwud2llY3pvcmVrQHVi...3R0RDA=
HTTP/1.1 302 Found
Also HTTPS:
curl -v https://www.google.com | head
* Establish HTTP proxy tunnel to www.google.com:443
* Proxy auth using Basic with user 'name.surname@xxx.com'
> CONNECT www.google.com:443 HTTP/1.1
> Host: www.google.com:443
> Proxy-Authorization: Basic cmFmYWwud2llY3pvcmVrQHVi...3R0RDA=
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Proxy-Connection: Keep-Alive
< HTTP/1.1 200 Connection established
* Proxy replied OK to CONNECT request
* successfully set certificate verify locations
But still doesn't work when adding ppa certificate.
pycurl.error: (56, 'Received HTTP code 407 from proxy after CONNECT')
CURL HEADERS
Headers sent:
CONNECT launchpad.net:443 HTTP/1.1
Host: launchpad.net:443
Proxy-Authorization: Basic cGVvcGxlcmVhbGx5c2hvdWxkQHNhbml0aXplcG9zdHM=
User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
Proxy-Connection: Keep-Alive
Reply:
HTTP/1.1 200 Connection established
PyCURL HEADERS
Headers sent:
CONNECT launchpad.net:443 HTTP/1.1
Host: launchpad.net:443
User-Agent: PycURL/7.22.0
Proxy-Connection: Keep-Alive
Accept: application/json
Reply:
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: BASIC realm="proxy"
It seems that PyCURL doesn't re-send any Authorization when requested.
Best Answer
Workaround if
apt-get
still works behind the proxy/etc/apt/sources.list
Adding sources manually
I think on launchpad.net every ppa still contains a small description how to add sources manually. The launchpad site for your mentioned ppa
ppa:nilarimogard/webupd8
is https://launchpad.net/~nilarimogard/+archive/webupd8. If you scroll down you see an expandable label Technical details about this PPA. If you expand it you find the description how to add sources manually. Add the following lines to mentioned/etc/apt/sources.list
Of course you have to adjust quantal to whatever version you are currently using.
Adding the Signing Key
The description also contains a signing key. This is important, so that your system can always verify that you actually access a trustworthy ppa-address. In case of your ppa that is
1024R/4C9D234C
(can also be found under Technical details about this PPA), where the number behind the slash is important. You can add the fingerprint via theapt-key
program. Typically you would perform the following commandAdding if
apt-key
doesn't work through proxySince you already had problems with the
add-apt-repository
program this might not work either. So instead you can download and add the 1024 Bit key manually. Ifwget
works you can do that in one step.Otherwise safe "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x531EE72F4C9D234C" in e.g.
/path/key
and usesudo apt-key add /path/key
to add it.Close with the usual
Afterwards you have to update the repository information
apt-get update
and then you should be able to download the packages.Resources
My personal favorite on how to use the packaging mechanism (sadly in German): http://wiki.ubuntuusers.de/Paketquellen_freischalten/PPA
The launchpad version also mentions all the important points: https://help.launchpad.net/Packaging/PPA/InstallingSoftware
Since it is untypical to use apt-key in the described way I only found the information in the man pages,
man apt-key
.Related answer that pretty much describes the standard way to install ppa's manually: https://askubuntu.com/a/38029/128349