Auto-Renew Lets Encrypt Certificate Problem
Posted: Thu Jul 04, 2024 2:08 am
Hi,
Got a really odd problem. I have 2x RB4011 (one at my home, one at the scout campsite) both of which have the same script on them to automatically renew the Let's Encrypt SSL Certificate that is used for SSTP VPN. I say they're the same, on the campsite we have a hotspot wifi system, so there's part of the script here that sets the new certificate for the hotspot, but that's the only difference.
Here's the script (with the DNS name commented out as [xxx] for privacy of course):
Here's the scheduler config:
Both boxes are running ROS 7.14 at the moment.
--> so, I don't think it's the ROS version (otherwise, I would have expected that it wouldn't work anywhere)
My RB4011 at home, everything just runs fine - the certificate renews every 75 days and the new certificate is applied.
The other box, doesn't seem to work, but when I run the script manually, works as expected.
--> so I don't think it's the script, otherwise I would have expected that it doesn't work when I run manually.
My thought at the moment is something to do with scheduler... but the scheduler config on both boxes are identical (apart from the start date when the scheduler was setup).
Is there any logging or anything like this that we could apply so that we can maybe see some errors here? I've got "Script" as a topic in my logging enabled, but I can't see anything that looks like Scheduler in there to add this in to the logging.
Anyone got any ideas to any of this at all?
Thanks very much.
Colin
Got a really odd problem. I have 2x RB4011 (one at my home, one at the scout campsite) both of which have the same script on them to automatically renew the Let's Encrypt SSL Certificate that is used for SSTP VPN. I say they're the same, on the campsite we have a hotspot wifi system, so there's part of the script here that sets the new certificate for the hotspot, but that's the only difference.
Here's the script (with the DNS name commented out as [xxx] for privacy of course):
Code: Select all
:log info "Script - Certificate renewal start"
:local commName "[xxx]"
/ip service set disabled=no [find where name="www"]
/ip firewall filter enable [find where comment="LetsEncrypt"]
#Delete old certificate, create new certificate
/certificate remove [find where common-name=$commName]
/certificate enable-ssl-certificate dns=$commName
#Delay to allow certificate to be requested and downloaded
:delay 60s
/certificate
:local certName [get [find where common-name=$commName] name]
#Set new certificate in SSTP Profile
/interface sstp-server server set certificate=$certName
#Set new certificate in Hotspot profile
/ip hotspot profile set ssl-certificate=$certName [find where name="Hotspot"]
/ip service set disabled=yes [find where name="www"]
/ip firewall filter disable [find where comment="LetsEncrypt"]
Code: Select all
/system scheduler add interval=10w5d name=letsencrypt-renew on-event=letsencrypt-renew policy=read,write start-date=2023-08-28 start-time=09:00:00
--> so, I don't think it's the ROS version (otherwise, I would have expected that it wouldn't work anywhere)
My RB4011 at home, everything just runs fine - the certificate renews every 75 days and the new certificate is applied.
The other box, doesn't seem to work, but when I run the script manually, works as expected.
--> so I don't think it's the script, otherwise I would have expected that it doesn't work when I run manually.
My thought at the moment is something to do with scheduler... but the scheduler config on both boxes are identical (apart from the start date when the scheduler was setup).
Is there any logging or anything like this that we could apply so that we can maybe see some errors here? I've got "Script" as a topic in my logging enabled, but I can't see anything that looks like Scheduler in there to add this in to the logging.
Anyone got any ideas to any of this at all?
Thanks very much.
Colin