1.\" $OpenBSD: spamdb.8,v 1.20 2017/10/29 19:11:34 millert Exp $ 2.\" 3.\" Copyright (c) 2004 Bob Beck. All rights reserved. 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: October 29 2017 $ 18.Dt SPAMDB 8 19.Os 20.Sh NAME 21.Nm spamdb 22.Nd spamd database tool 23.Sh SYNOPSIS 24.Nm spamdb 25.Op Fl adGTt 26.Op Ar keys ... 27.Sh DESCRIPTION 28.Nm 29manipulates the spamd database in 30.Pa /var/db/spamd 31used for 32.Xr spamd 8 . 33.Pp 34The options are as follows: 35.Bl -tag -width Ds 36.It Fl a 37Add or update the entries for 38.Ar keys . 39This can be used to whitelist one or more IP addresses 40(i.e. circumvent the greylisting process altogether) 41by adding all IP addresses as keys to the spamd database for WHITE entries. 42If any 43.Ar keys 44specified match entries already in the spamd database, 45.Nm 46updates the entry's time last seen to now. 47.It Fl d 48Delete entries for 49.Ar keys . 50.It Fl G 51Delete the keys as GREY entries. 52See the GREYTRAPPING section of 53.Xr spamd 8 54for more information. 55Must be used in conjunction with the 56.Fl d 57option. 58.It Fl T 59Add or delete the keys as SPAMTRAP entries. 60See the GREYTRAPPING section of 61.Xr spamd 8 62for more information. 63Must be used in conjunction with the 64.Fl a 65or 66.Fl d 67option. 68.It Fl t 69Add or delete the keys as TRAPPED entries. 70See the GREYTRAPPING section of 71.Xr spamd 8 72for more information. 73Must be used in conjunction with the 74.Fl a 75or 76.Fl d 77option. 78.El 79.Pp 80If adding or deleting a SPAMTRAP address 81.Pq Fl T , 82.Ar keys 83should be specified as email addresses: 84.Pp 85.Dl spamtrap@mydomain.org 86.Pp 87Otherwise 88.Ar keys 89must be numerical IP addresses. 90.Ss DATABASE OUTPUT FORMAT 91If invoked without any options, 92.Nm 93lists the contents of the database in a text format. 94If one or more 95.Ar keys 96are specified, only matching entries will be printed. 97.Pp 98For SPAMTRAP entries the format is: 99.Pp 100.Dl type|mailaddress 101.Pp 102where 103.Em type 104will be SPAMTRAP and 105.Em mailaddress 106will be the email address for which any connections received by 107.Xr spamd 8 108will be blacklisted if mail is sent to this address. 109.Pp 110For TRAPPED entries the format is: 111.Pp 112.Dl type|ip|expire 113.Pp 114where 115.Em type 116will be TRAPPED, 117.Em IP 118will be the IP address blacklisted due to hitting a spamtrap, and 119.Em expire 120will be when the IP is due to be removed from the blacklist. 121.Pp 122For GREY entries, the format is: 123.Pp 124.Dl type|source IP|helo|from|to|first|pass|expire|block|pass 125.Pp 126For WHITE entries, the format is: 127.Pp 128.Dl type|source IP|||first|pass|expire|block|pass 129.Pp 130The fields are as follows: 131.Pp 132.Bl -tag -width "source IP" -offset indent -compact 133.It type 134.Em WHITE 135if whitelisted or 136.Em GREY 137if greylisted 138.It source IP 139IP address the connection originated from 140.It helo 141what the connecting host sent as identification in the HELO/EHLO command in the 142SMTP dialogue 143.It from 144envelope-from address for 145.Em GREY 146(empty for 147.Em WHITE 148entries) 149.It to 150envelope-to address for 151.Em GREY 152(empty for 153.Em WHITE 154entries) 155.It first 156time the entry was first seen 157.It pass 158time the entry passed from being 159.Em GREY 160to being 161.Em WHITE 162.It expire 163time the entry will expire and be removed from the database 164.It block 165number of times a corresponding connection received a temporary 166failure from 167.Xr spamd 8 168.It pass 169number of times a corresponding connection has been seen to pass 170to the real MTA by 171.Xr spamlogd 8 172.El 173.Pp 174Note that times are in seconds since the Epoch, in the manner returned by 175.Xr time 3 . 176Times may be converted to human readable format using: 177.Pp 178.Dl $ date -r <value> 179.Sh FILES 180.Pa /var/db/spamd 181.Sh SEE ALSO 182.Xr spamd.conf 5 , 183.Xr spamd 8 , 184.Xr spamd-setup 8 185.Sh HISTORY 186The 187.Nm 188command 189appeared in 190.Ox 3.5 . 191