개요

maven 3.0.5 부터는 repository 의 URL 이 https 일 경우 SSL 인증서를 validation 하게 변경이 되었다.(http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-0253)

man-in-the-middle attack 이 가능하기 때문에 기본값으로 켰다는데 이로 인해 nexus repository 를 https 로 서비스하는 경우 Comodo나 Verisign 같이 유명한 SSL CA에서 산 SSL 인증서가 아니면 SSL 인증서 검증 오류로 인해 artifact를 제대로 받을수 없게 된다.

 

해결책은 세가지가 있다.

  1. maven 3.0.4 로 downgrade (maven 3.0.4 다운받기) - 임시 해결책
  2. Java 의 keystore에 SSL Server 인증서를 import 하는 방법 을 참고하여 JDK 의 keystore 에 nexus 에 적용된 SSL 인증서 import
  3. maven 이 사용하는 wagon-http 에는 SSL 관련 properties가 두 개가 있다.
    • maven.wagon.http.ssl.insecure = true/false (default false), enable/disable use of relaxed ssl check for user generated certificates.
    • maven.wagon.http.ssl.allowall = true/false (default false), enable/disable match of the server's X.509 certificate with hostname. If disabled, a browser like check will be used.
    • Runtime properties 를 maven 구동시에 추가해 주거나 MAVEN_OPTS 환경변수에 추가한다.

      Runtime properties

      maven -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
      BASH

       

추가로 상용 SSL 인증서를 샀더라도 SSL 을 VirtualHost로 서비스하고 있다면 SSL 인증서 검증때문에 다음과 같은 에러를 접할 수 있다.

hostname in certificate didn't match


위의 에러는 SNI(Server Name Indication)를 미지원하는 JDK 에서 발생한다. (JDK6 이하)

자세한 내용은 OpenSSL 에서 self signed certificate 생성 및 apache httpd 에 SSL 적용 을 참고한다.