Guest User

Untitled

a guest
May 27th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. LDAP_SERVER=example.com:636
  4. ALIAS=LDAP_SERVER
  5. KEYSTORE=/usr/lib/jvm/java-1.6.0-openjdk-amd64/jre/lib/security/cacerts
  6. PASSWD=changeit
  7.  
  8. # grep the certificate
  9. echo -n | openssl s_client -connect $LDAP_SERVER | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ldaps.crt
  10.  
  11. # remove the old cert
  12. keytool -delete -alias $ALIAS -keystore $KEYSTORE -storepass $PASSWD
  13.  
  14. # install the new cert
  15. keytool -import -trustcacerts -alias $ALIAS -file ldaps.crt -keystore $KEYSTORE -storepass $PASSWD
Add Comment
Please, Sign In to add comment