summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpctl.c
AgeCommit message (Collapse)Author
2014-07-20Make sure the correct errno is reported by warn* or err* and notPhilip Guenther
the errno of an intervening cleanup operation like close/unlink/etc. Diff from Doug Hogan (doug (at) acyclic.org)
2014-07-08get rid of mfa leftoversEric Faurot
2014-07-07Allow to enable profiling at runtime and fix timings output.Eric Faurot
ok gilles@
2014-05-23use reallocarrayMarc Espie
okay gilles@
2014-05-20format string cleanup: change "%i" to "%d" and fix a few typosEric Faurot
2014-04-22malloc -> callocGilles Chehade
2014-04-19(void) cast a strlcpy() that cannot truncateGilles Chehade
(void) cast a few snprintf()/strlcat() that cannot truncate and that would be harmless if they could
2014-04-04Merge the mda, mta and smtp processes into a single unprivilegedEric Faurot
process managing message reception, delivery and transfer. Mostly mechanical, but very intrusive as it required to rewamp all IMSG to fix ambiguities. with and ok gilles@
2014-02-17new "smtpctl show status" command to show if mta/mda/smtp are currently ↵Eric Faurot
running or paused.
2014-02-04Allow the admin to pause relaying to a specific domain:Eric Faurot
- smtpctl pause mta from <source> for <domain> - smtpctl resume mta from <source> for <domain> - smtpctl show mta paused
2013-12-26bcopy -> memmoveEric Faurot
bzero -> memset
2013-11-13document smtpctl "show hosts" and "show relays".Eric Faurot
add an encrypt wrapper usable for auth tables.
2013-10-30add "smtpctl show relays" and "smtpctl show hosts" commandsEric Faurot
2013-10-27Implement a feedback mechanism which allows the mta to "hold" envelopesEric Faurot
in the scheduler when it has too many tasks for a given relay. The envelopes are put on a wait queue, and are not scheduled again until the mta "releases" some envelopes from that queue. It prevents from having too many inflight envelopes, which are out of reach for the admin.
2013-10-25local enqueuer improvements:Eric Faurot
- parse the whole input before trying to establish the connection to the local socket: fixes timeout problems when reading the output of a long running program. - use sendmail(8)-like exit status.
2013-10-25Improve reporting in smtpctl and a few fixes.Eric Faurot
When sending a request to the scheduler, wait for the success/failure report from the scheduler. Simplify the code by introducing generic functions for interruptible iteration over envelopes. Report the total number of affected envelopes for schedule, pause, resume and remove envelope operations.
2013-07-19Many MTA improvements:Eric Faurot
- Better transient error handling logic: failing destinations are automatically disabled for a while. When a destination is active again, ask the scheduler to retry previous envelopes immediatly. - More informative error report when all routes fail for a mail. - Implement a "smtpctl show hoststats" command to get the latest stat message per MX domain. - Implement a "smtpctl show routes" command to show the state the currently known routes to remote MXs. - Implement a "smtpctl resume route" command to re-enable a route that has been disabled. - Do not hardcode limits - Minor code improvements
2013-07-19scheduler improvements:Eric Faurot
- implement suspend/resume scheduling for individual envelopes or message, with the associated smtpctl commands. - allow the mta to request immediate scheduling of an envelope. - on temporary failures a penalty can be given to further delay the next try.
2013-07-19New implementation for smtpctl and the command line parser. AllowsEric Faurot
richer syntax, and makes the code way simpler to follow and extend with new commands.
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-04-12replace MAX_LINE_SIZE and SMTP_LINE_MAX with SMTPD_MAXLINESIZE forEric Faurot
consistency and clarity. Remove useless and confusing extra byte in a few arrays based on this define. ok gilles@
2013-02-14- smtpctl trace expand, enables tracing of aliases expansionGilles Chehade
- replace "users" keyword with "userbase" when providing alternate userbase - disambiguise expansion nodes when expanding across domains and userbases - allow use of '=' instead of '=>' when declaring a mapping ok eric@
2013-01-28- introduce 'smtpctl trace lookup' to trace lookup processGilles Chehade
- improve logging of the transfer process trace by me, logging by eric
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-20Allow "smtpctl show queue" to run in "online" mode if the smtpd serverEric Faurot
is running. The scheduler sends the runtime state of each envelope to the queue process which loads the envelope, fills the runtime bits and sends the envelope back to the client. Iteration over the envelope set happens in small chunks to make the request interruptible and to allow the server to keep doing its job in the meantime. Adpat "smtpctl schedule-all" to schedule the messages one by one using the same iteration mechanism. Document "smtpctl monitor" and "smtpctl show queue". ok gilles@
2012-11-13Simplify the smtpctl code: add a try_connect() function to test ifEric Faurot
the server is running, and flush()/next_message() helpers to make imsg request/response loops easier. 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-26add a new uptime.human entry in stats, derived from uptime, but displayedCharles Longeau
in a human readable fashion: uptime=123456 uptime.human=1d10h17m36s ok gilles@
2012-10-14introduce map_file.c which will deprecate map_stdio.cGilles Chehade
The idea is to have a file-backed map but to have smtpd(8) cache the maps so that it cannot be partially read if edited while mail is received. The file is read and converted to a static map (map_static.c), changes aren't visible to smtpd until an explicit: smtpctl update map which reads file, builds a new static map and invalidates the former. partial-read issue discussed with beck@ and halex@ idea to convert internally to a static map by eric@ diff ok eric@ and chl@
2012-10-10teach smtpctl how to display envelopes and messages using their id.Gilles Chehade
this allows an admin to inspect the queue without having to manually extract bucket and find the path to an envelope or message. diff by Sunil Nimmagadda <sunil@poolp.org> ok eric@, chl@ and I
2012-09-19use lower case for envelope fields.Eric Faurot
requested by gilles@
2012-09-19Remove DF_ENQUEUE flag. It is mostly unused and logically broken.Eric Faurot
Ignore it in existing envelopes until it gets completely dropped. Change "smtpctl show queue" to display the address family of the envelope source instead of the ENQUEUE flag. ok gilles@
2012-08-30- rename show_envelope() to show_queue_envelope()Gilles Chehade
- remove SHOW_RUNQUEUE it was a noop since runqueues have been removed years ago from smtpd
2012-08-25- introduce struct stat_valueGilles Chehade
- statistics can now have a type (counter, timestamp, timeval, timespec and possibly others in the future) - stat_increment() / stat_decrement() now take an increment/decrement value and are at the moment only of type counter - stat_set() now takes a stat_value - provide helpers to convert raw values to stat_value ok eric@, ok chl@ while at it fix a rq_queue_dump() call using a bogus timestamp in scheduler ramqueue.
2012-08-19coding style: replace all occurences of u_int* with uint*Charles Longeau
ok eric@
2012-08-18- introduce stat_backend, an API for pluggable statistic backendsGilles Chehade
> statistics are no longer static structures in shared memory > statistics are only set, smtpd never uses them in its logic > each statistic is a key/value where key can be any (dynamic) string - convert all uses of the former API to use the new one - implement stat_ramstat that keeps non-persistent stats in ram structure ok eric@, ok chl@
2012-08-08remove useless definesEric Faurot
ok gilles@ chl@
2012-08-07fix evpid parsing on 32bit archsEric Faurot
ok gilles@
2012-07-09- runner is the terminology we used back when we had runqueues, we noGilles Chehade
longer have them and runner is actually a scheduler so rename. - introduce scheduler_backend which does the same to scheduler than queue_backend does to queue and map_backend does to maps - remove all occurences of RUNNER and runner, replace them with SCHEDULER and scheduler ok eric@, ok chl@
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-05-13Remove sizes entry so it doesn't appear as a valid command in theNicholas Marriott
"smtpctl show" output, and use errx rather than err for the unknown message error. ok gilles
2012-04-15Remove dead assignments and newly created unused variables.Charles Longeau
Found by LLVM/Clang Static Analyzer. ok gilles@
2012-01-28- introduce the scheduler_backend APIGilles Chehade
- introduce the scheduler_ramqueue backend - remove all occurences of ramqueue outside of the ramqueue backend - teach runner how to use the new API it is now possible to write custom schedulers ! ok eric@, ok chl@
2012-01-24Add a parameter to the queue backend init() call to specify wether theEric Faurot
call is issued by smtpd or smtpctl. In the latter case, only perform sanity checks and do not touch directories. A running server no longer lose its "incoming/" directory each time smtpctl is called... ok gilles@
2012-01-12The status field in the envelope is confusing. Its only purpose is toEric Faurot
notify the runner of what happened with an envelope that has been scheduled. It is not part of the state of the envelope, and it is not even dumped. So it should only be set by mta/mda, checked by runner to decide what to do with the envelope, and ignored everywhere else. ok gilles@
2012-01-12Remove dead code for config reloading for now. It is not functionnalEric Faurot
and confusing. ok gilles@