KUSANAGIでのLet’s Encryptによる常時SSL化設定

南京錠 wordpress

このブログはKUSANAGIというプライム・ストラテジー株式会社が提供している超高速Wordpress仮想マシン上で構築しています。今回KUSANAGIで既に導入済みのWordpressサイトにLet’s Encryptによる常時SSL化設定を行いました。

KUSANAGI導入段階でSSL化

本来はKUSANAGI導入段階でSSL化出来るしそうすべきなのです。こちらの公式ドキュメント『6.Let’s Encryptの設定』に記載されている手順のとおりに。ただ、お恥ずかしいことにサイト構築前にDNSでAレコードを登録するのを忘れるという初歩的な失態を犯しまして、以下の通りSSL化に失敗しました・・・

※以下ログ出力は一部"***"でマスクしてあります。

Saving debug log to /***/***/***/***.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for infra-study.com
http-01 challenge for www.infra-study.com
Using the webroot path /***/***/***/*** for all unmatched domains.
Waiting for verification…
Cleaning up challenges
Failed authorization procedure. www.infra-study.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://www.infra-study.com/.well-known/acme-challenge/**************************************: "\n\n\n\nChe", infra-study.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://infra-study.com/.well-known/acme-challenge/
**************************************: "<html>\r\n<head><title>404 Not Found\r\n\r\n
404 Not Found
\r\n
"
IMPORTANT NOTES:
The following errors were reported by the server:
Domain: www.infra-study.com
Type: unauthorized
Detail: Invalid response from
http://www.infra-study.com/.well-known/acme-challenge/
************************************** "\n\n\n\nChe"</p> <p>Domain: infra-study.com<br /> Type: unauthorized<br /> Detail: Invalid response from<br /> http://infra-study.com/.well-known/acme-challenge/
************************************** :<br /> "<html>\r\n<head><title>404 Not Found\r\n\r\n
404 Not Found
\r\n
"
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address.
Cannot get Let\'s Encrypt SSL Certificate files.

サーバが404返してるのは、ドメインを取得したレジストラがデフォルトでドメインパーキングをしてくれているからだと思われます。パーキングサイトから404が返ってきたのでしょう。

KUSANAGI導入後にSSL化

というわけで本題のKUSANAGI導入後のSSL化です。やり方はとっても簡単です。

#kusanagi ssl –email <email-address>

コマンドを実行するだけです。

※以下ログ出力は一部"***"でマスクしてあります。 

[root@hogehoge kusanagi]# kusanagi ssl --email ****@****.com
Saving debug log to /***/***/***/***.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for infra-study.com
http-01 challenge for www.infra-study.com
Using the webroot path /***/***/***/*** for all unmatched domains.
Waiting for verification…
Cleaning up challenges
IMPORTANT NOTES:
Congratulations! Your certificate and chain have been saved at:
/***/***/***/***/***.pem
Your key file has been saved at:
/***/***/***/***/***.pem
Your cert will expire on 2019-04-02. To obtain a new or tweaked
version of this certificate in the future, simply run certbot-auto
again. To non-interactively renew all of your certificates, run
"certbot-auto renew"
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
証明書の自動更新は既に有効です。何もしません。
nginx/httpd の設定を変更し、再起動しました。
完了しました。
新しいメールが /***/***/***/*** にあります
[root@hogehoge kusanagi]#

どうやら証明書の自動更新だけはprovisioningの際に有効となっていたようです。

これで無事SSL化されました。良かった・・・

コメント