aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar alecdwm 2016-04-09 11:44:11 +0200
committerGravatar alecdwm 2016-04-09 11:44:11 +0200
commit2a57f18b63184956ef3521c46804b8dbcee0bc93 (patch)
treebe0e3e17d7d828a49c83bd31edbc1c5a15face16
parent16a73fd7c900f34f2e0d0162cbf7e19d6e8620c9 (diff)
fixed iptablesdrop mode
-rw-r--r--rsham.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/rsham.go b/rsham.go
index 6736bf4..81bc50b 100644
--- a/rsham.go
+++ b/rsham.go
@@ -90,10 +90,10 @@ func sshHandleConnection(mode string, nConn net.Conn, config *ssh.ServerConfig)
ip := nConn.RemoteAddr().String()[:strings.LastIndex(nConn.RemoteAddr().String(), ":")]
sshLog.Info("adding drop rule to iptables for ip", "ip", ip)
- cmd := exec.Command("iptables", "-I INPUT", "-s "+ip, "-j DROP")
- err := cmd.Run()
+ cmd := exec.Command("iptables", "-I", "INPUT", "-s", "ip", "-j", "DROP")
+ out, err := cmd.CombinedOutput()
if err != nil {
- sshLog.Error("error blocking IP", "ip", ip, "error", err)
+ sshLog.Error("error blocking IP", "ip", ip, "error", err, "command output", out)
}
nConn.Close()