【JDK】Remote host closed connection during handshakeのエラー【apache】

Remote host closed connection during handshake ってエラーがでて四苦八苦した備忘録です。

背景

サーバにて表題のエラーがでて困ったの。

結論

IBM JDK は TLSv1.0 で通信するそうな。
根本的な要因は Apache の設定で TLSv1.1 / TLSv1.2 以外のプロトコルを許可していなかったため。

↓ Apache のパラメータを下記のように書き換え

# TLSv1.0 含め許可
====================================
SSLProtocol ALL -SSLv2 -SSLv3
====================================

# Apache リロード
systemctl reload httpd

下記サイトで許可している SSLProtocol を確認できます。
https://www.cman.jp/network/support/ssl.html

【チラ裏】SSL(TLS)証明書関連【openssl】

SSL(というかTLS)証明書関連ですね。
いつもどおりのチラ裏です。

証明書の整合性確認

# 秘密鍵
openssl rsa -noout -text -in test.com.key
# 証明書
openssl x509 -noout -text -in test.com.crt
# 中間証明書
openssl x509 -noout -text -in test.com.ca

・秘密鍵、証明書の「Modules」の値が同じであること
・証明書のIssuer:CNと中間証明書のSubject:CNが同じであること

秘密鍵、CSR作成

# 秘密鍵作成
openssl genrsa -aes256 2048 > test.com.key

# CSR作成
openssl req -new -key test.com.key -out test.com.csr
=========================================================
Country Name:
ISOによる2文字の国名の符号
→JP

State or Province Name:
都道府県名
→Osaka

Locality Name:
市区町村名
→Osaka

Organization Name:
組織名
→test,Co.,Ltd.

Organizational Unit Name:
部署名
→test

Common Name:
→test.com

その他便利なopenssl

# CSRの内容確認
openssl req -noout -text -in test.com.csr

# Keyファイルの確認
openssl rsa -noout -check -in test.com.key
RSA key ok

# CSRとKeyファイルの比較
openssl rsa -in test.com.key -text
openssl req -in test.com.csr -text
⇒mosulusの値を比較し、差異が無いことを確認

# 秘密鍵のパスフレーズを解除
openssl rsa -in test.com.key -out test.com.key
openssl rsa -in test.com -text