PlugLetsEncrypt

TravisHex.pm

PlugLetsEncrypt responds to Let’s Encrypt domain verification requests.

Installation

Add plug_letsencrypt to the deps function in your project's mix.exs file:

defp deps do
  [
    ,
    {:plug_letsencrypt, "~> 0.2"}
  ]
end

Then run mix do deps.get, deps.compile inside your project's directory.

Usage

PlugLetsEncrypt can be used just as any other plugs. Add PlugLetsEncrypt with your other plugs and provide a response to serve.

defmodule Endpoint do
  plug PlugLetsEncrypt, response: System.get_env("LETSENCRYPT_RESPONSE")
end

The LETSENCRYPT_RESPONSE is the response Let’s Encrypt will be looking for, something like:

LETSENCRYPT_RESPONSE=esLXAidxzFUn2kkakqeqwe4Z6VqtechtQtF0.yJLghAfMirn4ejUskeB-GrqSb411923hjX-OWUvDtgc

The result:

$ curl -XGET "http://localhost:4000/.well-known/acme-challenge/esLXAidxzFUn2kkakqeqwe4Z6VqtechtQtF0"
esLXAidxzFUn2kkakqeqwe4Z6VqtechtQtF0.yJLghAfMirn4ejUskeB-GrqSb411923hjX-OWUvDtgc

$ curl -XGET "http://localhost:4000/.well-known/acme-challenge/anything"

License

PlugLetsEncrypt is © 2017 Rémi Prévost and may be freely distributed under the MIT license. See the LICENSE.md file for more information.