Les répertoires importants d'openVPN sont :
/etc/openVPN/
|
Emplacement des fichiers de configuration |
/usr/local/easy-rsa
|
Emplacement des scripts d'aide à la gestion de certificats SSL |
/usr/local/openvpn-keys
|
Emplacement des certificats (racines et clients) |
Il faut aller dans /usr/local/easy-rsa et effectuer la série d'ordres suivante :
Chargement de la configuration des certificats
. vars
Création du certificat avec un mot de passe :
./build-key-pass NomCertificat
Exemple de session complète :
[root@VPN-Server easy-rsa]# ./build-key-pass Nicolas
Generating a 1024 bit RSA private key
.......................................................................................................++++++
....................++++++
writing new private key to 'Nicolas.key'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
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) [FR]:
State or Province Name (full name) [NA]:
Locality Name (eg, city) [PARIS]:
Organization Name (eg, company) [JIGA]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:Nicolas Fradet
Email Address [admin@jiga.fr]:nfradet@jiga.fr
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /usr/local/easy-rsa/openssl.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'FR'
stateOrProvinceName :PRINTABLE:'NA'
localityName :PRINTABLE:'PARIS'
organizationName :PRINTABLE:'JIGA'
commonName :PRINTABLE:'Nicolas Fradet'
emailAddress :IA5STRING:'nfradet@jiga.fr'
Certificate is to be certified until May 11 09:44:45 2014 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
[root@VPN-Server easy-rsa]#
Maintenant, il ne reste plus qu'à fournir le jeu de fichiers à l'utilisateur final.
Il faut prendre les fichiers suivants et les transmettre de manière sécurisé (par principe) :
[root@VPN-Server openvpn-keys]# ll
total 92
-rw-r--r-- 1 root root 3218 mai 5 10:10 01.pem
-rw-r--r-- 1 root root 3333 mai 5 13:53 02.pem
-rw-r--r-- 1 root root 3340 mai 7 12:32 03.pem
-rw-r--r-- 1 root root 3368 mai 13 11:44 04.pem
-rw-r--r-- 1 root root 1127 mai 5 10:08 ca.crt
-rw-r--r-- 1 root root 887 mai 5 10:08 ca.key
-rw-r--r-- 1 root root 245 mai 5 10:20 dh1024.pem
-rw-r--r-- 1 root root 340 mai 13 11:44 index.txt
-rw-r--r-- 1 root root 247 mai 7 12:32 index.txt.old
-rw-r--r-- 1 root root 3340 mai 7 12:32 Jacques.crt
-rw-r--r-- 1 root root 647 mai 7 12:32 Jacques.csr
-rw-r--r-- 1 root root 963 mai 7 12:32 Jacques.key
-rw-r--r-- 1 root root 3368 mai 13 11:44 Nicolas.crt
-rw-r--r-- 1 root root 664 mai 13 11:44 Nicolas.csr
-rw-r--r-- 1 root root 963 mai 13 11:44 Nicolas.key
-rw-r--r-- 1 root root 3 mai 13 11:44 serial
-rw-r--r-- 1 root root 3 mai 7 12:32 serial.old
[root@VPN-Server openvpn-keys]#
Parce que si le portable est volé ou perdu, il vaut mieux interdire l'accès à votre VPN au certificat qui est installé dessus. Un mot de passe peut toujours être cracké, alors que la révocation est faite au niveau du serveur.
Il faut aller dans /usr/local/easy-rsa et effectuer la série d'ordres suivante :
Chargement de la configuration des certificats
. vars
Révoquation du certificat
./revoke-key NomCertificat
Exemple de session complète :
[root@VPN-Server easy-rsa]# ./revoke-key Nicolas
Using configuration from /usr/local/easy-rsa/openssl.cnf
Revoking Certificate 04.
Data Base Updated
Using configuration from /usr/local/easy-rsa/openssl.cnf
[root@VPN-Server easy-rsa]#