CertbotによるSSL証明書の自動更新方法
1.Certbotのインストール方法
$ sudo apt(dnf) install certbot certbot-apache $ sudo certbot certonly --apache -d example.com
2.自動更新を設定する
ファイル1の定義
<!-- /etc/systemd/system/certbot-renew.timer --> [Unit] Description=Run certbot twice daily [Timer] OnCalendar=*-*-* 00/12:00:00 Persistent=true [Install] WantedBy=timers.target
ファイル2の定義
<!--/etc/systemd/system/certbot-renew.service --> [Unit] Description=Certbot renewal [Service] Type=oneshot ExecStart=/usr/bin/certbot renew --quiet --deploy-hook "/bin/systemctl reload apache2"
3.certbot起動を行う
$ sudo systemctl enable certbot-renew.timer $ sudo systemctl start certbot-renew.timer