Ho un sito web che sto usando per ospitare Redmine e diversi repository gitSSL funziona con il browser, wget, e riccio, ma non riesce con git
Questo funziona perfettamente per http, ma non riesco a clonare con https, cioè
git clone http://mysite.com/git/test.git
funziona bene, ma
git clone https://mysite.com/git/test.git
fallisce
La cosa strana è che https sembra funzionare per tutto il resto che ho testato. Se apro
https://mysite.com/git/test.git
in un browser (testato in chrome e firefox), non ottengo errori o avvisi. Posso anche
curl https://mysite.com/git/test.git
wget https://mysite.com/git/test.git
entrambi funzionano senza lamentele o avvisi.
Ecco l'output dettagliato da git:
$ GIT_CURL_VERBOSE=1 git clone https://[email protected]/test/test.git
Cloning into test...
Password:
* Couldn't find host mysite.com in the .netrc file; using defaults
* About to connect() to mysite.com port 443 (#0)
* Trying 127.0.0.1... * Connected to mysite.com (127.0.0.1) port 443 (#0)
* found 157 certificates in /etc/ssl/certs/ca-certificates.crt
* server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
* Closing connection #0
* Couldn't find host mysite.com in the .netrc file; using defaults
* About to connect() to mysite.com port 443 (#0)
* Trying 127.0.0.1... * Connected to mysite.com (127.0.0.1) port 443 (#0)
* found 157 certificates in /etc/ssl/certs/ca-certificates.crt
* server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
* Closing connection #0
error: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none while accessing https://user\
@mysite.com/test/test.git/info/refs
fatal: HTTP request failed
Ecco l'output dettagliato da riccio, con le informazioni personali cambiato:
* About to connect() to mysite.com port 443 (#0)
* Trying 127.0.0.1... connected
* Connected to mysite.com (127.0.0.1) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
* subject: C=US; <... cut my certs info ...>
* start date: 2011-10-18 00:00:00 GMT
* expire date: 2013-10-17 23:59:59 GMT
* subjectAltName: mysite.com matched
* issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO High-Assurance Secure Server CA
* SSL certificate verify ok.
> GET/HTTP/1.1
> User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> Host: mysite.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 18 Oct 2011 21:39:54 GMT
< Server: Apache/2.2.14 (Ubuntu)
< Last-Modified: Fri, 14 Oct 2011 03:20:01 GMT
< ETag: "8209c-87-4af39bb89ccac"
< Accept-Ranges: bytes
< Content-Length: 135
< Vary: Accept-Encoding
< Content-Type: text/html
< X-Pad: avoid browser bug
<
<p>Welcome to the mysite.com<p/>
* Connection #0 to host mysite.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
L'unica differenza che posso vedere è che git sembra usare un CAfile esplicito mentre curl usa l'intera directory? Sono nuovo di ssl (almeno sul lato admin), quindi non sono sicuro di cosa significhi o di come potrei configurare git per funzionare allo stesso modo di curl.
Sto usando git 1.7.5.4 e apache 2.2.14 su Ubuntu 10.04. Ho provato a clonare da 3 diversi host Linux (incluso un altro account sul server stesso), e niente funziona.
Ho anche usato il tool OpenSSL per verificare il mio cert sul server:
$openssl verify -purpose sslserver -CAfile chain.crt signed.pem
signed.pem: OK
Questo può essere correlato al bug https://bugs.maemo.org/show_bug.cgi?id=4953 ma sembra diverso perché non ricevo alcun avviso o errori in qualsiasi altro programma.
Vale la pena ricordare che sto utilizzando gitolite e redmine_git_hosting utilizzando http per eseguire l'autenticazione tramite https. Non penso che nulla di tutto questo sia comunque in colpa, perché il problema esiste anche se mi metto un repository nudo in altrimenti funzionamento in/var/www e lo accedo direttamente. Inoltre, git over ssh (con e senza gitolite) funziona.
Per favore fatemi sapere se avete qualche idea su cosa potrebbe essere sbagliato o se desiderate ulteriori informazioni. Preferirei davvero che lo ssl funzioni correttamente, invece di forzare tutti a disabilitare il controllo dei certificati in git, anche se questa è una soluzione alternativa.
Grazie per aver letto questo lungo post!
Si noti che con Git 2.5+, si sarà in grado di specificare un elenco di cifratura per curl per usare. Questo potrebbe aiutare. vedi http://stackoverflow.com/a/30442395/6309 – VonC