This guide will take you step by step through the process of configuring a MikroTik RouterBOARD as well as resetting it to the factory defaults and upgrading. Dec 09, 2018 Mikrotik RouterOS same command shell with Linux, such as saving the order, please use the TAB key on the keyboard long command, no longer need to be typed, simply type at the beginning of the command is called, will be automatically Shell will display itself commands respect.
Let's Encrypt certificates for RouterOS / Mikrotik
UPD 2018-05-27: Works with wildcard Let's Encrypt Domains
How it works:
- Dedicated Linux renew and push certificates to RouterOS / Mikrotik
- After CertBot renew your certificates
- The script connects to RouterOS / Mikrotik using DSA Key (without password or user input)
- Delete previous certificate files
- Delete the previous certificate
- Upload two new files: Certificate and Key
- Import Certificate and Key
- Change SSTP Server Settings to use new certificate
- Delete certificate and key files form RouterOS / Mikrotik storage
Installation on Ubuntu 16.04
Similar way you can use on Debian/CentOS/AMI Linux/Arch/Others
Download the repo to your system
Edit the settings file:
Variable Name | Value | Description |
---|---|---|
ROUTEROS_USER | admin | user with admin rights to connect to RouterOS |
ROUTEROS_HOST | 10.0.254.254 | RouterOSMikrotik IP |
ROUTEROS_SSH_PORT | 22 | RouterOSMikrotik PORT |
ROUTEROS_PRIVATE_KEY | /opt/letsencrypt-routeros/id_dsa | Private Key to connecto to RouterOS |
DOMAIN | mydomain.com | Use main domain for wildcard certificate or subdomain for subdomain certificate |
![Software Software](/uploads/1/2/5/8/125856930/679855519.png)
Change permissions:
Generate DSA Key for RouterOS
![Change Change](/uploads/1/2/5/8/125856930/461420323.jpg)
Make sure to leave the passphrase blank (-N ')
Send Generated DSA Key to RouterOS / Mikrotik
Setup RouterOS / Mikrotik side
Check that user is the same as in the settings file letsencrypt-routeros.settings
Check Mikrotik ssh port in /ip services ssh
Check Mikrotik firewall to accept on SSH port
CertBot Let's Encrypt
Install CertBot using official manuals https://certbot.eff.org/#ubuntuxenial-other
for Ubuntu 16.04
In the first time, you will need to create Certificates manually and put domain TXT record
follow CertBot instructions
Usage of the script
To use settings form the settings file:
To use script without settings file:
To use script with CertBot hooks for wildcard domain:
To use script with CertBot hooks for subdomain:
Edit Script
You can easily edit script to execute your commands on RouterOS / Mikrotik after certificates renewalAdd these strings in the «.sh» file before «exit 0» to have www-ssl and api-ssl works with Let's Encrypt SSL
Licence MIT
Copyright 2018 Konstantin Gimpel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.