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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
.\" $OpenBSD: spamdb.8,v 1.20 2017/10/29 19:11:34 millert Exp $
.\"
.\" Copyright (c) 2004 Bob Beck. All rights reserved.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: October 29 2017 $
.Dt SPAMDB 8
.Os
.Sh NAME
.Nm spamdb
.Nd spamd database tool
.Sh SYNOPSIS
.Nm spamdb
.Op Fl adGTt
.Op Ar keys ...
.Sh DESCRIPTION
.Nm
manipulates the spamd database in
.Pa /var/db/spamd
used for
.Xr spamd 8 .
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl a
Add or update the entries for
.Ar keys .
This can be used to whitelist one or more IP addresses
(i.e. circumvent the greylisting process altogether)
by adding all IP addresses as keys to the spamd database for WHITE entries.
If any
.Ar keys
specified match entries already in the spamd database,
.Nm
updates the entry's time last seen to now.
.It Fl d
Delete entries for
.Ar keys .
.It Fl G
Delete the keys as GREY entries.
See the GREYTRAPPING section of
.Xr spamd 8
for more information.
Must be used in conjunction with the
.Fl d
option.
.It Fl T
Add or delete the keys as SPAMTRAP entries.
See the GREYTRAPPING section of
.Xr spamd 8
for more information.
Must be used in conjunction with the
.Fl a
or
.Fl d
option.
.It Fl t
Add or delete the keys as TRAPPED entries.
See the GREYTRAPPING section of
.Xr spamd 8
for more information.
Must be used in conjunction with the
.Fl a
or
.Fl d
option.
.El
.Pp
If adding or deleting a SPAMTRAP address
.Pq Fl T ,
.Ar keys
should be specified as email addresses:
.Pp
.Dl spamtrap@mydomain.org
.Pp
Otherwise
.Ar keys
must be numerical IP addresses.
.Ss DATABASE OUTPUT FORMAT
If invoked without any options,
.Nm
lists the contents of the database in a text format.
If one or more
.Ar keys
are specified, only matching entries will be printed.
.Pp
For SPAMTRAP entries the format is:
.Pp
.Dl type|mailaddress
.Pp
where
.Em type
will be SPAMTRAP and
.Em mailaddress
will be the email address for which any connections received by
.Xr spamd 8
will be blacklisted if mail is sent to this address.
.Pp
For TRAPPED entries the format is:
.Pp
.Dl type|ip|expire
.Pp
where
.Em type
will be TRAPPED,
.Em IP
will be the IP address blacklisted due to hitting a spamtrap, and
.Em expire
will be when the IP is due to be removed from the blacklist.
.Pp
For GREY entries, the format is:
.Pp
.Dl type|source IP|helo|from|to|first|pass|expire|block|pass
.Pp
For WHITE entries, the format is:
.Pp
.Dl type|source IP|||first|pass|expire|block|pass
.Pp
The fields are as follows:
.Pp
.Bl -tag -width "source IP" -offset indent -compact
.It type
.Em WHITE
if whitelisted or
.Em GREY
if greylisted
.It source IP
IP address the connection originated from
.It helo
what the connecting host sent as identification in the HELO/EHLO command in the
SMTP dialogue
.It from
envelope-from address for
.Em GREY
(empty for
.Em WHITE
entries)
.It to
envelope-to address for
.Em GREY
(empty for
.Em WHITE
entries)
.It first
time the entry was first seen
.It pass
time the entry passed from being
.Em GREY
to being
.Em WHITE
.It expire
time the entry will expire and be removed from the database
.It block
number of times a corresponding connection received a temporary
failure from
.Xr spamd 8
.It pass
number of times a corresponding connection has been seen to pass
to the real MTA by
.Xr spamlogd 8
.El
.Pp
Note that times are in seconds since the Epoch, in the manner returned by
.Xr time 3 .
Times may be converted to human readable format using:
.Pp
.Dl $ date -r <value>
.Sh FILES
.Pa /var/db/spamd
.Sh SEE ALSO
.Xr spamd.conf 5 ,
.Xr spamd 8 ,
.Xr spamd-setup 8
.Sh HISTORY
The
.Nm
command
appeared in
.Ox 3.5 .
|