Home / メール受信不可

2020-10-7 の日記 OCNメールを受信出来なくなっていた の続き。

Linux環境:
Version 3.7.0 (Build 1185)
GTK+ 2.24.32 / GLib 2.64.3
Operating System: Linux 5.4.0-48-generic (x86_64)
Compiled-in features: gthread IPv6 iconv compface GnuPG OpenSSL LDAP GtkSpell Oniguruma

Windows環境:
version 3.0.3
GTK+ 2.10.14 / GLib 2.12.13
Operating System: Win32
Compiled-in features: gthread iconv compface GnuPG OpenSSL Oniguruma

Sylpheed は次のログを吐いている。

[16:51:09] fcitx-connection-DEBUG: _fcitx_connection_connection_finished
[16:52:07] * message: POP3サーバ: pop.ocn.ne.jp に接続中...
[16:52:08] ** LibSylph-WARNING: SSL_connect() failed with error 1, ret = -1
            (error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature type)
[16:52:08] ** LibSylph-WARNING: can't initialize SSL.
[16:52:08] ** LibSylph-WARNING: [16:52:08] 接続に失敗しました。
[16:52:08] ** warning: 接続に失敗しました。

該当する libsylph のソース ssl.c を見ても、(OpenSSLの)SSL_connect()がエラーを起こしているだけとしか判らない(リトライする価値が無い原因だとは判る)。

124         SSL_set_fd(sockinfo->ssl, sockinfo->sock);
125         while ((ret = SSL_connect(sockinfo->ssl)) != 1) {
126                 err = SSL_get_error(sockinfo->ssl, ret);
127                 if (err == SSL_ERROR_WANT_READ || 
                        err == SSL_ERROR_WANT_WRITE) {
128                         g_usleep(100000);
129                         g_warning("SSL_connect(): try again\n");
130                         continue;
131                 }
132                 g_warning("SSL_connect() failed with error %d, ret = %d (%s)\n",
133                           err, ret, ERR_error_string(ERR_get_error(), NULL));
134                 return FALSE;
135         }

肝心のエラーメッセージは OpenSSL からエラーコードでメッセージを引けるようだ。 errstr コマンドで上記のエラーコードを与えると全く同じメッセージが得られる。

$ openssl errstr 1414D172
error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature type

処置: SSLセキュリティレベルを下げる

先のエラーメッセージで探すと多くの(英語圏の)事例が出て来る。 Ubuntu 20.04では、どうやらSSLセキュリティレベルが上がっているらしい。 (19.10 から 20.04へアップグレードしたので合点がいく。) OpenSSLのChanges Listを見ると、確かにそう書いてある。

openssl (1.1.1f-1ubuntu1) focal; urgency=low

  * Merge from Debian unstable.  Remaining changes:
...
    - Revert "Enable system default config to enforce TLS1.2 as a
      minimum" & "Increase default security level from 1 to 2".
...
    - Set OPENSSL_TLS_SECURITY_LEVEL=2 as compiled-in minimum security
      level. Change meaning of SECURITY_LEVEL=2 to prohibit TLS versions
      below 1.2 and update documentation. Previous default of 1, can be set
      by calling SSL_CTX_set_security_level(), SSL_set_security_level() or
      using ':@SECLEVEL=1' CipherString value in openssl.cfg.

 -- Dimitri John Ledkov < xnox@ubuntu.com >  Fri, 03 Apr 2020 18:31:00 +0100

どうやらこれが原因らしいので変更する。
まずは OpenSSL の位置等を確認。

$ openssl version
OpenSSL 1.1.1f  31 Mar 2020
$ openssl version -d
OPENSSLDIR: "/usr/lib/ssl"
$ ls -l /usr/lib/ssl
total 4
lrwxrwxrwx 1 root root   14  8月 20  2019 certs -> /etc/ssl/certs
drwxr-xr-x 2 root root 4096  9月 20 07:45 misc
lrwxrwxrwx 1 root root   20  4月 20 20:53 openssl.cnf -> /etc/ssl/openssl.cnf
lrwxrwxrwx 1 root root   16  8月 20  2019 private -> /etc/ssl/private

次のサイトの通りに openssl.cnf へ追記する。
security - Ubuntu 20.04-SSLセキュリティレベルを低く設定する方法

/etc/ssl/openssl.cnf
  1 openssl_conf = default_conf
  2 #
  3 # OpenSSL example configuration file.
...
352
353 # 2020-10-7
354 [ default_conf ]
355 ssl_conf = ssl_sect
356
357 [ssl_sect]
358 system_default = ssl_default_sect
359
360 [ssl_default_sect]
361 MinProtocol = TLSv1.2
362 CipherString = DEFAULT:@SECLEVEL=1

流石に1行目には書かずとも構わないだろうが、某は詳しくないのでそう書いた。


Home / メール受信不可

© 2008 usskim    http://usskim.web.fc2.com/
inserted by FC2 system