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

auth udp: use stubDoResolve for ALIAS #14594

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

zeha
Copy link
Collaborator

@zeha zeha commented Aug 27, 2024

Short description

Implements @Habbie's "alternate outcome" from #13039.

Somebody please tell me what is wrong with this :)

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

@coveralls
Copy link

coveralls commented Aug 27, 2024

Pull Request Test Coverage Report for Build 10760451933

Details

  • 63 of 104 (60.58%) changed or added relevant lines in 4 files are covered.
  • 55 unchanged lines in 16 files lost coverage.
  • Overall coverage increased (+0.02%) to 64.679%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pdns/dnspacket.cc 6 8 75.0%
pdns/tcpreceiver.cc 6 9 66.67%
pdns/stubresolver.cc 1 5 20.0%
pdns/packethandler.cc 50 82 60.98%
Files with Coverage Reduction New Missed Lines %
pdns/auth-main.cc 1 61.47%
modules/gpgsqlbackend/gpgsqlbackend.cc 1 88.62%
pdns/backends/gsql/gsqlbackend.hh 1 97.71%
pdns/signingpipe.cc 1 87.37%
pdns/iputils.hh 1 78.29%
pdns/misc.cc 1 64.05%
pdns/tcpreceiver.cc 1 66.92%
modules/godbcbackend/sodbc.cc 2 70.8%
pdns/iputils.cc 3 54.53%
pdns/recursordist/test-syncres_cc2.cc 3 88.85%
Totals Coverage Status
Change from base Build 10738945676: 0.02%
Covered Lines: 124524
Relevant Lines: 161874

💛 - Coveralls

@zeha zeha force-pushed the zeha-13039-udp-dostubresolve branch from e9c86c0 to 69fde7f Compare August 27, 2024 16:05
@zeha zeha changed the title auth udp: use stubDoResolve auth udp: use stubDoResolve for ALIAS Aug 27, 2024
@zeha zeha force-pushed the zeha-13039-udp-dostubresolve branch 8 times, most recently from fa04ca4 to 95880fa Compare August 28, 2024 09:14
@zeha zeha force-pushed the zeha-13039-udp-dostubresolve branch from 95880fa to 312119e Compare August 28, 2024 13:43
@zeha zeha marked this pull request as ready for review August 28, 2024 14:37
@zeha zeha requested a review from Habbie September 2, 2024 14:02
@Habbie
Copy link
Member

Habbie commented Sep 3, 2024

this emits A+RRSIG for me, very nice. Did not verify the signature but I'm confident.

@Habbie
Copy link
Member

Habbie commented Sep 3, 2024

Somebody please tell me what is wrong with this :)

haven't found anything yet! We'll need tests though

@Habbie Habbie added this to the auth-5 milestone Sep 3, 2024
@zeha
Copy link
Collaborator Author

zeha commented Sep 3, 2024

Somebody please tell me what is wrong with this :)

haven't found anything yet! We'll need tests though

I took the passing of the existing ALIAS tests as good enough. If you have something specific to test in mind, please let me know!

@Habbie
Copy link
Member

Habbie commented Sep 3, 2024

I took the passing of the existing ALIAS tests as good enough. If you have something specific to test in mind, please let me know!

oh. I didn't even check if we had those :D I'll have a look, testing the DNSSEC bits would probably be nice now.

@klaus-nicat
Copy link
Contributor

klaus-nicat commented Sep 3, 2024

this emits A+RRSIG for me, very nice. Did not verify the signature but I'm confident.

Does that mean that this PR also solves the problem of signing ALIAS responses?

@Habbie
Copy link
Member

Habbie commented Sep 6, 2024

Does that mean that this PR also solves the problem of signing ALIAS responses?

sure feels that way. Please test and give us your opinion :)

I took the passing of the existing ALIAS tests as good enough. If you have something specific to test in mind, please let me know!

the existing tests are good besides, indeed, the DNSSEC thing. We test plenty of DNSSEC in regression-tests/ but not so much in .auth-py/ currently. I'm not sure what's the easiest path is here. Perhaps just start with +DO on a query from test_ALIAS.py and see if an RRSIG appears.

@Habbie
Copy link
Member

Habbie commented Sep 6, 2024

oohh "Dnspython can do simple DNSSEC signature validation and signing."

@zeha
Copy link
Collaborator Author

zeha commented Sep 7, 2024

Now with DNSSEC tests using dnspython.

@zeha zeha force-pushed the zeha-13039-udp-dostubresolve branch from 5add661 to 1ba2386 Compare September 7, 2024 23:07
@zeha zeha force-pushed the zeha-13039-udp-dostubresolve branch 2 times, most recently from be40330 to 6ae28d7 Compare September 8, 2024 13:22
@zeha zeha force-pushed the zeha-13039-udp-dostubresolve branch from 6ae28d7 to d127b24 Compare September 8, 2024 13:48
@mind04
Copy link
Contributor

mind04 commented Sep 9, 2024

I like the idea of dnssec and ALIAS.

There is however something you cannot ignore. Using stubDoResolve will make ALIAS much more sensitive to exhausting all available backends.

There are similarities wit LUA but the big difference with ALIAS is it's legacy. ALIAS is deployed in many places and is hand out to customers. Hopefully this didn't happen for LUA records ;)

@zeha
Copy link
Collaborator Author

zeha commented Sep 9, 2024

Using stubDoResolve will make ALIAS much more sensitive to exhausting all available backends.

Yeah that was also my concern. But I guess one can a) get more backends and b) employ ratelimiting in front and also behind the auth.

@Habbie
Copy link
Member

Habbie commented Sep 9, 2024

Given that the diff to packethandler itself is quite small, I wonder if we can give users the choice between 'old' (dnsproxy) and 'new' (stubDoResolve)

@zeha
Copy link
Collaborator Author

zeha commented Sep 9, 2024

I wonder if we can give users the choice

Seems possible, but code and test complexity will go up.

I can type it in, if we know we want this.

@Habbie
Copy link
Member

Habbie commented Sep 9, 2024

Seems possible, but code and test complexity will go up.

understood

I can type it in, if we know we want this.

if people have existing deployments where users have the ability to enter ALIASed names (which I'm sure they do), I'm afraid @mind04's concerns are relevant. I did not think about existing users enough, before.

@klaus-nicat
Copy link
Contributor

What exactly is the problem with stubDoResolve and the Backends? Why does resolving a domain requires a backend?

@Habbie
Copy link
Member

Habbie commented Sep 9, 2024

What exactly is the problem with stubDoResolve and the Backends? Why does resolving a domain requires a backend?

in this PR, the resolving happens synchronously inside the distributor thread, which has a database connection open

@klaus-nicat
Copy link
Contributor

in this PR, the resolving happens synchronously inside the distributor thread, which has a database connection open

"synchronously" sounds bad. Was the old code also synchronously or asynchronous?

@Habbie
Copy link
Member

Habbie commented Sep 12, 2024

"synchronously" sounds bad. Was the old code also synchronously or asynchronous?

The old code was asynchronous, which is why doing DNSSEC there was so hard it never happened.

@klaus-nicat
Copy link
Contributor

klaus-nicat commented Sep 12, 2024

That's bad. Having a zone with

*.example.com.  ALIAS zone.with.nonresponding.nameservers.

and someone doing <random>.example.com with a few queries per second can cause a DoS attack.

Do we have the same problem already if the incoming queries use TCP?

@zeha
Copy link
Collaborator Author

zeha commented Sep 22, 2024

Do we have the same problem already if the incoming queries use TCP?

No, only in the AXFR path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants