Skip to content

cdrrazan/certgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Certgen

Ruby License: MIT

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.

πŸ“¦ Setup

  1. Clone the repository:

    git clone https://github.com/cdrrazan/certgen
    cd certgen
  2. Install dependencies:

    bundle install

🌍 Global Usage (Recommended)

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/certgen

Now you can simply run:

certgen generate --domain example.com --email user@example.com

πŸš€ Usage

πŸ”§ Generating Certificates

Run the CLI tool from the project directory:

bin/certgen generate --domain example.com --email user@example.com

This above command will overall:

  1. Generate or reuse your Let's Encrypt account key
  2. Create DNS-01 challenge instructions
  3. Wait for your confirmation after DNS is set
  4. Generate the certificate files
  5. 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

πŸ§ͺ Testing

The project uses RSpec for testing. To run the full test suite:

bundle exec rspec

The tests include mocks for the ACME API and file system, ensuring safe and fast execution.

✍️ 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.

βœ… Requirements

  • Ruby >= 3.1
  • 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!

About

πŸ’Ž Ruby CLI tool to generate free SSL certificates from Let's Encrypt! [90 days]

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages