Hey,
i found some interesting stuff applying some echo lines on datetimes:
Let's encrypt generated certificate is always 90 days valid
pfsense WebUI "Services/Acme/Certificate options/Certificate renewal after" option does not affect certificate lifetime generated by Let's encrypt. It does affect acme_command.sh;
Even a 1 day certificate is valid for 90 days but the option set "Certificate renewal after" correctly set the end date checked by acme_command.sh. So i trust that it could do a good job within 90 days time frame. Any value grater than 90 would let you drop in an unmanged time frame where your certificate is outdated but the script things "Renewal number of days not yet reached".
I would suggest a bug fix in pfsense UI to discard bad values set up in certificate edit page and help users.
Also
You should consider the second gap: since cron job run once a day, you may run the job just 1 hour before a certificate may ends, then you have to wait next job 24 later to get an updated certificate; in the case a webserver's certificate you can get users warned by browser security features for 23/24 hours.
We will plan to examine better the code and patch it with such as a provision feature to issue a new certificate if it will be replaced soon
Easy as we speak
just adding the following line in acme.inc it is possible to renew certificates on the edge of 24 hours
$nextrenewalex = $nextrenewal->sub(new \DateInterval('PT24H'));
in the function issue_certificate right after:
$nextrenewal = $lastrenewal->add(new \DateInterval('P'.$renewafterdays.'D'));
With this patch cron job would be more efficent while renewing certificates giving no downtime of services where certificates are applied to