Skip to content

Instantly share code, notes, and snippets.

@hobayoba
Forked from dlangille/commands
Last active August 27, 2019 15:26
Show Gist options
  • Save hobayoba/388903c5577eb194de605983944e2d8c to your computer and use it in GitHub Desktop.
Save hobayoba/388903c5577eb194de605983944e2d8c to your computer and use it in GitHub Desktop.
Importing your own cert into a Unifi controller
# All of this was run on FreeBSD 11, but with path adjustments to the keystore, should work for any OS.
# Your cert is in your local directory:
#
# unifi01.int.unixathome.org.key
# unifi01.int.unixathome.org.pem
# aircontrolenterprise is the password we are using on our pkcs12 file
# crete the keys.p12 file
# the -name directive specifies the alias for this cert.
# aliases appear in the list command below
echo aircontrolenterprise | openssl pkcs12 -export -inkey unifi01.int.unixathome.org.key \
-in unifi01.int.unixathome.org.pem -name unifi01 \
-out keys.p12 \
-password stdin
# import keys.p12 into the keystore
sudo keytool -importkeystore -srckeystore keys.p12 \
-srcstoretype pkcs12 -destkeystore /usr/local/share/java/unifi/data/keystore \
-storepass aircontrolenterprise -srcstorepass aircontrolenterprise
# list the certs in the keystore
# this is where we see the aliases
keytool -list -keystore /usr/local/share/java/unifi/data/keystore
# delete the one we don't want: we imported unifi01 alias above.
# the unifi alias was created by the controller by default
sudo keytool -delete -keystore /usr/local/share/java/unifi/data/keystore -alias unifi
# restart the controller
sudo service unifi restart
@hobayoba
Copy link
Author

Software Unifi Controller on Ubuntu 18+
default keystore path: /var/lib/unifi/keystore
default keystore passw: aircontrolenterprise

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