ROS scripting engine is fully custom like terminal. That route was chosen probably due to performance & security reasons.What kind (aka type eg. Python, Bash etc.) of scripts are used in RouterOS?
(...)
but what are they?... proprietary?
Nope.Is there a plugin to run a more common type of script like python or bash shell etc.?
There's no way besides external automation and updating certificates via SFTP.Any other suggestions/recommendations for the best route to solve this problem other then in wishful thinking of a RouterOS update one day?
How you generated the certificate and installed ?No, they are "certificats", can be use on anything (firewall, mail, ftp, etc...). The only "problem" is that they are 90 days lifetime... so without ACME, you'll have to update the cert manually each 3 month. Certs are actually working right now if you do install it manually.
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOMAIN=vpn1.example.net
CERT=vpn1.example.net.cer
KEY=vpn1.example.ne.key
ROUTER=<Router 1 IP Address>
cd $DIR/$DOMAIN
if [ -f $CERT ]; then
echo -n "Uploading $DOMAIN certificate $ROUTER router..."
scp -q $CERT $ROUTER:$CERT
scp -q $KEY $ROUTER:$KEY
echo "done!"
exit 0
fi
DOMAIN=vpn2.example.net
CERT=vpn2.example.net.cer
KEY=vpn2.example.ne.key
ROUTER=<Router 2 IP Address>
cd $DIR/$DOMAIN
if [ -f $CERT ]; then
echo -n "Uploading $DOMAIN certificate $ROUTER router..."
scp -q $CERT $ROUTER:$CERT
scp -q $KEY $ROUTER:$KEY
rm $CERT $KEY
echo "done!"
exit 0
fi
:if ([:len [/file find name=vpn1.example.net]] > 0) do={
:put "Deleting Old Certificate"
/certificate remove vpn1.example.net.cer_0
:delay 1
:put "Importing new Certificate"
/certificate import file-name=vpn1.example.net.cer passphrase=""
/certificate import file-name=vpn1.example.net.key passphrase=""
:delay 1
:put "Assigning certificate to SSTP Server"
/interface sstp-server server set certificate=vpn1.example.net.cer_0
:delay 1
:put "Cleaning up files"
/file remove vpn1.example.net.cer
/file remove vpn1.example.net.key
:put "Certificate installation complete"
}
In other words, CCR, RB3011, RB850Gx2, RB1100AHx4, etc which have enough cpu/storage/memory resources are not supported.Currently MetaRouter can be used on
RB400, RB700 series except models with SPI flash, RB900 series except models with SPI flash, RB2011 boards
Listed PPC boards: RB1000, RB1100, RB1100AH and RB800.
certbot certonly --preferred-challenges=dns --manual -d $DOMAIN --manual-public-ip-logging-ok --post-hook /opt/letsencrypt-routeros/letsencrypt-routeros.sh
this is the only sad part. My CCR should be able to do it by itself!Dedicated Linux renew and push certificates to RouterOS / Mikrotik
I am wondering; because the "first" validation method is manual (by creating a TXT record at your DNS provider) it seems the renewal process also needs a TXT DNS record validation.You can use Let's Encrypt RouterOS / Mikrotik script
How it works:https://github.com/gitpel/letsencrypt-routeros
- 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
To use script with CertBot hooks:Code: Select allcertbot certonly --preferred-challenges=dns --manual -d $DOMAIN --manual-public-ip-logging-ok --post-hook /opt/letsencrypt-routeros/letsencrypt-routeros.sh
A few do, most don't have a plugin available. However, the registration via the script is based on the manual TXT verification which in turn determines the way certbot stores the information regarding the particular certificate. So you'd have to fidget around with the certbot config to get this working properly. Furthermore; in the readme it is suggested the TXT verification is only once. I think this is false.It depends. Some DNS providers have API access for editing records, so if you use one of them, everything can be scripted and made fully automatic.
ok, so your script works for me, but how to script it to renew my certificate after 2-3 months, even when my DNS has no APIs to (automatically) change the DNS TXT file...You can use Let's Encrypt RouterOS / Mikrotik script
How it works:https://github.com/gitpel/letsencrypt-routeros
- 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
To use script with CertBot hooks:Code: Select allcertbot certonly --preferred-challenges=dns --manual -d $DOMAIN --manual-public-ip-logging-ok --post-hook /opt/letsencrypt-routeros/letsencrypt-routeros.sh
this is not a solution as long as we needed additional non-RouterOS host.You can use Let's Encrypt RouterOS / Mikrotik script
How it works:https://github.com/gitpel/letsencrypt-routeros
- 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
To use script with CertBot hooks:Code: Select allcertbot certonly --preferred-challenges=dns --manual -d $DOMAIN --manual-public-ip-logging-ok --post-hook /opt/letsencrypt-routeros/letsencrypt-routeros.sh
Ah, not?+1 need dns-challenge
For example, IKE2 VPN use a certificate from CA would be much more convenient than self signed certificate.
My ISp only has dynamic public ip and blocked port 80.
/certificate enable-ssl-certificate dns-name=mydomain.ext
/certificate/acme-client
add name=main common-name=myrouter.example.net use-for=www=ssl,sstp-server
add name=api common-name=api.myrouter.example.net use-for=api-ssl
/certificate/acme-client
add name=mycertificate common-name=myrouter.example.net acme-server="https://acme-v02.api.letsencrypt.org/directory" challenge=http-01
/certificate/acme-client
add name=mycertificate challenge=dns-01 on-deploy-challenge="<some script>" on-clean-challenge="<some script>" on-deploy-cert="<some script>" on-invalid-challenge="<some script>"
/tool/dns-update dns-server=a.ns.example.net key-name=<something> key=<something> zone=example.net name=_acme-challenge type=TXT value=$"challenge-value"
/ip firewall filter enable [find comment="access to http for LE"]
> /certificate/acme-client/print detail
0 name="myrouter.example.net" issued-at="2022-01-20 04:50:34" next-renewal="2022-03-20 05:00:00" ...
/certificate/acme-client/revoke 0
/certificate/acme-client/force-renew 0
My Mikrotik Router hasn't the certificate/acme-client submenu. What is needed to do for it? I didn't understand something.
They are all examples of proposed commands, nothing exists.....My Mikrotik Router hasn't the certificate/acme-client submenu. What is needed to do for it? I didn't understand something.
YES YES YES! I am currently working on a SCEP server or automated way to push certs to my couple of home routers as I have always had it on my checklist to fix my ssl hell at home. This would be AWESOME!
Current LE client in RouterOS is good as technology preview, but final version needs different approach, not just single-purpose LE client, but universal ACME client. For start, support for multiple certificates:
And the beauty of it is that it's not difficult, almost everything is there already, it just needs some interface to it and make some things configurable instead of using hardcoded values.
+1Current LE client in RouterOS is good as technology preview, but final version needs different approach, not just single-purpose LE client, but universal ACME client.
How would SSTP server work then?Also https port most be forwarded to this container for acme.sh to work.