Rails engine for generating Let's Encrypt certificates
Add this line to your application's Gemfile:
gem 'lets_encrypt_plugin', git: "https://github.com/Ragnarson/lets_encrypt_plugin.git"
And then execute:
$ bundle
Create an initializer in config/initializers
with
LetsEncryptPlugin.configure do |config|
config.domains = %w(example.com www.example.com)
config.email_contact = "[email protected]"
config.private_key = "KEY CONTENT" # File.read("server.key")
# config.endpoint = "https://acme-v01.api.letsencrypt.org"
end
All domains have to point to your application otherwise validation will fail and certificate won't be generated.
Email and private key are used for Let's Encrypt registration. To generate private key you may use
openssl genrsa -out server.key 4096
Endpoint will be set based on Rails.env
to either
https://acme-v01.api.letsencrypt.org
for production or
https://acme-staging.api.letsencrypt.org
for any other environment.
Challenges will be stored in database for validation purposes.
Copy migrations to your application and run them:
rake lets_encrypt_plugin:install:migrations
rake db:migrate
Mount LetsEncryptPlugin at the top of routes.rb
:
mount LetsEncryptPlugin::Engine, at: '/'
- Generator for initializer
- Different output
- Release on rubygems.org
Pull requests are welcome
The gem is available as open source under the terms of the MIT License.