Skip to content

Instantly share code, notes, and snippets.

@Mazorius
Last active July 4, 2020 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mazorius/74ac9221f963b5a9c25c7c5cd65f6bd2 to your computer and use it in GitHub Desktop.
Save Mazorius/74ac9221f963b5a9c25c7c5cd65f6bd2 to your computer and use it in GitHub Desktop.
Install Let's Encrypt on Ubiquiti Cloud Key Gen1
#!/bin/sh
set -x
/root/.acme.sh/acme.sh --issue --nginx --domain '<DOMAIN>'
/root/.acme.sh/acme.sh --deploy --domain <DOMAIN> --deploy-hook unifi
set +x

Ubiquiti UniFi Cloud Key Gen1

Table of Contents

First Setup

Install Let's Encrypt

  1. sudo apt-get update
  2. sudo apt-get install --yes socat
  3. cd $(mktemp --directory)
  4. curl https://get.acme.sh | sh
  5. source ~/.bashrc

Run Let's Encrypt

  1. acme.sh --upgrade --auto-upgrade --accountemail "<MAIL>"
  2. acme.sh --issue --nginx --domain '<DOMAIN>'

Install in Nginx

  1. cp /root/.acme.sh/<DOMAIN>/<DOMAIN>.cer /etc/ssl/private/cloudkey.crt
  2. cp /root/.acme.sh/<DOMAIN>/<DOMAIN>.key /etc/ssl/private/cloudkey.key

Install in UniFi

  1. acme.sh --deploy --domain <DOMAIN> --deploy-hook unifi

Setup Crontab for Renewal Process

  1. Create /etc/cron.monthly/letsEncrypt with code in file below
  2. Make it runnable by root sudo chmod 0700 /etc/cron.monthly/letsEncrypt

After Firmware Upgrade

  1. sudo apt-get update
  2. sudo apt-get install --yes socat
  3. Install in Nginx
  4. Install in UniFi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment