風は北向き ブログ

時の狭間で 今 お前を待つ

let's encrypt使ってみました

このサーバもHTTPS化対応したいと思い、let's encryptを設定しました。
ただ、WEBサーバにインストールするのもちょっとあれですので、別サーバで手動で、証明書を発行する方法で設定しました。
備忘として記します。

まずは、インストールを行います。

sudo yum install certbot

 

証明書生成を実行

certbot certonly --manual --config-dir=./config --work-dir=./work --logs-dir=./log -d www.example.com
  • certonly : 証明書の取得のみ
  • --manual : 証明書の設定は手動で行う(FRONTサーバは別サーバなので)
  • --config-dir, --work-dir, --logs-dir : certbotをrootで実行しないので、証明書をroot以外で書き込み可能なディレクトリへ出力するため
  • -d : https化する対象のWEBサーバ ※例:www.example.com

途中に
・メールアドレス

Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): example@example.com

・いろいろと承認

Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v01.api.letsencrypt.org/directory
(A)gree/(C)ancel: A

・EFFにメールアドレスを登録してよいか

Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
(Y)es/(N)o: Y

・準備OK?

OTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.
 
Are you OK with your IP being logged?
(Y)es/(N)o: Y

・証明書の発行するためのキー

Create a file containing just this data:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
And make it available on your web server at this URL:
http://example.com/.well-known/acme-challenge/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
Press Enter to Continue

・ここで、実際にWEBサーバに上記のファイル名・内容でファイルを作成し、エンターキー押下

Waiting for verification...
Cleaning up challenges
Non-standard path(s), might not work with crontab installed by your operating system package manager
 
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   .../config/live/example.com/fullchain.pem
   Your key file has been saved at:
   .../config/live/example.com/privkey.pem
   Your cert will expire on 9999-12-31. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at .../config. You
   should make a secure backup of this folder now. This configuration
   directory will also contain certificates and private keys obtained
   by Certbot so making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:
 
   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

certbot起動時の引数(config-dir)で指定した、ディレクトリの下の上記のディレクトリに各種証明書ファイルができました!