/usr/lib/x86_64-linux-gnu/sshg-fw is in sshguard 1.7.1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #!/bin/sh
# sshg-fw -- control firewall backends
# This file is part of SSHGuard.
# DEVELOPER NOTE: sshg-fw is built from sshg-fw.in and the backend script
# only when the 'configure' script is run. If you change either source files,
# you should re-run 'configure'.
run_iptables() {
cmd=iptables
if [ "6" = "$2" ]; then
cmd=ip6tables
fi
# Check if iptables supports the '-w' flag.
if $cmd -w -V >/dev/null 2>&1; then
$cmd -w $1
else
$cmd $1
fi
}
fw_init() {
run_iptables "-L -n"
}
fw_block() {
run_iptables "-I sshguard -s $1 -j DROP" $2
}
fw_release() {
run_iptables "-D sshguard -s $1 -j DROP" $2
}
fw_flush() {
run_iptables "-F sshguard" 4
run_iptables "-F sshguard" 6
}
fw_fin() {
:
}
fw_init
if [ $? -ne 0 ]; then
echo "Could not initialize firewall" >&2
exit 1
fi
cleanup() {
trap "" EXIT
fw_fin
}
trap cleanup EXIT INT
while read cmd address addrtype; do
case $cmd in
block)
fw_block $address $addrtype;;
release)
fw_release $address $addrtype;;
flush)
fw_flush;;
noop)
;;
*)
break;;
esac
done
|