summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/queue_backend.c
AgeCommit message (Collapse)Author
2013-07-19Assorted queue improvements:Eric Faurot
- cleanup the internal queue backend API and get rid of the QOP_* thing. - implement a queue_proc backend - rename queue_fsqueue.c to queue_fs - enable support for queue encryption - add an envelope cache - better logging and error reporting
2013-07-19Get rid of env->sc_pw and env->sc_pwqueue. Early queue initializationEric Faurot
now happens in queue_init(), and backends take the queue passwd as parameter in their init function. Remove useless SMTPD_FILTER_USER while there.
2013-05-24sync with OpenSMTPD 5.3.2Eric Faurot
ok gilles@
2013-04-17large time_t problemsTheo de Raadt
ok gilles
2013-01-26Sync with our smtpd repo:Gilles Chehade
* first bricks of ldap and sqlite support (not finished but both working) * new table API to replace map API, all lookups are done through tables * improved handling of temporary errors throughout the daemon * improved scheduler and mta logic: connection reuse, optimizes batches * improved queue: more tolerant to admin errors, new layout, less disk-IO * improved memory usage under high load * SSL certs/keys isolated to lookup process to avoid facing network * VIRTUAL support improved, fully virtual setups possible now * runtime tracing of processes through smtpctl trace * ssl_privsep.c sync-ed with relayd * ssl.c no longer contains smtpd specific interfaces * smtpd-specific ssl bits moved to ssl_smtpd.c * update mail address in copyright FLUSH YOUR QUEUE. FLUSH YOUR QUEUE. FLUSH YOUR QUEUE. FLUSH YOUR QUEUE. smtpd.conf(5) simplified, it will require adaptations ok eric@
2012-11-23Replace the qwalk API (to retreive on disk envelopes at runtime) withEric Faurot
a simple QOP_WALK queue operation. Some knf and formating fixes while there. ok gilles@
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-09fix a FILE* leak when using compression.Eric Faurot
ok gilles@
2012-09-01- remove crypto_backendGilles Chehade
- remove support for encrypted queue, it will be reintroduced later after pouring more thinking into it if you had it enabled, flush your queue before updating
2012-08-30switch compress_backend to use FILE * instead of file descriptors, likeCharles Longeau
crypto_backend ok gilles@
2012-08-30fix uninitialized variable which can be reach in case of failure.Charles Longeau
ok gilles@
2012-08-29Introduce the crypto_backend API and provide support for... encrypted queueGilles Chehade
using the new API. By default, OpenSMTPD does not provide queue encryption, but it can be enabled with "queue encryption [args]" and will transparently encrypt/decrypt envelopes/messages as they hit the queue. By default, it will use Blowfish in CBC mode with a different random IV for each envelope and message. User provided key is expanded using sha256 but a different cipher and digest may be specified in smtpd.conf Queue encryption is compatible with compression and if both options are set it will do them in correct order and transparently. tested by chl@, a few users and myself ok chl@ and I
2012-08-26- remove unused variableGilles Chehade
- comment variables unused at this time
2012-08-25Add compress_backend, allowing compression of messages and envelopes in the ↵Charles Longeau
queue. To use it, just add "queue compress" in smtpd.conf. For now, only zlib is used. lots of feedback from eric@ and gilles@ ok eric@ gilles@
2012-08-24envelope_validate() don't take the evpid anymore.Eric Faurot
2012-08-24In envelope ascii dump/load:Charles Longeau
- remove loading of evpid. - don't dump the msgid - ignore msgid at load - remove now unused functions ascii_{dump,load}_uint{32,64}_hex() With inputs from eric@ and gilles@ ok gilles@ eric@
2012-08-24Don't pass struct envelope pointer in queue backend API, instead use ↵Charles Longeau
envelope id and an envelope ascii buffer. ok eric@ gilles@
2012-08-19coding style: replace all occurences of u_int* with uint*Charles Longeau
ok eric@
2012-07-10backout the:Charles Longeau
- remove the /envelopes subdirectory, envelopes are at the same level than the message file - kill PATH_ENVELOPES define but keep the: - reduce the number of buckets from 0xfff to 0xff, this avoid performances of the queue to decrease when we start having tons of buckets ok eric@ gilles@
2012-07-09first step of simplifying fsqueue:Gilles Chehade
- remove the /envelopes subdirectory, envelopes are at the same level than the message file - kill PATH_ENVELOPES define - reduce the number of buckets from 0xfff to 0xff, this avoid performances of the queue to decrease when we start having tons of buckets this diff introduces a change to the queue layout, you will want to empty your queue before updating. more cleanup to come ok eric@, ok chl@
2012-07-08remove enum queue_kind from queue_fsqueue.c.Charles Longeau
incoming messages are now always stored in /incoming, whatever the queue_backend is. remove QOP_FD_RW and fsqueue_message_fd_rw(). while there check return value of generated paths before calling rmtree() with advice from gilles@ and eric@ ok gilles@ eric@
2012-07-02Lookup queue and scheduler backends by name, rather than enum.Eric Faurot
Add a command-line option to specify the backend to use at runtime. ok gilles@
2012-06-20Finally get rid of the queue_kind enum in the queue API. Keep thatEric Faurot
internally in fsqueue backend for now, and let the fsqueue_message() and fsqueue_envelope() dispatchers do the right thing. Based on a diff by chl@ ok chl@ gilles@
2012-06-08add missing header needed by time()Charles Longeau
ok eric@ gilles@
2012-06-03Do not store the envelope id within the envelope, only the message id.Eric Faurot
Make sure existing envelopes can be properly loaded. ok chl@ gilles@
2012-06-01on envelope creation, setup and reset the relevant envelope fields inEric Faurot
the wrapper function rather than in individual backends. ok gilles@
2012-01-14Add missing header needed by PRI format stringCharles Longeau
ok gilles@ eric@
2012-01-13queue_message_purge() and queue_message_delete() are actually the sameEric Faurot
thing. Remove queue_message_purge() in favor of queue_message_delete and simplify fsqueue_message_delete() implementation to move the message dir to purge/ ok gilles@
2011-12-23On envelope creation, get the message id in a saner way than theEric Faurot
current confusing hack. ok gilles@
2011-12-19fix/improve envelope_validate():Eric Faurot
- return an informative error string if the envelope is invalid. - take the envelope id as a parameter and make sure it matches. - do not expect the errorline to start with an SMTP response code, as this is not always the case: a temporary failure with mda would cause the envelope to be marked as corrupted. Instead, just make sure that all string fields are actual strings to prevent overflows later. ok gilles@ chl@
2011-12-16simplifyEric Faurot
ok chl@ gilles@
2011-12-14make queue_fsqueue backend consistent with the backend scheme.Eric Faurot
ok gilles@
2011-11-15Qwalk, our API to linearly walk over the persistent queue, did not take theGilles Chehade
queue_backend into account and assumed a filesystem with a specific layout. This commit does plenty of things: - make qwalk an abstraction in the queue_backend API, and impose queue drivers to implement qwalk_open(), qwalk() and qwalk_close(); - move previous qwalk_open(), qwalk() and qwalk_close() to the fsqueue driver since they were fsqueue specific ... - make qwalk API work with msgid/evpid instead of pathnames since we're going to use the queue_backend API to load envelopes by evpid anyway; - makes smtpd use *solely* the queue_backend API when manipulating the queue. pathnames were removed from smtpd.h and moved into the fsqueue which means we can now store a queue anywhere ... as long as we write the ten functions or so required for a queue driver ;-) ok eric@, ok chl@
2011-10-23introduce Q_CORRUPT and queue_backend operation to move a message fromGilles Chehade
schedule queue to corrupt queue upon envelope loading failure. tested by me, ok eric@
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-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-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.
2011-04-14- implement missing operations for fsqueue:Gilles Chehade
fsqueue_envelope_create(), fsqueue_message_purge() - kill deprecated functions in queue_shared.c At this point fsqueue backend is almost complete, all that is left to do is to move the qwalk() API inside the queue_backend API, then make sure smtpd is no longer calling anything queue related directly.
2011-04-14fsqueue queue backend will implement a filesystem queue:Gilles Chehade
- fsqueue->setup() performs the queue initialization; - fsqueue->message() controls messages; - fsqueue->envelope() controls envelopes; This commit brings the following to fsbackend: fsqueue_setup(), fsqueue_message_delete(), fsqueue_envelope_load(), fsqueue_envelope_update(), fsqueue_envelope_delete(). It also makes smtpd use the queue_backend API for these operations.
2011-04-14smtpd makes too many assumptions about the structure and layout of itsGilles Chehade
disk-based queue, it makes it near impossible to make changes to it without editing twenty files... how am i going to implement mongodb support ? :-) bring a new queue_backend API which hides the details of the disk-based queue to smtpd. it is not "plugged in" yet and I'm filling the holes.
2010-10-09no longer compiled, i will reintroduce them later, lots of stuff needs toGilles Chehade
be done before we can write queue backends anyway ...
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.