CertWatch is a Go-based tool that checks SSL certificates for all domains every 12 hours. If a certificate is set to expire within 24 hours, it automatically renews it using Certbot with the Nginx plugin.
- Checks SSL certificate expiry dates for the domains every 12 hours.
- Automatically renews certificates if they are expiring within 24 hours.
- Uses
certbot certificatesto fetch certificate details. - Renews certificates using
certbot renew --nginx -d <domain>. - Implements scheduling using Go's
time.Tickerinstead of an external cron package.
Download the latest binary from the releases page.
Run the application:
./certwatch- The tool runs every 12 hours using
time.Ticker. - It executes the
certbot certificatescommand to retrieve certificate details. - Parses the output using regex to extract domain names and expiry dates.
- If a certificate expires within 24 hours, it triggers the renewal process:
sudo certbot renew --nginx -d <domain>
- Logs are maintained for tracking renewal attempts.
- If a certificate expired more than 7 days ago, it is skipped.
Contributions are welcome! Feel free to submit issues and pull requests.