diff options
Diffstat (limited to 'txrban.txr')
-rw-r--r-- | txrban.txr | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -54,7 +54,8 @@ (new-until (+ time howlong))) (cond ((not cli.banned) - (sh `@{*off*}iptables -I INPUT 1 -s @{cli.ip} -i @{*iface*} -j DROP`) + (unless *dry-run* + (sh `@{*off*}iptables -I INPUT 1 -s @{cli.ip} -i @{*iface*} -j DROP`)) (debug "banned ~a for ~a starting on ~a\n" cli.ip (hrtime howlong) (time-string-local time "%c")) (set cli.banned (rcons time new-until))) @@ -85,11 +86,14 @@ (unban cli)))) (defun unban (cli) - (sh `@{*off*}iptables -D INPUT -s @{cli.ip} -i @{*iface*} -j DROP`) + (unless *dry-run* + (sh `@{*off*}iptables -D INPUT -s @{cli.ip} -i @{*iface*} -j DROP`)) (debug "unbanned ~a\n" cli.ip) (set cli.banned nil)) (cond - (t (daemon nil nil) - (openlog `txrban-@self` log-pid log-authpriv)) - (nil (set *stdlog* *stdout*)))) + (*dry-run* + (set *stdlog* *stdout*)) + (t + (daemon nil nil) + (openlog `txrban-@self` log-pid log-authpriv)))) |