summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2003-02-14 05:51:58 +0000
committerJason Wright <jason@cvs.openbsd.org>2003-02-14 05:51:58 +0000
commitc17f4034a524f3d7b0c3d69fa6ea2b4e86a5111b (patch)
treef5a5bbff9230c4fa49f0e06f0d2ff3b2d7210969 /libexec
parent3bced4dc2511d2584c35be4d2f328916477b69b8 (diff)
Add back -w support (was -much- easier than I thought)
Diffstat (limited to 'libexec')
-rw-r--r--libexec/spamd/spamd-setup.831
-rw-r--r--libexec/spamd/spamd-setup.sh14
2 files changed, 32 insertions, 13 deletions
diff --git a/libexec/spamd/spamd-setup.8 b/libexec/spamd/spamd-setup.8
index 376cb8c8b87..8a57208c1f2 100644
--- a/libexec/spamd/spamd-setup.8
+++ b/libexec/spamd/spamd-setup.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: spamd-setup.8,v 1.1 2003/02/14 05:32:02 jason Exp $
+.\" $OpenBSD: spamd-setup.8,v 1.2 2003/02/14 05:51:57 jason Exp $
.\"
.\" Copyright (c) 2003 Jason L. Wright (jason@thought.net)
.\" All rights reserved.
@@ -39,30 +39,41 @@
.Op Fl 1
.Op Fl 2
.Op Fl f Ar file
+.Op Fl w Ar file
.Sh DESCRIPTION
The
.Nm
-utility loads the
+utility adds or deletes address from the
.Xr pf 4
table
-.Aq spamd
-with IP addresses to be redirected to
-.Xr spamd 8
-from one of several sources:
+.Aq spamd .
+This table combined with
+.Xr spamd 8
+and a
+.Xr pf 4
+redirection rule can be used to selectively send spammers
+.Xr spamd 8 .
+Sources and actions are as follows:
.Bl -tag -width XXXXXXXXXX
.It Fl 1
The SPEWS level 1 database is fetched via
-.Xr ftp 1 .
+.Xr ftp 1
+and used in the black-list.
.It Fl 2
The SPEWS level 2 database is fetched via
-.Xr ftp 1 .
+.Xr ftp 1
+and used in the black-list.
.It Fl f Ar file
-The local file specified is used.
+The local file specified is added to the black-list.
+.It Fl w Ar file
+The local file specified is added to the white-list.
.El
.Pp
The arguments are processed in the order they are given and the resulting
-output is concatenated to build up a single large table for
+output is concatenated to build up a table for
.Xr pf 4 .
+First, all of the addresses from the black-list are added.
+Then, all of the addresses from the white-list are removed.
The input file is expected to consist of one IP address per line (optionally
followed by a space and text that is ignored).
Comment lines beginning with
diff --git a/libexec/spamd/spamd-setup.sh b/libexec/spamd/spamd-setup.sh
index df63c7dbfaf..8e9c6e1e7f3 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.6 2003/02/14 00:34:14 jason Exp $
+# $OpenBSD: spamd-setup.sh,v 1.7 2003/02/14 05:51:57 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]";
+ echo "usage: spamd-setup [-s12] [-f file] [-w file]";
exit 1
}
@@ -43,7 +43,10 @@ fetch() {
}
R=`mktemp /tmp/_spamdXXXXXX` || exit 1
-
+W=`mktemp /tmp/_spamwXXXXXX` || {
+ rm -f ${R}
+ exit 1
+}
trap "rm -f $R; exit 0" 0
trap "rm -f $R; exit 1" 1 2 3 13 15
@@ -59,6 +62,10 @@ while :
cat $2 | filter >> $R
shift
;;
+ -w)
+ cat $2 | filter >> $W
+ shift
+ ;;
*)
break
;;
@@ -73,5 +80,6 @@ fi
# knock out whitelist here
pfctl -t spamd -T replace -f $R
+pfctl -t spamd -T delete -f $W
exit 0