commit 282ea7e97dd28967a2672569a2acceaa3a0b7767 Author: Thomas Constans Date: Thu Nov 24 14:05:54 2022 +0100 solution diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..b977d59 --- /dev/null +++ b/Readme.md @@ -0,0 +1,73 @@ +# SSL + +## Démonstration préalable: + +lancer un wireshark sur le poste client, avec comme filtre _port 389_ + +faire une requète ldap authentifiée. Constater la présence du mot de passe et DN de connexion en clair + + + +## Création du certificat + +### Certificat autosigné + +Suivre la procédure slide 97. + +⚠️ Bien faire attention aux permissions sur les fichiers, l'utilisateur _ldap_ doit pouvoir les lire. + +### Certificat letsencrypt + +```bash +systemctl stop httpd +dnf install certbot -y +certbot certonly --standalone -d CHANGEME.formation.opendoor.fr -m formation@opendoor.fr --agree-tos --test-cert +# répondre N à la question +systemctl start httpd +``` +⚠️ Attention, pour que le certificat (de test) soit reconnu, il faudra que le client télécharge la clé publique de la CA: + +```bash +curl https://letsencrypt.org/certs/staging/letsencrypt-stg-root-x1.pem -L >> /etc/openldap/certs/ca.pem +echo TLS_CACERT /etc/openldap/certs/ca.pem >> /etc/openldap/ldap.conf +``` + +Attention également aux permissions. L'utilisateur _ldap_ doit pouvoir lire les différents fichiers: + +```bash +chgrp -R ldap chgrp ldap /etc/letsencrypt/{archive,live} +chmod -R g+rX /etc/letsencrypt/{archive,live} +``` + +```ldif +dn: cn=config +changetype: modify +replace: olcTLSCipherSuite +olcTLSCipherSuite: ECDHE-RSA-AES256-SHA384:AES256-SHA256:!RC4:HIGH:!MD5:!EDH:!EXP:!SSLV2:!eNULL +- +replace: olcTLSProtocolMin +olcTLSProtocolMin: 3.4 +- +replace: olcTLSCACertificateFile +olcTLSCACertificateFile: /etc/openldap/certs/ca.pem +#LETsEncrypt: olcTLSCACertificateFile: /etc/letsencrypt/live/CHANGEME.formation.opendoor.fr/fullchain.pem +- +replace: olcTLSCertificateFile +olcTLSCertificateFile: /etc/openldap/certs/cert.pem +#LETsEncrypt: olcTLSCertificateFile: /etc/letsencrypt/live/CHANGEME.formation.opendoor.fr/fullchain.pem +- +replace: olcTLSCertificateKeyFile +olcTLSCertificateKeyFile: /etc/openldap/certs/key.pem +#LETsEncrypt: olcTLSCertificateKeyFile: /etc/letsencrypt/live/CHANGEME.formation.opendoor.fr/privkey.pem +``` + +## Configurer le client + +dans le fichier /etc/openldap/ldap.conf modifier l'_URI_, _TLS_REQCERT_ et _TLS_CACERT_ + +## Test + +On doit pouvoir se connecter de manière sécurisé au serveur + +Wireshark ne doit voir passer que des paquets TLS 1.3 application_data + diff --git a/ssl.ldif b/ssl.ldif new file mode 100644 index 0000000..ff63f10 --- /dev/null +++ b/ssl.ldif @@ -0,0 +1,15 @@ +# Mise en œuvre SSL +dn: cn=config +changetype: modify +replace: olcTLSCertificateFile +olcTLSCertificateFile: CHANGEME +- +replace: olcTLSCertificateKeyfile +olcTLSCertificateKeyfile: CHANGEME +- +replace: olctlsverifyclient +olctlsverifyclient: never +- +replace: olctlscacertificatefile +olctlscacertificatefile: CHANGEME + diff --git a/ssl_le.ldif b/ssl_le.ldif new file mode 100644 index 0000000..e56bc81 --- /dev/null +++ b/ssl_le.ldif @@ -0,0 +1,16 @@ +dn: cn=config +changetype: modify +replace: olcTLSCipherSuite +olcTLSCipherSuite: ECDHE-RSA-AES256-SHA384:AES256-SHA256:!RC4:HIGH:!MD5:!EDH:!EXP:!SSLV2:!eNULL +- +replace: olcTLSProtocolMin +olcTLSProtocolMin: 3.4 +- +replace: olcTLSCACertificateFile +olcTLSCACertificateFile: /etc/letsencrypt/live/CHANGEME.formation.opendoor.fr/fullchain.pem +- +replace: olcTLSCertificateFile +olcTLSCertificateFile: /etc/letsencrypt/live/CHANGEME.formation.opendoor.fr/fullchain.pem +- +replace: olcTLSCertificateKeyFile +olcTLSCertificateKeyFile: /etc/letsencrypt/live/CHANGEME.formation.opendoor.fr/privkey.pem \ No newline at end of file