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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
.\" $OpenBSD: spamd.8,v 1.10 2003/02/13 08:23:39 jmc Exp $
.\"
.\" Copyright (c) 2002 Theo de Raadt. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd Dec 18, 2002
.Dt SPAMD 8
.Os
.Sh NAME
.Nm spamd
.Nd spam deferral daemon
.Sh SYNOPSIS
.Nm spamd
.Op Fl 45d
.Op Fl r Ar reply
.Op Fl c Ar maxcon
.Op Fl p Ar port
.Op Fl n Ar name
.Sh DESCRIPTION
.Nm
is a fake
.Xr sendmail 8 Ns -like
daemon which absorbs false mail.
If the
.Xr pf 4
packet filter is configured to redirect port 25 (SMTP) to this daemon,
it will attempt to waste the time and resources of the spam sender.
.Pp
The options are as follows:
.Bl -tag -width Ds
.Pp
.It Fl 4
Return error code 450 to the spammer.
.It Fl 5
Return error code 550 to the spammer.
.It Fl d
Debug mode.
.Nm
does not
.Xr fork 2
into the background.
.It Fl r
The SMTP error to return to the spammer, ie 450, 451, 550. This defaults
to 450.
.It Fl c
The maximum number of concurrent connections to allow.
.It Fl p
Specify the port number that
.Nm
should operate on.
.It Fl n
The SMTP version banner that is reported upon initial connection.
.El
.Pp
.Nm
is designed to be very efficient so that it does not slow down the
receiving machine. SPAM is never accepted, but always rejected with
either a 450 or 550 error message. The normal way that SPAM has been
dealt with in the past is to either accept and drop, or outright block.
When configured to use 450 responses,
.Nm
takes neither of these actions: it rejects the mail back to the senders'
queue.
.Pp
.Nm
is best started from
.Xr rc 8
and is used in conjuction with
.Xr spamd-setup 8
which processes a list of spammers' addresses, and applies appropriate
.Xr pfctl 8
.Em rdr
rules.
.Pp
.Sh REDIRECTING SMTP CONNECTIONS
With
.Xr pf 4 ,
connections to port 25 (SMTP) can be redirected to another host or port,
based on the source address of the sender.
The
.Em rdr
rules used for this purpose are described in
.Xr pf.conf 5 .
The rules can be loaded into an
.Em anchor
to simplify handling.
If the main ruleset contains the following
.Em rdr-anchor rule ,
all
.Em rdr
rules inside the specified
.Em anchor
are evaluated for SMTP connections:
.Bd -literal
rdr-anchor spews proto tcp from any to any port smtp
.Ed
.Pp
And all
.Em rdr
rules related to
.Nm
can be loaded into one or more rulesets inside that
.Em anchor ,
like:
.Bd -literal
echo "rdr inet proto tcp from { 10.1.2.3, 10.2.3.4/30, 10.3.4.5/24 }
to any port smtp -> 127.0.0.1 port 8025" | pfctl -a spews:first -f -
.Ed
.Pp
.Sh SEE ALSO
.Xr pf.conf 5 ,
.Xr pfctl 8 ,
.Xr spamd-setup 8
.Sh HISTORY
The
.Nm
command
appeared in
.Tn OpenBSD 3.3.
|