Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 31421  / 2 Years ago, fri, april 22, 2022, 6:05:37

I'm trying to add the ppa repository (as a root) with the following command:



export HTTP_PROXY="http://[email protected]:[email protected]: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
Host: launchpad.net:443
User-Agent: PycURL/7.22.0
Proxy-Connection: Keep-Alive
Accept: application/json

", 146, MSG_NOSIGNAL, NULL, 0) = 146
recvfrom(4, "HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: BASIC realm="proxy"
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Proxy-Connection: close
Set-Cookie: BCSI-CS-91b9906520151dad=2; Path=/
Connection: 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 = [email protected]:mypass0


It seems to work for the plain curl.



curl www.google.com | head

* Proxy auth using Basic with user '[email protected]'
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 '[email protected]'
> 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.


More From » apt

 Answers
3

Workaround if apt-get still works behind the proxy




  • add sources manually to /etc/apt/sources.list

  • add gpg key



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



deb http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu quantal main 
deb-src http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu quantal main


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 the apt-key program. Typically you would perform the following command



 sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 4C9D234C


Adding if apt-key doesn't work through proxy



Since 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. If wget works you can do that in one step.



wget "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x531EE72F4C9D234C" -O out && sudo apt-key add out && rm out


Otherwise safe "http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x531EE72F4C9D234C" in e.g. /path/key and use sudo 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


[#34471] Friday, April 22, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
laceanz

Total Points: 86
Total Questions: 113
Total Answers: 104

Location: Australia
Member since Thu, Jan 26, 2023
1 Year ago
;