Maven実行時のsun.security.validator.ValidatorException

Mavenを実行してたら、teklabsにアクセスした時に、表題のエラー発生

[WARNING] Could not transfer metadata asm:asm/maven-metadata.xml from/to gwt-i18n-server (https://service.teklabs.com/nexus/content/repositories/public-releases/): Error transferring file: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

 

https://service.teklabs.comの証明書を見たところ、2015/09/21に更新した模様
簡単なscript書いて、確認したところ、JDKのkeystoreが、teklabsを信用していない様子

$ git clone https://github.com/hdkshjm/check-java-trusted-store.git
$ bash ./check-java-trusted-store/bin/access_ssl_test.sh -u https://service.teklabs.com
Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

 

解決方法は2つあって
1. 社内のNEXUSでreverse proxyする
2. JDKのkeystoreに、teklabsを追加

1の方が確実なんだけど(NEXUS側で証明書について対応するので、JenkinsとかローカルのPCのJDKに変更不要)
とりあえず、2の方法での対応方法をmemoしておく

$ openssl s_client -showcerts -connect service.teklabs.com:443 </dev/null 2>/dev/null|openssl x509 -outform DER > teklabs.cer
$ ${JAVA_HOME}/bin/keytool -import -trustcacerts -file teklabs.cer -keystore ${JAVA_HOME}/jre/lib/security/cacerts -alias teklabs -storepass changeit