Installer un certificat auto-signé (Serveur Apache)

-Créer la clé privée (algorithme RSA 2048 bits)

# openssl genrsa -out domaine.key 2048

Generating RSA private key, 2048 bit long modulus
……………………………………………………………………………………………….+++
……….+++
e is 65537 (0x10001)

-Générer le fichier . CSR (Cerficat Signing Request):

# openssl req -new -key domaine.key -out domaine.csr

Renseigner les éléments demandés:

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:domaine.tld ⇒ Ajouter votre domaine
Email Address []:

Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

-Générer le certificat auto-signé:

# openssl x509 -req -days 365 -in domaine.csr -signkey domaine.key -out domaine.crt

Signature ok
subject=/C=/ST=/L=/O=/OU=/CN=domaine.tld/emailAddress=adresse@
Getting Private key

-Créer le fichier vhost du domaine (/etc/apache2/site-available):

DocumentRoot /repertoire_racine/domaine.tld/
ServerName domaine.tld

SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile /etc/ssl/domaine.crt
SSLCertificateKeyFile /etc/ssl/domaine.key

-Activer le vhost et relancer apache2

# a2ensite domaine.tld

# service apache2 reload