stevejenkins/unifi-linux-utils

UniFi path changes?

regexaurus opened this issue · 1 comments

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.

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: 4e8302c

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