Arturas Minderis
Arturas Minderis

Reputation: 41

How to install CA certificate on Nexus 3?

I have installed Nexus Repository Manager OSS 3.0.2-02 on my CentOS Linux release 7.4.1708.

Also I have CA certificate:

Issued to: \*.mycompany.com  
Issued by: Go Daddy Secure Certificate Authority - G2  
Valid from 2016-11-12 to 2018-01-11

The RSA private key match with my CA certificate, which was checked with Certificate Key Matcher and reported:

The certificate and private key match!

In Nexus3 directory I made the following changes:

Added to the file org.sonatype.nexus.cfg the lines:

nexus-args=${karaf.etc}/jetty.xml,${karaf.etc}/jetty-http.xml,${karaf.etc}/jetty-requestlog.xml,${karaf.etc}/jetty-https.xml     
application-port-ssl=8443

Added to jetty-https.xml file next lines:

KeyStorePath /ssl/test.jks  
KeyStorePassword 123456  
KeyManagerPassword 123456  
TrustStorePath ssl/test.jks  
TrustStorePassword 123456

Created SSL directory in $NEXUS_HOME/etc/ and created inside the SSL directory a Java keystore file test.jks with command:

openssl pkcs12 -export -in mycompany.com.pem -inkey key.pem -name xxx.mycompany.com -out test.pks
keytool -importkeystore -deststorepass 123456 -destkeystore test.jks -srckeystore test.pks -srcstoretype PKCS12
keytool -import -alias bundle -trustcacerts -file gd_bundle.crt -keystore test.jks

After Nexus restart I can't not reach it by URL //xxx.mycompany.com:8443. Firefox says:

The page you are trying to view cannot be shown because the authenticity of the received data could not be verified

Also trying to do: docker login xxx.mycompany.com:8443 and providing default admin:admin:123 credentials cause:

Error response from daemon: Get xxx.mycompany.com:8443/v1/users/: x509: certificate signed by unknown authority

I also try to chain certificates by various scenarions from Google, including How to add certificate chain to keystore?, but got error on Docker:

Error response from daemon: Get //xxx.mycompany.com:8443/v1/users/: EOF

on Firefox, the same as first time and on Chrome:

//xxx.mycompany.com unexpectedly closed the connection

Question: Where is my mistake, or how to correctly install CA certificate on Nexus3?

Upvotes: 2

Views: 9935

Answers (1)

Arturas Minderis
Arturas Minderis

Reputation: 41

I've found the resolution. Just needed to set in jetty-https.xml next lines:

<Set name="NeedClientAuth"><Property name="jetty.ssl.needClientAuth" default="false"/></Set>
<Set name="WantClientAuth"><Property name="jetty.ssl.wantClientAuth" default="false"/></Set>

Upvotes: 2

Related Questions