[LetsEncrypt] How To in XG

Hi Guys,

interested in a little self written Guide for LetsEncrypt on XG? 

UTM has a LE Support for WAF (since UTM9.6). But on XG you can use LE certificates as well! Seems like many people does not know, that you simply need a little Linux server and 5-10 minutes of your time each 3 month. 

If you are interested in this topic, just leave a comment, will write this guide for you. Would replace this Thread so stay tuned and comment to get the alert :) 

 

 

*Update* 

Some facts. 

First of all, i want to share the "how it works" page of LE. https://letsencrypt.org/how-it-works/

 

 

My Setup. 

Internet - XG - Ubuntu 18.04 LTS

Ubuntu has "certbot" installed. Feel free to use other LE modules. 

https://certbot.eff.org/

https://certbot.eff.org/lets-encrypt/ubuntubionic-apache

Follow straight the Guide for your OS. I am relying fully on those apps for the renewal process. (Myself, certbot seems to be very easy to handle). 

 

Next step is, i am choosing the HTTP-01 Method for LE, so i need a DNAT for LE to my Ubuntu.

PS: You can try to figure out the LE used DNS / IP and specify this DNAT or simply activate this Firewall in Case of renewal the Certificate. But most likely you will not get those...

https://community.letsencrypt.org/t/can-i-get-list-ip-from-letsencrypt/57117

PS2: You could switch to the DNS validation like explained in this Community thread. 

 

 

Next steps would be to check your Domain. Your DNS should point to your WAN IP. Otherwise this Process will not work. 

So perform a dig / nslookup of your Domain. It should point to your WAN IP, so your DNAT will work and HTTP packets are forwarded to Certbot. 

PS: i did not test this process with Sophos dynamic DNS. Feel free to try it! Most likely it will work.

https://community.sophos.com/kb/en-us/123126

 

 

Lets start certbot and try it. 

(i have to point you to your rubric of certbot).

My renewal process is straight forward:

 

(Be careful with this process. LE blocks you after couple of "failed" request for some time. So check everything!).

 

 

So in the End you will get 4 files. 

Public, Chain, Fullchain, Privatkey Certificates. 

 

You will use this Public and Privatkey Certificate. 

There are couple of "ways" to upload this to XG. 

 

The first LE Cert can be simply uploaded. 

You should use the Public.pem in "Certificate" and the Privatkey in "Privat key". 

Ps: you have to rename the Privatkey.pem to Privatkey.key, otherwise XG will not take this certificate. 

 

Optionally you can upload the other Chain and fullchain Certificate under Certificate Authorities (Without Privat key). 

 

Now you can use this Certificate for WAF/Webadmin etc. 

 

In case of renewal (Each 90 Days), you have to choose a process. 

You can simply upload the new LE certificate with another Name and replace it in WAF/Webadmin. 

Or you can "update" the current LE certificate with new public.pem / privat.key. But for this method, you have to switch to a fallback certificate in WAF/Webadmin, because XG cannot update a certificate, which is currently in use. 

 

 

 

 

After all, those steps are manual process each 90 Days. 

You can "script" this, if you want to. So basically upload the certificate each 90 Days to XG. 

https://community.sophos.com/kb/en-us/132560

Other member in the community performed already scripts for this.

https://community.sophos.com/products/xg-firewall/f/sophos-xg-firewall-general-discussion/102208/upload-certificate-using-api

 

The point is, i will not share script examples in this community, most likely because i cannot support them. 

If you want to script this, this community can help you in case you are struggling with a point! 

So simply open a new Thread with your issue with the API, we will try to find a solution. 

  • Would be very interested, am using LE and do a manual renew every 3 months.

  • Me too.

    Teach-in videos library needs a solid lifting.  I used to rely on firewalls.com video on Youtube, but many are based on old version of XG and touch mostly the surface only.  Aside Sophos own Website, it is hard to find learning stuff that applies to XG on the net.

    Paul Jr

  • I would like get this gude!

  • Hi,

     

    Any progress on finishing / publishing / sharing the above mentioned guide?

     

    Thnx, Peter-Paul

  • In reply to Peter-Paul Gras:

    Hi, 

    I am kinda busy right now in other projects / stuffs...

    So i have to renew some certificates end of Jan, so i will wrap up this process then. 

     

    Cheers

  • In reply to LuCar Toni:

    Excellent. I'm following up.

    Paul Jr

  • Right now I am keeping my UTM active, mostly for this function.  I've just been too lazy to set up the process myself, so I would take a look if you put one up.  Thanks!

  • We also need a guide for LE on XG

    Thanks

  • In reply to SGH:

    Updated this Thread with some facts.

    Most likely not the content, you excepted. 

    Feel free to share your thoughts about the automated process. 

    I can help you to build a script for it, but most likely i can only help to call the correct API on XG. I am not able to help you in your Script for calling certbot, renaming files etc pp. 

    This is more likely a serverfault / stackoverflow domain. 

  • Ive been running a Hyper-V VM on my LAN with a DNAT rule for HTTP & HTTPS to this and a standard rule for LAN to WAN with IPS enabled, but for some reason the LE bot cannot update the _acme.domain TXT record using an API.  Ive had it work once when i disabled all the IPS and filtering on both rules but it soon failed on a reboot of the VM.  Has anyone got any advice on the best practices for rules for LE acme bots?

    Thanks

  • In reply to LuCar Toni:

    Is this guide already made? I would also like to have this guide. I use the captive portal and it would be great if I can get a cert working on it.

    Your assistance is much appreciated.

     

    Thank you,

    KM

  • In reply to Sleepy_admin:

    The initial Post should cover most of the facts about Lets Encrypt in XG right now. 

  • In reply to LuCar Toni:

    Hi again,

    I have a couple questions.

    1. Are you using Ubuntu Server or Desktop?

    I'm familiar with Ubuntu Desktop and I spun up a VM of it on my Windows machine yesterday. I set up Certbot according to the instruction manual on Certbot's site. There's no GUI for Certbot and it's all done from Terminal right? 

    2. Can you provide a little more detail on the firewall rule. I've tried following your guide but got stuck at that point. I'll post a screenshot of the issue. I'm using Sophos DDNS because I don't have a static IP and I've taken the liberty to strike that from the screenshot.

    Can you help me resolve get this working?

    KM

  • In reply to Sleepy_admin:

    i used Ubuntu LTS 18 but this should not be important. Most likely certbot is easy to use. 

    https://certbot.eff.org/lets-encrypt/ubuntubionic-apache

     

    The Firewall Rule should be "Business Application". 

    It should be WAN to WAN XG IP. Service HTTP. And Should forward this traffic to Ubuntu. 

     

  • Good read! Thanks!