Certgen is a pure 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.
-
Clone the repository:
git clone https://github.com/cdrrazan/certgen cd certgen -
Install dependencies:
bundle install
To run certgen from anywhere without typing the full path, create a symlink in your system bin:
sudo ln -s "$(pwd)/bin/certgen" /usr/local/bin/certgenNow you can simply run:
certgen generate --domain example.com --email user@example.comRun the CLI tool from the project directory:
bin/certgen generate --domain example.com --email user@example.comThis 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
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.
After running, your certs will be saved in:
~/.ssl_output/example.com/
βββ certificate.crt
βββ private_key.pem
βββ ca_bundle.pem
βββ cert_bundle.zip
The project uses RSpec for testing. To run the full test suite:
bundle exec rspecThe tests include mocks for the ACME API and file system, ensuring safe and fast execution.
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.
- Ruby >= 3.1
- DNS management access to create TXT records
- cPanel or similar manual SSL upload support
This project is licensed under the MIT License. See the LICENSE file for details.
Rajan Bhattarai
GitHub β’ Email
π Contributions and issues are welcome β feel free to open a PR or issue on GitHub!