Page MenuHomeFreeBSD

Disable ICMP (v4) redirects by default
AcceptedPublic

Authored by emaste on May 6 2024, 3:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 20, 11:26 AM
Unknown Object (File)
Sat, Sep 19, 12:03 AM
Unknown Object (File)
Fri, Sep 18, 11:52 PM
Unknown Object (File)
Fri, Sep 18, 11:07 PM
Unknown Object (File)
Fri, Sep 18, 9:22 AM
Unknown Object (File)
Fri, Sep 11, 2:57 PM
Unknown Object (File)
Wed, Sep 2, 8:42 AM
Unknown Object (File)
Wed, Sep 2, 8:07 AM

Details

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste requested review of this revision.May 6 2024, 3:14 PM

Based on discussion on a recent secteam call. After putting this together I discovered D23329, which provides an rc.conf setting defaulting to AUTO which is set to yes (drop) if a routing daemon is enabled, and no if not - so if we do want to make this change we'll want to update rc.d/routing as well.

CC @donner and @melifaro.

I agree that this default is a long due to be changed. Needs to be mentioned in Release Notes, though.

switch userland default as well

libexec/rc/rc.d/routing
341

I don't think there's an issue with just changing the var itself from AUTO to YES (i.e., avoiding the underscore-prefixed dance)

ceri added inline comments.
libexec/rc/rc.d/routing
340

Is the |โ€โ€ still appropriate?
It seems to have the wrong default behaviour if this is somehow unset.

libexec/rc/rc.d/routing
340

Default is now yes, so choosing yes if unset seems appropriate?

libexec/rc/rc.d/routing
340

A very fine point; was reading backwards.

rgrimes added inline comments.
libexec/rc/rc.d/routing
341

For systems doing "updates" just switching auto to yes *may* break some installations.

libexec/rc/rc.d/routing
341

That's kind of the point here. At some point we have to break some eggs. We will doing this for 15 and not intending to MFC. It will be a release note item.

346

Should we print this on the yes case given it is now the default?

libexec/rc/rc.d/routing
346

Hrm, good question. This is one of the unfortunate side effects of negative-sense sysctls; we print a message in all of the "= 1" cases so there's some argument for keeping that for consistency. We could instead print ignore ICMP redirect=NO in the no case I suppose.

libexec/rc/rc.d/routing
341

Also note that redirects are a performance optimization, if a system changes to yes after upgrade it won't "break" in the sense of network unreachability.

ICMP6:

VNET_DEFINE_STATIC(int, icmp6_rediraccept) = 1;
#define V_icmp6_rediraccept     VNET(icmp6_rediraccept)
SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT, rediraccept,
    CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(icmp6_rediraccept), 0,
    "Accept ICMPv6 redirect messages");

It appears there's no rc.conf machinery to configure this though?

A long long time ago ( I was a student then ), I enabled drop_redirect on one of my VM, but the router ( out of my control ) keep sending ICMP redirects. That confused me for quite a long time until I figured out that is perfect legitimate for routers to do that.

I meant, if the industry encourage disabling sending ICMP redirects on routers, then it is good time to drop ICMP redirects on a host, for security reason.

Is there a reason we shouldn't go ahead with this?

Is there a reason we shouldn't go ahead with this?

+1

I'm surprised this wasn't already done. :)

In practice everyone drops redirects at the edges but it's good hygiene to drop them on the host too.

This revision is now accepted and ready to land.Thu, Sep 10, 10:57 AM

Regarding v6, ICMP6 redirects are validated more than v4 redirects: they are ignored when forwarding is enabled, they need to come from a link-local addr and they need to come from the current next-hop gateway. It's not obvious to me that we want to drop v6 redirects by default.

Regarding v6, ICMP6 redirects are validated more than v4 redirects: they are ignored when forwarding is enabled, they need to come from a link-local addr and they need to come from the current next-hop gateway. It's not obvious to me that we want to drop v6 redirects by default.

... we should probably make it more clear in the man page that this applies to v4 only.

While here., the variable and sysctl can be changed to bool.