-
Notifications
You must be signed in to change notification settings - Fork 18.8k
libnet: Don't forward to upstream resolvers on internal nw #47538
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
Conversation
3a5a6c3
to
999a014
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with one missing comment.
// an internal network. This way, it's the driver responsibility to make sure `connect` syscall fails fast when | ||
// no external connectivity is available (eg. by not setting a default gateway). | ||
sb.resolver = NewResolver(resolverIPSandbox, true, sb) | ||
sb.resolver = NewResolver(resolverIPSandbox, sb.getGatewayEndpoint() != nil, sb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a comment here that explains the proxyDNS/internal relationship.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's done, thank you.
999a014
to
13d4546
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, comments aside
Commit cbc2a71 makes `connect` syscall fail fast when a container is only attached to an internal network. Thanks to that, if such a container tries to resolve an "external" domain, the embedded resolver returns an error immediately instead of waiting for a timeout. This commit makes sure the embedded resolver doesn't even try to forward to upstream servers. Co-authored-by: Albin Kerouanton <albinker@gmail.com> Signed-off-by: Rob Murray <rob.murray@docker.com>
13d4546
to
790c303
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for moving this forward.
Shouldn't the GHSA-mq39-4gv4-mvpx package/version list also refer to moby/moby? It's currently only talking about docker. |
The name of the Go codebase in this repo is |
since moby/moby#47538, dns isn't forward automaticlly into internal networks, and we need to create a specfic network that has a gatway, for it to work as we expect and forward DNS requests out Fixes: scylladb#7302 Ref: moby/moby#47538
since moby/moby#47538, dns isn't forward automaticlly into internal networks, and we need to create a specfic network that has a gatway, for it to work as we expect and forward DNS requests out Fixes: scylladb#7302 Ref: moby/moby#47538
Correct. But as I read it both packages are equally affected, right? So both should be listed in the advisory, otherwise moby would not be matched by automated tools. I.e. I'm confused that e.g. GHSA-rc4r-wh2q-q6c4 uses moby/moby but this one does not. |
There is only one package; github.com/docker/docker is a redirect to github.com/moby/moby. As far as Go is concerned, there is only one package, as relative imports do not exist. That GHSA has an incorrect Go package identified, and should be corrected: github/advisory-database#4144. |
since moby/moby#47538, dns isn't forward automaticlly into internal networks, and we need to create a specfic network that has a gatway, for it to work as we expect and forward DNS requests out Fixes: scylladb#7302 Ref: moby/moby#47538
since moby/moby#47538, dns isn't forward automaticlly into internal networks, and we need to create a specfic network that has a gatway, for it to work as we expect and forward DNS requests out Fixes: scylladb#7302 Ref: moby/moby#47538
Ok, thanks for the clarification. Here are some more: |
It sounds like we'll have to reach out to GitHub's security team regarding how they editorialize advisories. Thanks for bringing this to our attention! |
since moby/moby#47538, dns isn't forward automaticlly into internal networks, and we need to create a specfic network that has a gatway, for it to work as we expect and forward DNS requests out Fixes: #7302 Ref: moby/moby#47538
since moby/moby#47538, dns isn't forward automaticlly into internal networks, and we need to create a specfic network that has a gatway, for it to work as we expect and forward DNS requests out Fixes: #7302 Ref: moby/moby#47538 (cherry picked from commit b23e17a)
since moby/moby#47538, dns isn't forward automaticlly into internal networks, and we need to create a specfic network that has a gatway, for it to work as we expect and forward DNS requests out Fixes: #7302 Ref: moby/moby#47538 (cherry picked from commit b23e17a)
#47662 is open to track this regression; please 👍 there instead of commenting on related issues, or adding a "me too." |
Hey, I see this change was backported to 25.0 and 23.0, is 24.0 not affected by this issue? |
|
@akerouanton thanks for the clarification! |
since moby/moby#47538, dns isn't forward automaticlly into internal networks, and we need to create a specfic network that has a gatway, for it to work as we expect and forward DNS requests out Fixes: #7302 Ref: moby/moby#47538 (cherry picked from commit b23e17a)
- What I did
CVE-2024-29018
Picked up Albin's change from #46609 - and added a regression test.
Commit cbc2a71 makes
connect
syscall fail fast when a container is only attached to an internal network. Thanks to that, if such a container tries to resolve an "external" domain, the embedded resolver returns an error immediately instead of waiting for a timeout.This commit makes sure the embedded resolver doesn't even try to forward to upstream servers - this is important when the host's DNS server is running on a localhost address. In this case, the internal resolver's upstream DNS requests are made from the host's network namespace, so they work even when the network is declared as 'internal'. Communication with external DNS servers is unexpected for an internal network.
- How Albin did it
Add a way to enable/disable upstream forwarding to the embedded resolver. When an endpoint joins/leaves a sandbox, this forwarding policy is modified based on whether there's an endpoint providing external connectivity.
- How to verify it
New regression test.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)