Certificats SSL et HTTPS expliqués
SSL-certificaten en HTTPS uitgelegd
Cet article explique ce que sont les certificats SSL/TLS et comment implémenter correctement HTTPS sur votre serveur Pixzo.
Vereisten
- Accès à votre serveur web (Apache 2.4.41+ ou Nginx 1.18+) - Nom de domaine avec gestion DNS - Accès root ou sudo via SSH - OpenSSL version 1.1.1 ou supérieure installée
Stappen
1. Genereer een private key en CSR
Créez une clé privée RSA 2048 bits et une demande de signature de certificat (CSR) pour votre domaine :
openssl req -new -newkey rsa:2048 -nodes -keyout jouwdomein.key -out jouwdomein.csr
Vul tijdens het proces je domeinnaam (Common Name) en organisatiegegevens in.
2. Demandez un certificat auprès d'une AC
Utilisez Let's Encrypt pour un certificat DV gratuit via Certbot :
sudo certbot certonly --standalone -d jouwdomein.nl -d www.jouwdomein.nl
Certbot plaatst het certificaat in `/etc/letsencrypt/live/jouwdomein.nl/`.
3. Download de intermediate certificate
Récupère la bonne chaîne de certificats intermédiaires pour ton autorité de certification. Pour Let's Encrypt, elle est fournie automatiquement. Vérifie la chaîne :
openssl crl2pkcs7 -nocrl -certfile /etc/letsencrypt/live/jouwdomein.nl/fullchain.pem | openssl pkcs7 -print_certs -text | grep "Subject:"4. Configurez votre serveur web pour TLS 1.2 ou supérieur
Ajoutez la configuration suivante dans votre virtual host Apache ou votre bloc serveur Nginx :
Apache
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/jouwdomein.nl/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/jouwdomein.nl/privkey.pem
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256
SSLHonorCipherOrder onNginx
ssl_certificate /etc/letsencrypt/live/jouwdomein.nl/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/jouwdomein.nl/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
ssl_prefer_server_ciphers on;5. Verwijder zwakke cipher suites
Sluit RC4, SHA-1 en 3DES uit in je cipher configuratie.
OpenSSL test: RC4 mag niet voorkomen
openssl ciphers -v 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256' | grep -i rc46. Activez la redirection HTTP vers HTTPS
Ajoutez une redirection vers HTTPS pour tout le trafic HTTP :
<VirtualHost *:80>
ServerName jouwdomein.nl
Redirect permanent / https://jouwdomein.nl/
</VirtualHost>7. Herlaad de serverconfiguratie
Pas de wijzigingen toe zonder downtime:
sudo systemctl reload apache2 voor Apache
sudo systemctl reload nginx voor Nginx8. Configurez le renouvellement automatique (Let's Encrypt)
Certbot kan certificaten automatisch verlengen. Test de vernieuwing:
sudo certbot renew --dry-run
Ajoutez une tâche cron pour une vérification quotidienne (`0 3 * /usr/bin/certbot renew --quiet`).
Verificatie
Controleer of je HTTPS correct werkt:
curl -vI https://jouwdomein.nl 2>&1 | grep -E "(SSL connection|TLS|HTTP/2)"
Gebruik de SSL Labs test (ssllabs.com/ssltest) of de OpenSSL s_client:
openssl s_client -connect jouwdomein.nl:443 -servername jouwdomein.nl 2>/dev/null | openssl x509 -noout -dates -subject -issuerVeelgestelde problemen
Certificaat wordt niet vertrouwd door browser
Le certificat intermédiaire manque dans la chaîne. Toute la chaîne doit être fournie — vérifiez avec :
openssl s_client -connect jouwdomein.nl:443 -showcerts | grep "s:" | uniq
Vous ne voyez pas le certificat racine ; seuls le certificat final et l’intermédiaire doivent être visibles. Ajoutez `SSLCertificateChainFile` dans Apache ou le fichier de chaîne complet dans Nginx.
Foutmelding "certificate has expired" na installatie
Controleer of de systeemtijd correct is gesynchroniseerd:
timedatectl status
Forceer NTP-sync: `sudo timedatectl set-ntp true`.
TLS 1.0 ou 1.1 toujours actif malgré la configuration
Certains load balancers ou reverse proxies réécrivent la configuration SSL. Vérifiez qu’aucun paramètre SSL global dans `/etc/ssl/` ou un fichier `ssl.conf` ne remplace les paramètres locaux avec `grep -r "SSLProtocol\|ssl_protocols" /etc/`.