From 6635180ffd66066ed11af48106c0102d39adb251 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 29 Jul 2018 07:56:29 +0200 Subject: [PATCH] test: Update MacOS firewall commands Make commands in conntest.sh match the newer variants in test.sh. Also add a missing sudo. --- test/conntest.sh | 14 ++++++++------ test/test.sh | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/test/conntest.sh b/test/conntest.sh index 61d6c3b..96dc49a 100755 --- a/test/conntest.sh +++ b/test/conntest.sh @@ -5,8 +5,9 @@ fw_drop_port() { case `uname` in Linux) sudo iptables -A OUTPUT -p tcp --dport $1 -j DROP;; - Darwin) - sudo ipfw add 100 drop tcp from any to 127.0.0.1 dst-port $1;; + Darwin|OpenBSD) + echo "block drop out proto tcp from any to 127.0.0.1 port $1" \ + | sudo pfctl -a pgbouncer -f -;; *) echo "Unknown OS";; esac @@ -16,8 +17,9 @@ fw_reject_port() { case `uname` in Linux) sudo iptables -A OUTPUT -p tcp --dport $1 -j REJECT --reject-with tcp-reset;; - Darwin) - sudo ipfw add 100 reset tcp from any to 127.0.0.1 dst-port $1;; + Darwin|OpenBSD) + echo "block return-rst out proto tcp from any to 127.0.0.1 port $1" \ + | sudo pfctl -a pgbouncer -f -;; *) echo "Unknown OS";; esac @@ -28,8 +30,8 @@ fw_reset() { case `uname` in Linux) sudo iptables -F;; - Darwin) - sudo ipfw del 100;; + Darwin|OpenBSD) + sudo pfctl -a pgbouncer -F all;; *) echo "Unknown OS"; exit 1;; esac diff --git a/test/test.sh b/test/test.sh index 00dc62c..2ebb530 100755 --- a/test/test.sh +++ b/test/test.sh @@ -136,7 +136,7 @@ fw_reset() { Linux) sudo iptables -F OUTPUT;; Darwin|OpenBSD) - pfctl -a pgbouncer -F all;; + sudo pfctl -a pgbouncer -F all;; *) echo "Unknown OS"; exit 1;; esac -- 2.40.0