Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- LDAP_SERVER=example.com:636
- ALIAS=LDAP_SERVER
- KEYSTORE=/usr/lib/jvm/java-1.6.0-openjdk-amd64/jre/lib/security/cacerts
- PASSWD=changeit
- # grep the certificate
- echo -n | openssl s_client -connect $LDAP_SERVER | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ldaps.crt
- # remove the old cert
- keytool -delete -alias $ALIAS -keystore $KEYSTORE -storepass $PASSWD
- # install the new cert
- keytool -import -trustcacerts -alias $ALIAS -file ldaps.crt -keystore $KEYSTORE -storepass $PASSWD
Add Comment
Please, Sign In to add comment