56 lines
2 KiB
YAML
56 lines
2 KiB
YAML
id: 06-chiffrement-https
|
|
titre: Chiffrement et HTTPS
|
|
niveau: intermediaire
|
|
duree_min: 50
|
|
formations: [nsi-tle, bts-sio, bts-ciel-ir, but-rt, ais]
|
|
competences: [chiffrement-asymetrique, certificats, tls]
|
|
|
|
reseaux:
|
|
- nom: lan
|
|
cidr: 10.60.0.0/24
|
|
|
|
machines:
|
|
- nom: serveur
|
|
image: paillasse-debian
|
|
flavor: eleve.petit
|
|
reseaux: [lan]
|
|
|
|
consignes:
|
|
- "Génère une clé privée RSA 2048 bits et un certificat auto-signé pour le nom labo.paillasse.local, valable 30 jours, dans /etc/ssl/labo/."
|
|
- "Configure nginx pour servir sa page en HTTPS sur le port 443 avec ce certificat."
|
|
- "Redirige HTTP (port 80) vers HTTPS."
|
|
- "Protège la clé privée : seul root doit pouvoir la lire."
|
|
|
|
verifications:
|
|
- id: certificat
|
|
titre: Certificat au bon nom
|
|
machine: serveur
|
|
commande: "openssl x509 -in /etc/ssl/labo/labo.crt -noout -subject | grep -q 'labo.paillasse.local'"
|
|
attendu: { code_retour: 0 }
|
|
points: 2
|
|
message_echec: "Le certificat /etc/ssl/labo/labo.crt est absent ou n'a pas le bon nom."
|
|
- id: https
|
|
titre: HTTPS répond
|
|
machine: serveur
|
|
commande: "curl -sk --max-time 3 -o /dev/null -w '%{http_code}' https://localhost/ | grep -q 200"
|
|
attendu: { code_retour: 0 }
|
|
points: 3
|
|
message_echec: "nginx ne répond pas en HTTPS sur le port 443."
|
|
- id: redirection
|
|
titre: HTTP redirige vers HTTPS
|
|
machine: serveur
|
|
commande: "curl -s --max-time 3 -o /dev/null -w '%{http_code}' http://localhost/ | grep -Eq '301|302|308'"
|
|
attendu: { code_retour: 0 }
|
|
points: 1
|
|
message_echec: "Le port 80 ne redirige pas vers HTTPS."
|
|
- id: cle
|
|
titre: Clé privée protégée
|
|
machine: serveur
|
|
commande: "test \"$(stat -c %a /etc/ssl/labo/labo.key)\" = 600"
|
|
attendu: { code_retour: 0 }
|
|
points: 1
|
|
message_echec: "La clé privée doit avoir les droits 600."
|
|
|
|
indices:
|
|
- "openssl req -x509 -newkey rsa:2048 -nodes -days 30 -subj '/CN=labo.paillasse.local' …"
|
|
- "Dans nginx : listen 443 ssl; ssl_certificate …; ssl_certificate_key …;"
|