Skip to content

Instantly share code, notes, and snippets.

@sshimko
Created January 11, 2019 16:19
Show Gist options
  • Save sshimko/e4e70ec5b6a0b5285189342ee2c245e8 to your computer and use it in GitHub Desktop.
Save sshimko/e4e70ec5b6a0b5285189342ee2c245e8 to your computer and use it in GitHub Desktop.
Extracting keys + certs from nssdb
#!/bin/sh
pk12util -d . -r -n Server-Cert -o foo.p12
openssl pkcs12 -in foo.p12 -out foo-crt.pem -clcerts -nokeys
openssl pkcs12 -in foo.p12 -out foo-key.pem -nocerts -nodes
@sshimko
Copy link
Author

sshimko commented Jan 11, 2019

It was surprisingly hard to figure out how to do this - even with Google's help. I use it to extract keys from the nssdb IPA clients use but services like rsyslog don't support.

Drawback - I need to figure out how to automate this when certs are re-issued.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment