Search code examples
sslssl-certificatecasjasig

CAS gradle overlay with non self signed certificate


I'm using CAS using the gradle overlay method. I am able to use it with a self signed certificate. However, when I try to use a certificate from the FreeIPA certificate authority, I am getting the following error message:

2018-02-03 13:39:54,298 ERROR [org.apache.catalina.core.StandardService] - <Failed to start connector [Connector[HTTP/1.1-8443]]>
org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-8443]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.24.jar!/:8.5.24]

...

Caused by: java.lang.IllegalArgumentException: java.io.IOException: Alias name [null] does not identify a key entry
    at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:116) ~[tomcat-embed-core-8.5.24.jar!/:8.5.24]

I have added the FreeIPA CA certificate to /usr/java/jdk1.8.0_152/jre/lib/security/cacerts

And, put the certificate into /etc/cas/thekeystore


Solution

  • This is the solution:

    openssl req -nodes -newkey rsa:2048 -sha256 -keyout cas.key -out cas.csr
    

    [Send CSR to certificate authority]

    [Download CA certificate PEM file]

    [Download CAS certificate PEM file]

    cp cas.key /etc/pki/tls/private/.
    cp cas.crt /etc/pki/tls/certs/.
    cp freeipa_ca.crt  /etc/pki/tls/certs/.
    cat cas.pem freeipa_ca.pem > cas_all.pem
    openssl pkcs12 -export -inkey /etc/pki/tls/private/cas.key -in cas_all.pem  -name cas -out cas.p12
    keytool -delete -alias cas -keystore /etc/cas/thekeystore
    keytool -list  -keystore /etc/cas/thekeystore -v
    keytool -importkeystore -srckeystore cas.p12 -srcstoretype pkcs12 -destkeystore /etc/cas/thekeystore