Let's Encryptから追加で証明書を取得する

メールサーバでTLSをサポートするにあたり、メールサーバ用に証明書を取得する

現在取得している証明書を確認する

現在、Webサーバ用に証明書を取得している

$ sudo certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
  Certificate Name: www.example.jp
    Serial Number: 
    Key Type: RSA
    Domains: www.example.jp
    Expiry Date: YYYY-mm-DD HH:MM:SS+00:00 (VALID: nn days)
    Certificate Path: /etc/letsencrypt/live/www.example.jp/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/www.example.jp/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$

httpdの停止

稼働しているhttpdを一時的に停止します。停止しないと、

Could not bind TCP port 80 because it is already in use by another process on
this system (such as a web server). Please stop the program in question and then
try again.

というエラーが発生します。

メールサーバ用に証明書を取得する

Webサーバ用に証明書を取得しているため、メールアドレスの入力、利用規約の承認などはスキップされます。

$ sudo certbot certonly --standalone -d mail.example.jp
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for mail.example.jp

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/mail.example.jp/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/mail.example.jp/privkey.pem
This certificate expires on YYYY-mm-DD
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$

コマンドの出力のとおり、証明書は/etc/letsencrypt/live/mail.example.jp/以下に作成されます。

証明書が生成されていることを確認したら、httpdを起動しておきます。