Skip to content
Geek is the Way!
Menu
  • Forums
  • Sobre o blog
  • Contato
  • English
    • Português
Menu

Install Let’s Encrypt SSL certificates on your UDM-Pro from pfSense crontab

Posted on July 5, 2020August 14, 2022 by Thiago Crepaldi

Last Updated on August 14, 2022 by Thiago Crepaldi

As you may have noticed, your UDM Pro came with a self-signed certificate, which browsers don’t like much and neither do I. In this article, we are going to install Let’s Encrypt SSL certificates using crontab from a pfSense device. You can replace pfSense with any other device with crontab available.

Unifi OS doesn’t provide any builtin configuration for SSL certificates, so we have to copy it to the device and replace the old ones ourselves. To get started, make sure you have SSH access enabled on your UDM Pro and SSH enabled on your pfSense. You will also need Let’s Encrypts certificates issued for your domain and for this purpose, we are going to use a pfSense appliance!

Before getting our hands dirty in the automation process, let’s test connectivity between your pfSense and UDM-Pro. SSH into your pfSense. and once inside, SSH into your UDM Pro. You will be asked to add the Unifi device to the list of known hosts; you have to type Yes and hit <Enter>. If you are daisy chaining your pfSense and UDM Pro, you have to create a firewall rule on your UDM Pro to allow SSH coming from pfSense.

Now that you pfSense and UDM-Pro are acquainted, create a folder on the UDM Pro to store the certificates that will be sent by pfSense’s crontab: run mkdir -p /root/ssl_from_pfsense. It is a good idea to backup your UDM Pro original keys by copying them with a different name. Run cp /mnt/data/unifi-os/unifi-core/config/unifi-core.crt /mnt/data/unifi-os/unifi-core/config/unifi-core.crt.bkp and cp /mnt/data/unifi-os/unifi-core/config/unifi-core.key /mnt/data/unifi-os/unifi-core/config/unifi-core.key.bkp for backing them up. Now you can exit both pfSense and UDM Pro terminals. We are going to use pfSense GUI for the next steps.

On your pfSense, you are going to need cron installed. Go to System >> Package Manager >> Available Packages, search for cron and click on Install button and finish the process clicking on Confirm.

Let’s create cron job that will copy and install the new certificates every day of the month at 3 am. On your pfSense, go to Services >> cron and click on Add and fill the new job as follow:

  • Minute: 0
  • Hour: 3
  • Day of the month: 1
  • Month of the year: *
  • Day of the week: *
  • User: root
  • Command: ssh root@<udm_pro_ip> “rm -fv /root/ssl_from_pfsense/*”;scp /conf/acme/<certificate_name>.* root@<udm_pro_ip>:/root/ssl_from_pfsense; ssh root@<udm_pro_ip> “cd /root/ssl_from_pfsense/; cp -fv <certificate_name>.all.pem /mnt/data/unifi-os/unifi-core/config/unifi-core.crt; cp -fv <certificate_name>.key /mnt/data/unifi-os/unifi-core/config/unifi-core.key; /usr/sbin/unifi-os restart”

Make sure you replace <udm_pro_ip> by the UDM Pro IP on pfSense network, not the IP from the UDM Pro network.

Click on Save and you are done.

Share this:

  • Tweet

Related

5 thoughts on “Install Let’s Encrypt SSL certificates on your UDM-Pro from pfSense crontab”

  1. John Kirk says:
    December 5, 2020 at 5:16 PM

    The command you have doesn’t work

    Reply
    1. Thiago Crepaldi says:
      December 5, 2020 at 6:17 PM

      Could you elaborate with log message, etc? Maybe I can help you

      Reply
  2. Thiago Crepaldi says:
    December 5, 2020 at 8:47 PM

    After an offline talk, we figured it out. Freaking typos…. 🙂

    Reply
  3. John Kirk says:
    December 5, 2020 at 9:10 PM

    Yeah thank you very much, it works flawlessly now.

    Reply

Leave a ReplyCancel reply

LIKED? SUPPORT IT :)

Buy Me a Coffee


Search


Categories

  • Cooking (1)
  • Homelab (79)
    • APC UPS (6)
    • pfSense (40)
    • Proxmox (20)
    • Shopping (1)
    • Supermicro (2)
    • Synology NAS (8)
    • Ubiquiti (6)
    • UDM-Pro (4)
  • Random (3)
  • Wordpress (1)

Tags

Agentless monitoring (3) AP9631 (3) Apache2 (3) APC UPS (6) Bind9 (3) certificates (5) DDNS (5) debian (3) DNS (7) DNSBL (2) DSM (6) Dynamic DNS (4) Firewall (9) gmail (3) Let's Encrypt Certificates (7) monitoring (18) networking (21) NMC (2) PBS (3) pfsense (43) port forwarding (3) privacy (2) proxmox (17) proxmox backup server (3) proxmox virtual environment (16) pve (5) rev202207eng (76) security (28) SNMP (4) SNMPv1 (3) ssh (4) SSL (6) Supermicro (2) Synology (7) udm-pro (5) unifi (6) unifi controller (3) unifi switch (2) UPS (5) VLAN (4) vpn (9) vpn server (2) wifi (4) Zabbix (18) Zabbix Agent2 (11)

See also

Privacy policy

Sitemap

©2025 Geek is the Way! | Design by Superb