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

fix: fix reverse routing for KubeSpan #10074

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dsseng
Copy link
Member

@dsseng dsseng commented Dec 30, 2024

This allows it to not come down when rp_filter is enabled.
Fixes #9814

Signed-off-by: Dmitry Sharshakov [email protected]

Comment on lines 123 to 128
// Consider fwmark for rp_filter routing table lookup.
{
Key: "proc.sys.net.ipv4.conf.kubespan.src_valid_mark",
Value: "1",
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might even consider enabling rp_filter on all interfaces by default as Red Hat and SUSE do for increased security against IP spoofing

This comment was marked as resolved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can set to 1 as default like RHEL

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss that later for 1.10, it's not to be backported like this change is

@@ -120,6 +120,11 @@ func (ctrl *KernelParamDefaultsController) getKernelParams() []*kernel.Param {
Key: "proc.sys.net.ipv4.tcp_keepalive_intvl",
Value: "60",
},
// Consider fwmark for rp_filter routing table lookup.
{
Key: "proc.sys.net.ipv4.conf.kubespan.src_valid_mark",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be rp_filter instead of src_valid_mark 🤔 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rp_filter will get overriden. This is what I mean:

src_valid_mark - BOOLEAN

        0 - The fwmark of the packet is not included in reverse path route lookup. This allows for asymmetric routing configurations utilizing the fwmark in only one direction, e.g., transparent proxying.

        1 - The fwmark of the packet is included in reverse path route lookup. This permits rp_filter to function when the fwmark is used for routing traffic in both directions.

    This setting also affects the utilization of fmwark when performing source address selection for ICMP replies, or determining addresses stored for the IPOPT_TS_TSANDADDR and IPOPT_RR IP options.

    The max value from conf/{all,interface}/src_valid_mark is used.

    Default value is 0.

https://docs.kernel.org/networking/ip-sysctl.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not to disable rp_filter (you cannot override someone enabling rp_filter in mode 2 (loose), like current Kube-Router versions), but to make it honor policy-based routing. To avoid potential side effects we only do this on kubespan interface as it's the interface we do our policy-based routing on.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, that makes sense 👍

This allows it to not come down when rp_filter is enabled.
Fixes siderolabs#9814

Signed-off-by: Dmitry Sharshakov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Proposed
Status: Proposed
Development

Successfully merging this pull request may close these issues.

bug: kube-router and KubeSpan don't play nice together
3 participants