Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use a Maven 2 repository protected using SSL and a wildcard/self-signed certificate?

I am trying to use a Maven 2 repository via SSL secured with a self-signed certificate. I followed the instructions at HTTPS and Self-Signed Certificates in Java but I doesn't to work.

I think its because the certificate is a wild-card certificate. So I wonder if I should be doing something different to import the wild-card certificate?

like image 407
Brian Matthews Avatar asked Oct 31 '25 08:10

Brian Matthews


2 Answers

The issue was not the use of a wild-card certificate after all. I had to import the CA certificate I used to sign the server certificate into the jssecacerts keystore rather than cacerts:

keytool -keystore %JAVA_HOME%\jre\lib\security\jssecacerts -import -file cacert.pem
like image 65
Brian Matthews Avatar answered Nov 02 '25 22:11

Brian Matthews


Rather the tampering with the certificates for all java applications, generate a separate certificate file that only maven uses, and then use MAVEN_OPTS to set the -D parameter.

-Djavax.net.ssl.trustStore=/private/${ACCOUNT}/java/keystore.pks -Djavax.net.ssl.trustStorePassword=${PASSWORD}

See: https://developer.cloudbees.com/bin/view/DEV/Maven+with+untrusted+SSL+Certificates

like image 21
java4africa Avatar answered Nov 02 '25 21:11

java4africa