fetchmail で “OpenSSL reported: error:141A318A:SSL routi nes:tls_process_ske_dhe:dh key too small” と怒られるようになった

何だかメールが来ないなと思っていたら、fetchmailでシクっていました。

Feb  9 19:52:09 xxxxx fetchmail[2374]: OpenSSL reported: error:141A318A:SSL routi
nes:tls_process_ske_dhe:dh key too small
Feb  9 19:52:09 xxxxx fetchmail[2374]: mail.xxxxxx.ne.jp: SSL connection failed.

fetchmailのbug reportですが、これはfetchmailではなく、opensslのセキュリティ設定のせいだと分かります。

Debian Bug report logs – #974167 fetchmail: OpenSSL reported error: key too small

ググると、この手の話はたくさん見つかります。ただ、/etc/ssl/openssl.cnfを弄る例ばかり。

これってsystem wideで変更してしまうので、普通はやりたくないと思うんだけどな。 問題があるのはfetchmailだけなので、system wideでセキュリティ・レベルを変更する理由にはならない。 そもそも、こちらというよりはメールサーバー側の問題だし。

ユーザーレベルで一時的にopensslの設定を変更する方法が上のBTSで触れられていました:

To avoid having this change to be system-wide, one can use a local openssl configuration file (where the Cipherstring line is commented out) and call fetchmail like

OPENSSL_CONF=~/insecure-openssl.conf fetchmail

同様な例がこちらでも。

Overriding OpenSSL CipherString at a more granular level in Debian 10?

Override system default with user level environment:

An empty file will do: touch ~/.openssl.cnf

BASH define & export: export OPENSSL_CONF=~/.openssl.cnf

Wrap application within a script: export OPENSSL_CONF=/dev/null

と言うことで、今回は以下のようにしました。

touch ~/.openssl.cnf
OPENSSL_CONF=~/.openssl.cnf fetchmail

.openssl.cnfの中身は空でも良いようですが、

CipherString = DEFAULT@SECLEVEL=1

を入れておきました。

Adsense広告