Bitbucket and Jenkins, in-order to talk to each other we have installed SSL certs in Bitbucket server. Issue started when Jenkins team used to mess up with their configuration and end up changing their SSL cert which disturbs the communication between Bitbucket and Jenkins. This happens frequently in a month.
I was assigned with a task to automate the effort of installing the new cert every time they change cert. i.e., check the URL cert and the cert in server keystore and alert us when there is difference so that we can import the newer certs.
So, this is what I did. I got the SSL cert from the keystore using commands
keytool -export -alias jenkins -file jenkins.der -keystore keystore.path openssl x509 -inform der -in jenkins.der -out jenkins.crt
Then retrieved the SSL cert from openssl command which I assume is taken from browser URL
openssl s_client -connect jenkins:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > jenkins_new.crt
After this when I compare, there are differences in few lines between the files. The SSL certs have not changed after the last import, then how does the installed SSL and the browser SSL differ?
IS what I am trying to do incorrect?