mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
Add firewall address-sets: named sets of IP addresses and networks, usable as zone sources for per-IP access control, issue #1189. Static entries are part of the configuration; dynamic entries are managed at runtime with new add/remove/flush actions, from the CLI or over NETCONF/RESTCONF. Dynamic entries survive firewall configuration changes but are not saved to the configuration. Sets with a timeout expire their entries automatically. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
35 lines
1.1 KiB
Bash
Executable File
35 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
SCRIPT_PATH="$(dirname "$(readlink -f "$0")")"
|
|
JSON="$SCRIPT_PATH/json/firewall-overview.json"
|
|
CLI="$SCRIPT_PATH/../../../src/statd/python/cli_pretty/cli_pretty.py"
|
|
|
|
strip_ansi() {
|
|
sed 's/\x1b\[[0-9;]*m//g'
|
|
}
|
|
|
|
echo "1..2"
|
|
|
|
OUT1="$(cat "$JSON" | "$CLI" show-firewall | strip_ansi)"
|
|
if printf '%s\n' "$OUT1" | grep -q "Address Sets" &&
|
|
printf '%s\n' "$OUT1" | grep -q "allowed" &&
|
|
printf '%s\n' "$OUT1" | grep -q "greylist" &&
|
|
printf '%s\n' "$OUT1" | grep -q "ADDR SET" &&
|
|
printf '%s\n' "$OUT1" | grep -q "trusted" &&
|
|
printf '%s\n' "$OUT1" | grep -q "greylist" ; then
|
|
echo "ok 1 - show-firewall includes address-set summaries"
|
|
else
|
|
echo "not ok 1 - show-firewall missing address-set overview"
|
|
exit 1
|
|
fi
|
|
|
|
OUT2="$(cat "$JSON" | "$CLI" show-firewall-zone trusted | strip_ansi)"
|
|
if printf '%s\n' "$OUT2" | grep -q "address-sets" &&
|
|
printf '%s\n' "$OUT2" | grep -q "allowed, greylist" ; then
|
|
echo "ok 2 - show-firewall-zone shows zone address-sets"
|
|
exit 0
|
|
fi
|
|
|
|
echo "not ok 2 - show-firewall-zone missing zone address-sets"
|
|
exit 1
|