@@ -10,45 +10,45 @@ import (
10
10
11
11
// iptablesOutboundStaticRules is the list of iptables rules related to outbound traffic interception and redirection
12
12
var iptablesOutboundStaticRules = []string {
13
- // Redirects outbound TCP traffic hitting PROXY_REDIRECT chain to Envoy's outbound listener port
14
- fmt .Sprintf ("-A PROXY_REDIRECT -p tcp -j REDIRECT --to-port %d" , constants .EnvoyOutboundListenerPort ),
13
+ // Redirects outbound TCP traffic hitting OSM_PROXY_OUT_REDIRECT chain to Envoy's outbound listener port
14
+ fmt .Sprintf ("-A OSM_PROXY_OUT_REDIRECT -p tcp -j REDIRECT --to-port %d" , constants .EnvoyOutboundListenerPort ),
15
15
16
16
// Traffic to the Proxy Admin port flows to the Proxy -- not redirected
17
- fmt .Sprintf ("-A PROXY_REDIRECT -p tcp --dport %d -j ACCEPT" , constants .EnvoyAdminPort ),
17
+ fmt .Sprintf ("-A OSM_PROXY_OUT_REDIRECT -p tcp --dport %d -j ACCEPT" , constants .EnvoyAdminPort ),
18
18
19
- // For outbound TCP traffic jump from OUTPUT chain to PROXY_OUTPUT chain
20
- "-A OUTPUT -p tcp -j PROXY_OUTPUT " ,
19
+ // For outbound TCP traffic jump from OUTPUT chain to OSM_PROXY_OUTBOUND chain
20
+ "-A OUTPUT -p tcp -j OSM_PROXY_OUTBOUND " ,
21
21
22
22
// Don't redirect Envoy traffic back to itself, return it to the next chain for processing
23
- fmt .Sprintf ("-A PROXY_OUTPUT -m owner --uid-owner %d -j RETURN" , constants .EnvoyUID ),
23
+ fmt .Sprintf ("-A OSM_PROXY_OUTBOUND -m owner --uid-owner %d -j RETURN" , constants .EnvoyUID ),
24
24
25
25
// Skip localhost traffic, doesn't need to be routed via the proxy
26
- "-A PROXY_OUTPUT -d 127.0.0.1/32 -j RETURN" ,
26
+ "-A OSM_PROXY_OUTBOUND -d 127.0.0.1/32 -j RETURN" ,
27
27
28
28
// Redirect remaining outbound traffic to Envoy
29
- "-A PROXY_OUTPUT -j PROXY_REDIRECT " ,
29
+ "-A OSM_PROXY_OUTBOUND -j OSM_PROXY_OUT_REDIRECT " ,
30
30
}
31
31
32
32
// iptablesInboundStaticRules is the list of iptables rules related to inbound traffic interception and redirection
33
33
var iptablesInboundStaticRules = []string {
34
- // Redirects inbound TCP traffic hitting the PROXY_IN_REDIRECT chain to Envoy's inbound listener port
35
- fmt .Sprintf ("-A PROXY_IN_REDIRECT -p tcp -j REDIRECT --to-port %d" , constants .EnvoyInboundListenerPort ),
34
+ // Redirects inbound TCP traffic hitting the OSM_PROXY_IN_REDIRECT chain to Envoy's inbound listener port
35
+ fmt .Sprintf ("-A OSM_PROXY_IN_REDIRECT -p tcp -j REDIRECT --to-port %d" , constants .EnvoyInboundListenerPort ),
36
36
37
- // For inbound traffic jump from PREROUTING chain to PROXY_INBOUND chain
38
- "-A PREROUTING -p tcp -j PROXY_INBOUND " ,
37
+ // For inbound traffic jump from PREROUTING chain to OSM_PROXY_INBOUND chain
38
+ "-A PREROUTING -p tcp -j OSM_PROXY_INBOUND " ,
39
39
40
40
// Skip metrics query traffic being directed to Envoy's inbound prometheus listener port
41
- fmt .Sprintf ("-A PROXY_INBOUND -p tcp --dport %d -j RETURN" , constants .EnvoyPrometheusInboundListenerPort ),
41
+ fmt .Sprintf ("-A OSM_PROXY_INBOUND -p tcp --dport %d -j RETURN" , constants .EnvoyPrometheusInboundListenerPort ),
42
42
43
43
// Skip inbound health probes; These ports will be explicitly handled by listeners configured on the
44
44
// Envoy proxy IF any health probes have been configured in the Pod Spec.
45
45
// TODO(draychev): Do not add these if no health probes have been defined (https://github.com/openservicemesh/osm/issues/2243)
46
- fmt .Sprintf ("-A PROXY_INBOUND -p tcp --dport %d -j RETURN" , livenessProbePort ),
47
- fmt .Sprintf ("-A PROXY_INBOUND -p tcp --dport %d -j RETURN" , readinessProbePort ),
48
- fmt .Sprintf ("-A PROXY_INBOUND -p tcp --dport %d -j RETURN" , startupProbePort ),
46
+ fmt .Sprintf ("-A OSM_PROXY_INBOUND -p tcp --dport %d -j RETURN" , livenessProbePort ),
47
+ fmt .Sprintf ("-A OSM_PROXY_INBOUND -p tcp --dport %d -j RETURN" , readinessProbePort ),
48
+ fmt .Sprintf ("-A OSM_PROXY_INBOUND -p tcp --dport %d -j RETURN" , startupProbePort ),
49
49
50
50
// Redirect remaining inbound traffic to Envoy
51
- "-A PROXY_INBOUND -p tcp -j PROXY_IN_REDIRECT " ,
51
+ "-A OSM_PROXY_INBOUND -p tcp -j OSM_PROXY_IN_REDIRECT " ,
52
52
}
53
53
54
54
// generateIptablesCommands generates a list of iptables commands to set up sidecar interception and redirection
@@ -57,10 +57,10 @@ func generateIptablesCommands(outboundIPRangeExclusionList []string, outboundPor
57
57
58
58
fmt .Fprintln (& rules , `# OSM sidecar interception rules
59
59
*nat
60
- :PROXY_INBOUND - [0:0]
61
- :PROXY_IN_REDIRECT - [0:0]
62
- :PROXY_OUTPUT - [0:0]
63
- :PROXY_REDIRECT - [0:0]` )
60
+ :OSM_PROXY_INBOUND - [0:0]
61
+ :OSM_PROXY_IN_REDIRECT - [0:0]
62
+ :OSM_PROXY_OUTBOUND - [0:0]
63
+ :OSM_PROXY_OUT_REDIRECT - [0:0]` )
64
64
var cmds []string
65
65
66
66
// 1. Create inbound rules
@@ -73,7 +73,7 @@ func generateIptablesCommands(outboundIPRangeExclusionList []string, outboundPor
73
73
portExclusionListStr = append (portExclusionListStr , strconv .Itoa (port ))
74
74
}
75
75
inboundPortsToExclude := strings .Join (portExclusionListStr , "," )
76
- rule := fmt .Sprintf ("-I PROXY_INBOUND -p tcp --match multiport --dports %s -j RETURN" , inboundPortsToExclude )
76
+ rule := fmt .Sprintf ("-I OSM_PROXY_INBOUND -p tcp --match multiport --dports %s -j RETURN" , inboundPortsToExclude )
77
77
cmds = append (cmds , rule )
78
78
}
79
79
@@ -84,7 +84,7 @@ func generateIptablesCommands(outboundIPRangeExclusionList []string, outboundPor
84
84
for _ , cidr := range outboundIPRangeExclusionList {
85
85
// *Note: it is important to use the insert option '-I' instead of the append option '-A' to ensure the exclusion
86
86
// rules take precedence over the static redirection rules. Iptables rules are evaluated in order.
87
- rule := fmt .Sprintf ("-I PROXY_OUTPUT -d %s -j RETURN" , cidr )
87
+ rule := fmt .Sprintf ("-I OSM_PROXY_OUTBOUND -d %s -j RETURN" , cidr )
88
88
cmds = append (cmds , rule )
89
89
}
90
90
@@ -95,7 +95,7 @@ func generateIptablesCommands(outboundIPRangeExclusionList []string, outboundPor
95
95
portExclusionListStr = append (portExclusionListStr , strconv .Itoa (port ))
96
96
}
97
97
outboundPortsToExclude := strings .Join (portExclusionListStr , "," )
98
- rule := fmt .Sprintf ("-I PROXY_OUTPUT -p tcp --match multiport --dports %s -j RETURN" , outboundPortsToExclude )
98
+ rule := fmt .Sprintf ("-I OSM_PROXY_OUTBOUND -p tcp --match multiport --dports %s -j RETURN" , outboundPortsToExclude )
99
99
cmds = append (cmds , rule )
100
100
}
101
101
0 commit comments