Created
May 3, 2021 17:39
-
-
Save dchenbecker/6fb2de0f07e487dcfa95e05129b0e44f to your computer and use it in GitHub Desktop.
Script to import Unifi admin certificates (e.g. letsencrypt)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
KS_HOME=/var/lib/unifi | |
cd $KS_HOME/certs | |
umask 0077 | |
print "Paste in the cert.pem file followed by Ctrl-D" | |
cat > unifi.crt | |
print "Paste in the privkey.pem file followed by Ctrl-D" | |
cat > unifi.key | |
print "Paste in the chain.pem file followed by Ctrl-D" | |
cat > chain.crt | |
openssl pkcs12 -export -in unifi.crt -inkey unifi.key \-out unifi.p12 -name unifi -CAfile chain.crt -caname root -passout pass:aircontrolenterprise | |
cp ../keystore ../keystore.$(date "+%F") | |
keytool -importkeystore \ | |
-deststorepass aircontrolenterprise -destkeypass aircontrolenterprise -destkeystore $KS_HOME/keystore \ | |
-srckeystore unifi.p12 -srcstoretype PKCS12 -srcstorepass aircontrolenterprise \ | |
-alias unifi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment