SSL cert automation (outside of LetsEncrypt)


The PBX is located behind a firewall and port 80 and 443 are in use, this means Lets Encrypt wont work on this box, however i need items like ZULU which needs a certificate. I can get certificates, so whats the best way to automate saving the external certificate in to the box?

Most are valid for 60-90 days and i dont want to be uploading a cert every 60 days. Assuming there’s no module i can load, the other way would be the exposé the cert path through a share so i can copy the new PEM and CRT file in OR a scrit inside freePBX that runs to collect the certificate PEM and CRT files…

Any ideas?
Many Thanks

If you have a covered nameservice or are prepared to move to one, I suggest dns-01 over http-01, no ports needed , le can do it but this one covers more services

It also has hook-scripts for all sorts of services not just web-servers

This topic has some ideas about how to automate the process:

And completely agree with @dicko that DNS validation is the way to go if you can make it work. Cloudflare DNS is free and works well.

Not so for the Free tld’s at CF

??? Not sure what you mean here.

These two conditions alone do not prevent you from using LE certs with auto renewal. This is an extremely common setup.

Apparently CloudFlare’s API for ‘free’ TopLevelDomains accounts cant be scripted to issue a certificate. I just posted Mr. Pangs tske, i don’t have CF anymore.

Not true, unless I’m grandfathered in, but one account isn’t that old, so it would have to be a recent change.

Yes, it worked for me too before I moved everything to DO where DNS is comprehensive , fully scriptable with doctl and free , even for non DO hosted hosts…

I merely posted Mr. Pang’s notes on DNS services

Easy way to test dns auth without moving your current dns hosting is to use

Assumptions: Your current DNS provider does not support API access, and you want to use dns-01 auth to generate a cert for your.pbx.fqdn.

Ultimately you need to move to a provider with an API, but this is a way to test and should get past the blank page syndrome.

1: Install curl | sh -s [email protected]

2: Log out and back into your current shell. Needed to pick up the changes from installing

3: Login to with your preferred method.

4: Copy your duckdns token somewhere:

5: Create a domain:

6:duckdns should now look like:

7: Log into your current dns provider’s management page and create a CNAME record for _acme-challenge.<your.pbx.fqdn>and point to your newly created duckdns domain(

8: Run using dnsalias mode, we have to export our duckdns token into the environment:

export DuckDNS_Token="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -d <your.pbx.fqdn> --challenge-alias <> --dns dns_duckdns --issue

Thinks this (using DNS) should be an option in the LetsEncrypt for Admin Pro

Please explain how to use LE when both port 80 and 443 cant be accessed on the PBX (when the whole PC cant be accessed from outside), Admin Pro says LE has to be port 80…

Please advise

Dns-01 is not a partucularly easy option to script, either you have to manually put the txt record in your DNS server or use one of the 130 and growing supported ones over the various acme clients that do dns-01, but each one uses a different method though.

For http-01, you will have to preempt port 80 and allow the world for the brief time the acme client verifies the url. or have a redirection particular to the ‘well-known’ request on whatever is serving port 80

If I get off my a** and finish it up, there will be at least a 3rd party version of certman that will support dns-01 auth.

I have an backed version of certman with working dns-01 and http-01

The time consuming work is in simplifying the options and GUI presentation enough to keep from overwhelming those that aren’t network geeks without giving up too much functionality.

Of course, the fact that I am not a PHP guy, and it’s currently a “tinkering” project may have something to do with the speed or lack thereof.


As i was writing the message i thought the DNS had to be dynamically updated as well, going to submit a feature request about this, as its problematic if items like ZULU wants to be used with no outside access to port 80 and 443, there’s no way to automate the SSL process without hacking up the system somehow.

There’s already a two year+ ticket open. @xrobau had actually done an initial (very incomplete/not functional) commit.

I started with that, but ultimately went in a slightly different direction. It will be interesting to see if it gets torn apart.

Even when(if) I get to the point of submitting a PR (and I won’t until I think it’s production ready), I would be hesitant to merge if I were in Sangoma’s shoes. It’s a support problem with the all the additional factors it adds that are outside Sangoma’s control - itself, the various plugins, varying dns providers and APIs, etc.

Letsencrypt HTTP-01 needs to dynamically update whatever is responding on port 80 at the URL you are trying to issue a certificate for. whereas DNS-01 needs to dynamically update your DNS records, So HTTP-01 needs access to your server whereas DNS-01 needs no access over any port to your server.

Perhaps we can ask what name service are you currently using? you can use

dig +short ns

Ive seen a few of the scripts…

Ive also requested an automated process to “import” a key and crt file, i have those, can get them in to the correct location (/etc/asterisk/keys i think the folder is), however it still needs manual work to then make them live in the system, if that can be automated that would work as well.

fwconsole certificates --help

there a bunch of CLI options to manage certs

from --help

These parameters are to install the cert to nginx/apache or any other server after issue/renew a cert:                              
  --cert-file <file>                Path to copy the cert file to after issue/renew..                                                 
  --key-file <file>                 Path to copy the key file to after issue/renew.                                                   
  --ca-file <file>                  Path to copy the intermediate cert file to after issue/renew.                                     
  --fullchain-file <file>           Path to copy the fullchain cert file to after issue/renew.                                        
  --reloadcmd <command>             Command to execute after issue/renew to reload the server.   

set the --cert-file and key-file to /etc/asterisk/keys/your.domain.(crt and key)

–reloadcmd ‘fwconsole certificates --updateall;systemctl httpd reload’

That will work for DNS-01 or HTTP-01 and be fully automated by’s cron job

(you will have to fwconsole certificates import;fwconsole certificates --set-default=X after the first time you use to issue a certificate and make sure your webserver is using the cert and key in /etc/asterisk/keys)

1 Like