Sto cercando di aggiungere il repository ppa (come root) con il seguente comando:
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')
Sfortunatamente non funziona. Sembra che l'arricciatura si stia collegando al proxy, ma il proxy dice che è richiesta l'autenticazione. Ho provato con .curlrc, http_proxy env invece, ma non funziona.
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\
Forse è perché c'è @ sign nel nome utente? Wget funziona con proxy bene.
Correlati: Come posso aggiungere un repository da dietro un proxy?
Ambiente
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 Caratteristiche: GSS-Negoziare IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
AGGIORNARE
Quando vengono aggiunte le credenziali in .curlrc
cat ~/.curlrc
proxy = 165.x.x.232:8080
proxy-user = name.surname@xxx.com:mypass0
Sembra funzionare per il semplice ricciolo .
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
Anche 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
Ma non funziona ancora quando si aggiunge il certificato ppa.
pycurl.error: (56, 'Received HTTP code 407 from proxy after CONNECT')
TESTINE DI CURL
Intestazioni inviate:
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
Rispondere:
HTTP/1.1 200 Connection established
Intestazioni PyCURL
Intestazioni inviate:
CONNECT launchpad.net:443 HTTP/1.1
Host: launchpad.net:443
User-Agent: PycURL/7.22.0
Proxy-Connection: Keep-Alive
Accept: application/json
Rispondere:
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: BASIC realm="proxy"
Sembra che PyCURL non rinvii alcuna autorizzazione quando richiesto.