OpenSSLのdefault security levelを変更
Page content
現象
Ubuntu20.04に上げてから、pythonのrequestsを使ってSSL通信しようとしたところ、bad handshakeのエラー。
requests.exceptions.SSLError: HTTPSConnectionPool(host='xxx.com', port=443): Max retries exceeded with url: /brabra.html (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls12_check_peer_sigalg', 'wrong signature type')])")))軽く調べると、/etc/ssl/openssl.cnfのDEFAULT@SECLEVEL=2を1に変えれば解決する、と書いてあるが、ファイルを見たところそのような記載はない。
解決策
/etc/ssl/openssl.cnfにDEFAULT@SECLEVEL=1を記載した定義を作成し、openssl_confに設定する。
ファイルの上の方に以下を記載。
openssl_conf = default_confファイル末尾に以下を記載。
[default_conf]
ssl_conf = ssl_sect
[ssl_sect]
system_default = system_default_sect
[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=1

