Précédent   Forum des professionnels en informatique > Systèmes > Linux > Réseau
Réseau Vos questions autour des réseaux et télécoms sous Linux
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 23/02/2011, 12h33   #1
Modérateur
 
Avatar de tchize_
 
Homme
Responsable de service informatique
Inscription : avril 2007
Messages : 16 190
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 32
Localisation : Belgique

Informations professionnelles :
Activité : Responsable de service informatique
Secteur : Service public

Informations forums :
Inscription : avril 2007
Messages : 16 190
Points : 25 347
Points : 25 347
Envoyer un message via MSN à tchize_ Envoyer un message via Skype™ à tchize_
Par défaut curl ne reconnait pas mon certificat SSL

bonjour,

j'essaie d'envoyer, via curl, un fichier sur un serveur https. Tant que le serveur était en http, aucun soucis. Depuis qu'il est en https, impossible de faire fonctionner curl avec. Curl refuse de reconnaitre le certificat SSL du serveur. Il y a bien l'option '-k' dans curl, mais celle-ci désactive la validation ssl sur serveur, ce qui réduit à 0 la sécurité du ssl, et je voudrais donc l'éviter.

Voilà d'abord le dit serveur, reconnu par défaut par firefox:


J'y suis d'abord allé version naif:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
$ curl -v -u user:pass -T /path/to/source.xml https://server.domain/path/to/destination
* About to connect() to serveur.domain port 443 (#0)
*   Trying 193.190.249.140... connected
* Connected to serveur.domain (193.190.249.140) port 443 (#0)
* error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
 
* Closing connection #0
curl: (77) error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
Visiblement, pas de certificat dispo. J'exporte donc le certificat de mon serveur (bouton exporter de firefox). J'obtiens alors un fichier .pem spécifique à serveur.domain, que j'utilise

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$ curl  --cacert /tmp/server.domain -v -u user:pass -T /path/to/source.xml https://server.domain/path/to/destination
* About to connect() to serveur.domain port 443 (#0)
*   Trying 193.190.249.140... connected
* Connected to serveur.domain (193.190.249.140) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: /tmp/serveur.domain
  CApath: none
* SSLv2, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS alert, Server hello (2):
* SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
* Closing connection #0
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html
 
curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
j'essaie alors avec le .pem de l'autorité qui a signé mon serveur, de nouveau exporé avec firefox:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$ curl --cacert /tmp/TERENASSLCA -v -u user:pass -T /path/to/source.xml https://serveur.domain/path/to/destination
* About to connect() to serveur.domain port 443 (#0)
*   Trying 193.190.249.140... connected
* Connected to serveur.domain (193.190.249.140) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: /tmp/TERENASSLCA
  CApath: none
* SSLv2, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS alert, Server hello (2):
* SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
* Closing connection #0
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html
 
curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
et pas plus de chance avec l'autorité racine
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$ curl --cacert /tmp/AddTrustExternalCARoot -v -u user:pass -T /path/to/source.xml https://serveur.domain/path/to/destination
* About to connect() to serveur.domain port 443 (#0)
*   Trying 193.190.249.140... connected
* Connected to serveur.domain (193.190.249.140) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: /tmp/AddTrustExternalCARoot
  CApath: none
* SSLv2, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS alert, Server hello (2):
* SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
* Closing connection #0
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html
 
curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
un dernier essai en téléchargeant les certificate autorities depuis le site de curl:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
$ wget http://curl.haxx.se/ca/cacert.pem -O /tmp/fullcacert.pem     
--11:28:07--  http://curl.haxx.se/ca/cacert.pem
           => `/tmp/fullcacert.pem'
Resolving curl.haxx.se... 80.67.6.50
Connecting to curl.haxx.se|80.67.6.50|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 252,513 (247K) [text/plain]
 
100%[======================================================================================================================>] 252,513        1.10M/s             
 
11:28:07 (1.09 MB/s) - `/tmp/fullcacert.pem' saved [252513/252513]
 
$ curl --cacert /tmp/fullcacert.pem -v -u user:pass -T /path/to/source.xml https://serveur.domain/path/to/destination
* About to connect() to serveur.domain port 443 (#0)
*   Trying 193.190.249.140... connected
* Connected to serveur.domain (193.190.249.140) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: /tmp/fullcacert.pem
  CApath: none
* SSLv2, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS alert, Server hello (2):
* SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
* Closing connection #0
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html
 
curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
Alors la question fondamentale, qu'est-ce que je rate dans la doc à ce sujet? Qu'est-ce qu'il me manque??
Images attachées
Type de fichier : png certificates.png (27,4 Ko, 15 affichages)
__________________
⥀⥁ Чиз faq java, cours java, javadoc. Pensez à et
"Votre génitrice tute des pédoncules au pandémonium" (le conjurateur, 1973)
tchize_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 13h11.


 
 
 
 
Partenaires

Hébergement Web