master
Brie Bruns 2016-03-08 12:11:20 -07:00
parent 9eb04833ac
commit 3abd8bcb72
1 changed files with 7 additions and 7 deletions

View File

@ -50,19 +50,19 @@ echo "Firing up standalone authenticator on TCP port 443 and requesting cert..."
${LEOPTIONS} ${LEOPTIONS}
if `md5sum -c /etc/letsencrypt/live/${DOMAIN}/cert.pem.md5 %>/dev/null`; then if `md5sum -c /etc/letsencrypt/live/${DOMAIN}/cert.pem.md5 &>/dev/null`; then
echo "Cert has not changed, not updating controller." echo "Cert has not changed, not updating controller."
exit 0 exit 0
else else
TEMPFILE=$(mktemp) TEMPFILE=$(mktemp)
echo "Cert has changed, updating controller..." echo "Cert has changed, updating controller..."
md5sum /etc/letsencrypt/live/${DOMAIN}/cert.pem > /etc/letsencrypt/live/${DOMAIN}/cert.pem.md5 md5sum /etc/letsencrypt/live/${domains[0]}/cert.pem > /etc/letsencrypt/live/${domains[0}/cert.pem.md5
echo "Using openssl to prepare certificate..." echo "Using openssl to prepare certificate..."
openssl pkcs12 -export -passout pass:aircontrolenterprise \ openssl pkcs12 -export -passout pass:aircontrolenterprise \
-in /etc/letsencrypt/live/${DOMAIN}/cert.pem \ -in /etc/letsencrypt/live/${domains[0]}/cert.pem \
-inkey /etc/letsencrypt/live/${DOMAIN}/privkey.pem \ -inkey /etc/letsencrypt/live/${domains[0]}/privkey.pem \
-out ${TEMPFILE} -name unifi \ -out ${TEMPFILE} -name unifi \
-CAfile /etc/letsencrypt/live/${DOMAIN}/chain.pem -caname root -CAfile /etc/letsencrypt/live/${domains[0]}/chain.pem -caname root
echo "Stopping Unifi controller..." echo "Stopping Unifi controller..."
service unifi stop service unifi stop
echo "Removing existing certificate from Unifi protected keystore..." echo "Removing existing certificate from Unifi protected keystore..."
@ -79,8 +79,8 @@ else
rm -f ${TEMPFILE} rm -f ${TEMPFILE}
echo "Importing cert into Unifi database..." echo "Importing cert into Unifi database..."
java -jar /usr/lib/unifi/lib/ace.jar import_cert \ java -jar /usr/lib/unifi/lib/ace.jar import_cert \
/etc/letsencrypt/live/${DOMAIN}/cert.pem \ /etc/letsencrypt/live/${domains[0]}/cert.pem \
/etc/letsencrypt/live/${DOMAIN}/chain.pem \ /etc/letsencrypt/live/${domains[0]}/chain.pem \
${EXTRACERT} ${EXTRACERT}
echo "Starting Unifi controller..." echo "Starting Unifi controller..."
service unifi start service unifi start