Skip to content

Instantly share code, notes, and snippets.

@Sharifur
Last active March 17, 2025 09:43
Show Gist options
  • Save Sharifur/7870360a6a3586b47c73b3124b5d9863 to your computer and use it in GitHub Desktop.
Save Sharifur/7870360a6a3586b47c73b3124b5d9863 to your computer and use it in GitHub Desktop.
auto renew cloud panel ssl certificate
Using Let's Encrypt Auto-renewal
Log in to your Cloud Panel account
Navigate to the SSL/TLS section (often under "Security" or "Domains")
Look for Let's Encrypt integration options
Enable auto-renewal for your certificates
Configure the renewal frequency (typically 30-60 days before expiration)
# Install certbot if not already installed
apt-get update
apt-get install certbot
To make this fully automated, you can set up a cron job that runs this command periodically. Here's how to do it:
Open your crontab file for editing:
crontab -e
Select an editor. To change later, run 'select-editor'.
1. /bin/nano <---- easiest
2. /usr/bin/vim.basic
3. /usr/bin/vim.tiny
4. /bin/ed
select 1 if you see above message
Add a line to run the renewal command once a day (or weekly):
# Run SSL renewal daily at 3 AM
0 3 * * * su -s /bin/bash -c '/usr/bin/clpctl lets-encrypt:renew:certificates' clp
This will execute your renewal command every day at 3 AM. Let's Encrypt certificates are typically valid for 90 days, and the renewal process will only take action if a certificate is within the renewal window (usually 30 days before expiration).
You might also want to add logging to track the renewal attempts:
bashCopy0 3 * * * su -s /bin/bash -c '/usr/bin/clpctl lets-encrypt:renew:certificates' clp >> /var/log/le-renewal.log 2>&1
This approach ensures your certificates will renew automatically without any manual intervention.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment