Hey folks! Super stoked right now
Finally cracked it — automated SSL for all my client subdomains on this cheap RackNerd VPS. No more letsencrypt manual runs, no more expired certs making me look like a chump.
Bash script attached, credentials sanitized (I hope? Changed the API key format at least). Basically loops through cPanel, checks cert expiry, fires acme.sh if under 14 days. Handles wildcards via dns-01 through their API.
Been running clean for 3 months. Clients stopped complaining. Feels good man.
[code]#!/bin/bash
# ssl_autobot.sh - runs via cron daily
# TODO: add notification on failure
API_KEY="dh_live_xxxxxxxxxxxxxxxx"
DOMAIN_LIST="/etc/ssl/domains.txt"
For domain in $(cat $DOMAIN_LIST); do
Expiry=$(echo | openssl s_client -servername $domain -connect $domain:443 2>/dev/null | openssl x509 -noout -dates | grep notAfter | cut -d= -f2)
# ... rest of logic
Done
Anyone want to improve the error handling? I know it's barebones. Gonna add slack webhook eventually.