stevejenkins / unifi-linux-utils

Helpful Linux / Unix scripts for admins of Ubiquiti (UBNT) UniFi wireless products
https://www.stevejenkins.com/blog/tag/unifi/
MIT License
695 stars 127 forks source link

UniFi path changes? #11

Closed regexaurus closed 7 years ago

regexaurus commented 7 years ago

I'm running UniFi Controller 5.3.8.2 on Ubuntu 14.04.5 LTS. After updating UNIFI_HOSTNAME, UNIFI_DIR, UNIFI_SERVICE and LE_MODE, the following are included in your script's messages:

Updating certificate MD5 checksum... cp: cannot stat ‘/var/lib/unifi/data/keystore’: No such file or directory

Removing previous certificate data from UniFi keystore... keytool error: java.lang.Exception: Keystore file does not exist: /var/lib/unifi/data/keystore

Importing SSL certificate into UniFi keystore... keytool error: java.io.FileNotFoundException: /var/lib/unifi/data/keystore (No such file or directory)

Error: Unable to access jarfile /var/lib/unifi/lib/ace.jar

On the system in question, keystore is at /var/lib/unifi/keystore. There is no directory /var/lib/unifi/data, and sudo find /var/lib/unifi | grep ace returns only:

/var/lib/unifi/db/ace_stat.1 /var/lib/unifi/db/ace_stat.0 /var/lib/unifi/db/ace_stat.ns /var/lib/unifi/db/ace.ns /var/lib/unifi/db/ace.1 /var/lib/unifi/db/ace.0

I updated the script, setting KEYSTORE to ${UNIFI_DIR}/keystore and re-ran. This time, I only see:

Starting UniFi Controller SSL Import... Running in Let's Encrypt Mode... Inspecting current SSL certificate... Certificate is unchanged, no update is necessary.

After a while, I realized that though the first attempt to import failed, the script still created cert.pem.md5. After removing that file and re-running, the only error in the output is:

Error: Unable to access jarfile /var/lib/unifi/lib/ace.jar

But this time the import succeeded.

stevejenkins commented 7 years ago

Weird. I updated to 5.5.1 on my CentOS box, but the path didn't seem to change on that version. Looks like UBNT changed it on the Deb version.

I've updated the script so Ubuntu/Debian users can select the appropriate file location. Commit is: https://github.com/stevejenkins/unifi-linux-utils/commit/4e8302c1d1e113744c38860dc91dd01d7d715594

Please let me know if this new version doesn't address the issue.