π Language: πΊπΈ English | π·πΊ Π ΡΡΡΠΊΠΈΠΉ
I created this tool after getting tired of manually updating SSL certificates for my domains hosted on Selectel Object Storage. The built-in certificate manager kept having issues, so I decided to automate the whole process using Let's Encrypt and acme.sh.
The script automatically:
β
Generates or renews SSL certificates using Let's Encrypt via acme.sh
β
Uploads certificates to Selectel Object Storage using their API
β
Handles all certificate validation and key format conversions
β
Sends notifications via Telegram when something goes wrong (or right)
β
Installs certificates locally for backup purposes
β
Gracefully handles rate limiting from Let's Encrypt
Selectel's certificate management can be finicky, especially when you have wildcard domains. I needed something reliable that would run monthly and just work without me having to think about it. The script handles rate limiting from Let's Encrypt gracefully and will use existing valid certificates when needed.
git clone https://github.com/dignezzz/s3-ssl-selectel.git
cd s3-ssl-selectelpip install -r requirements.txtcp .env.example .env
nano .env # fill in your detailspython ssl_renewal.pyAll configuration is done through the .env file. The paths are automatically generated based on your domain, so you only need to specify the domain once and everything else gets calculated.
- Your Selectel cloud username and password
- Account ID and project ID from your Selectel dashboard
- Container name where your domain is hosted
- Main domain (
DOMAIN) is required (e.g., example.com) - Wildcard domain (
WILDCARD_DOMAIN) is optional (e.g., *.example.com)
- Bot token and chat ID for notifications
- I highly recommend setting this up so you know when renewals happen
The script is pretty smart about handling different scenarios:
- Gets new certificates from Let's Encrypt and uploads to Selectel
- Validates certificate/key pairs automatically
- Sends success notification via Telegram
- Detects rate limiting from API response
- Uses existing valid certificates instead of failing
- Continues operation without interruption
- Automatically searches for valid certificate/key pairs
- Checks backup directories if main files are corrupted
- Restores from backups when needed
I run this monthly via cron:
# Every 1st day of month at 3:00 AM
0 3 1 * * /path/to/your/script/ssl_renewal.pyCreate service files for better monitoring:
# /etc/systemd/system/ssl-renewal.service
[Unit]
Description=SSL Certificate Renewal
After=network.target
[Service]
Type=oneshot
User=root
WorkingDirectory=/path/to/ssl-automation
ExecStart=/usr/bin/python3 ssl_renewal.py# /etc/systemd/system/ssl-renewal.timer
[Unit]
Description=SSL Certificate Renewal Timer
Requires=ssl-renewal.service
[Timer]
OnCalendar=monthly
Persistent=true
[Install]
WantedBy=timers.targetThe script will automatically try to find matching pairs in your acme.sh directory. This usually happens when acme.sh creates new certificates but doesn't update all files consistently.
The script handles this gracefully and will use existing valid certificates. Let's Encrypt allows 5 certificates per week for the same domain set.
Make sure your credentials are correct and you have the right project ID. The script uses Selectel's v2 SSL API which requires specific permissions.
- Python 3.6+
- requests library β for HTTP requests to APIs
- python-dotenv library β for loading environment variables
- acme.sh installed and configured β for Let's Encrypt certificates
- OpenSSL tools β for certificate validation and conversion
β οΈ The.envfile contains sensitive credentials β keep it secure- π Private keys are automatically converted to PKCS#8 format for Selectel
- πΎ Backup copies of certificates are created before any changes
- π‘οΈ All API calls use proper authentication headers
Unlike other SSL automation tools, this one is specifically designed for Selectel Object Storage. It handles their API quirks and certificate format requirements automatically. I've been using it for several months without issues.
The script also gracefully handles Let's Encrypt rate limiting by using existing valid certificates when new ones can't be issued. This means your sites stay online even if you hit API limits.
- β Stable release β used in production for several months
- π Active maintenance β regular updates and bug fixes
- π Complete documentation β detailed setup and usage guides
- π Multilingual β English and Russian documentation
- π Star the repository if you find it useful
- π Report bugs via Issues
- π‘ Suggest improvements via Pull Requests
- π Improve documentation
MIT β Use it however you want. If you find bugs or have improvements, feel free to contribute.
β Star β’ π Issues β’ π Wiki