J'essaie d'ajouter le référentiel ppa (en tant que root) avec la commande suivante:
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')
Malheureusement ça ne marche pas. Il semble que curl se connecte au proxy, mais le proxy indique que l'authentification est requise. J'ai essayé avec .curlrc, http_proxy env à la place, mais cela ne fonctionne pas.
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\
C'est peut-être parce qu'il y a @ signe dans le nom d'utilisateur? Wget fonctionne correctement avec proxy.
Connexe: Comment ajouter un référentiel derrière un proxy?
Environnement
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 Caractéristiques: GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
MISE À JOUR
Lors de l'ajout d'informations d'identification dans .curlrc
cat ~/.curlrc
proxy = 165.x.x.232:8080
proxy-user = name.surname@xxx.com:mypass0
Il semble fonctionner pour la boucle simple .
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
HTTPS également:
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
Mais ne fonctionne toujours pas lors de l'ajout d'un certificat ppa.
pycurl.error: (56, 'Received HTTP code 407 from proxy after CONNECT')
CURL HEADERS
En-têtes envoyés:
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
Répondre:
HTTP/1.1 200 Connection established
EN-TÊTES PyCURL
En-têtes envoyés:
CONNECT launchpad.net:443 HTTP/1.1
Host: launchpad.net:443
User-Agent: PycURL/7.22.0
Proxy-Connection: Keep-Alive
Accept: application/json
Répondre:
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: BASIC realm="proxy"
Il semble que PyCURL ne renvoie aucune autorisation à la demande.