summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-08-30 21:09:10 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-08-30 21:09:10 -0700
commit0b33b1cb61bcc49cfdf14589935700ac42a6607f (patch)
treeb400e69e2496a27edaa469d99f892b2a4d4c4f6c
parent3539d92a0260a2095a16bc61ada6a76e48120dac (diff)
downloadtxrban-0b33b1cb61bcc49cfdf14589935700ac42a6607f.tar.gz
txrban-0b33b1cb61bcc49cfdf14589935700ac42a6607f.tar.bz2
txrban-0b33b1cb61bcc49cfdf14589935700ac42a6607f.zip
Use a variable for iptables command.
-rw-r--r--txrban.txr5
1 files changed, 3 insertions, 2 deletions
diff --git a/txrban.txr b/txrban.txr
index 27b5c10..086f4b0 100644
--- a/txrban.txr
+++ b/txrban.txr
@@ -1,5 +1,6 @@
@(include "config")
@(include "utils")
+@(bind iptables "iptables")
@(do
(defstruct client-info nil
(ip nil)
@@ -55,7 +56,7 @@
(cond
((not cli.banned)
(unless *dry-run*
- (sh `@{*off*}iptables -I INPUT 1 -s @{cli.ip} -i @{*iface*} -j DROP`))
+ (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)))
@@ -89,7 +90,7 @@
(defun unban (cli)
(unless *dry-run*
- (sh `@{*off*}iptables -D INPUT -s @{cli.ip} -i @{*iface*} -j DROP`))
+ (sh `@{*off*}@iptables -D INPUT -s @{cli.ip} -i @{*iface*} -j DROP`))
(debug "unbanned ~a\n" cli.ip)
(set cli.banned nil))