@@ -53,6 +53,7 @@ func (g *Glutton) initConfig() error {
53
53
// If no config is found, use the defaults
54
54
viper .SetDefault ("ports.tcp" , 5000 )
55
55
viper .SetDefault ("ports.udp" , 5001 )
56
+ viper .SetDefault ("ports.ssh" , 22 )
56
57
viper .SetDefault ("max_tcp_payload" , 4096 )
57
58
viper .SetDefault ("conn_timeout" , 45 )
58
59
viper .SetDefault ("rules_path" , "rules/rules.yaml" )
@@ -186,11 +187,11 @@ func (g *Glutton) Start() error {
186
187
187
188
g .startMonitor (quit )
188
189
189
- if err := setTProxyIPTables (viper .GetString ("interface" ), g .publicAddrs [0 ].String (), "tcp" , uint32 (g .Server .tcpPort )); err != nil {
190
+ if err := setTProxyIPTables (viper .GetString ("interface" ), g .publicAddrs [0 ].String (), "tcp" , uint32 (g .Server .tcpPort ), uint32 ( viper . GetInt ( "ports.ssh" )) ); err != nil {
190
191
return err
191
192
}
192
193
193
- if err := setTProxyIPTables (viper .GetString ("interface" ), g .publicAddrs [0 ].String (), "udp" , uint32 (g .Server .udpPort )); err != nil {
194
+ if err := setTProxyIPTables (viper .GetString ("interface" ), g .publicAddrs [0 ].String (), "udp" , uint32 (g .Server .udpPort ), uint32 ( viper . GetInt ( "ports.ssh" )) ); err != nil {
194
195
return err
195
196
}
196
197
@@ -335,11 +336,11 @@ func (g *Glutton) Shutdown() {
335
336
}
336
337
337
338
g .Logger .Info ("FLushing TCP iptables" )
338
- if err := flushTProxyIPTables (viper .GetString ("interface" ), g .publicAddrs [0 ].String (), "tcp" , uint32 (g .Server .tcpPort )); err != nil {
339
+ if err := flushTProxyIPTables (viper .GetString ("interface" ), g .publicAddrs [0 ].String (), "tcp" , uint32 (g .Server .tcpPort ), uint32 ( viper . GetInt ( "ports.ssh" )) ); err != nil {
339
340
g .Logger .Error ("failed to drop tcp iptables" , producer .ErrAttr (err ))
340
341
}
341
342
g .Logger .Info ("FLushing UDP iptables" )
342
- if err := flushTProxyIPTables (viper .GetString ("interface" ), g .publicAddrs [0 ].String (), "udp" , uint32 (g .Server .udpPort )); err != nil {
343
+ if err := flushTProxyIPTables (viper .GetString ("interface" ), g .publicAddrs [0 ].String (), "udp" , uint32 (g .Server .udpPort ), uint32 ( viper . GetInt ( "ports.ssh" )) ); err != nil {
343
344
g .Logger .Error ("failed to drop udp iptables" , producer .ErrAttr (err ))
344
345
}
345
346
0 commit comments