How to create a Let’s Encrypt wildcard certificate on a Synology NAS

I love the Let’s Encrypt functionality on the Synology but the built-in solution will not allow you to create a wildcard certificate. From a security standpoint a good way to do certificates with SAN’s but if you are like me and run a home lab… The pain of doing it the SAN way with domain DNS validation and having a /29 ipv4 public subnet is a bitch…

I always need to change a few of my public DNS IP’s to point to the Synology or the auto-renewal will fail. Also, there is a stupid 255 character limit in the SAN text box on the Synology.. so having a few SAN’s is fine but there is a limit… Hence here comes the wildcard and for a lab, it makes life easy. Below is my guide to do this manually every 3 months. I will be working out on how to automate this renewal.

How to create a wildcard on a Synology

We are going to use the script to accomplish this. For authentication of the domain name, we will use the DNS option. First login to your Synology with ssh as the admin user and then sudo -i to get root access. When you login into the Synology with ssh you will end up in the /root path. I assume for the rest of the guide we run everything from that path. Now we need to get the script and change the permissions so it is executable.

chmod a+x
Next we issue the certificate:
Note: replace * with your own domain. To add top-level domain or multi-domain add “-d  yourdomain
./ --issue -d * --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please

You will get an output like below:

Registering account
Creating domain key
The domain key is here: /root/**
Single domain='*'
Getting domain auth token for each domain
Getting webroot for domain='*'
You need to add the txt record manually.
Add the following TXT record:
Domain: ''
TXT value: 'ThIsISNoTtHeReAlKeY'
Please be aware that you prepend _acme-challenge. before your domain
so the resulting subdomain will be:
Please add the TXT records to the domains, and re-run with --renew.
Please add '--debug' or '--log' to check more details.

As you can see you will have to create a DNS text record with your domain name provider according to the output I marked. Needless to say that you need to use your own values.After you created it we will have to run the script again with –renew.
Note: It can take some time for DNS records to get updated. Depends on your provider for my provider it is less than a minute. For renewal, after 3 months you can just run the renew command.

./ --renew -d * --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please

When all goes well you get an output like below:

Your cert is in /root/**
Your cert key is in /root/**
The intermediate CA cert is in /root/*
And the full chain certs is there: /root/*

Now copy the files to an accessible share on your NAS. In my case a made a share called Certs with the subfolder of in it.:

cp "/root/**" "/volume1/Certs/"
cp "/root/**" "/volume1/Certs/"
cp "/root/*" "/volume1/Certs/"
cp "/root/*" "/volume1/Certs/"

You will see that the files will be in that folder after running the cp actions.

You can close the SSH session now and for security reasons, you can also disable SSH.
All you need to do now is to import your certificate on the Synology if you want or just start using it where you need it!

To import it on your Synology

If you use your Synology as a reverse proxy and ssl ofloader like me this is pretty darn handy!
Go to the Control Panel, then Security and Certificate. Choose Add.

Then import

And put in the files requested.

Now you’re done and you have a Let’s Encrypt wildcard certificate.

1 thought on “How to create a Let’s Encrypt wildcard certificate on a Synology NAS

  1. Tone

    You’re a wizard, thank so much! I was looking for a single solution for synology and you give me!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.