Compare commits

5 Commits

Author SHA1 Message Date
91abb8d783 explicit sudo 2025-12-04 16:48:38 +01:00
7391f39107 typo 2024-10-08 16:18:51 +02:00
1cfde13b90 ajout references 2022-11-25 23:49:21 +01:00
ad84af3b69 mise en forme 2022-11-24 14:35:40 +01:00
b6955ae0ab instructions 2022-11-24 14:15:52 +01:00
3 changed files with 21 additions and 77 deletions

View File

@@ -1,5 +1,10 @@
# SSL
## Référence
📖 Support Ch 7 (p97)
## Démonstration préalable:
lancer un wireshark sur le poste client, avec comme filtre _port 389_
@@ -7,7 +12,6 @@ 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é
@@ -19,74 +23,45 @@ Suivre la procédure slide 97.
### 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
sudo systemctl stop httpd
sudo dnf install certbot -y
sudo certbot certonly --standalone -d CHANGEME.formation.opendoor.fr -m formation@opendoor.fr --agree-tos --test-cert
# répondre N à la question
systemctl start httpd
sudo 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
curl https://letsencrypt.org/certs/staging/letsencrypt-stg-root-x1.pem -L | sudo tee -a /etc/openldap/certs/ca.pem
echo TLS_CACERT /etc/openldap/certs/ca.pem | sudo tee -a /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}
sudo chgrp -R ldap /etc/letsencrypt/{archive,live}
sudo chmod -R g+rX /etc/letsencrypt/{archive,live}
```
## Configurer le serveur
```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
```
La configuration est globale au serveur (1 certificat par serveur). Elle se fait donc au niveau de la branche _cn=config_
Le cas échéant on ouvrira le parefeu:
Mettez au point le fichier ldif permettant de remplacer les attributs suivants par la bonne valeur (qui dépend de la méthode utilisée pour créer les certificats)
```bash
firewall-cmd --add-service ldaps--permanent
firewall-cmd --add-service ldaps
```
- olcTLSCipherSuite : ECDHE-RSA-AES256-SHA384:AES256-SHA256:!RC4:HIGH:!MD5:!EDH:!EXP:!SSLV2:!eNULL | idem |
- olcTLSProtocolMin : 3.4 | idem |
- olcTLSCACertificateFile : /etc/openldap/certs/ca.pem | /etc/letsencrypt/live/CHANGEME.formation.opendoor.fr/fullchain.pem
- olcTLSCertificateFile : /etc/openldap/certs/cert.pem | /etc/letsencrypt/live/CHANGEME.formation.opendoor.fr/fullchain.pem
- olcTLSCertificateKeyFile : /etc/openldap/certs/key.pem | /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_
```bash
URI ldaps://CHANGEME.formation.opendoor.fr
TLS_REQCERT demand
TLC_CACERT /etc/openldap/certs/ca.pem
```
Dans le fichier /etc/openldap/ldap.conf modifier l'_URI_, _TLS_REQCERT_ et _TLS_CACERT_ afin de forcer l'utilisation de ssl, avec vérification du certificat
## Test
On doit pouvoir se connecter de manière sécurisé au serveur
```bash
lds -Z
```
Wireshark ne doit voir passer que des paquets TLS 1.3 application_data

View File

@@ -1,15 +0,0 @@
# 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

View File

@@ -1,16 +0,0 @@
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