# Proxmox sécurisation certificats SSL clients

L'interface d'administration Proxmox est accessible en HTTPS, donc échanges cryptés et sécurisés par SSL. Les login/mot de passe demandés à la connexion ne passent donc pas en clair.

Pour encore plus de sécurité, on peut forcer le serveur à n'autoriser que les clients disposant d'un certificat local. Sans ce certificat généré avec le CA du serveur, le client n'arrive pas jusqu'à la page de login et reçoit une erreur (certificat erroné, ou certificat client requis, selon les navigateurs).

## Sommaire

<div class="toc" id="bkmrk-%C2%A0%5Bmasquer%5D%C2%A0-1%C2%A0instal"><div class="toctitle"><span class="toctoggle"> \[<a class="togglelink" role="button" tabindex="0">masquer</a>\] </span></div>- [<span class="tocnumber">1</span> <span class="toctext">Installation</span>](https://wiki.kogite.fr/index.php/Proxmox_s%C3%A9curisation_certificats_SSL_clients#Installation)
    - [<span class="tocnumber">1.1</span> <span class="toctext">Création du certificat client</span>](https://wiki.kogite.fr/index.php/Proxmox_s%C3%A9curisation_certificats_SSL_clients#Cr.C3.A9ation_du_certificat_client)
    - [<span class="tocnumber">1.2</span> <span class="toctext">Configuration d'Apache</span>](https://wiki.kogite.fr/index.php/Proxmox_s%C3%A9curisation_certificats_SSL_clients#Configuration_d.27Apache)
- [<span class="tocnumber">2</span> <span class="toctext">Utilisation</span>](https://wiki.kogite.fr/index.php/Proxmox_s%C3%A9curisation_certificats_SSL_clients#Utilisation)
    - [<span class="tocnumber">2.1</span> <span class="toctext">Navigateurs</span>](https://wiki.kogite.fr/index.php/Proxmox_s%C3%A9curisation_certificats_SSL_clients#Navigateurs)
    - [<span class="tocnumber">2.2</span> <span class="toctext">JAVA (pour les consoles VNCviewer)</span>](https://wiki.kogite.fr/index.php/Proxmox_s%C3%A9curisation_certificats_SSL_clients#JAVA_.28pour_les_consoles_VNCviewer.29)
- [<span class="tocnumber">3</span> <span class="toctext">Notes</span>](https://wiki.kogite.fr/index.php/Proxmox_s%C3%A9curisation_certificats_SSL_clients#Notes)

</div># <span class="mw-headline" id="bkmrk-installation-0">Installation</span>

## <span class="mw-headline" id="bkmrk-cr%C3%A9ation-du-certific-0">Création du certificat client</span>

Eventuellement, modifier

```
/usr/share/ssl-cert/ssleay.cnf
```

pour intégrer le nom du serveur ("@HostName@" ne revoit pas toujours le hostname en question). Puis :

```
cd /tmp
mkdir ssl
cd ssl/
openssl genrsa -out proxmox-cli-cert.key 2048
openssl req -config /usr/share/ssl-cert/ssleay.cnf -new -key proxmox-cli-cert.key -out proxmox-cli-cert.req
openssl x509 -req -in proxmox-cli-cert.req -CA /etc/pve/pve-root-ca.pem -CAkey /etc/pve/pve-root-ca.key -set_serial 101 -days 3650 -outform PEM -out proxmox-cli-cert.pem
```

Puis on exporte ce certificat dans un format lisible par les navigateurs

```
openssl pkcs12 -export -inkey proxmox-cli-cert.key -in proxmox-cli-cert.pem -out proxmox-cli-cert.p12
```

Donner un mot de passe ET S'EN SOUVENIR !

Le fichier P12 contient tout ce qu'il faut, on peut supprimer le reste.

```
rm proxmox-cli-cert.req proxmox-cli-cert.key proxmox-cli-cert.pem
```

## <span class="mw-headline" id="bkmrk-configuration-d%27apac-0">Configuration d'Apache</span>

Editer /etc/apache2/sites-enabled/pve.conf. Après les lignes "SSLCertificate..." ajouter :

```
    SSLVerifyClient require
    SSLVerifyDepth 4
    SSLCACertificateFile /etc/pve/pve-root-ca.pem
```

Et ne pas oublier

```
/etc/init.d/apache2 reload
```

# <span class="mw-headline" id="bkmrk-utilisation-0">Utilisation</span>

A partir d'un client sans certificat, vérifier que Proxmox interdit l'accès à l'interface web (on doit avoir une erreur du type "connexion réinitialisée").

## <span class="mw-headline" id="bkmrk-navigateurs-0">Navigateurs</span>

Télécharger le fichier p12 (par FTP, SCP, ou tout autre moyen). L'importer dans le navigateur.

- Firefox

```
Edition / Préférences / Avancé / Chiffrement / Afficher les certificats / Vos certificats / Importer...
```

- Chrome

```
Préférences / Options avancées / HTTPS/SSL / Gérer les certificats / Importer...
```

Une fois importé, vérifier que le navigateur accède (après validation) à la page de login

## <span class="mw-headline" id="bkmrk-java-%28pour-les-conso-0">JAVA (pour les consoles VNCviewer)</span>

**Problème à résoudre :** la console VNC ne fonctionne plus avec ces certificats.

Résolution temporaire : -&gt; private.

# <span class="mw-headline" id="bkmrk-notes-0">Notes</span>

- Les certificats Proxmox (pve-root-ca) étant générés à l'installation, il contiennent un nom d'hôte générique "@HostName". C'est ce nom qui apparaitra dans le gestionnaire de certificats des navigateurs pour tous les serveur Proxmox.