summaryrefslogtreecommitdiffstats
path: root/txrban.txr
diff options
context:
space:
mode:
Diffstat (limited to 'txrban.txr')
-rw-r--r--txrban.txr14
1 files changed, 9 insertions, 5 deletions
diff --git a/txrban.txr b/txrban.txr
index d150e33..f66f76e 100644
--- a/txrban.txr
+++ b/txrban.txr
@@ -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))))