Skip to content
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

nixos/security/acme: Add DNS resolver option #99948

Merged
merged 1 commit into from Oct 7, 2020
Merged

Conversation

@jsimonetti
Copy link
Contributor

@jsimonetti jsimonetti commented Oct 7, 2020

Motivation for this change

When using the ACME DNS-01 challenge, there is a possibility of a
failure to resolve the challenge if the record is not propagated
fast enough. To circumvent this generic DNS problem, this adds
a setting to explicitly tell the ACME provider to use a certain DNS
resolver to lookup the challenge.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • [ X ] NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • [ X ] Fits CONTRIBUTING.md.
When using the ACME DNS-01 challenge, there is a possibility of a
failure to resolve the challenge if the record is not propagated
fast enough. To circumvent this generic DNS problem, this adds
a setting to explicitly tell the ACME provider to use a certain DNS
resolver to lookup the challenge.

Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
@andir
Copy link
Member

@andir andir commented Oct 7, 2020

Thanks for this PR!

Do you have some details on how the issue did surface for you? Just yesterday I filed a PR that fixed a race of ACME with local resolvers (#99901). Could this maybe also fix your issue?

That being said, there is no reason not to support the option you are proposing.

Overall 👍 to this.

@jsimonetti
Copy link
Contributor Author

@jsimonetti jsimonetti commented Oct 7, 2020

Hi @andir
I encountered this when using DNS-01 with cloudflare as the DNS provider. If I did not use their 1.1.1.1 server as resolver, the request for the challenge would fail on the letsencrypt end. I only recently changed from a docker based setup to using the acme nix module.
I have seen this same behaviour on the docker setup I had and other linux machines too and adding the specific option resolved it there also. This leads me to believe it has something to do with the DNS propagation being slow either with letsencrypt or cloudflare and nothing with the module itself.

I can't really comment on the unbound issue, as I do not use that.

@andir
Copy link
Member

@andir andir commented Oct 7, 2020

Interesting. This looks good to me. Let us see what the @NixOS/acme team thinks about this.

Copy link
Contributor

@m1cr0man m1cr0man left a comment

This looks good! dnsResolver is a good name for the argument. I don't think we need any extra tests for this.

@andir andir merged commit 9cc924a into NixOS:master Oct 7, 2020
17 checks passed
17 checks passed
tests tests
Details
action
Details
Evaluation Performance Report Evaluator Performance Report
Details
Wait for ofborg
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="cc3ce9a"; rev="cc3ce9a13a32ce2326127c6af7ca6cabcdd71f2d"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="cc3ce9a"; rev="cc3ce9a13a32ce2326127c6af7ca6cabcdd71f2d"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="cc3ce9a"; rev="cc3ce9a13a32ce2326127c6af7ca6cabcdd71f2d"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="cc3ce9a"; rev="cc3ce9a13a32ce2326127c6af7ca6cabcdd71f2d"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="cc3ce9a"; rev="cc3ce9a13a32ce2326127c6af7ca6cabcdd71f2d"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="cc3ce9a"; rev="cc3ce9a13a32ce2326127c6af7ca6cabcdd71f2d"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="cc3ce9a"; rev="cc3ce9a13a32ce2326127c6af7ca6cabcdd71f2d"; } ./pkgs/t
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
@jsimonetti jsimonetti deleted the jsimonetti:acme-dnsresolver branch Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.