summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason <jason@openbsd.org>2003-02-14 00:34:14 +0000
committerjason <jason@openbsd.org>2003-02-14 00:34:14 +0000
commit70d450c1772a464035b97cdd13ef8c074da906a3 (patch)
treec4b2bb535c2637ed538fd90802654f83e1a1fc7e
parentno mdec/boot on the ramdisk. name it chewable for the etc/makefiles (diff)
downloadwireguard-openbsd-70d450c1772a464035b97cdd13ef8c074da906a3.tar.xz
wireguard-openbsd-70d450c1772a464035b97cdd13ef8c074da906a3.zip
spamd now uses tables (these load MUCH faster on my ss2); ok deraadt
-rw-r--r--etc/pf.conf7
-rw-r--r--libexec/spamd/spamd-setup.sh26
2 files changed, 12 insertions, 21 deletions
diff --git a/etc/pf.conf b/etc/pf.conf
index 1442fad2a1b..58b75ef87b3 100644
--- a/etc/pf.conf
+++ b/etc/pf.conf
@@ -1,4 +1,4 @@
-# $OpenBSD: pf.conf,v 1.15 2002/12/30 23:17:54 dhartmei Exp $
+# $OpenBSD: pf.conf,v 1.16 2003/02/14 00:34:14 jason Exp $
#
# See pf.conf(5) and /usr/share/pf for syntax and examples.
# General order: options, scrub rules, translation rules, and filter rules.
@@ -35,9 +35,10 @@ external_addr="192.168.1.1"
# outgoing packets will be translated as coming from the external address.
#rdr on $ext_if proto tcp from any to $external_addr/32 port 1234 -> 10.1.1.1 port 5678
-# anchor where spamd-setup(8) attaches spam-redirection to spamd(8).
+# spamd-setup puts addresses to be redirected into table <spamd>
+#table <spamd> persist
#no rdr on { lo0, lo1 } from any to any
-#rdr-anchor spamd inet proto tcp from any to any port = smtp
+#rdr inet proto tcp from { <spamd> } to any port smtp -> 127.0.0.1 port 8025
# filter rules: the implicit first two rules are
#pass in all
diff --git a/libexec/spamd/spamd-setup.sh b/libexec/spamd/spamd-setup.sh
index 94d804b19b6..df63c7dbfaf 100644
--- a/libexec/spamd/spamd-setup.sh
+++ b/libexec/spamd/spamd-setup.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# $OpenBSD: spamd-setup.sh,v 1.5 2003/02/08 10:19:30 pvalchev Exp $
+# $OpenBSD: spamd-setup.sh,v 1.6 2003/02/14 00:34:14 jason Exp $
#
# Copyright (c) 2002 Theo de Raadt. All rights reserved.
#
@@ -25,7 +25,7 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
usage() {
- echo "usage: spamd-setup [-s12] [-f file] [-w whitelist]";
+ echo "usage: spamd-setup [-s12] [-f file]";
exit 1
}
@@ -35,11 +35,7 @@ case $# in
esac
filter() {
- grep -v '#' | cut -d' ' -f1 | sort
-}
-
-pfcmd() {
- awk '{ printf("rdr inet proto tcp from %s to any port 25 -> 127.0.0.1 port 8025\n", $1); } '
+ cut -f1 -d' '
}
fetch() {
@@ -47,12 +43,9 @@ fetch() {
}
R=`mktemp /tmp/_spamdXXXXXX` || exit 1
-W=`mktemp /tmp/_spamwXXXXXX` || {
- rm -f ${R}
- exit 1
-}
-trap "rm -f $R $W; exit 0" 0
-trap "rm -f $R $W; exit 1" 1 2 3 13 15
+
+trap "rm -f $R; exit 0" 0
+trap "rm -f $R; exit 1" 1 2 3 13 15
while :
do case "$1" in
@@ -66,10 +59,6 @@ while :
cat $2 | filter >> $R
shift
;;
- -w)
- cat $2 | filter >> $W
- shift
- ;;
*)
break
;;
@@ -83,5 +72,6 @@ fi
# knock out whitelist here
-cat $R | uniq | pfcmd | pfctl -a spamd:spews -f -
+pfctl -t spamd -T replace -f $R
+
exit 0