LoginSignup
0
0

CentOS Stream 9 で Let’s Encrypt のSSLサーバ証明書が自動更新されない原因

Last updated at Posted at 2024-02-09

原因

CentOS系管理者の思い込み。
CentOS 7, 8, CentOS Stream 8 では自動更新される、と思い込んでいる。

  • SSLサーバ証明書そのものは自動更新される。
  • snapd 管理の certbot は apache を再起動しない。
  • apacheの再起動を行わないと古いSSLサーバ証明書が参照された状態が続く。
  • CentOS Stream 9 の logrotate はデフォルトで起動されない。
  • apache の logrotate の際に、apache は reload される。

つまり、これまでのOSでは、logrotateのおかけで apache が reload され SSLサーバ証明書が再読み込みされた結果、自動更新されていた。

CentOS Stream 9 の logrotate は cron ではなく systemd の timer ユニットで管理されるようになり、デフォルトで起動しないようになっていた。


# systemctl status logrotate.timer
○ logrotate.timer - Daily rotation of log files
     Loaded: loaded (/usr/lib/systemd/system/logrotate.timer; disabled; preset: enabled)
     Active: inactive (dead)
    Trigger: n/a
   Triggers: ● logrotate.service
       Docs: man:logrotate(8)
             man:logrotate.conf(5)


# systemctl start logrotate.timer
# systemctl enable logrotate.timer
Created symlink /etc/systemd/system/timers.target.wants/logrotate.timer → /usr/lib/systemd/system/logrotate.timer.

# systemctl status logrotate.timer
● logrotate.timer - Daily rotation of log files
     Loaded: loaded (/usr/lib/systemd/system/logrotate.timer; disabled; preset: enabled)
     Active: active (waiting) since Tue 2024-02-13 12:16:59 JST; 32s ago
      Until: Tue 2024-02-13 12:16:59 JST; 32s ago
    Trigger: Wed 2024-02-14 00:00:00 JST; 11h left
   Triggers: ● logrotate.service
       Docs: man:logrotate(8)
             man:logrotate.conf(5)

# systemctl list-timers
NEXT                        LEFT          LAST                        PASSED       UNIT                         ACTIVATES
・・・
Wed 2024-02-14 00:00:00 JST 11h left      Tue 2024-02-13 11:42:10 JST 39min ago    logrotate.timer              logrotate.service
・・・

SSLサーバ証明書の管理も大事ですが、ログの管理もしっかりしなければなりません。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0