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

inbound: allow netmasks in LINKERD2_PROXY_INBOUND_IPS #1164

Closed
wants to merge 14 commits into from

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Jul 23, 2021

This branch extends #1161 to support specifying netmasks in CIDR
notation in the LINKERD2_PROXY_INBOUND_IPS environment variable. This
will cause the proxy to accept connections targeting any IPs that match
that netmask. This isn't strictly necessary, since the proxy injector
only ever sets single IPs in that env variable currently, but I thought
that since we accept CIDRs in other env vars, we may as well accept them
here as well.

In order to continue accepting single IPs without prefix lengths, the
parse_nets function was extended to try parsing as an IP address when
parsing as a CIDR (the ipnet::IpNet type) fails. If this succeeds, we
construct an IpNet from the parsed IP address, with the prefix length
equal to the number of bits in an address of that type (which will match
only that address exactly). The AllowIps request filter was rewritten
to just use IpMatch internally.

In some ways, this is actually simpler, since it uses more of our
existing code for parsing CIDRs and matching IPs.

Depends on #1161

hawkw and others added 14 commits July 22, 2021 09:21
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Previously, this was used to replace the mocked SO_ORIGINAL_DST's IP
address with a totally bogus one. We could do this without breaking
stuff because the inbound proxy would still always forward on localhost.

It doesn't do that anymore, so the IP address part of the mock
SO_ORIGINAL_DST is actually load-bearing now. This commit removes
`inbound_fuzz_addr` from the integration tests.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Co-authored-by: Oliver Gould <ver@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
this isn't particularly important, but...why not!

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
@hawkw hawkw requested review from olix0r and a team July 23, 2021 18:05
@hawkw hawkw marked this pull request as draft July 23, 2021 18:05
@hawkw
Copy link
Member Author

hawkw commented Jul 23, 2021

(this is a draft because it depends on #1161, which is also a draft)

Base automatically changed from eliza/inbound-ips to main September 15, 2021 21:43
@olix0r
Copy link
Member

olix0r commented Sep 16, 2021

I don't think we really need to support this.

@olix0r olix0r closed this Sep 16, 2021
@olix0r olix0r deleted the eliza/inbound-netmasks branch March 7, 2023 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants