Skip to content

Commit

Permalink
Fix Alertmanager receiver firewal to detect 0.0.0.0 and IPv6 interfac…
Browse files Browse the repository at this point in the history
…e-local multicast address as local addresses (#9308)

* Fix receiver firewal to detect 0.0.0.0 and IPv6 interface-local multicast address as local addresses

Signed-off-by: Marco Pracucci <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Vernon Miller <[email protected]>

---------

Signed-off-by: Marco Pracucci <[email protected]>
Co-authored-by: Vernon Miller <[email protected]>
  • Loading branch information
pracucci and aldernero authored Sep 17, 2024
1 parent bdd443b commit 3737b0c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
* [BUGFIX] Alertmanager: Fix config validation gap around unreferenced templates. #9207
* [BUGFIX] Alertmanager: Fix goroutine leak when stored config fails to apply and there is no existing tenant alertmanager #9211
* [BUGFIX] Querier: fix issue where both recently compacted blocks and their source blocks can be skipped during querying if store-gateways are restarting. #9224
* [BUGFIX] Alertmanager: fix receiver firewall to detect `0.0.0.0` and IPv6 interface-local multicast address as local addresses. #9308

### Mixin

Expand Down
2 changes: 1 addition & 1 deletion pkg/util/net/firewall_dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ func (d *FirewallDialer) control(_, address string, _ syscall.RawConn) error {
}

func isLocal(ip net.IP) bool {
return ip.IsLoopback() || ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast()
return ip.IsLoopback() || ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast() || ip.IsInterfaceLocalMulticast() || ip.IsUnspecified()
}
13 changes: 8 additions & 5 deletions pkg/util/net/firewall_dialer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func TestFirewallDialer(t *testing.T) {
cases: []testCase{
{"localhost", false},
{"127.0.0.1", false},
{"0.0.0.0", false},
{"google.com", false},
{"172.217.168.78", false},
},
Expand All @@ -46,15 +47,17 @@ func TestFirewallDialer(t *testing.T) {
cases: []testCase{
{"localhost", true},
{"127.0.0.1", true},
{"0.0.0.0", true},
{"192.168.0.1", true},
{"10.0.0.1", true},
{"google.com", false},
{"172.217.168.78", false},
{"fdf8:f53b:82e4::53", true}, // Local
{"fe80::200:5aee:feaa:20a2", true}, // Link-local
{"2001:4860:4860::8844", false}, // Google DNS
{"::ffff:172.217.168.78", false}, // IPv6 mapped v4 non-private
{"::ffff:192.168.0.1", true}, // IPv6 mapped v4 private
{"fdf8:f53b:82e4::53", true}, // Local
{"fe80::200:5aee:feaa:20a2", true}, // Link-local
{"ff01::2f3b:56a1:88e4:7c9d", true}, // Interface-local multicast address
{"2001:4860:4860::8844", false}, // Google DNS
{"::ffff:172.217.168.78", false}, // IPv6 mapped v4 non-private
{"::ffff:192.168.0.1", true}, // IPv6 mapped v4 private
},
},
"should support blocking custom CIDRs": {
Expand Down

0 comments on commit 3737b0c

Please sign in to comment.