en:vpn:renew-cert
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:vpn:renew-cert [2019/10/13 15:01] – external edit 127.0.0.1 | en:vpn:renew-cert [2024/06/19 08:33] (current) – [1. Neutrinet app] hgo | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Renouvellement du certificat ====== | + | # Renewal of VPN certificate |
- | TODO: refaire les images | + | If you have issues connecting to the VPN and you see the error: |
- | + | ``` | |
- | Si je ne me trompe ces méthodes sont reprisent dans l' | + | Certificate has key usage 00a0, expects 00a0 |
- | Pour mettre à jour cette application : | + | ``` |
- | + | in `/ | |
- | `$ sudo yunohost app upgrade neutrinet -u https:// | + | |
- | + | ||
- | Si non, et que vous voyez l' | + | |
- | Pour vérifier sa date d' | + | |
+ | To check its expiry date, as `root` type the command: | ||
```sh | ```sh | ||
- | $ openssl x509 -in / | + | $ openssl x509 -in / |
notAfter=Nov 12 13:42:43 2018 GMT | notAfter=Nov 12 13:42:43 2018 GMT | ||
- | -----BEGIN CERTIFICATE----- | ||
- | ... | ||
- | -----END CERTIFICATE----- | ||
``` | ``` | ||
+ | The displayed date after `noAfter` is the expiry date. | ||
- | La date affichée après le `noAfter` est la date d' | + | There are four methods to renew the certificate. |
+ | ## 1. Neutrinet app | ||
- | Il y a trois procédures possibles pour renouveler le certificat. | + | The [[https:// |
- | # Directement à partir d'une brique | + | ### Install |
- | + | ||
- | Pour le renouveler, en tant que `root`: | + | |
+ | You can either install the app through the admin panel, or with: | ||
```sh | ```sh | ||
- | $ cd /opt/neutrinet/ | + | yunohost app install |
- | $ ve/ | + | |
``` | ``` | ||
- | # Procédure par le script Renew_cert de Bram | + | ### Upgrade |
- | La procédure est donc de cloner le dépôt git sur ton cubie board, ou d' | + | To upgrade this app: |
+ | ```sh | ||
+ | yunohost tools update apps | ||
+ | yunohost app upgrade neutrinet | ||
+ | ``` | ||
- | `git clone https:// | + | ## 2. From a cube |
- | (dans le dossier qui te convient le mieux) | + | If the Neutrinet app is already installed, you can force the certificates verification: |
- | Et tu rentres dans le sous-dossier qui vient d' | + | ```sh |
+ | / | ||
+ | ``` | ||
- | `cd renew_cert` | + | ## 3. From the renew_cert |
- | Ensuite, tu crées un environnement virtuel python (ce qui veut dire que les paquets pythons que tu installeras n' | + | Clone the following git repository, either on your cube or your own computer: |
+ | ```sh | ||
+ | git clone https:// | ||
+ | ``` | ||
- | `virtualenv ve` | + | Move to the folder that just has been created: |
+ | ```sh | ||
+ | cd renew_cert | ||
+ | ``` | ||
- | Puis, tu actives cet environnement: | + | Create a virtual python3 environment. This means that the installed python3 packages won't have any impact on the rest of the system: |
+ | ```sh | ||
+ | python3 -m venv ve | ||
+ | ``` | ||
- | `source ve/ | + | Enable this environment: |
+ | ```sh | ||
+ | source ve/ | ||
+ | ``` | ||
- | Enfin, tu installes les dépendances du script | + | Install the script |
+ | ``` | ||
+ | pip install -r requirements.txt | ||
+ | ``` | ||
- | `pip install -r requirements.txt` | + | Finally, run the script with this command: |
- | + | ``` | |
- | Pour finir, tu peux enfin lancer le script en lui-même en tapant cette commande | + | python renew.py < |
+ | ``` | ||
- | | + | You will be asked for your password to login to the Neutrinet VPN. |
- | Je te conseillerais de mettre un espace avant cette commande, et ce afin d' | + | Normaly, a subfolder named `certs_YYYY-MM-DD_HH: |
- | Le script | + | |
- | Tu auras alors dans le dossier renew_cert, un sous-dosser appelé certs_2017-07-xx_XX: | + | The files that we need are `client.crt`, `client.key`, and `ca.crt`, i.e. the public and private key of the client |
- | Ce sont essentiellement les fichiers client.crt et client.key qui t' | + | These files must replace the files in `/ |
- | Avant de remplacer l'un par l' | + | On the cube, these files are in `/ |
- | Cela donnerait quelque chose comme (toujours en étant dans le dossier renew_cert): | + | |
+ | **Remark**: Before replacing one with the other, it is advisable to make a backup of the old certificate, | ||
```sh | ```sh | ||
- | sudo mv / | + | sudo mv / |
- | sudo mv / | + | sudo mv / |
- | sudo mv client.crt / | + | sudo mv / |
- | sudo mv client.key / | + | sudo mv client.crt / |
+ | sudo mv client.key / | ||
+ | sudo mv ca.crt / | ||
``` | ``` | ||
- | OU (apparement dans centains cas -à définir- user. remplace client.) | + | All you need to do is to restart the OpenVPN service to check if it's still working. |
+ | **Remark**: Ideally, make sure to be connected on the same local network as your cube, i.e. through its local address (192.168.1.x in most cases). | ||
+ | ```sh | ||
+ | sudo systemctl restart ynh-vpnclient` | ||
+ | ``` | ||
+ | |||
+ | You can check that everything went well by looking at the logs: | ||
``` | ``` | ||
- | sudo mv /etc/openvpn/ | + | tail /var/log/openvpn-client.log /var/log/ynh-vpnclient.log |
- | sudo mv /etc/ | + | |
- | sudo mv user.crt / | + | |
- | sudo mv user.key / | + | |
``` | ``` | ||
+ | ## 4. From user.neutrinet.be | ||
- | Après quoi, il ne te resterait plus qu'à re-démarrer le service VPN pour tester qu'il fonctionne toujours (idéalement, | + | This method sometimes requires some patience because user.neutrinet.be can produce some failures. |
+ | Login with ssh to your internet cube, then go to the folder where the VPN key is located (it should be the file `/ | ||
+ | ```sh | ||
+ | cd / | ||
+ | ``` | ||
- | `sudo systemctl restart openvpn` | + | Create a certificate signing request (CSR) for this key: |
+ | ```sh | ||
+ | openssl req -out client.csr -new -newkey rsa:4096 -nodes -keyout user.key | ||
+ | ``` | ||
- | # Procédure manuelle et via le site user.neutrinet.be | + | You will be asked for several questions, such as the country code (BE), the region (Bruxelles, |
+ | Most important is the `Cname`, that is the name which will be used by Neutrinet to know to whom belongs the certificate. | ||
- | Deuxième méthode (qui parfois demande la patience car actuellement user.neutrinet.be connait des ratés): | + | **Remark**: It is recommended to provide your email address for the Cname field. |
- | La seconde méthode consiste à se connecter en ssh au cubieboard, aller dans le dossier où se trouve la clef du VPN (a priori, il s'agit du fichier / | + | This command create |
- | + | ```sh | |
- | `cd / | + | cat client.csr |
- | + | ``` | |
- | Puis de créer une demande de signature de clefs (CSR) pour cette clef | + | |
- | + | ||
- | `openssl req -new -sha1 -out client.csr | + | |
- | + | ||
- | Plusieurs questions te seront posées, comme le code pays (BE), la région (Bruxelles, ...), la Société etc... auquel le certificat est attaché. Le plus important est le " | + | |
- | + | ||
- | Cette commande créé un fichier | + | |
- | + | ||
- | `cat client.csr` | + | |
- | Copie ce contenu précieusement, et rends-toi sur https:// | + | Copy this content, then go to https:// |
- | Connecte-toi | + | {{ : |
- | **image** | + | Login |
- | Clique sur users | + | {{ : |
+ | Click on `Users` | ||
- | Attends que cela charge, et quand tu vois ton nom, clique dessus, puis sur "View associated clients" | + | {{ : |
+ | Wait for the page to load, and when you see your name click on it. | ||
- | **image** | + | {{ : |
- | Ensuite clique sur ton certificat (si tu en as plusieurs, il faut utiliser celui qui liste une IPv4 - 80.67.181.x), | + | Click on `View associated clients` |
+ | {{ : | ||
- | **image** | + | Click on your certificate (if you have more than one, use the one with an IPv4 - 80.67.181.x) |
- | Il va alors te présenter ton certificat actuel. si tu cliquer sur Rekey, tu auras la possibilité de coller le CSR (le fichier généré plus tôt, que tu as copié), puis de cliquer sur Rekey. | + | {{ : |
- | Une fois cette opération terminée, tu verras un bandeau comme ceci: | + | Choose the `Renew certificate` option |
- | **image** | + | {{ : |
- | Tu pourras alors cliquer sur "View client details" | + | The current certificate should appear on the screen. Click on `Rekey`, then paste the content of the CSR (the file you copied earlier). |
+ | Click on the `Rekey` button to confirm. | ||
- | Voilà, c'est tout! | + | Once this operation done, you should see the following banner: |
- | # Liens | + | {{ : |
- | - https:// | + | You can click on `View client details`, then on `Download config package`. |
- | - https:// | + | |
+ | This will download a zip file containing the certificate files. In the directory `/ | ||
+ | That's it! |
en/vpn/renew-cert.1570971669.txt.gz · Last modified: 2019/10/13 15:01 by 127.0.0.1