{{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://docs.ansible.com/ansible/2.9/modules/list_of_crypto_modules.html == Général Get the location of your openssl files 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 [[https://fr.wikipedia.org/wiki/LibreSSL|LibreSSL]], la réécriture d'OpenSSL nettoyé par l’équipe d'[[http://www.openbsd.org/|OpenBSD]] Ç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 [[https://gnunet.org/gnurl|gnurl]] lié au projet [[https://gnunet.org/|GNUnet]]. 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 ? openssl s_client -help 2>&1 > /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 openssl s_client -connect host:443 -servername www.test.fr -cert cert_and_key.pem -key cert_and_key.pem -state -debug openssl enc -bf -in fichier.txt -out fichier.txt.enc -pass file:key.txt openssl enc -d -bf -in fichier.txt.enc -out fichier.txt -pass file:key.txt nmap --script ssl-enum-ciphers www.test.fr Emprunte / Hash d'un certificat $ openssl s_client -connect gnunet.org:443 ou gnutls-cli --print-cert acme.fr Vérifier la chaîne de certification gnutls-cli --print-cert acme.fr Connaître la date d'expiration d'un certificat $ openssl s_client -connect gnunet.org:443 /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 nmap --script=tls-nextprotoneg -p 443 www.acme.fr 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) openssl s_client -tls1 -starttls smtp -crlf -connect smtp.acme.fr:25 Liste des courbes elliptiques disponibles openssl ecparam -list_curves === Perf openssl speed gnutls-cli --benchmark-ciphers