Hi guys,
quick question regarding automated certificate renewal.
Short version: Can I rely on the timer
$ systemctl list-timers
Thu 2020-04-02 18:01:17 CEST 2h 25min left Thu 2020-04-02 10:35:25 CEST 5h 0min ago certbot.timer certbot.service
to reliably renew the certificate when due time has come?
Long version: I managed to create a certificate thanks to your support. Now I would like to make my machine automatically renew it when time is due such that it doesn’t expire without me noticing. I found this HowTo: https://techmonger.github.io/49/certbot-auto-renew/ and wanted to implement it, but then found out that exactly this script is already placed into /etc/cron.d/. Looks like the folks from Raspbian/Debian made a comfy package for us. However, the script has the following comment, I mean the last paragraph:
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc. Renewal will only occur if expiration
# is within 30 days.
#
# Important Note! This cronjob will NOT be executed if you are
# running systemd as your init system. If you are running systemd,
# the cronjob.timer function takes precedence over this cronjob. For
# more details, see the systemd.timer manpage, or use systemctl show
# certbot.timer.
Since Raspbian indeed uses systemd, the comment does apply in my case. So I looked into the timer and it shows:
$ systemctl show certbot.timer
Unit=certbot.service
NextElapseUSecRealtime=50y 3month 20h 31min 17.696741s
NextElapseUSecMonotonic=0
LastTriggerUSec=50y 3month 13h 5min 25.549290s
LastTriggerUSecMonotonic=3d 13h 19min 18.141108s
Result=success
AccuracyUSec=1min
RandomizedDelayUSec=12h
Persistent=yes
WakeSystem=no
RemainAfterElapse=yes
Id=certbot.timer
Names=certbot.timer
Requires=-.mount sysinit.target
WantedBy=timers.target
Conflicts=shutdown.target
Before=certbot.service timers.target shutdown.target
After=time-sync.target -.mount sysinit.target
Triggers=certbot.service
RequiresMountsFor=/var/lib/systemd/timers
Description=Run certbot twice daily
LoadState=loaded
ActiveState=active
SubState=waiting
FragmentPath=/lib/systemd/system/certbot.timer
UnitFileState=enabled
UnitFilePreset=enabled
StateChangeTimestamp=Thu 2020-04-02 10:36:04 CEST
StateChangeTimestampMonotonic=307197325293
InactiveExitTimestamp=Tue 2020-03-31 20:45:30 CEST
InactiveExitTimestampMonotonic=170963190579
ActiveEnterTimestamp=Tue 2020-03-31 20:45:30 CEST
ActiveEnterTimestampMonotonic=170963190579
ActiveExitTimestampMonotonic=0
InactiveEnterTimestampMonotonic=0
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
OnFailureJobMode=replace
IgnoreOnIsolate=no
NeedDaemonReload=no
JobTimeoutUSec=infinity
JobTimeoutAction=none
ConditionResult=yes
AssertResult=yes
ConditionTimestamp=Tue 2020-03-31 20:45:30 CEST
ConditionTimestampMonotonic=170963176874
AssertTimestamp=Tue 2020-03-31 20:45:30 CEST
AssertTimestampMonotonic=170963176882
Transient=no
Perpetual=no
StartLimitIntervalSec=10000000
StartLimitBurst=5
StartLimitAction=none
InvocationID=89108875dbdd41d1a33f85f50ee9cb92
It also appears in the timers list as
$ systemctl list-timers
Thu 2020-04-02 18:01:17 CEST 2h 25min left Thu 2020-04-02 10:35:25 CEST 5h 0min ago certbot.timer certbot.service
So everything actually looks good to me, but just to be sure: Can I rely on the timer to renew the certificate without any further intervention from my side?
My domain is: photon.serverpit.com
I ran this command: sudo certbot --nginx
It produced this output: https://pastebin.com/Gzna3aQg
My web server is (include version): nginx 1.10.3
The operating system my web server runs on is (include version): Raspbian GNU/Linux 9.11 (stretch)
My hosting provider, if applicable, is: none
I can login to a root shell on my machine (yes or no, or I don’t know): yes
I’m using a control panel to manage my site (no, or provide the name and version of the control panel): no
The version of my client is (e.g. output of certbot --version
or certbot-auto --version
if you’re using Certbot): 0.28.0
Thanks!