LoginSignup
3
4

More than 5 years have passed since last update.

Let's Encrypt でDNS認証で証明書を発行してdokkuに設定する

Posted at

最近使っているdokku環境にてSSLが必要になったので、Let's Encryptで証明書を発行して
設定してみました

dokkuについては以下の記事にわかりやすく紹介されています
個人開発ならHerokuよりDokkuを使おう

  1. certbot-auto をインストール

    curl https://dl.eff.org/certbot-auto -o /usr/bin/certbot-auto
    chmod +x /usr/bin/certbot-auto
    
  2. certbot-autoでDNS証明書を発行

    certbot-auto certonly --manual --email <email@address> --agree-tos --preferred-challenges dns --domain <FDQN>
    

    途中でDNSのTXTレコードに指定の文字列を登録しろって言われるので指示に従ってDNSにTXTレコードを登録する。

    問題なく認証できると以下のファイルが生成されます

    $ ls -1 /etc/letsencrypt/hogehoge
    cert.pem
    chain.pem
    fullchain.pem
    privkey.pem
    
  3. 鍵と証明書を tarに固める

    $ cp /etc/letsencrypt/hogehoge/fullchain.pem server.crt
    $ cp /etc/letsencrypt/hogehoge/privkey.pem server.key
    $ tar cvf cert-key.tar server.crt server.key
    
  4. dokkuに鍵ファイルをインポート

    $ dokku certs:add <appname> < cert-key.tar
    

参考

http://dokku.viewdocs.io/dokku/configuration/ssl/
http://sig9.hatenablog.com/entry/2017/10/27/000000

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4