Skip to content

Instantly share code, notes, and snippets.

@Nepherte
Created October 11, 2020 14:21
Show Gist options
  • Save Nepherte/4a4bbd90fc44431c838a904f19ada3f7 to your computer and use it in GitHub Desktop.
Save Nepherte/4a4bbd90fc44431c838a904f19ada3f7 to your computer and use it in GitHub Desktop.
Script to import an SSL certificate into a UniFi USG.
#!/usr/bin/env bash
# Graceful shutdown of the http server.
kill -SIGINT $(cat /var/run/lighttpd.pid)
# Install certificate in the http server.
mv /home/admin/.certificate/server.pem /etc/lighttpd/server.pem
chown root:root /etc/lighttpd/server.pem; chmod 0400 /etc/lighttpd/server.pem
# Start http server with new certificate.
/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment