-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the DNS-01 challenge #7
base: main
Are you sure you want to change the base?
Conversation
If SNIKKET_DNS_CHALLENGE is set to 1, or SNIKKET_TWEAK_XMPP_DOMAIN is set, spin up an instance of CoreDNS to respond to DNS challenges. Shut it down once certificates are obtained, and only enable it on renewal. Rationale "Many DNS servers do not provide an API to enable automation for the ACME DNS challenges. Those which do, give the keys way too much power. Leaving the keys laying around your random boxes is too often a requirement to have a meaningful process automation." See https://github.com/joohoi/acme-dns Requirements (domain.tld is SNIKKET_TWEAK_XMPP_DOMAIN or SNIKKET_DOMAIN if not set) - The CNAME record of _acme-challenge.domain.tld needs to point to cert.snikket.domain.tld - The NS record of snikket.domain.tld needs to point to ns-snikket.domain.tld - The A/AAAA record(s) of ns-snikket.domain.tld needs(s) to point to the instance IP address Mechanics - Through a certbot pre-hook, the requirements are first validated (although a failure is only logged). Next, a CoreDNS instance is spun up with just SOA and NS records for snikket.domain.tld, with the NS set to ns-snikket.domain.tld - Using certbot's manual plugin + its authorization hook, the relevant TXT record is added to cert.snikket.domain.tld. Multiple records are supported here, so this script can be used for domain.tld and *.domain.tld in one go. - Through a certbot post-hook, the DNS server is shut down after certificates are obtained. Considerations - Since it is possible that people are hosting their instance on snikket.domain.tld, an override for the DNS ZONE can be added. Alternatively, we can keep the DNS server running, but that will add much more complexity to the setup.
- Add wait time between DNS server creation and NS record check - Add logs to indicate if DNS challenge is being used, and why - Add logs to indicate wait time and completion - Add style file and pre-commit hook (activate with `git config --local core.hooksPath .githooks`)
Instructions to test this out are below: Prerequisites:
Make a new folder and mkdir snikket-custom
cd snikket-custom In the folder, add your
Clone the respective repositories with branches in the same folder: git clone -b split-xmpp-domain https://github.com/Rijul-A/snikket-server
git clone -b dns-challenge https://github.com/Rijul-A/snikket-cert-manager
git clone -b split-xmpp-domain https://github.com/Rijul-A/snikket-web-proxy Add the following as version: "3.3"
services:
snikket_proxy:
container_name: snikket-proxy-custom
build: ./snikket-web-proxy
env_file: snikket.conf
network_mode: host
volumes:
- snikket_data_custom:/snikket
- acme_challenges_custom:/var/www/html/.well-known/acme-challenge
restart: "unless-stopped"
snikket_certs:
container_name: snikket-certs-custom
build: ./snikket-cert-manager
env_file: snikket.conf
volumes:
- snikket_data_custom:/snikket
- acme_challenges_custom:/var/www/.well-known/acme-challenge
restart: "unless-stopped"
ports:
- "53:53/udp"
snikket_portal:
container_name: snikket-portal-custom
image: snikket/snikket-web-portal:beta
network_mode: host
env_file: snikket.conf
restart: "unless-stopped"
snikket_server:
container_name: snikket-custom
build: ./snikket-server
network_mode: host
volumes:
- snikket_data_custom:/snikket
env_file: snikket.conf
restart: "unless-stopped"
volumes:
acme_challenges_custom:
snikket_data_custom: Build the docker images, run and follow the logs: docker-compose build
docker-compose up -d
docker-compose logs --follow Wait for the certificates to be obtained from LE (takes some time, around 3 minutes). If it fails, the logs will indicate why.
Once this is done, you can remove
The certificates obtained are then imported into
Wait a bit, and make an invite for yourself:
|
To prevent `assert( token )` from failing for persistent volumes (certificate renewal or other option changes), remove the file each time the pre-hook is run.
The instructions in comment above helped me bring up a Snikket server with a tweaked domain. In particular, the DNS error checking caught a couple configuration issues. Very helpful, thanks. After fixing the configuration issues, I still had difficulty that I resolved by This build did not provide the web portal. So login fails with "This Snikket service only hosts addresses ending in I, rather blindly, mangled The resulting web portal does not currently support account export as this pull request does not have the necessary snikket-server XEP-227 work. But I do get circle management. And that is good enough for me. Thanks for this work and the instructions. |
If SNIKKET_DNS_CHALLENGE is set to 1, or SNIKKET_TWEAK_XMPP_DOMAIN is
set, spin up an instance of CoreDNS to respond to DNS challenges. Shut
it down once certificates are obtained, and only enable it on renewal.
Rationale
"Many DNS servers do not provide an API to enable automation for the
ACME DNS challenges. Those which do, give the keys way too much power.
Leaving the keys laying around your random boxes is too often a
requirement to have a meaningful process automation."
See https://github.com/joohoi/acme-dns
Requirements (domain.tld is SNIKKET_TWEAK_XMPP_DOMAIN or SNIKKET_DOMAIN
if not set)
cert.snikket.domain.tld
ns-snikket.domain.tld
the instance IP address
Mechanics
(although a failure is only logged). Next, a CoreDNS instance is spun
up with just SOA and NS records for snikket.domain.tld, with the NS
set to ns-snikket.domain.tld
TXT record is added to cert.snikket.domain.tld. Multiple records are
supported here, so this script can be used for domain.tld and
*.domain.tld in one go.
certificates are obtained.
Considerations
snikket.domain.tld, an override for the DNS ZONE can be added.
Alternatively, we can keep the DNS server running, but that will add
much more complexity to the setup.
Related issues