このセクションでは、Let’s Encrypt の SSL証明書の手動取得について紹介していきます。

ここでは、Let’s Encrypt で SSL証明書を取得するのに必要なクライアントソフト certbot が既にインストールされている前提で話を進めます。

certbot で既にSSL証明書を取得している環境で、別ドメインのSSL証明書を別で取得したい場合もあると思います。例えば、以下では既にcertbotを使ってexample.f5.si ドメイン(架空のドメインです)のSSL証明書を取得された環境になっています。

[user@pub-web ~]$ sudo ls -la /etc/letsencrypt/live/
drwx------. 4 root root   60 Aug 30 08:53 .
drwxr-xr-x. 7 root root 4096 Aug 30 21:14 ..
-rw-r--r--. 1 root root  740 Aug 14 10:25 README
drwxr-xr-x. 2 root root   93 Aug 20 02:42 example.f5.si
[user@pub-web ~]$

[user@pub-web ~]$ sudo ls -la /etc/letsencrypt/live/example.f5.si
drwxr-xr-x. 2 root root  93 Aug 20 02:42 .
drwx------. 4 root root  60 Aug 30 08:53 ..
-rw-r--r--. 1 root root 692 Aug 20 02:42 README
lrwxrwxrwx. 1 root root  39 Aug 20 02:42 cert.pem -> ../../archive/example.f5.si/cert1.pem
lrwxrwxrwx. 1 root root  40 Aug 20 02:42 chain.pem -> ../../archive/example.f5.si/chain1.pem
lrwxrwxrwx. 1 root root  44 Aug 20 02:42 fullchain.pem -> ../../archive/example.f5.si/fullchain1.pem
lrwxrwxrwx. 1 root root  42 Aug 20 02:42 privkey.pem -> ../../archive/example.f5.si/privkey1.pem
[user@pub-web ~]$

既に取得済みのexample.f5.siとは別ドメインexample.com(架空のドメインです)でSSL証明書を取得していきます。

[user@pub-web ~]$ sudo certbot certonly --webroot -w /var/www/html -d example.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for clcce.com and www.clcce.com

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/example.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/example.com/privkey.pem
This certificate expires on 2023-11-28.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[user@pub-web ~]$

example.com ドメインのSSL証明書が発行されていることを確認します。

[user@pub-web ~]$ sudo ls -la /etc/letsencrypt/live/
drwx------. 4 root root   60 Aug 30 08:53 .
drwxr-xr-x. 7 root root 4096 Aug 30 21:14 ..
-rw-r--r--. 1 root root  740 Aug 14 10:25 README
drwxr-xr-x. 2 root root   93 Aug 30 08:53 example.com
drwxr-xr-x. 2 root root   93 Aug 20 02:42 example.f5.si
[user@pub-web ~]$

[user@pub-web ~]$ sudo ls -la /etc/letsencrypt/live/example.com
drwxr-xr-x. 2 root root  93 Aug 30 08:53 .
drwx------. 4 root root  60 Aug 30 08:53 ..
-rw-r--r--. 1 root root 692 Aug 30 08:53 README
lrwxrwxrwx. 1 root root  33 Aug 30 08:53 cert.pem -> ../../archive/example.com/cert1.pem
lrwxrwxrwx. 1 root root  34 Aug 30 08:53 chain.pem -> ../../archive/example.com/chain1.pem
lrwxrwxrwx. 1 root root  38 Aug 30 08:53 fullchain.pem -> ../../archive/example.com/fullchain1.pem
lrwxrwxrwx. 1 root root  36 Aug 30 08:53 privkey.pem -> ../../archive/example.com/privkey1.pem
[user@pub-web ~]$