@@ -27,6 +27,10 @@ type NodeIPTables struct {
27
27
mu sync.Mutex // Protects concurrent access to syncIPTableRules()
28
28
}
29
29
30
+ const (
31
+ OutputFilteringChain iptables.Chain = "OPENSHIFT-OUTPUT-FILTERING"
32
+ )
33
+
30
34
func newNodeIPTables (clusterNetworkCIDR string , syncPeriod time.Duration ) * NodeIPTables {
31
35
return & NodeIPTables {
32
36
ipt : iptables .New (kexec .New (), utildbus .New (), iptables .ProtocolIpv4 ),
@@ -78,6 +82,10 @@ func (n *NodeIPTables) syncIPTableRules() error {
78
82
}()
79
83
glog .V (3 ).Infof ("Syncing openshift iptables rules" )
80
84
85
+ if _ , err := n .ipt .EnsureChain (iptables .TableFilter , OutputFilteringChain ); err != nil {
86
+ return fmt .Errorf ("failed to ensure chain %q exists: %v" , OutputFilteringChain , err )
87
+ }
88
+
81
89
rules := n .getStaticNodeIPTablesRules ()
82
90
for _ , rule := range rules {
83
91
_ , err := n .ipt .EnsureRule (iptables .Prepend , iptables .Table (rule .table ), iptables .Chain (rule .chain ), rule .args ... )
@@ -99,5 +107,6 @@ func (n *NodeIPTables) getStaticNodeIPTablesRules() []FirewallRule {
99
107
{"filter" , "INPUT" , []string {"-i" , "docker0" , "-m" , "comment" , "--comment" , "traffic from docker" , "-j" , "ACCEPT" }},
100
108
{"filter" , "FORWARD" , []string {"-d" , n .clusterNetworkCIDR , "-j" , "ACCEPT" }},
101
109
{"filter" , "FORWARD" , []string {"-s" , n .clusterNetworkCIDR , "-j" , "ACCEPT" }},
110
+ {"filter" , "FORWARD" , []string {"-i" , TUN , "!" , "-o" , TUN , "-m" , "comment" , "--comment" , "administrator overrides" , "-j" , string (OutputFilteringChain )}},
102
111
}
103
112
}
0 commit comments