Simple Docker-based SSL certificate renewal system using Let's Encrypt. Originally created for Synology NAS systems that don't support automatic SSL renewal for custom domains, but the generated certificate files work with any web server (Nginx, Apache, IIS, etc.).
- Renews SSL certificates for any domain using Let's Encrypt
- Docker-based: Isolated, reproducible certificate management
- Domain-agnostic: Works with any domain name (interactive input)
- Local export: Saves certificates to local
./certificates/directory - DNS-01 challenge: Works behind firewalls and NAT (manual DNS verification)
- Multiple formats: Standard
privkey.pemandfullchain.pemfiles
ssl-manager/
βββ docker-compose.yaml # Docker configuration
βββ renew-ssl.sh # Main renewal script
βββ .gitignore # Ignore sensitive files
βββ certificates/ # Exported certificates (created automatically)
βββ letsencrypt-config/ # Certificate storage (created automatically)
βββ letsencrypt-lib/ # Certbot library data (created automatically)
βββ logs/ # Application logs (created automatically)
- Docker and Docker Compose installed
- DNS management access for your domain (to add TXT records)
- Domain ownership verification capability
# Clone the repository
git clone https://github.com/isantiago95/ssl-renewal-manager ssl-manager
cd ssl-manager
# Make the script executable
chmod +x renew-ssl.shRun the script with the --first-cert flag to create your initial certificate:
./renew-ssl.sh --first-certThe script will interactively ask you for:
- Domain name (e.g.,
your-domain.com) - supports wildcards - Email address (for Let's Encrypt account registration)
Important: During this process, you'll need to add a DNS TXT record to your domain DNS registry to validate ownership. Follow the prompts carefully and wait for DNS propagation before continuing.
# Check that certificates were created and exported,
# Replace "your_domain_com" with your domain name switching the `dot` with `underscore`:
# your-domain.com -> your_domain_com
ls -la ./certificates/your_domain_com/You should see: privkey.pem and fullchain.pem ready for use!
# Interactive mode (will prompt for domain)
./renew-ssl.sh
# Or specify domain directly
./renew-ssl.sh your-domain.com
# For first-time certificate creation
./renew-ssl.sh --first-certSet up a monthly cron job for automatic renewal:
# Edit crontab
crontab -e
# Add this line for monthly renewal on the 1st at 2 AM
# Replace /volume1/docker/ssl-manager and your-domain.com with your actual path and domain
0 2 1 * * cd /volume1/docker/ssl-manager/renew-ssl.sh your-domain.comStep 1: Create the Task
Navigate to: DSM β Control Panel β Task Scheduler β Create β Scheduled Task β User-defined script
Step 2: General Settings
Configure the General tab:
- Task name:
SSL Certificate Auto Renewal - User:
rootoryour_user_name(make sure the user has Docker permissions) - Enabled: β Check this box
Step 3: Schedule Settings
Configure the Schedule tab:
- Date: Run on the following date
- Repeat: Monthly
- Date: Select
1(1st of every month) - Time:
02:00(2 AM - low traffic time) - Frequency: Every month
Step 4: Task Settings
Configure the Task Settings tab:
- Send run details by email: β (Optional - for email notifications)
- Email: Your email address
- Send run details only when the script terminates abnormally: β (Recommended)
Add the following user-defined script:
#!/bin/bash
# Replace /volume1/docker/ssl-manager with your actual path (where you cloned this repo)
# Replace your-domain.com with your actual domain
cd /volume1/docker/ssl-manager/renew-ssl.sh your-domain.comAfter successful renewal, certificates are exported to ./certificates/your_domain_com/ in multiple formats:
your-domain.key- Private Key (.key format)your-domain.crt- Certificate (.crt format)intermediate.crt- Intermediate Certificate Chain (.crt format)your-domain.ca-bundle- CA Bundle (same as intermediate, different naming)
privkey.pem- Private Key (PEM format)cert.pem- Certificate only (PEM format)chain.pem- Certificate chain/intermediate (PEM format)fullchain.pem- Full certificate chain (PEM format)
your-domain.der- Certificate (DER binary format)your-domain.key.der- Private Key (DER binary format)your-domain.p7b- Certificate chain (PKCS#7 format)your-domain.pfx- Certificate + Key bundle (PKCS#12 format, no password)
-
Download certificate files to your computer
-
Go to DSM > Control Panel > Security > Certificate
-
Click Add > Import certificate
-
Then we have 2 options:
- Option 1 (recommended): Individual files
- Private Key:
your-domain.key - Certificate:
your-domain.crt - Intermediate Certificate:
your-domain.ca-bundle(Optional, see note below)
- Private Key:
Note: Intermediate certificate for Synology DSM is optional, but some services may require it, such as the VPN Server. (See this post)
- Option 2: Standard PEM format
-
- Private Key:
privkey.pemoryour-domain.key
- Private Key:
-
- Certificate:
fullchain.pemoryour-domain.crt
- Certificate:
-
- Intermediate Certificate:
your-domain.ca-bundle(optional)
- Intermediate Certificate:
-
- Option 1 (recommended): Individual files
The generated certificate files are compatible with most web servers and applications:
- Nginx, Apache, IIS: Use the appropriate combination of
.key,.crt, and intermediate files - Load Balancers: Typically use
.crt+.key+intermediate.crt - Java Applications: Use
.pfxfile or convert PEM files as needed - Docker/Kubernetes: Use standard PEM files (
privkey.pem,fullchain.pem)
Note: Server-specific configuration examples are not provided as they haven't been tested. Consult your server's SSL certificate installation documentation.
The system supports multiple domains automatically. Each domain gets its own folder:
certificates/
βββ your_domain_com/
β βββ privkey.pem
β βββ fullchain.pem
βββ another_domain_org/
βββ privkey.pem
βββ fullchain.pem
By default, certificates are exported to ./certificates/. This keeps everything contained within the project directory and works on any system.
Check renewal status:
# View export logs
cat ./logs/export.log
# Check exported certificates
ls -la ./certificates/your_domain_com/*.pem
# Verify certificate expiration (remember to use the domain with underscore name)
openssl x509 -in ./certificates/your_domain_com/fullchain.pem -noout -dates-
Project Origin: This project was created specifically for Synology NAS systems that don't support automatic SSL renewal for custom domains. However, the generated certificate files are compatible with any web server (Nginx, Apache, IIS, etc.).
-
User Responsibility: You are responsible for:
- Properly copying certificate files to the correct paths based on your server configuration
- Renewing certificates before they expire (Let's Encrypt certificates expire every 90 days)
- Testing the renewal process before setting up automation
-
SSH Setup for NAS/Cloud Servers: To smoothly manage SSL renewals on any cloud server or NAS system:
- Connect via SSH to your server/NAS
- Clone this project to a familiar path (e.g.,
/volume1/docker/ssl-managerfor Synology) - Ensure Docker and Docker Compose are installed and accessible
-
Manual DNS Challenge: Renewals require manual DNS TXT record updates (cannot be fully automated)
-
Backup: Always backup existing certificates before renewal
# Check if certificates exist in Let's Encrypt directory
ls -la ./letsencrypt-config/live/your-domain.com/
# Check if certificates were exported
ls -la ./certificates/your_domain_com/
# create new certificates using the --first-cert flag
./renew-ssl.sh --first-cert# Fix permissions
chmod +x renew-ssl.sh# Clone and setup
git clone https://github.com/isantiago95/ssl-renewal-manager
cd ssl-manager
# Make the script executable
chmod +x renew-ssl.sh
# Create your first certificate (interactive)
./renew-ssl.sh --first-cert
# Enter your domain: your-domain.com
# Enter your email: your-email@your-domain.com
# Follow DNS TXT record instructions
# For renewals, just run:
./renew-ssl.sh your-domain.com
# Your certificates are now in ALL formats:
# Required formats:
# ./certificates/your_domain_com/your-domain.com.key
# ./certificates/your_domain_com/your-domain.com.crt
# ./certificates/your_domain_com/intermediate.crt
# ./certificates/your_domain_com/your-domain.com.ca-bundle
#
# Plus: .pem, .der, .p7b, .pfx formats for maximum compatibilityThis project is licensed under the MIT License - see the LICENSE file for details.
Free to use and modify - You are welcome to use, modify, and distribute this software according to the terms of the MIT License.
This Docker-based SSL certificate manager works with any domain and any server system that supports standard SSL certificate files.
