forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iptables: always use restore format (istio#53066)
* iptables: always use restore format This has been the default and only used value for >5 years. Just make it the only option. This introduces some breakages to tests, which are now legitimately failing. I don't know why they didn't fail before. These are around the new iptables idempotency logic. There are a few bugs here: * NFLOG quoting was resulting in double quotes. This is due to a mismatch of iptables input vs iptables-save output (as indicated would be a risk on the PR). * We have some NFLOGs that are not on Istio chains which breaks the logic. We should have these! I removed them, but would loveto add them back * `-A PREROUTING -m conntrack --ctstate INVALID -j DROP` rule is not on Istio chain. We need to fix this. * add nflog back * move drop to its own chain * fixes * drop unused
1 parent
6f6f3d1
commit 9a85305
Showing
65 changed files
with
1,399 additions
and
1,302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
iptables -t mangle -N ISTIO_PRERT | ||
iptables -t nat -N ISTIO_PRERT | ||
iptables -t nat -N ISTIO_OUTPUT | ||
iptables -t mangle -N ISTIO_OUTPUT | ||
iptables -t raw -N ISTIO_OUTPUT | ||
iptables -t raw -N ISTIO_PRERT | ||
iptables -t mangle -A PREROUTING -j ISTIO_PRERT | ||
iptables -t mangle -A OUTPUT -j ISTIO_OUTPUT | ||
iptables -t nat -A OUTPUT -j ISTIO_OUTPUT | ||
iptables -t raw -A PREROUTING -j ISTIO_PRERT | ||
iptables -t raw -A OUTPUT -j ISTIO_OUTPUT | ||
iptables -t nat -A PREROUTING -j ISTIO_PRERT | ||
iptables -t mangle -A ISTIO_PRERT -m mark --mark 0x539/0xfff -j CONNMARK --set-xmark 0x111/0xfff | ||
iptables -t nat -A ISTIO_PRERT -s 169.254.7.127 -p tcp -m tcp -j ACCEPT | ||
iptables -t nat -A ISTIO_OUTPUT -d 169.254.7.127 -p tcp -m tcp -j ACCEPT | ||
iptables -t nat -A ISTIO_PRERT ! -d 127.0.0.1/32 -p tcp ! --dport 15008 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15006 | ||
iptables -t mangle -A ISTIO_OUTPUT -m connmark --mark 0x111/0xfff -j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff | ||
iptables -t nat -A ISTIO_OUTPUT ! -o lo -p udp -m mark ! --mark 0x539/0xfff -m udp --dport 53 -j REDIRECT --to-port 15053 | ||
iptables -t nat -A ISTIO_OUTPUT ! -d 127.0.0.1/32 -p tcp --dport 53 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15053 | ||
iptables -t raw -A ISTIO_OUTPUT -p udp -m mark --mark 0x539/0xfff -m udp --dport 53 -j CT --zone 1 | ||
iptables -t raw -A ISTIO_PRERT -p udp -m mark ! --mark 0x539/0xfff -m udp --sport 53 -j CT --zone 1 | ||
iptables -t nat -A ISTIO_OUTPUT -p tcp -m mark --mark 0x111/0xfff -j ACCEPT | ||
iptables -t nat -A ISTIO_OUTPUT ! -d 127.0.0.1/32 -o lo -j ACCEPT | ||
iptables -t nat -A ISTIO_OUTPUT ! -d 127.0.0.1/32 -p tcp -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15001 | ||
* mangle | ||
-N ISTIO_PRERT | ||
-N ISTIO_OUTPUT | ||
-A PREROUTING -j ISTIO_PRERT | ||
-A OUTPUT -j ISTIO_OUTPUT | ||
-A ISTIO_PRERT -m mark --mark 0x539/0xfff -j CONNMARK --set-xmark 0x111/0xfff | ||
-A ISTIO_OUTPUT -m connmark --mark 0x111/0xfff -j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff | ||
COMMIT | ||
* nat | ||
-N ISTIO_PRERT | ||
-N ISTIO_OUTPUT | ||
-A OUTPUT -j ISTIO_OUTPUT | ||
-A PREROUTING -j ISTIO_PRERT | ||
-A ISTIO_PRERT -s 169.254.7.127 -p tcp -m tcp -j ACCEPT | ||
-A ISTIO_OUTPUT -d 169.254.7.127 -p tcp -m tcp -j ACCEPT | ||
-A ISTIO_PRERT ! -d 127.0.0.1/32 -p tcp ! --dport 15008 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15006 | ||
-A ISTIO_OUTPUT ! -o lo -p udp -m mark ! --mark 0x539/0xfff -m udp --dport 53 -j REDIRECT --to-port 15053 | ||
-A ISTIO_OUTPUT ! -d 127.0.0.1/32 -p tcp --dport 53 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15053 | ||
-A ISTIO_OUTPUT -p tcp -m mark --mark 0x111/0xfff -j ACCEPT | ||
-A ISTIO_OUTPUT ! -d 127.0.0.1/32 -o lo -j ACCEPT | ||
-A ISTIO_OUTPUT ! -d 127.0.0.1/32 -p tcp -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15001 | ||
COMMIT | ||
* raw | ||
-N ISTIO_OUTPUT | ||
-N ISTIO_PRERT | ||
-A PREROUTING -j ISTIO_PRERT | ||
-A OUTPUT -j ISTIO_OUTPUT | ||
-A ISTIO_OUTPUT -p udp -m mark --mark 0x539/0xfff -m udp --dport 53 -j CT --zone 1 | ||
-A ISTIO_PRERT -p udp -m mark ! --mark 0x539/0xfff -m udp --sport 53 -j CT --zone 1 | ||
COMMIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,60 @@ | ||
iptables -t mangle -N ISTIO_PRERT | ||
iptables -t nat -N ISTIO_PRERT | ||
iptables -t nat -N ISTIO_OUTPUT | ||
iptables -t mangle -N ISTIO_OUTPUT | ||
iptables -t raw -N ISTIO_OUTPUT | ||
iptables -t raw -N ISTIO_PRERT | ||
iptables -t mangle -A PREROUTING -j ISTIO_PRERT | ||
iptables -t mangle -A OUTPUT -j ISTIO_OUTPUT | ||
iptables -t nat -A OUTPUT -j ISTIO_OUTPUT | ||
iptables -t raw -A PREROUTING -j ISTIO_PRERT | ||
iptables -t raw -A OUTPUT -j ISTIO_OUTPUT | ||
iptables -t nat -A PREROUTING -j ISTIO_PRERT | ||
iptables -t mangle -A ISTIO_PRERT -m mark --mark 0x539/0xfff -j CONNMARK --set-xmark 0x111/0xfff | ||
iptables -t nat -A ISTIO_PRERT -s 169.254.7.127 -p tcp -m tcp -j ACCEPT | ||
iptables -t nat -A ISTIO_OUTPUT -d 169.254.7.127 -p tcp -m tcp -j ACCEPT | ||
iptables -t nat -A ISTIO_PRERT ! -d 127.0.0.1/32 -p tcp ! --dport 15008 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15006 | ||
iptables -t mangle -A ISTIO_OUTPUT -m connmark --mark 0x111/0xfff -j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff | ||
iptables -t nat -A ISTIO_OUTPUT ! -o lo -p udp -m mark ! --mark 0x539/0xfff -m udp --dport 53 -j REDIRECT --to-port 15053 | ||
iptables -t nat -A ISTIO_OUTPUT ! -d 127.0.0.1/32 -p tcp --dport 53 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15053 | ||
iptables -t raw -A ISTIO_OUTPUT -p udp -m mark --mark 0x539/0xfff -m udp --dport 53 -j CT --zone 1 | ||
iptables -t raw -A ISTIO_PRERT -p udp -m mark ! --mark 0x539/0xfff -m udp --sport 53 -j CT --zone 1 | ||
iptables -t nat -A ISTIO_OUTPUT -p tcp -m mark --mark 0x111/0xfff -j ACCEPT | ||
iptables -t nat -A ISTIO_OUTPUT ! -d 127.0.0.1/32 -o lo -j ACCEPT | ||
iptables -t nat -A ISTIO_OUTPUT ! -d 127.0.0.1/32 -p tcp -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15001 | ||
ip6tables -t mangle -N ISTIO_PRERT | ||
ip6tables -t nat -N ISTIO_PRERT | ||
ip6tables -t nat -N ISTIO_OUTPUT | ||
ip6tables -t mangle -N ISTIO_OUTPUT | ||
ip6tables -t raw -N ISTIO_OUTPUT | ||
ip6tables -t raw -N ISTIO_PRERT | ||
ip6tables -t mangle -A PREROUTING -j ISTIO_PRERT | ||
ip6tables -t mangle -A OUTPUT -j ISTIO_OUTPUT | ||
ip6tables -t nat -A OUTPUT -j ISTIO_OUTPUT | ||
ip6tables -t raw -A PREROUTING -j ISTIO_PRERT | ||
ip6tables -t raw -A OUTPUT -j ISTIO_OUTPUT | ||
ip6tables -t nat -A PREROUTING -j ISTIO_PRERT | ||
ip6tables -t mangle -A ISTIO_PRERT -m mark --mark 0x539/0xfff -j CONNMARK --set-xmark 0x111/0xfff | ||
ip6tables -t nat -A ISTIO_PRERT -s e9ac:1e77:90ca:399f:4d6d:ece2:2f9b:3164 -p tcp -m tcp -j ACCEPT | ||
ip6tables -t nat -A ISTIO_OUTPUT -d e9ac:1e77:90ca:399f:4d6d:ece2:2f9b:3164 -p tcp -m tcp -j ACCEPT | ||
ip6tables -t nat -A ISTIO_PRERT ! -d ::1/128 -p tcp ! --dport 15008 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15006 | ||
ip6tables -t mangle -A ISTIO_OUTPUT -m connmark --mark 0x111/0xfff -j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff | ||
ip6tables -t nat -A ISTIO_OUTPUT ! -o lo -p udp -m mark ! --mark 0x539/0xfff -m udp --dport 53 -j REDIRECT --to-port 15053 | ||
ip6tables -t nat -A ISTIO_OUTPUT ! -d ::1/128 -p tcp --dport 53 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15053 | ||
ip6tables -t raw -A ISTIO_OUTPUT -p udp -m mark --mark 0x539/0xfff -m udp --dport 53 -j CT --zone 1 | ||
ip6tables -t raw -A ISTIO_PRERT -p udp -m mark ! --mark 0x539/0xfff -m udp --sport 53 -j CT --zone 1 | ||
ip6tables -t nat -A ISTIO_OUTPUT -p tcp -m mark --mark 0x111/0xfff -j ACCEPT | ||
ip6tables -t nat -A ISTIO_OUTPUT ! -d ::1/128 -o lo -j ACCEPT | ||
ip6tables -t nat -A ISTIO_OUTPUT ! -d ::1/128 -p tcp -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15001 | ||
* mangle | ||
-N ISTIO_PRERT | ||
-N ISTIO_OUTPUT | ||
-A PREROUTING -j ISTIO_PRERT | ||
-A OUTPUT -j ISTIO_OUTPUT | ||
-A ISTIO_PRERT -m mark --mark 0x539/0xfff -j CONNMARK --set-xmark 0x111/0xfff | ||
-A ISTIO_OUTPUT -m connmark --mark 0x111/0xfff -j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff | ||
COMMIT | ||
* nat | ||
-N ISTIO_PRERT | ||
-N ISTIO_OUTPUT | ||
-A OUTPUT -j ISTIO_OUTPUT | ||
-A PREROUTING -j ISTIO_PRERT | ||
-A ISTIO_PRERT -s 169.254.7.127 -p tcp -m tcp -j ACCEPT | ||
-A ISTIO_OUTPUT -d 169.254.7.127 -p tcp -m tcp -j ACCEPT | ||
-A ISTIO_PRERT ! -d 127.0.0.1/32 -p tcp ! --dport 15008 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15006 | ||
-A ISTIO_OUTPUT ! -o lo -p udp -m mark ! --mark 0x539/0xfff -m udp --dport 53 -j REDIRECT --to-port 15053 | ||
-A ISTIO_OUTPUT ! -d 127.0.0.1/32 -p tcp --dport 53 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15053 | ||
-A ISTIO_OUTPUT -p tcp -m mark --mark 0x111/0xfff -j ACCEPT | ||
-A ISTIO_OUTPUT ! -d 127.0.0.1/32 -o lo -j ACCEPT | ||
-A ISTIO_OUTPUT ! -d 127.0.0.1/32 -p tcp -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15001 | ||
COMMIT | ||
* raw | ||
-N ISTIO_OUTPUT | ||
-N ISTIO_PRERT | ||
-A PREROUTING -j ISTIO_PRERT | ||
-A OUTPUT -j ISTIO_OUTPUT | ||
-A ISTIO_OUTPUT -p udp -m mark --mark 0x539/0xfff -m udp --dport 53 -j CT --zone 1 | ||
-A ISTIO_PRERT -p udp -m mark ! --mark 0x539/0xfff -m udp --sport 53 -j CT --zone 1 | ||
COMMIT | ||
* mangle | ||
-N ISTIO_PRERT | ||
-N ISTIO_OUTPUT | ||
-A PREROUTING -j ISTIO_PRERT | ||
-A OUTPUT -j ISTIO_OUTPUT | ||
-A ISTIO_PRERT -m mark --mark 0x539/0xfff -j CONNMARK --set-xmark 0x111/0xfff | ||
-A ISTIO_OUTPUT -m connmark --mark 0x111/0xfff -j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff | ||
COMMIT | ||
* nat | ||
-N ISTIO_PRERT | ||
-N ISTIO_OUTPUT | ||
-A OUTPUT -j ISTIO_OUTPUT | ||
-A PREROUTING -j ISTIO_PRERT | ||
-A ISTIO_PRERT -s e9ac:1e77:90ca:399f:4d6d:ece2:2f9b:3164 -p tcp -m tcp -j ACCEPT | ||
-A ISTIO_OUTPUT -d e9ac:1e77:90ca:399f:4d6d:ece2:2f9b:3164 -p tcp -m tcp -j ACCEPT | ||
-A ISTIO_PRERT ! -d ::1/128 -p tcp ! --dport 15008 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15006 | ||
-A ISTIO_OUTPUT ! -o lo -p udp -m mark ! --mark 0x539/0xfff -m udp --dport 53 -j REDIRECT --to-port 15053 | ||
-A ISTIO_OUTPUT ! -d ::1/128 -p tcp --dport 53 -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15053 | ||
-A ISTIO_OUTPUT -p tcp -m mark --mark 0x111/0xfff -j ACCEPT | ||
-A ISTIO_OUTPUT ! -d ::1/128 -o lo -j ACCEPT | ||
-A ISTIO_OUTPUT ! -d ::1/128 -p tcp -m mark ! --mark 0x539/0xfff -j REDIRECT --to-ports 15001 | ||
COMMIT | ||
* raw | ||
-N ISTIO_OUTPUT | ||
-N ISTIO_PRERT | ||
-A PREROUTING -j ISTIO_PRERT | ||
-A OUTPUT -j ISTIO_OUTPUT | ||
-A ISTIO_OUTPUT -p udp -m mark --mark 0x539/0xfff -m udp --dport 53 -j CT --zone 1 | ||
-A ISTIO_PRERT -p udp -m mark ! --mark 0x539/0xfff -m udp --sport 53 -j CT --zone 1 | ||
COMMIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
iptables -t nat -N ISTIO_POSTRT | ||
iptables -t nat -A POSTROUTING -j ISTIO_POSTRT | ||
iptables -t nat -A ISTIO_POSTRT -m owner --socket-exists -p tcp -m set --match-set istio-inpod-probes-v4 dst -j SNAT --to-source 169.254.7.127 | ||
* nat | ||
-N ISTIO_POSTRT | ||
-A POSTROUTING -j ISTIO_POSTRT | ||
-A ISTIO_POSTRT -m owner --socket-exists -p tcp -m set --match-set istio-inpod-probes-v4 dst -j SNAT --to-source 169.254.7.127 | ||
COMMIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
iptables -t nat -N ISTIO_POSTRT | ||
iptables -t nat -A POSTROUTING -j ISTIO_POSTRT | ||
iptables -t nat -A ISTIO_POSTRT -m owner --socket-exists -p tcp -m set --match-set istio-inpod-probes-v4 dst -j SNAT --to-source 169.254.7.127 | ||
ip6tables -t nat -N ISTIO_POSTRT | ||
ip6tables -t nat -A POSTROUTING -j ISTIO_POSTRT | ||
ip6tables -t nat -A ISTIO_POSTRT -m owner --socket-exists -p tcp -m set --match-set istio-inpod-probes-v6 dst -j SNAT --to-source fd16:9254:7127:1337:ffff:ffff:ffff:ffff | ||
* nat | ||
-N ISTIO_POSTRT | ||
-A POSTROUTING -j ISTIO_POSTRT | ||
-A ISTIO_POSTRT -m owner --socket-exists -p tcp -m set --match-set istio-inpod-probes-v4 dst -j SNAT --to-source 169.254.7.127 | ||
COMMIT | ||
* nat | ||
-N ISTIO_POSTRT | ||
-A POSTROUTING -j ISTIO_POSTRT | ||
-A ISTIO_POSTRT -m owner --socket-exists -p tcp -m set --match-set istio-inpod-probes-v6 dst -j SNAT --to-source fd16:9254:7127:1337:ffff:ffff:ffff:ffff | ||
COMMIT |
Oops, something went wrong.