Certgen
Certgen is a Ruby CLI tool to generate free SSL certificates from Let's Encrypt using DNS-01 verification. Perfect for developers and site owners who use cPanel or manually managed servers and need to upload certificates themselves.
β¨ Features
- β Generate valid SSL certificates via Let's Encrypt
- π Supports both base domains and
www.
subdomains automatically - π Uses DNS-01 challenge (great for wildcard and shared hosting)
- π Outputs
.crt
,.pem
, and zipped bundles for easy upload - π Stores reusable Let's Encrypt account key
- π₯οΈ CLI interface for quick and easy usage
π¦ Installation
gem install certgen
π Usage
π§ Testing with Letβs Encrypt Production
Run the CLI tool from your terminal:
certgen --domain example.com --email user@example.com
This above command will overall:
- Generate or reuse your Let's Encrypt account key
- Create DNS-01 challenge instructions
- Wait for your confirmation after DNS is set
- Generate the certificate files
- Zip them for upload to cPanel or any hosting service
π§ Testing with Letβs Encrypt Staging
To avoid hitting rate limits during development or testing, use the Letβs Encrypt staging environment:
certgen test --domain example.com --email you@example.com
- This runs the same generation process but against the staging ACME server.
- Useful for verifying DNS setup and automation without generating real certificates.
π Example Output Files
After running, your certs will be saved in:
~/.ssl_output/example.com/
βββ certificate.crt
βββ private_key.pem
βββ ca_bundle.pem
βββ cert_bundle.zip
βοΈ DNS Setup
You'll be prompted to create a DNS TXT record:
Record Name: _acme-challenge.example.com
Record Type: TXT
Record Value: abc123...
Use https://dnschecker.org to confirm propagation before continuing.
π§ Development
Clone and run locally:
git clone https://github.com/cdrrazan/certgen
cd certgen
bundle install
Run the CLI locally:
bin/certgen --domain example.com --email user@example.com
β Requirements
- Ruby >= 3
- DNS management access to create TXT records
- cPanel or similar manual SSL upload support
π License
This project is licensed under the MIT License. See the LICENSE file for details.
π Author
Rajan Bhattarai
GitHub β’ Email
π Contributions and issues are welcome β feel free to open a PR or issue on GitHub!