A comprehensive tool to simplify SSL certificate management for Proxmox environments. This script creates a dedicated LXC container that handles SSL certificate generation, distribution, and renewal for all your Proxmox containers.
- Automated Container Setup: Creates a dedicated LXC container for SSL certificate management
- Multiple Certificate Types: Support for both Let's Encrypt and self-signed certificates
- Flexible Validation: Multiple validation methods (HTTP, DNS-Cloudflare, DNS-Route53, Manual DNS)
- Comprehensive Coverage: Generates certificates for all containers (existing and future)
- Automatic Renewal: Built-in renewal process for certificates
- Interactive Wizard: User-friendly prompts to gather necessary information
- Secure Deployment: Distributes certificates securely to individual containers
- Host Certificate Support: Can update the Proxmox host's own certificates
- Detailed Logging: Comprehensive logging for troubleshooting
- Cloudflare Integration: Support for Cloudflare DNS API and optional tunnel setup
- Subject Alternative Names: Support for SANs including IP addresses
- Configuration Templates: Support for defaults and templates via configuration files
-
Required:
- Proxmox VE 6.x or newer
- Root access to the Proxmox host
- Internet connectivity (for Let's Encrypt certificates)
- Domain name(s) that you control (for Let's Encrypt certificates)
- OpenSSL 1.1.0+ (for certificate generation)
- Bash 4.0+ (for script execution)
-
Optional:
- DNS access (for DNS validation methods)
- Nginx (for reverse proxy setup)
- Cloudflared (for Cloudflare Tunnel)
- SSH client (for remote Proxmox integration)
-
Clone this repository to your Proxmox server:
git clone https://github.com/pdubbbbbs/ssl-cert-generator.git cd ssl-cert-generator -
Make the script executable:
chmod +x proxmox_ssl_setup.sh
-
Run the script as root or with sudo:
sudo ./proxmox_ssl_setup.sh
For the main SSL container setup and wizard:
# Set up SSL container and wizard
sudo ./proxmox_ssl_setup.sh
# Then follow the guided setupFor standalone certificate generation:
# Generate a certificate
./generate-ssl-cert.sh -d example.com -o ./certs
# For Proxmox integration
./install-proxmox-cert.sh -d pve.example.com -i 192.168.1.10The installation script will guide you through the setup process with clear instructions. Once the setup is complete, follow these steps:
-
Connect to the SSL Wizard container:
pct enter <CONTAINER_ID> # The ID will be shown during setup
-
Run the SSL Wizard:
/root/ssl_wizard.sh
Follow the prompts to enter your domain information and select certificate settings.
-
Generate certificates:
/root/generate_certs.sh
This will scan for containers and generate certificates as needed.
-
Set up automatic renewal (from host, after exiting the container):
/root/setup_cert_renewal.sh
To apply certificates to your containers:
- For each container, a deployment script is created in the SSL container at
/root/push_cert_XXX.sh - These scripts should be copied to and run from the Proxmox host
To apply a certificate to the Proxmox host itself:
/root/apply_host_cert.sh your-domain.comThe system operates through these key components:
- SSL Wizard Container: A dedicated LXC container that handles all certificate operations
- Configuration Wizard: Gathers domain information and certificate preferences
- Certificate Generation: Creates SSL certificates using Let's Encrypt or self-signed methods
- Container Scanner: Identifies all containers in your Proxmox environment
- Deployment Scripts: Creates custom scripts to deploy certificates to each container
- Renewal System: Automatic renewal process to keep certificates valid
# Run the SSL wizard
/root/ssl_wizard.sh
# Enter domain: example.com
# Enter email: admin@example.com
# Choose certificate: 1 (Let's Encrypt)
# Choose validation: 1 (HTTP)
# Generate certificates
/root/generate_certs.sh
# Run the SSL wizard
/root/ssl_wizard.sh
# Enter domain: example.com
# Enter email: admin@example.com
# Choose certificate: 1 (Let's Encrypt)
# Choose validation: 2 (Cloudflare DNS)
# Enter Cloudflare API token: your-cloudflare-api-token
# Generate certificates
/root/generate_certs.sh
# After running the SSL wizard and configuring your domain
/root/generate_certs.sh
# For each container, you'll be prompted:
# "Generate certificate for container1.example.com? (y/n): y"
# "Generate certificate for container2.example.com? (y/n): y"
# The script will generate certificates and deployment scripts
# You'll need to run these deployment scripts from the host:
/root/push_cert_101.sh # For container ID 101
/root/push_cert_102.sh # For container ID 102-
Issue: Container fails to create
- Solution: Verify storage availability in Proxmox with
pvesm status - Solution: Check network connectivity with
ping -c 4 8.8.8.8
- Solution: Verify storage availability in Proxmox with
-
Issue: Container starts but can't access internet
- Solution: Verify container networking with
pct exec <ID> -- ping -c 4 8.8.8.8 - Solution: Check Proxmox firewall settings with
pvefw status
- Solution: Verify container networking with
-
Issue: HTTP validation fails
- Solution: Ensure port 80 is accessible from the internet
- Solution: Check DNS settings for your domain
- Solution: Verify your router is forwarding port 80 to your Proxmox host
-
Issue: DNS validation fails
- Solution: Check API credentials for your DNS provider
- Solution: Verify domain ownership and API permissions
- Solution: Wait longer for DNS propagation (up to 24 hours)
-
Issue: Certificate renewal failures
- Solution: Check the renewal log at
/root/renewal.login the SSL container - Solution: Verify validation method still works (HTTP ports open, API keys valid)
- Solution: Check rate limits at Let's Encrypt (max 5 certificates per domain per week)
- Solution: Check the renewal log at
-
Issue: Cannot push certificates to containers
- Solution: Verify the target container is running with
pct list - Solution: Check network connectivity between host and container
- Solution: Verify permissions on the certificate files
- Solution: Verify the target container is running with
-
Issue: Proxmox web interface still shows old certificate
- Solution: Restart pveproxy service with
systemctl restart pveproxy - Solution: Clear your browser cache or try in private/incognito mode
- Solution: Restart pveproxy service with
For detailed troubleshooting, check these log files:
- Setup logs:
/home/user/ssl-cert-generator/ssl_setup_*.log - Certificate renewal logs: Inside SSL container at
/root/renewal.log - Container logs: Available in Proxmox UI or via
pct console <ID> - Let's Encrypt logs: Inside SSL container at
/var/log/letsencrypt/
Run these commands for diagnostic information:
# Container status
pct list
# Network connectivity
pct exec <ID> -- ping -c 4 8.8.8.8
# Certbot certificate status
pct exec <ID> -- certbot certificates
# Check certificate validity
pct exec <ID> -- openssl x509 -in /root/ssl-certs/example.com/fullchain.pem -text -noout- Private Key Protection: All private keys are protected with 0600 permissions
- Container Isolation: The SSL container runs as an unprivileged LXC container
- API Credentials: Store API credentials securely with proper permissions
- Certificate Backups: Automated backups of existing certificates are created before replacement
- Password Security: Container passwords are randomly generated and logged only during setup
- Update Regularly: Keep your Proxmox host and SSL container updated with security patches
- Network Isolation: Consider placing the SSL container in a separate VLAN
- Firewall Rules: Implement proper firewall rules on your Proxmox host
- Audit Logs: Review log files periodically for suspicious activity
- Access Control: Limit SSH access to the Proxmox host to authorized users only
Additional documentation is available in the docs directory:
Note: Some documentation files may be created during initial setup or need to be created manually.
If you encounter issues with the script:
- Check the Troubleshooting section above
- Review the log files mentioned in the Logs section
- Check for open issues on GitHub
- Open a new issue if your problem isn't already addressed
To update the script to the latest version:
cd /path/to/ssl-cert-generator
git pull
chmod +x proxmox_ssl_setup.sh- Minor Updates: Released as needed for bug fixes and small improvements
- Major Releases: Announced on the GitHub repository with release notes
- Security Patches: Applied promptly when vulnerabilities are discovered
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions to improve the SSL Certificate Generator are welcome! Here's how to contribute:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure your code follows the project's coding standards and includes appropriate documentation and tests.
- Let's Encrypt for providing free SSL certificates
- Proxmox for their excellent virtualization platform
- Certbot for their Let's Encrypt client
- OpenSSL for providing cryptographic libraries
- Cloudflare for their DNS and security services
- All contributors who have helped improve this project
Last updated: April 2025