summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/mfa.c
AgeCommit message (Collapse)Author
2012-11-12Cleanups and improvements:Eric Faurot
* Log more events (especially client session) and use a better scheme for that: each messages is prefixed with a token to easily identify its class: - info/warn/debug: general server messages - smtp-in: smtp client connections - relay: status update for relayed messages - delivery: status update for local deliveries * Implement "smtpctl monitor" to display updates of selected internal counters. * When reloading the on-disk queue at startup do not commit a message if no envelope was submitted for that message. * Remove unused stuff in the config parser. ok gilles@
2012-10-25send the semantically correct msg when RCPT fails, even if the exact valueEric Faurot
does not matter. spotted by chl@ ok gilles@ chl@
2012-09-29some mfa_session cleanups.Eric Faurot
- move mfa_session() prototype to smtpd.h - make mfa session use a tree - make static functions static - merge mfa_session_init() into mfa_session() ok chl@
2012-09-27simplify calloc() + strlcpy()/memcpy() dance with xmemdup()Charles Longeau
use xcalloc() helper remove newly unused variable ok gilles@ eric@
2012-09-19Set envelope expirancy in lka before sending the envelope to mfa.Eric Faurot
The goal is to eventually have only the lka see the rules. ok gilles@ chl@
2012-09-16Factorize log_imsg() in imsg_dispatch() instead of in each imsg_callback()'sCharles Longeau
and put it out of profiling, so it's not accounted. While there, for PROC_PARENT: - set smtpd_process for PROC_PARENT - use setproctitle() like other processes ok gilles@
2012-01-18Add new filters callbacks for:Charles Longeau
- network events (CONNECT/CLOSE) - commands (QUIT/RSET) ok gilles@ eric@
2011-11-14when receiving an unexpected imsg, print its name.Charles Longeau
with help and ideas from eric@ ok eric@ gilles@
2011-11-10Use STDIN_FILENO instead of magic constant 0Charles Longeau
ok gilles@
2011-10-23fsqueue no longer stores envelopes by dumping the structure, instead use aGilles Chehade
couple of load/dump functions to convert to and from a human readable fmt. while at it kill struct delivery and merge back its fields to the envelope. this basically means we shouldn't require users to flush their queues every time we make a change to struct envelope. work is not done, but we're at a better state than the binary fsqueue so we'll improve it in-tree. has been running on my own box for the last 12 hours or so ok eric@, chl@
2011-10-09show messages sent between processes in debug modeEric Faurot
ok gilles@ chl@
2011-09-27check closefrom() return valueCharles Longeau
use STDERR_FILENO instead of hard coded value ok gilles@
2011-08-31add support for per-line DATA callbacks, this allows filters to take theirGilles Chehade
decisions *while* the message is being received by the client.
2011-08-27initial support for a session-time filtering APIGilles Chehade
currently only HELO/EHLO, MAIL, RCPT are supported, however ... I have voluntarily disabled filters at smtpd.conf level so people don't play with it until the API has stabilized a bit discussed with several people in private, no one opposed the feature
2011-05-16murder struct path and make sure smtpd uses simpler structures that do notGilles Chehade
bring a shitload of unnecessary information everywhere. this required many parts of smtpd to be refactored and more specifically envelope expansion. in the process lots of code got simplified, and the envelope expansion code has been isolated to lka_session.c with some longstanding bugs fixed. Diff has been tested by many with no major regression reported. armani@ spotted a bug in a setup where a domain is listed a both primary and virtual, I will fix that in-tree as it's becoming painful to maintain this diff out.
2011-05-01the smtpd env is meant to be global, so do not pass it all around.Eric Faurot
discussed with and ok gilles@
2011-04-17cleanups, cosmethic changes, functions that should be static are now staticGilles Chehade
no functionnal change
2011-04-17a structure describing an envelope should be called struct envelope, notGilles Chehade
struct message ...
2011-04-15kill message_id and message_uidGilles Chehade
smtpd now has an evpid associated to each delivery message, the evpid is an u_int64_t where the upper 32 bits are the msgid, and the 32 bits are the envelope unique identifier for that message. this results in lots of space saved in both disk-based and ram-based queues, but also simplifies a lot of code. change has been stressed on my desktop, and has ran on my MX for the entire afternoon without a regression.
2010-11-28remove all unused headersGilles Chehade
2010-11-28a bit of .h cleanups, no functionnal changeGilles Chehade
2010-10-29smtpd no longer knows a map called "secrets" which holds credentials forGilles Chehade
authenticated relaying. one can create many maps holding credentials and name them however he/she wants, just like any other map. teach smtpd how to select a credentials map at the rule-level allowing a setup to relay through the same MX with different credentials depending on the source. smtpd.conf.5 updated to reflect changes with help from jmc@
2010-10-28teach smtpd how to handle per-rule delays for message expiry, this allowsGilles Chehade
some rules to have a longer expiry delay than the default: accept for [...] relay expire 8d # will stay 8 days in queue I added the man page bits so I don't forget but I need to reword it a bit
2010-10-09backout the "new" queue code commited 4 months ago. it has many good ideas,Gilles Chehade
is way more optimized than what we had earlier and there's definitely stuff we want to keep, however it is early optimization that doesn't account for many features and makes them hard (if not impossible) to write without ugly workarounds that ruin the purpose of the optimizations. the backout goes to 30 May's right before the commit and catches up on all the non-queue related commits that happened since then. i'll work on reintroducing the ideas from this queue when the basic features we expect from a MTA are implemented. suggested on tech@ about a week ago, no objections, several "please make smtpd move forward" mails from hackers and tech readers.
2010-06-02check event_dispatch() return valueCharles Longeau
ok jacekm@
2010-06-01new queue, again; gcc2 compile tested by deraadtJacek Masiulaniec
2010-06-01New queue doesn't compile on gcc2, back out. Spotted by deraadt@Jacek Masiulaniec
2010-05-31Rewrite entire queue code.Jacek Masiulaniec
Major goals: 1) Fix bad performance caused by the runner process doing full queue read in 1s intervals. My Soekris can now happily accept >50 msg/s while having multi-thousand queue; before, one hundred queue would bring the system to its knees. 2) Introduce Qmail-like scheduler that doesn't write as much to the disk so that it needs less code for servicing error conditions, which in some places can be tricky to get right. 3) Introduce separation between the scheduler and the backend; these two queue aspects shouldn't be too tied too each other. This means that eg. storing queue in SQL requires rewrite of just queue_backend.c. 4) Make on-disk queue format architecture independent, and more easily extensible, to reduce number of flag days in the future. Minor goals: ENOSPC no longer prevents delivery attempts, fixed session limiting for relayed mail, improved batching of "relay via" mails, human-readable mailq output, "show queue raw" command, clearer logging, sending of single bounce about multiple recipients, exact delay= computation, zero delay between deliveries while within session limit (currently 1s delay between re-scheduling is enforced), mta no longer requests content fd, corrected session limit for bounce submissions, tiny <100B queue files instead of multi-KB, detect loops before accepting mail, reduce traffic on imsg channels by killing enormous struct submit_status.
2010-04-21Remove unusable ifdef DEBUG code.Jacek Masiulaniec
2010-04-20Kill *2400* lines of code by abstracting common bits of the imsg handlers.Jacek Masiulaniec
2010-01-03Implement "log verbose" and "log brief" to enable or disable verbose debugCharles Longeau
logging on runtime. Based on claudio@'s work on ripd, ospfd, ospf6d, dvmrpd, ldpd, bgpd. With help/ideas/testing from gilles@ jacekm@ todd@ ok jacekm@
2009-10-18fix a bug that was introduced by my changes in ruleset matching and whichGilles Chehade
caused an envelope to be saved with action A_INVALID when it matches either A_RELAY or A_RELAYVIA. reported by various people
2009-10-12- fix a null deref which could happen after a couple iterations of theGilles Chehade
aliases/virtual domains resolution code. - fix a logic bug which caused virtual domains not to be correctly handled after one iteration of the aliases resolution code. - introduce a few helper functions to help clean up and simplify the lka code. - simplify the IS_EXT/IS_MAILBOX/IS_RELAY macros so they manipulate a struct path * instead of the mess of dereferences we were passing them.
2009-10-07now that mfa no longer does ruleset matching, parent no longer needs toGilles Chehade
send it the ruleset configuration, and mfa no longer needs to interpret it and load it in memory. kill kill kill. as an added bonus: removes 88 lines of code :-)
2009-10-07currently both mfa and lka perform ruleset matching for their own purposes.Gilles Chehade
make lka the only caller of ruleset_match(), mfa request match through imsg which will shrink its code and help me implement virtual domains properly. idea discussed with jacekm@
2009-10-07since the bounce code rewrite, we no longer need to perform ruleset matchGilles Chehade
and aliases resolution on the sender before envelope is written in queue: - mfa_test_mail() no longer calls ruleset_match() - lka_verify_mail() no longer resolves sender and set rule action - lka_resolve_mail() becomes dead code so just kill it ok jacekm@
2009-09-03imsg_get sets errno so use fatal instead of fatalx.Jacek Masiulaniec
2009-06-06Sync with relayd:Pierre-Yves Ritschard
Stop pushing event handling in the imsg framework. Instead, provide a small glue layer on top of both imsg and libevent. This finally clearly separates event handling and imsg construction. Sidetrack bonus: remove the mega-ugly hack of having a dummy imsg_event_add stub in smtpctl. ok jaceckm@
2009-06-05make smtpd's imsg lib ready, just like relayd and ospfd.Pierre-Yves Ritschard
ok gilles@, jacekm@
2009-06-01yet another cleanup in mfa/lka, don't roll their own loops to release mapsGilles Chehade
and rules when config.c provides us with purge_config(), PURGE_MAPS and PURGE_RULES. kills lots of lines with no functionnal change. ok jacekm@
2009-06-01add new file ruleset.c with code related to the ruleset matching, and killGilles Chehade
the two or three "almost" identical versions of ruleset matching loops from lka and mfa by having one unified function in ruleset.c; ok jacekm@ while at it, bring maildir support back to life; trivial one-liner by me
2009-06-01Fix EV_READ/EV_WRITE testing inside IMSG handlers. Based on similar changeJacek Masiulaniec
to the routing daemons by claudio@; ok gilles@
2009-05-24Parent process forks 3 types of processes, track them all in a single treeJacek Masiulaniec
using newly introduced child struct. Manage process titles centrally in struct smtpd. ok gilles@
2009-05-21fix sockaddr_storage lenght check in mfa_check_source()Gilles Chehade
2009-05-20previous commit to add reload support was missing some code, this diffsGilles Chehade
contains the missing parts + a memleak plug
2009-05-20replace a TAILQ_FOREACH loop with a TAILQ_FIRST loop when releasing entriesGilles Chehade
of the tailq, this is how it must be done.
2009-05-20first step towards configuration reload in smtpd, smtpctl reload will parseGilles Chehade
the configuration file again and replace current configuration with new one in all processes. what we don't support yet is graceful restart, clients in sessions at the moment of the reload will have a temp failure thrown at 'em which is ok RFC-wise but which we will try to improve anyway. tested with various setups, "diff reads good" jacekm@
2009-05-19Verify the amount of IMSG payload is exactly as expected; ok gilles@Jacek Masiulaniec
2009-05-14use the nitems() macro where appropriateEric Faurot
ok gilles@, jacekm@
2009-04-28smtp auth happened to work by luck because delivery to mbox action was theGilles Chehade
first action of an enum and we allocated a struct using calloc, but we did not properly initialize the action for authenticated users. while at it, change the name of path action flags so that we know at first sight that they are path related. this diff fixes the immediate issue but still needs work. ok jacekm@, "we'll work out a long term solution"