Quantcast
Channel: プログラム の個人的なメモ
Viewing all articles
Browse latest Browse all 860

【トラブル】【Java】Javaで、SSLプロキシに接続した際に例外「No subject alternative names present」が発生

$
0
0

■ 現象

https://blogs.yahoo.co.jp/dk521123/36966230.html
で、キーストアインポートした後に、以下の例外が発生した

例外

No subject alternative names present = サブジェクトの別名がない
com.sun.xml.internal.ws.com.client.ClientTransportException: HTTP transport error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present

構成

 +-----------+        +-----------+       +------------+
 |           | http   |           | https |            |
 |Java appli |--------| SSL Proxy |-------| SSL Server |
 |           | 3128   |           |  443  |            |
 +-----------+        +-----------+       +------------+

その他

 * /var/log/squid/cache.log を確認したところ、SSL関連のエラーログあり。
 * subject alternative names(SANs)については、以下の関連記事を参照のこと
https://blogs.yahoo.co.jp/dk521123/33100623.html

■ 解決案

Proxyサーバ「squid」の設定変更

その1: SSLエラーをsquid側で無視する(握りつぶす)
http://wiki.squid-cache.org/ConfigExamples/Intercept/SslBumpExplicit#Troubleshooting
より

sudo vi /etc/squid/squid.conf
~~~~
sslproxy_cert_error allow all
sslproxy_flags DONT_VERIFY_PEER
~~~~

 * あくまで開発時でのデバッグ用の方法。
その2: SANsに記載されているホスト名/IPアドレスを指定する
http://lists.squid-cache.org/pipermail/squid-users/2016-February/009308.html
を参考に。

sudo vi /etc/squid/squid.conf
~~~~
acl tcp_level at_step SslBump1
acl client_hello_peeked at_step SslBump2
ssl_bump peek tcp_level all

acl to_target_host_ssl ssl::server_name 【SANsに記載されているホスト名/IPアドレス】

ssl_bump splice client_hello_peeked to_target_host_ssl

# SANsに記載されているホスト名/IPアドレスと正規証明書以外のサイトをエラーにしたい場合はコメントアウト
#ssl_bump terminate all
ssl_bump bump all
~~~~

関連記事

プロキシサーバソフト ~ Squid / SSLプロキシ構築編 ~

https://blogs.yahoo.co.jp/dk521123/36958786.html

Javaで、プロキシサーバ経由で接続する

https://blogs.yahoo.co.jp/dk521123/36966230.html

SSL / TLS ~用語・拡張子編~

https://blogs.yahoo.co.jp/dk521123/33100623.html

Viewing all articles
Browse latest Browse all 860

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>