summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/control.c
AgeCommit message (Collapse)Author
2021-06-14add required headers for smtpd.h and remove unnecessary ones in other files.Eric Faurot
ok jung@
2021-05-26replaces calls to err(3)/errx(3) with fatal()/fatalx() from log.cEric Faurot
for code that runs in the daemon. ok florian@ millert@
2020-12-31Rename the pony process to dispatcher and klondike to crypto.Martijn van Duren
From gilles@ OK millert@ giovanni@
2020-09-23Revert agentx support for now, we're too close to release.Martijn van Duren
requested by deraadt@
2020-09-23Add support for agentx to smtpd.Martijn van Duren
This is based around NETWORK-SERVICES-MIB from RFC2788 and MTA-MIB from RFC2789, but does not export the full spec. Hopefully this will expand in the future. People who want to use this against net-snmp (currently the only option known to me at the time of writing) may want to add -I -mta_sendmail to the flags, so net-snmp doesn't throw garbage into the mib-2.28 subtree.
2018-05-31remove 'where' parameter from all x*() functions in utils.c, it doesn'tGilles Chehade
really help us with anything, propagate the change in codebase ok millert@
2018-05-14kill corrupt / uncorrupt queue mechanism as it has never been usable and itGilles Chehade
will be made irrelevant when the new config comes up soon ok eric@
2018-01-27Avoid passing NULL to vprintf() by assigning a name to client processes. Whileanton
here rework the switch proc_title(), both clang and gcc will now warn if all possible values are not enumerated. ok gilles@
2017-11-27Show correct command execution status by checking against updateSunil Nimmagadda
operation return value. Issue reported by 'Zelest' (Jesper Wallin). Suggestions and ok eric@ gilles@.
2017-11-23simplify imsg handler.Eric Faurot
ok sunil@ gilles@
2017-01-09smtpd joins the 7 other daemons that share the same log.c file.Reyk Floeter
The only major difference was the "log_trace" concept that is only used by smtpd - move it from log.c into util.c and make it a local concept. This also needed to rename the global "verbose" variable to "tracing" in a few places. OK krw@ gilles@ eric@
2016-09-08Streamline the daemon shutdown sequence.Eric Faurot
Only the parent process handles SIGTERM and SIGINT. Upon receiving one of those, it closes all imsg sockets and waitpid() for the children. It fatal()s if one of the sockets is closed unexpectedly. Other processes exit() "normally" when one of the imsg sockets is closed. ok gilles@ sunil@
2016-09-04The smtpd processes are not expected to ever leave their event loop.Eric Faurot
So stop pretending that the *_shutdown() functions could ever be called in this context, and just fatal() if event_dispatch() returns. ok gilles@ sunil@ giovanni@
2016-09-04Remove the "smtpctl stop" command.Eric Faurot
The daemon is stopped with kill(1). ok gilles@
2016-09-01remove noop functionEric Faurot
ok sunil@
2016-05-28Implement the fork+exec pattern in smtpd.Eric Faurot
The parent process forks child processes and re-exec each of them with an additional "-x <proc>" argument. During the early setup phase, the parent process sends ipc socket pairs to interconnect the child processes as needed, and it passes the queue encryption key to the queue if necessary. When this is done, all processes have their environment set as in the fork-only case, and they can start doing their work as before. ok gilles@ jung@
2016-03-25Nuke session_socket_blockmode() and session_socket_linger(). UseKenneth R Westerback
the identical io_set_blocking() and io_set_linger(). Since both are always called to turn off blocking or lingering, nuke the parameter and associated enum in favour of "just doing the right thing". While passing remove the unneeded last parameter to the remaining fcntl(F_GETFL). Finally, rename the functions to io_set_nonblocking() and io_set_nolinger() for clarity. No functional change. Started with a sweep of fcntl() usage inspired by guenther@. ok gilles@
2016-02-09rename variable sun to s_un to ease portabilityGilles Chehade
diff from Freddy DISSAUX, ok gilles@, jung@, sunil@, millert@
2016-02-02Check imsg data size before use.Sunil Nimmagadda
Ok eric@ millert@
2015-12-28remove spaces after '!'Joerg Jung
no binary change ok millert
2015-11-05Implement smtpctl uncorrupt <msgid>Sunil Nimmagadda
"uncorrupt" moves envelopes from corrupt bucket back to the queue for further discovery by the daemon. After correcting the corrupt envelopes, admin could now... # smtpctl uncorrupt msgid # smtpctl discover msgid to schedule the messages. Ok gilles@
2015-10-29Implement smtpctl discover <evpid|msgid>.Sunil Nimmagadda
discover subcommand schedules envelopes manually moved to the queue. It triggers a queue walk searching for envelopes with the given id, schedules them and informs the user number of envelopes scheduled. Admins no longer would need to restart the daemon to discover manually moved messages. Ok gilles@
2015-10-13pledge() control processGilles Chehade
ok deraadt@
2015-10-02do not allow connid to wrap and collide with another active connection id.Gilles Chehade
this allows a local user to trigger a fatal() and exit the daemon. reported by Qualys Security
2015-06-11local user can cause smtpd to fail by sending invalid imsg to control sockGilles Chehade
2015-05-28Do not try to unlink the control socket in an unprivileged childFlorian Obser
process on shutdown. Found while working on tame(2). OK gilles@
2015-01-20use <limits.h> comprehensively. For now try to push <> includes toTheo de Raadt
each .c file, and out of the .h files. To avoid overinclude. ok gilles, in principle. If this has been done right, -portable should become easier to maintain.
2014-07-10make the control process broadcast verbose/profile admin requests directly,Eric Faurot
rather than going through the parent process. simplify code in the meantime.
2014-04-19it's ok for strlcpy to fail here though it can't, cast voidGilles Chehade
2014-04-09Zap the mfa process. It is not currently doing anything, and content filteringEric Faurot
will be done at session level anyway. ok gilles@
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
2014-02-04pki code cleanupEric Faurot
- rename "struct ssl" and "cert" to "struct pki" and "cert" to "pki_name" - inherit pki conf on fork instead of passing it through imsg at startup - implement SNI on smtp listeners
2013-12-26bcopy -> memmoveEric Faurot
bzero -> memset
2013-12-06fix smtpctl resume routeEric Faurot
2013-10-30add "smtpctl show relays" and "smtpctl show hosts" commandsEric Faurot
2013-10-27Create the control socket in the parent process to abort early ifEric Faurot
another smtpd instance is running. Close the inherited socket in every forked process but control.
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-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-07-19Remove useless sc_pid from struct smtpd.Eric Faurot
2013-05-24sync with OpenSMTPD 5.3.2Eric Faurot
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-03-11handle ECONNABORTED errors from accept(). In many code blocks they can beTheo de Raadt
ignored silently and without aborting, much like EINTR and EWOULDBLOCK are. ok's from various maintainers of these directories...
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-23send ack on update map.Eric Faurot
ok gilles@
2012-11-23knfEric Faurot
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@