Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Automating ACME Letsencrypt

    Scheduled Pinned Locked Moved ACME
    12 Posts 8 Posters 7.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      joppybt
      last edited by

      A small hijack of this topic: I have the same problem with the Squid reverse proxy. Renewal of the certificate works fine but Squid keeps serving the old certificate.

      The renew action is set to /usr/local/etc/rc.d/squid.sh restart but that does not help. Even when I ssh into the box and do this restart manually it makes no difference.
      What however does help is pressing Save in the Squid reverse proxy page.

      My guess: Squid makes a local copy of the certificates in "/usr/local/etc/squid" and only refreshes this on Save, not on reload.
      Is there a way to do this 'Save' as renewal action after the ACME refresh?

      1 Reply Last reply Reply Quote 0
      • remis4R
        remis4
        last edited by

        Thank you for the replies.

        Im testing some commands to automate restarting haproxy in a couple of instances (When my cert renews and when my WAN IP changes). We had some power outages this week and my WAN ip has changed 3 times (UPS keeps pfsense up, but remote VZ gateway went down and my ip changed). I noticed i needed to restart HAProxy for it to successfully route to my webservers after my WAN ip would change. I have python script to update godaddy A record if a change is detected, and at the end of the script i would like to restart haproxy, but i got the following error (still testing)

        : /usr/local/bin/python2.7

        from subprocess import call
        call(["/usr/local/etc/rc.d/haproxy.sh", "restart"])
        Restarting haproxy.
        Starting haproxy.
        cannot open command socket, haproxy not running? (Permission denied)0

        The logs read:
        Mar 1 22:06:04 php-cgi haproxy: startup error output!: [ALERT] 059/220604 (79520) : Starting frontend GLOBAL: cannot switch final and temporary UNIX sockets [/tmp/haproxy.socket]
        Mar 1 22:06:04 php-cgi haproxy: started new pid:89543
        Mar 1 22:06:04 php-cgi haproxy: reload old pid:89543

        any advice is appreciated!

        1 Reply Last reply Reply Quote 0
        • remis4R
          remis4
          last edited by

          So the ACME action section has THE example i was looking for to restart haproxy. That's simple enough of a fix when my cert renews.

          On another note, I wrote a script that works as a cron job in pfSense to update GoDaddy A records.

          https://github.com/nkleck/Godaddy-DDNS.git

          Its a bit simpler than some of the other options out there, but its written with libraries already available in pfsense FreeBSD python. So you dont have to worry about installing requests, its using urllib2  :-X . The usage is pretty straight forward in the cron job.

          2 * * * * root /usr/local/bin/python2.7 /home/<your user="">/godaddy-ddns.py hostname.domain.tld

          It also restarts HAProxy at the end of it if a change was detected. Not sure if its needed, as I found today the 'Reload behaviour' checkbox in HAProxy that might do the same thing.</your>

          1 Reply Last reply Reply Quote 0
          • B
            blarg3891
            last edited by

            Why dont you just use cname with a dyndns provider for your godaddy records so you dont have to update them?  One of my domains dns is hosted with namecheap.  Namecheap allows you to create your own free dyndns records.  You would then go into godaddy and create a cname that points to this record.  Setup dynamic dns in pfsense. Every time your IP is updated in pfsense, it will auto update the cname.  I find this is the easiest method.

            Your way works fine, i'm sure, just letting you know.

            1 Reply Last reply Reply Quote 0
            • remis4R
              remis4
              last edited by

              I use namecheap for a domain i own. but im also hosting a FQDN for someone else, of which I do not have a choice, they are using godaddy.

              1 Reply Last reply Reply Quote 0
              • J
                jpns
                last edited by

                Is domain ownership validation performed on every renewal, or only on the initial issuance?

                1 Reply Last reply Reply Quote 0
                • Y
                  yodaphone
                  last edited by

                  @remis4:

                  I use namecheap for a domain i own. but im also hosting a FQDN for someone else, of which I do not have a choice, they are using godaddy.

                  AFAIK acme package doesnt work with Namecheap. so i move my dns to cloudflare (free account).

                  1 Reply Last reply Reply Quote 0
                  • MikeV7896M
                    MikeV7896
                    last edited by

                    @jpns:

                    Is domain ownership validation performed on every renewal, or only on the initial issuance?

                    I'm pretty sure it's on every renewal, to make sure that if the domain were sold/traded, you can't still renew a certificate for that domain as the previous owner of it.

                    The S in IOT stands for Security

                    1 Reply Last reply Reply Quote 0
                    • jimpJ
                      jimp Rebel Alliance Developer Netgate
                      last edited by

                      There is a grace period on the authz and beyond that it must revalidate. I can't remember the exact time limit, they keep lowering it as the service matures.

                      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                      Need help fast? Netgate Global Support!

                      Do not Chat/PM for help!

                      1 Reply Last reply Reply Quote 0
                      • R
                        r0bb10
                        last edited by

                        @remis4:

                        So the ACME action section has THE example i was looking for to restart haproxy. That's simple enough of a fix when my cert renews.

                        On another note, I wrote a script that works as a cron job in pfSense to update GoDaddy A records.

                        https://github.com/nkleck/Godaddy-DDNS.git

                        Its a bit simpler than some of the other options out there, but its written with libraries already available in pfsense FreeBSD python. So you dont have to worry about installing requests, its using urllib2  :-X . The usage is pretty straight forward in the cron job.

                        2 * * * * root /usr/local/bin/python2.7 /home/<your user="">/godaddy-ddns.py hostname.domain.tld

                        It also restarts HAProxy at the end of it if a change was detected. Not sure if its needed, as I found today the 'Reload behaviour' checkbox in HAProxy that might do the same thing.</your>

                        hi, i saw you script for the DNS A record on Godaddy, is it possible to make it work to change the @ record? i'm just to dumb to figure out how to change it :|

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.