Outils pour utilisateurs

Outils du site


tech:notes_openssl

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tech:notes_openssl [2025/11/09 19:33] Jean-Baptistetech:notes_openssl [2026/06/29 14:20] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>openssl Crypt nmap TLS}}
 +
 +# Notes OpenSSL
 +
 +Voir aussi les implémentations :
 +  * [[#LibreSSL|LibreSSL]] (fork d'OpenSSL par BSD)
 +  * [[#gnutls|GnuTLS]]
 +  * miTLS
 + 
 +
 +Voir :
 +  * https://www.redhat.com/en/blog/6-openssl-commands
 +
 +Voir aussi :
 +  * https://www.feistyduck.com/library/bulletproof-tls-guide/
 +  * https://docs.ansible.com/ansible/2.9/modules/list_of_crypto_modules.html
 +
 +
 +
 +## Général
 +
 +Get the location of your openssl files
 +~~~bash
 +openssl version -d 
 +~~~
 +
 +
 +
 +## Sécurité - Cipher suite
 +
 +Il est recommandé de désactiver ces suites de chiffrement afin d'opter pour des suites de chiffrement robustes, en évitant d'utiliser des algorithmes tels que DES, RC4, MD5 et une taille de clé ECDH >= 256 bits ou DH >= 2048.
 +
 +Il est recommandé de n'accepter que le protocole TLSv1.2 ou de désactiver les algorithmes utilisant le mode CBC.
 +(et ECB)
 +
 +La conformité standard de protection des données de secteur de carte de paiement (norme PCI DSS) exige des chiffrements CBC d'être désactivés.
 +
 +
 +
 +
 +
 +## Tester TLS / SSL
 +
 +
 +Liens :
 +* https://testssl.sh/
 +
 +
 +
 +
 +## LibreSSL
 +
 +Vous pouvez compiler [LibreSSL](https://fr.wikipedia.org/wiki/LibreSSL), la réécriture d'OpenSSL nettoyé par l’équipe d'[OpenBSD](http://www.openbsd.org/)
 +Ça compile très bien sous Debian. L'exécutable s'appelle toujours *openssl*. Par défaut il s'installera dans /usr/local/ donc aucun pb, ça ne va pas cassez votre Debian.
 +
 +A voir également pour les curieux la lib [gnurl](https://gnunet.org/gnurl) lié au projet [GNUnet](https://gnunet.org/).
 +Une réécriture de curl avec GnuTLS à la place d'OpenSSL.
 +
 +
 +
 +## Autre
 +
 +Quelles versions de SSL/TLS sont prises en charge par ma version d'OpenSSL ?
 +~~~bash
 +openssl s_client -help 2>& > /dev/null | egrep "\-(ssl|tls)[^a-z]"
 +~~~
 +
 +Pour chiffrement de fichier voir **scrypt**
 +
 +Voir SSL/TLS - Benjamin Sonntag Il était une fois Internet
 +https://www.youtube.com/watch?v=7SEp9C1aBFE
 +
 +SSL Config Generator
 +Generateur de conf pour Gninx, Apache, HAProxy...
 +https://mozilla.github.io/server-side-tls/ssl-config-generator/
 +
 +Pour se s’amplifier la vie, alias bash à OpenSSL
 +https://certsimple.com/blog/openssl-shortcuts
 +
 +gnutls-cli-debug gnunet.org
 +sslscan --no-failed gnunet.org
 +
 +Voir aussi **sslscan**
 +
 +http://www.unilim.fr/pages_perso/olivier.ruatta/CRYPTO/TP1openssl.pdf
 +
 +http://perso.crans.org/~raffo/docs/openssl-qref.pdf
 +
 +https://www.madboa.com/geek/openssl/
 +
 +http://kb.paessler.com/en/topic/58793-how-to-get-a-godaddy-ssl-certificate-running-with-prtg
 +
 +~~~bash
 +openssl s_client -connect host:443 -servername www.test.fr -cert cert_and_key.pem -key cert_and_key.pem -state -debug
 +~~~
 +
 +~~~bash
 +openssl enc -bf -in fichier.txt -out fichier.txt.enc -pass file:key.txt
 +~~~
 +
 +~~~bash
 +openssl enc -d -bf -in fichier.txt.enc -out fichier.txt -pass file:key.txt
 +~~~
 +
 +~~~bash
 +nmap --script ssl-enum-ciphers www.test.fr
 +~~~
 +
 +Emprunte / Hash d'un certificat
 +~~~
 +$ openssl s_client -connect gnunet.org:443 </dev/null | openssl x509 -fingerprint | grep Fingerprint
 +depth=3 C = DE, O = Deutsche Telekom AG, OU = T-TeleSec Trust Center, CN = Deutsche Telekom Root CA 2
 +verify error:num=19:self signed certificate in certificate chain
 +verify return:0
 +DONE
 +SHA1 Fingerprint=9E:F2:A0:31:77:42:B6:0E:92:D0:9D:C7:1A:C3:DF:1C:9D:D3:CB:DC
 +~~~
 +
 +ou 
 +
 +~~~bash
 +gnutls-cli --print-cert acme.fr </dev/null | certtool -i
 +~~~
 +
 +Vérifier la chaîne de certification
 +~~~bash
 +gnutls-cli --print-cert acme.fr </dev/null | certtool -e
 +~~~
 +
 +Connaître la date d'expiration d'un certificat
 +~~~
 +$ openssl s_client -connect gnunet.org:443 </dev/null 2>/dev/null | openssl x509 -enddate -noout
 +notAfter=Feb 12 00:00:00 2019 GM
 +~~~
 +
 +ssl-cert-check s'appuie sur OpenSSL mais ne gère pas le SNI (Server Name Indication, RFC 6066)
 +Voir 
 +* http://www.bortzmeyer.org/tester-expiration-certifs.html
 +* http://prefetch.net/code/ssl-cert-check 
 +* http://prefetch.net/articles/checkcertificate.html
 +~~~
 +$ ./ssl-cert-check -s gnunet.org -p 443
 +
 +Host                                            Status       Expires      Days
 +----------------------------------------------- ------------ ------------ ----
 +gnunet.org:443                                  Valid        Feb 12 2019  1371 
 +~~~
 +
 +
 +### http2
 +
 +Voir aussi : 
 +* nghttp2-client
 +* h2load
 +
 +~~~
 +$ echo -n | openssl s_client -connect www.acme.fr:443 -nextprotoneg NULL
 +CONNECTED(00000003)
 +Protocols advertised by server: h2, http/1.1
 +...
 +Next protocol: (2) NULL
 +~~~
 +
 +~~~bash
 +nmap --script=tls-nextprotoneg -p 443 www.acme.fr
 +~~~
 +
 +~~~bash
 +openssl s_client -connect www.acme.fr:443 -nextprotoneg "h2"
 +~~~
 +
 +
 +## GnuTLS
 +
 +~~~
 +$ gnutls-cli-debug gnunet.org
 +Checking for SSL 3.0 support... no
 +Checking whether %COMPAT is required... no
 +Checking for TLS 1.0 support... yes
 +Checking for TLS 1.1 support... yes
 +Checking fallback from TLS 1.1 to... N/A
 +Checking for TLS 1.2 support... yes
 +Checking whether we need to disable TLS 1.2... N/A
 +Checking whether we need to disable TLS 1.1... N/A
 +Checking whether we need to disable TLS 1.0... N/A
 +Checking for Safe renegotiation support... no
 +Checking for Safe renegotiation support (SCSV)... no
 +Checking for HTTPS server name... not checked
 +Checking for version rollback bug in RSA PMS... dunno
 +Checking for version rollback bug in Client Hello... no
 +Checking whether the server ignores the RSA PMS version... yes
 +Checking whether the server can accept Hello Extensions... yes
 +Checking whether the server can accept HeartBeat Extension... no
 +Checking whether the server can accept small records (512 bytes)... yes
 +Checking whether the server can accept cipher suites not in SSL 3.0 spec... yes
 +Checking whether the server can accept a bogus TLS record version in the client hello... yes
 +Checking for certificate information... N/A
 +Checking for trusted CAs... N/A
 +Checking whether the server understands TLS closure alerts... yes
 +Checking whether the server supports session resumption... yes
 +Checking for anonymous authentication support... no
 +Checking anonymous Diffie-Hellman group info... N/A
 +Checking for ephemeral Diffie-Hellman support... yes
 +Checking ephemeral Diffie-Hellman group info... N/A
 +Checking for ephemeral EC Diffie-Hellman support... yes
 +Checking ephemeral EC Diffie-Hellman group info...
 + Curve SECP256R1 
 +Checking for AES-128-GCM cipher support... yes
 +Checking for AES-128-CBC cipher support... yes
 +Checking for CAMELLIA-128-GCM cipher support... no
 +Checking for CAMELLIA-128-CBC cipher support... yes
 +Checking for 3DES-CBC cipher support... yes
 +Checking for ARCFOUR 128 cipher support... no
 +Checking for MD5 MAC support... no
 +Checking for SHA1 MAC support... yes
 +Checking for SHA256 MAC support... yes
 +Checking for ZLIB compression support... no
 +Checking for max record size... no
 +Checking for OpenPGP authentication support... no
 +~~~
 +
 +SMTP (StartTLS)
 +~~~bash
 +openssl s_client -tls1 -starttls smtp -crlf -connect smtp.acme.fr:25
 +~~~
 +
 +
 +
 +Liste des courbes elliptiques disponibles
 +~~~bash
 +openssl ecparam -list_curves
 +~~~
 +
 +
 +### Perf
 +
 +~~~bash
 +openssl speed
 +~~~
 +
 +
 +~~~bash
 +gnutls-cli --benchmark-ciphers
 +~~~
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki