Does anybody have a guide to setting up the DNS-01 challenge on NS8, and incorporating the resulting certificates into Traefik for HTTPS routing?
I have HTTP-01 working, but it requires that services are exposed to the Internet via HTTP in the first instance, and I have internal services accessed via DNS name that I do not want exposed to the internet.
Searching the forum provides some references to doing this on NS7, but I am unsure about the applicability to NS8.
I am assuming I could replicate the wildcard certificate/key into redis to match the mail hostname, but that would require additional steps when the certificate is updated.
It would be more better for the script to check for a wildcard domain match first and use that rather than just checking ${MAIL_HOSTNAME}.
I’ll see if I can figure out some code to do that.
As there have been no updates on this matter, I manually replaced the certificate files (selfsigned.crt and selfsigned.key) with the wildcard certificate in the following directory:
/home/traefik1/.config/state/
This solution is functioning correctly on all nodes and remains effective even after a reboot.
Note:
I also updated the certificates for Dovecot and Postfix at the following locations:
The trickiest part was to set the environment variable INFOMANIAK_ACCESS_TOKEN for my DNS provider Infomaniak.
I have added the environment variable for the token to the service ../systemd/user/traefik.service as described here: Custom ACME Server - tls error to server - #6 by Tbaile
--env=INFOMANIAK_ACCESS_TOKEN=<my-token> \
Reload systemd with systemctl --user daemon-reload
Restart traefik service with systemctl --user restart traefik
Finally I was able to create the certificate (I had to increase the default timeout):
[root@test ~]# api-cli run module/traefik1/set-certificate --data '{"fqdn":"test1.mydomain.com", "sync_timeout":120}'
Warning: using user "cluster" credentials from the environment
{"obtained": true}
However, I don’t like the part with editing the service file. Does anybody know a better way?
The solution for issue 7300 is not limited to custom CA certificates. You can pass any environment variable to Traefik with it, including the provider’s token. And this is exactly what we need to make DNS-01 work.
This approach is better than exposing the token in the container command line.
If this works, somebody could write a complete Howto post with detailed steps.
From the API point of view (set-acme-server/get-acme-server), we probably need to handle the DNS-01 challenge beside HTTP-01 and the new default, TLS-ALPN-01.
Hello Davide
You are welcome and thank you for your input! It was fun to dive into new technologies and to provide some information to a great product.
After removing the token from ../systemd/user/traefik.service and following your two steps, I can confirm this is working now:
[root@test ~]# api-cli run module/traefik1/set-certificate --data '{"fqdn":"test3.mydomain.com", "sync_timeout":120}'
Warning: using user "cluster" credentials from the environment
{"obtained": true}
However, sometimes I ran into a timeout obtaining a certificate and I don’t know why. How can I get more verbose log information apart from the UI traefik1 app log?