summaryrefslogtreecommitdiff
path: root/libexec/spamd/grey.c
AgeCommit message (Collapse)Author
2018-10-25When spamd(8) runs in greylist mode in the parent process (which runsRicardo Mestre
greywatcher()) we know that the only files that it will ever access are PATH_SPAMD_DB in rw mode, alloweddomains_file in r and that it will need to execute PATH_PFCTL so we can unveil(2) them with those permissions. OK deraadt@ millert@ beck@
2017-10-18Make blacklist entries override the whitelist. When running spamdTodd C. Miller
in greylisting mode, it is not uncommon for an IP to get whitelisted before it shows up on a spam blacklist. With this change, spamd will check its blacklists before adding a WHITE entry to the <spamd-white> pf table. If the IP matches a blacklist, the WHITE entry will be removed. OK phessler@
2016-10-20- Remove useless var assignmentRicardo Mestre
- Use memset(*b, 0, len) instead of bzero(*b, len) - Use memcpy(*dst, *src, len) instead of bcopy(*src, *dst, len) - Use explicit_bzero(3) instead of bzero(3) to clean temporary HMAC Remarks from deraadt@ (duly noted!!), reviewed and OK by henning@ and tb@
2016-03-25- Both checks for pw are not needed since it was already done at the start ofmestre
the program - Add error message to syslog if privdrop didn't succeed and then exit - Remove lint comments OK beck@ after his suggestion and also looks good to jca@
2015-12-10tighten the pledge for spamd, from Ricardo Mestre <serial@helheim.mooo.com>Bob Beck
this loads the tls certificate files pre-pledge then does the bulk of the tls setup goo pledged.
2015-12-08Initially pledge spamdBob Beck
All the work done by Ricardo Mestre <serial@helheim.mooo.com> - Thanks.
2015-11-29Document that the pfdev check for 63 is /dev/fd/ only contains those nodesTheo de Raadt
2015-05-18Change spamd to use divert-to instead of rdr-to.Reyk Floeter
divert-to has many advantages over rdr-to for proxies. For example, it is much easier to use, requires less code, does not depend on /dev/pf, works in-band without the asynchronous lookup (DIOCNATLOOK ioctl), saves us from additional port allocations by the rdr/NAT code, and even avoids potential collisions and race conditions that could theoretically happen with the lookup. Heads up: users will have to update their spamd PF rules from rdr-to to divert-to. spamd now also listens to 127.0.0.1 instead of "any" (0.0.0.0) by default which should be fine with most setups but has to be considered for some special configurations. Based on a diff is almost two years old but got delayed several times ... beck@: "now is the time to get it in" :) Tested by many With help from okan@ OK okan@ beck@ millert@
2015-01-13Use address-family specific lists of addr/mask entries instead ofTodd C. Miller
a union that can store either ipv4 or ipv6. The old method used 4x as much memory as was really needed for ipv4. The spamd-setup protocol has changed from: tag;message;a/m;a/m;a/m...\n to :tag;message;af;count;a/m;a/m;a/m...[af;count;a/m;a/m;a/m]\n OK phessler@ "nice" beck@
2014-11-23Delete a bunch of unnecessary #includesPhilip Guenther
Use <fcntl.h> instead of <sys/{file,fcntl}.h> ok krw@
2014-10-09obvious reallocarray() conversionsTheo de Raadt
2013-11-27unsigned char for ctypeTheo de Raadt
ok okan kettenis
2013-11-19add a bunch of missing prototypesTheo de Raadt
ok beck phessler
2013-08-21Remove the use of time_t in the greylist db file and use int64_t insteadTodd C. Miller
with backwards compatibility for records with 32-bit times. OK deraadt@ beck@
2012-10-02while it's of little harm, it's also been 5.5 years (and 8 releases),Okan Demirmen
remove the db conversion from BTREE to HASH. ok beck@
2011-03-03repair arguments passed to pfctl; PR 6142, ok beckTheo de Raadt
2010-10-06do not pass GREY entries to pf's spamd-white table if already TRAPPED.Stephan A. Rickauer
Fixes pr/6467. (from boudewijn at indes dot com) - ok beck@
2010-01-11KNFBob Beck
2009-11-12malloc() after line length check, to avoid memory leak; ok teduTheo de Raadt
2009-04-20PR 6090 - from Olli Hauer <ohauer@gmx.de>Bob Beck
A number of small improvements: - patch for empty lines and comments in alloweddomains_file - remove some whitespaces at end of line. - document comment and empty line handling - Remove unused parameter 'r' from getopt in spamd.c, it is removed in the 'switch statement' but not in getopt. http://www.openbsd.org/cgi-bin/cvsweb/src/libexec/spamd/spamd.c.diff?r1=1.94;r2=1.95;f=h - replace atoi with strtonum - make debug output more usefull, display only what will be synced and not a second message which prints always "sync trapped %s" - some cosemtic and whitespace fixes.
2009-02-25fix slow memory leak, spotted by Max Laier and Artis CauneBob Beck
ok deraadt@, oga@, otto@
2008-12-07time_t is signed, so use INT_MAX rather than UINT_MAX when parsing a time_tChad Loder
with strtonum
2008-08-26Fix an if (); typo. ok beck@Jonathan Gray
2008-07-11write a syslog debug message when a new GREY or TRAPPED entry is addedReyk Floeter
to the database. ok beck@
2008-07-11greyreader() shouldn't return, so tell us if it doesPeter Hessler
ok beck@, reyk@
2007-11-03PR 5621 - spamd doesn't clear the last entry from an empty TRAP list,Bob Beck
noticed and patch from Piotr Sikora <piotr@sikora.nu>
2007-08-16- Don't fill spamd debug with bogus config errors if there are noRay Lai
traps. - Change count to size_t to avoid a size_t -> int conversion. - Since configure_spamd always returns 0, change to void. - Since configure_spamd now returns void, remove unreachable logging statement. OK ckuethe and deraadt, initial diff from fgsch@ and OKed by beck.
2007-03-18Be sure to exit if the db_open of the second db for conversion fails.Bob Beck
2007-03-16now that we leave the grey, avoid annoying re-adds of white entriesBob Beck
by checking for them being in the db first. ok millert@
2007-03-14when using low prio MX trapping, ignore hosts connecting to the low prioBob Beck
mx for the first minute, to avoid problems if hosts legitimately try it after we are down. suggested by millert@
2007-03-14Don't delete grey entries when whitelisting. They expire anywayBob Beck
and this hides the evidence. Avoids a potential race when using -M traps where a retry comes in between deletion and whitelisting. ok millert@
2007-03-12log when we trap a host.Bob Beck
2007-03-06Add -M option to specify a local address that is a lower priority MXBob Beck
address than the primary one. spamd will trap hosts that contact this address first without first contacting the primary. - get it in, deraadt@
2007-03-05don't make everything a sync once we see one, reset this onceBob Beck
we save the entry. ok reyk@
2007-03-05spacingTheo de Raadt
2007-03-04bob writes some of the most horrid space and tab riddled messy code aroundTheo de Raadt
2007-03-04Database synchronizaton for spamd/spamlogdBob Beck
This adds an HMAC protected synchronization protocol for use by spamd and spamlogd. - spamd can receive updates from other hosts for GREY, WHITE, and TRAPPED db entries, and will update the local /var/db/spamd accordingly. - spamd can send updates when it makes changes to the GREY or TRAPPED entries in the db to other hosts running spamd. (Note it does not send WHITE entries because the other spamd will see the GREY changes and have complete information to make appropritate decisions) - spamlogd can send updates for WHITE db entries that it performs on the local db to other hosts running spamd, which will then apply them on remote hosts. note that while this diff provides synchronization for changes made to the spamd db by the daemons, it does *not* provide for sychonizing changes to the spamd db made manually with the spamdb command. Synchronization protocol and most of the work by reyk@, with a bunch of the spamd, and spamlogd stuff by me. testing mostly at the U of A, running happily there under big load. ok reyk@ jmc@
2007-02-23Make spamd include the HELO/EHLO identification string sent byBob Beck
the connecting hosts in the tuple key when greylisting. catches a few more bogus hosts and will let us trap based on HELO later. Changes spamdb(8) output to include the new field. ok deraadt@, jmc@
2007-02-23make dequotetolower use regular string functions instead of the manualBob Beck
walk with mutiple conditions in the loop. ok deraadt@
2007-02-23continue collecting lint to be sold as a parsley substitute; ok beckTheo de Raadt
2007-02-23spacingTheo de Raadt
2007-02-23greytrapping improvementsBob Beck
1) remove requirement for <> around spamtrap addresses 2) add support for /etc/spamd/alloweddomains to specify suffixes for which any destinations that don't match get trapped various knf's by theo, feedback from jmc, millert, deraadt
2007-01-04 Using DB_BTREE for spamd is wrong, order is never requiredBob Beck
and the rebalancing really slags big databases. Make spamd use DB_HASH instead, and convert if the old type is noticed on startup. Testing by me, djm, ian, others ok deraadt@, millert@, djm@
2006-12-07check exit status of the pfctl command executed. ok beck@Otto Moerbeek
2005-05-15move db->close to not hold this lock unnecssarily during long protractedBob Beck
operations. ok millert@ ages ago.
2005-03-12asprintf in place of strdup really is kind of lameBob Beck
ok millert@
2005-03-11"Greytrapping" for spamd - allow for spamd greylisting to maintainBob Beck
a list of spamtrap destination addresses in the spamd database. When a spamtrap address gets an attempted greylist delivery, blacklist the offending host for a day. Does not affect hosts already whitelisted. ok deraadt@, jmc@, dhartmei@ to get it in so it can be whacked on
2004-12-04fix a signal race which could kill unrelated processes.Moritz Jodeit
signal handler could be interrupted by another instance of itself because it was used for multiple signals and only one signal was blocked. ok beck@ henning@
2004-09-15ARGSUSED before signal handler with unused signoTheo de Raadt
2004-08-15Expire entries that exactly match the time now in addition to onesTodd C. Miller
with an expire time in the past. From beck@, OK deraadt@