interbrite / letsencrypt-vesta

Automate Let's Encrypt Certificate Installation for VestaCP
Other
217 stars 64 forks source link

[Feature Suggestion] Cronjobs #13

Closed infinitnet closed 8 years ago

infinitnet commented 8 years ago

First of all thanks for your work, this has been very handy!

However one thing I'm missing is the script automatically adding cronjobs to renew certificates every 30 days. This could be done by a cronjob reading a file called say letsencrypt-domains.conf once every 30 (or 60, but with 30 we're on the safe side and can use /etc/cron.monthly/ for easy flat file cron management) days that contains a list of all domains that use Let's Encrypt. The letsencrypt-vesta script would add the domains to that file like a flat file database and if someone wants to stop using Let's Encrypt for a domain, he'd have to remove it from letsencrypt-domains.conf.

The cronjob that reads the file would then compare the list of domains against the domains active in Vesta. If a domain is in letsencrypt-domains.conf but not in Vesta, it removed the domain from the file as well.

At last the cronjob would renew the certificates for all domains left in letsencrypt-domains.conf.

Maybe there is an easier solution that I'm missing, but adding this shouldn't be too hard and would be nicer than having to manually manage cronjobs.

Spheerys commented 8 years ago

Nice idea :)

Bechrissed commented 8 years ago

+1

infinitnet commented 8 years ago

There is an open pull request related to this: https://github.com/interbrite/letsencrypt-vesta/pull/7

Although this just adds an additional comment (it's not an actual solution) and I'd suggest to rather use /etc/cron.monthly/ to manage cronjobs.

philip-p-jones commented 8 years ago

Pull request #7 is admittedly mostly comment, but its one uncommented line (easy to miss) sources /etc/profile.d/vesta.sh (as sourced by a few vestacp scripts in /usr/local/vesta/bin/), enabling letsencrypt-vesta to be successfully run from a cronjob.

joubertredrat commented 8 years ago

+1, I put manually, but with vesta cli is possible to add to admin cron jobs

triasrahman commented 8 years ago

+1

jpitoniak commented 8 years ago

Sorry that I've been absent from this project for a while...busy with work and family things and this is just a hobby. The good news is that I have an auto-renewal option planned for inclusion very soon (I'll hopefully get it out this weekend). Thanks for all the support and feedback. It's amazing how popular this little tool I initially wrote because I was too lazy to manually configure my own certs has become!

xRJx commented 8 years ago

This tool is very useful! Any word on your progress with implementing auto renew? I prefer to stay on the official build so I'm reluctant to do my own branch with the pull request that's waiting.

jpitoniak commented 8 years ago

OK, this is finally live...there's a new -a option to the script that lets you schedule automatic updates in a set number of days. This method uses at and doesn't require any special configuration (assuming at is available on your system...you may need to set it up).

I've also incorported pull request 7, which sources /etc/profile.d/vesta.sh so that the Vesta commands become available to the script when it's called without a shell, such as through cron. So if you prefer to schedule updates via a cron job, that should work, too.