certbotの警告: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to this_update_utc.

certbotから何やら警告メッセージが表示されるようになった。

環境

  • FreeBSD 14.1
  • certbot 2.11.0

状況

certbotで更新を行おうとすると、次のように警告メッセージが表示されるようになった。

/usr/home/admin/pyvenv/certbot/lib/python3.11/site-packages/certbot/ocsp.py:238: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to this_update_utc.
  if not response_ocsp.this_update:
/usr/home/admin/pyvenv/certbot/lib/python3.11/site-packages/certbot/ocsp.py:240: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to this_update_utc.
  if response_ocsp.this_update > now + timedelta(minutes=5):
/usr/home/admin/pyvenv/certbot/lib/python3.11/site-packages/certbot/ocsp.py:242: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to next_update_utc.
  if response_ocsp.next_update and response_ocsp.next_update < now - timedelta(minutes=5):
sending incremental file list

警告が出るだけで、処理自体には問題がない。

原因

原因は、cryptographyのバージョンを43.0.0に上げたこと。certbot 2.11.0ではcryptographyのバージョン42.0.7を想定しているため、43.0.0の仕様には対応していない。

certbotの不具合報告#9967に、まったく同じ現象の報告があった。

いずれcertbotのバージョンが上がれば、警告は出なくなると思われる。

対策

cryptographyを古いバージョンに戻せば、エラーは出なくなる。42.0.8に戻したら、警告は出なくなった。

# pip install cryptography==42.0.8

こういうとき、Pythonパッケージをportsから入れていると戻すのが大変で面倒くさい。Python仮想環境にしておいてよかった。

警告が出ていても処理上は何も問題がないので、特に何もせず気にしないというのも対策と言えば対策。

タイトルとURLをコピーしました