2014-11-17 8 views
12

accediamo nostro server Git con certificati client aggiungendo le seguenti righe a ~/.gitconfigOS X: Git con i certificati client respinto

[http] 
     sslCAInfo = /path/to/git-ca.crt 
     sslCert = /path/to/git-client.crt 
     sslKey = /path/to/git-client.pem 

Questo funziona bene su Linux, Windows e OS X < = 10,8 con esattamente gli stessi file. Quando provo su OS X 10.10, sto ottenendo il seguente errore:

bash-3.2$ git fetch 
fatal: unable to access 'https://ourserver:12345/repository.git/': SSL: Can't load the certificate "/path/to/git-client.crt" and its private key: OSStatus -25299 

Il problema si verifica con git version 1.9.3 (Apple Git-50) così come con git version 2.0.1.

Aggiornamento Dopo aver rimosso la voce corrispondente dal portachiavi, sto ottenendo seguente incidente:

bash-3.2$ git fetch 
2014-11-17 09:58:51.257 git-remote-https[2787:12194] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]' 
*** First throw call stack: 
(
    0 CoreFoundation      0x00007fff9828164c __exceptionPreprocess + 172 
    1 libobjc.A.dylib      0x00007fff8f91c6de objc_exception_throw + 43 
    2 CoreFoundation      0x00007fff98125068 -[__NSPlaceholderArray initWithObjects:count:] + 360 
    3 CoreFoundation      0x00007fff98124a2d CFArrayCreate + 141 
    4 libcurl.4.dylib      0x00007fff8f75169e darwinssl_connect_common + 2089 
    5 libcurl.4.dylib      0x00007fff8f75073a Curl_ssl_connect_nonblocking + 36 
    6 libcurl.4.dylib      0x00007fff8f719673 Curl_http_connect + 77 
    7 libcurl.4.dylib      0x00007fff8f727977 Curl_protocol_connect + 129 
    8 libcurl.4.dylib      0x00007fff8f739cef multi_runsingle + 799 
    9 libcurl.4.dylib      0x00007fff8f73993d curl_multi_perform + 170 
    10 git-remote-https     0x0000000109815c8a step_active_slots + 25 
    11 git-remote-https     0x0000000109815cfb run_active_slot + 77 
    12 git-remote-https     0x0000000109817621 http_request + 459 
    13 git-remote-https     0x0000000109816148 http_request_reauth + 34 
    14 git-remote-https     0x0000000109813f76 discover_refs + 476 
    15 git-remote-https     0x00000001098131e4 main + 1556 
    16 libdyld.dylib      0x00007fff94bd25c9 start + 1 
    17 ???         0x0000000000000003 0x0 + 3 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 

Dopo questo incidente, la voce certificato è reoccurred nel portachiavi. La cosa strana è che su OS X 10.8 nulla verrà aggiunto al mio portachiavi durante il recupero dal repository.

Update 2 Quando provo lo stesso su OS X 10.9, sto ottenendo seguente errore:

bash-3.2$ git fetch 
fatal: unable to access 'https://ourserver:12345/repository.git/': SSL certificate problem: Invalid certificate chain 

Update 3 posso collegarmi con successo con openssl utilizzando questi certificati, anche su OS X 10.9:

bash-3.2$ openssl s_client -connect ourserver:12345 -cert /path/to/git-client.crt -key /path/to/git-client.pem 
CONNECTED(00000003) 
depth=1 /C=de/O=companyca/CN=internal-ca 
verify error:num=19:self signed certificate in certificate chain 
verify return:0 
--- 
Certificate chain 
0 s:/C=de/O=companyserv/CN=smart 
    i:/C=de/O=companyca/CN=internal-ca 
1 s:/C=de/O=companyca/CN=internal-ca 
    i:/C=de/O=companyca/CN=internal-ca 
--- 
Server certificate 
... 
<----------------------snip----------------------> 
... 
--- 
SSL handshake has read 2348 bytes and written 1360 bytes 
--- 
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA 
Server public key is 2048 bit 
Secure Renegotiation IS supported 
Compression: NONE 
Expansion: NONE 
SSL-Session: 
    Protocol : TLSv1 
    Cipher : DHE-RSA-AES256-SHA 
    Session-ID: E5873AF43D24CEE6529178B4EFD7FE3368711DF1BFBC6CA89C50F8D39DE0B014 
    Session-ID-ctx: 
    Master-Key: <**********> 
    Key-Arg : None 
    Start Time: 1416486728 
    Timeout : 300 (sec) 
    Verify return code: 19 (self signed certificate in certificate chain) 
--- 
closed 

Il problema è simile a this one for GitHub, ma stiamo usando auto-firmato certificati.

+0

25299 significa "L'elemento specificato esiste già nel portachiavi". Forse hai copiato due volte una chiave pubblica nei file crt? – Phillip

+0

Grazie per il suggerimento. Ho rimosso l'oggetto dalla KeyChain. –

+0

@ThomasS. Bene, ha risolto il tuo problema? – musiKk

risposta

9

Sembra che si stia affrontando lo stesso problema di this docker issue dove si conclude che è probabile un errore nel ricciolo OSX.

In alcuni other post suggeriscono che ciò potrebbe essere causato dal numero seriale del certificato che è 1 o che è troppo grande per adattarsi a 32 bit.

Nel caso di OS X 10.9, penso che "Certificato non valido" debba essere risolto aggiungendo il certificato alla catena di chiavi del sistema come affidabile (discusso in this question).

This post descrive alcune modifiche nel ricciolo OS X, che sembrano essere correlate. A mio avviso, potrebbe essere la soluzione per passare a diversi curl implementation (ma probabilmente potrebbe funzionare solo se git verrebbe installato anche usando brew).

+0

Sfortunatamente, nessuna delle informazioni che ho trovato nei collegamenti ha aiutato a risolvere il problema. Ho dovuto passare da https con certificati client a SSH su OS X 10.9+. –

2

Come già detto da Michal, si tratta di un bug di OSX. Una possibile soluzione potrebbe essere quella di installare una versione git che non si basa l'osx ricciolo implementazione

  1. Installare macports: https://www.macports.org/install.php
  2. $ porta -v selfupdate
  3. $ port install git
+0

Sfortunatamente, questa non è un'opzione perché non possiamo aspettarci che Macports venga installato sulle macchine dell'utente finale. –

+0

non funziona per me il 10.11 .. Ho usato home-brew ma non funziona ancora –

Problemi correlati