I could use some help,
After my pem issues (see prior emails in chain) I tried my hand at the keystore.
I used the gradle task to build a generic keystore with ./gradlew createKeystore. This worked fine to get me through the rest of my build process.
Now I am ready to deploy to a test cluster but I can not get my new keystore to work.
I created a keystore, generated new csr, and got the csr approved and retrieved my new certificates, and imported them (see keytool commands below).
No errors during that process.
Then I move the keystore to /etc/cas/ and update /etc/cas/properties with:
server.ssl.key-store=/etc/cas/cas.jks
server.ssl.key-store-password=REDACTED
Which are the same settings used with the default "thekeystore" and password "changeit".
However,
every time I restart my CAS instance the embedded tomcat server throws
the same errors as my pem attempts earlier in this email chain. I included a summary of the trace below.
I'm very confused by this issue. I would love to simplify my deployment by keeping CAS and Tomcat together.
Am I missing something very simple? Has anyone else had luck with their own keystore on the embedded tomcat instance? Is it because I have SANs in my cert or is something messed up with the key?
Create new keystore and key:
keytool -genkey -alias sso -keystore cas.jks -storepass 'REDACTED' -keyalg rsa -keysize 2048 -dname "CN=My host,O=my org,L=my localisty,S=Ohio,C=US,OU=Information Technology,EMAILADDRESS=my work email" -ext san=dns:host1,dns:host2,etc...
Then the CSR:
keytool -certreq -alias sso -keystore cas.jks -storepass 'REDACTED' -file my.csr
Got it approved.
Split the chain into individual cert files.
Then imported the individual certificates with these commands:
keytool -import -alias root -keystore cas.jks -storepass 'REDACTED' -file root.pem
keytool -import -alias usertrust -keystore cas.jks -storepass 'REDACTED' -file usertrust.pem
keytool -import -alias sso -keystore cas.jks -storepass 'REDACTED' -file host.pem
Error summary:
WARN [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext] - <Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'>
Exception in thread "main" java.lang.reflect.InvocationTargetException
Caused by: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
Caused by: java.lang.IllegalArgumentException: Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
Caused by: java.security.UnrecoverableKeyException: Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.