Updated README and settings file to reflect the use of RSA private keys, vice DSA. RSA private keys require manual intervention from the user to add a PubkeyAcceptedKeyTypes setting to their SSH config file in OpenSSH 7+ and users may not be aware.

This commit is contained in:
threeplanetssoftware 2019-07-11 21:26:17 -04:00
parent ba52d0c817
commit 26febd844b
2 changed files with 10 additions and 10 deletions

View File

@ -9,7 +9,7 @@
### How it works: ### How it works:
* Dedicated Linux renew and push certificates to RouterOS / Mikrotik * Dedicated Linux renew and push certificates to RouterOS / Mikrotik
* After CertBot renew your certificates * After CertBot renew your certificates
* The script connects to RouterOS / Mikrotik using DSA Key (without password or user input) * The script connects to RouterOS / Mikrotik using RSA Key (without password or user input)
* Delete previous certificate files * Delete previous certificate files
* Delete the previous certificate * Delete the previous certificate
* Upload two new files: **Certificate** and **Key** * Upload two new files: **Certificate** and **Key**
@ -35,7 +35,7 @@ vim /opt/letsencrypt-routeros/letsencrypt-routeros.settings
| ROUTEROS_USER | admin | user with admin rights to connect to RouterOS | | ROUTEROS_USER | admin | user with admin rights to connect to RouterOS |
| ROUTEROS_HOST | 10.0.254.254 | RouterOS\Mikrotik IP | | ROUTEROS_HOST | 10.0.254.254 | RouterOS\Mikrotik IP |
| ROUTEROS_SSH_PORT | 22 | RouterOS\Mikrotik PORT | | ROUTEROS_SSH_PORT | 22 | RouterOS\Mikrotik PORT |
| ROUTEROS_PRIVATE_KEY | /opt/letsencrypt-routeros/id_dsa | Private Key to connecto to RouterOS | | ROUTEROS_PRIVATE_KEY | /opt/letsencrypt-routeros/id_rsa | Private RSA Key to connecto to RouterOS |
| DOMAIN | mydomain.com | Use main domain for wildcard certificate or subdomain for subdomain certificate | | DOMAIN | mydomain.com | Use main domain for wildcard certificate or subdomain for subdomain certificate |
@ -43,18 +43,18 @@ Change permissions:
```sh ```sh
chmod +x /opt/letsencrypt-routeros/letsencrypt-routeros.sh chmod +x /opt/letsencrypt-routeros/letsencrypt-routeros.sh
``` ```
Generate DSA Key for RouterOS Generate RSA Key for RouterOS
*Make sure to leave the passphrase blank (-N "")* *Make sure to leave the passphrase blank (-N "")*
```sh ```sh
ssh-keygen -t dsa -f /opt/letsencrypt-routeros/id_dsa -N "" ssh-keygen -t rsa -f /opt/letsencrypt-routeros/id_rsa -N ""
``` ```
Send Generated DSA Key to RouterOS / Mikrotik Send Generated RSA Key to RouterOS / Mikrotik
```sh ```sh
source /opt/letsencrypt-routeros/letsencrypt-routeros.settings source /opt/letsencrypt-routeros/letsencrypt-routeros.settings
scp -P $ROUTEROS_SSH_PORT /opt/letsencrypt-routeros/id_dsa.pub "$ROUTEROS_USER"@"$ROUTEROS_HOST":"id_dsa.pub" scp -P $ROUTEROS_SSH_PORT /opt/letsencrypt-routeros/id_rsa.pub "$ROUTEROS_USER"@"$ROUTEROS_HOST":"id_rsa.pub"
``` ```
### Setup RouterOS / Mikrotik side ### Setup RouterOS / Mikrotik side
@ -67,8 +67,8 @@ scp -P $ROUTEROS_SSH_PORT /opt/letsencrypt-routeros/id_dsa.pub "$ROUTEROS_USER"@
:put "Enable SSH" :put "Enable SSH"
/ip service enable ssh /ip service enable ssh
:put "Add to the user DSA Public Key" :put "Add to the user RSA Public Key"
/user ssh-keys import user=admin public-key-file=id_dsa.pub /user ssh-keys import user=admin public-key-file=id_rsa.pub
``` ```
### CertBot Let's Encrypt ### CertBot Let's Encrypt
@ -92,7 +92,7 @@ certbot certonly --preferred-challenges=dns --manual -d $DOMAIN --manual-public-
``` ```
### Usage of the script ### Usage of the script
*To use settings form the settings file:* *To use settings from the settings file:*
```sh ```sh
./opt/letsencrypt-routeros/letsencrypt-routeros.sh ./opt/letsencrypt-routeros/letsencrypt-routeros.sh
``` ```

View File

@ -5,5 +5,5 @@
ROUTEROS_USER=admin ROUTEROS_USER=admin
ROUTEROS_HOST=10.0.254.254 ROUTEROS_HOST=10.0.254.254
ROUTEROS_SSH_PORT=22 ROUTEROS_SSH_PORT=22
ROUTEROS_PRIVATE_KEY=/opt/letsencrypt-routeros/id_dsa ROUTEROS_PRIVATE_KEY=/opt/letsencrypt-routeros/id_rsa
DOMAIN=vpnserver.yourdomain.com DOMAIN=vpnserver.yourdomain.com