summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/lka.c
AgeCommit message (Collapse)Author
2015-12-12if no certificate matches name AND fallback hint was given, search for aGilles Chehade
global certificate
2015-12-12remove empty lineGilles Chehade
2015-12-12move the cert verify code to its own function outside the imsg handlingGilles Chehade
code, no functional change but this makes code easier to read, and will ease implementing DANE later on.
2015-12-12smtp / mta have been factored in the same process months ago, factor theGilles Chehade
code that handles the same imsg's too ok sunil@, ok jung@
2015-12-12Implement senders map.Sunil Nimmagadda
senders table allows to restrict the addresses that an authenticated user can use in the SMTP dialogue. Ok gilles@
2015-12-12prepare for asynchronous certificate verify, needed for a mechanicalGilles Chehade
cleanup and later on for DANE support
2015-12-11rename field member + whitespacesGilles Chehade
2015-11-30bring lka_mailaddrmap(), currently unused, required by sendermap/masqueradeGilles Chehade
ok jung@
2015-11-30mechanical rename of some IMSG constantsGilles Chehade
ok sunil@, ok jung@
2015-10-14whitespacesGilles Chehade
2015-10-14pledge() pony and lookupGilles Chehade
ok deraadt@
2015-10-02reset static pointer to NULL after we free it, just in case another bugGilles Chehade
leads us to reuse it.
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.
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-09-03if crypt(3) fails return an authentication errorGiovanni Bechis
ok gilles@
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-07-08Update the table API: lookup functions can take an optional parametersEric Faurot
dictionnary (currently not set). While there, add a helper for forking external backends, and remove unused table functions. ok gilles@
2014-05-22when we reduced the number of iovec's we passed through an imsg, the iovecGilles Chehade
declaration was not bumped down causing us to pass extra junk leading to a crash in the pki lookup code. i'm amazed no one else crashed on that :-/ reported by Olivier Antoine who kindly provided access to his box
2014-05-01Move RSA keys from "lka" to a new dedicated "ca" process because lkaReyk Floeter
is handling some async requests and shouldn't be busy with sync RSA. ok gilles@
2014-04-29Implement RSA privilege separation for OpenSMTPD, based on my previousReyk Floeter
implementation for relayd(8). The smtpd(8) pony processes (mta client, smtp server) don't keep the private keys in memory but send their private key operations as imsgs to the "lookup"/mta process. It's worth mentioning that this prevents acidental private key leakage as it could have been caused by "Heartbleed". ok gilles@
2014-04-15reply with correct imsg when using non-system auth.Eric Faurot
reported by Stefan Sieg ok gilles@
2014-04-09need to change imsg type before forwarding.Eric Faurot
reported by jturner@ 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-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
2014-02-04add base64_encode/base64_decode helpersEric Faurot
2014-02-04get rid of fdlimit()Eric Faurot
2013-11-20Rework the mda and scheduler to use the holdq mechanism instead ofEric Faurot
tempfail for limiting the number of pending deliveries to the same user. This allows to reach optimal delivery time even in case of burst, while keeping the number of inflight envelopes low.
2013-11-18Allow overriding the local caEric Faurot
2013-11-13Fix case-folding issue with pki names. They are case-insensitive.Eric Faurot
Make sure a pki entry exists when used in a listen or relay rule.
2013-11-06Much much improved config parser and related changes.Eric Faurot
Simplify code and do not impose an order on conditions and rule options. Format changes that may require smtpd.conf update for some setups: - SSL certificates are no longer automatically loaded, but must be explicitely declared using the "pki" keyword. - "certificate" option becomes "pki" in listener and accept rules. - "ssl://" becomes "secure://" in relay via rules. - "helo" becomes "hostnames" in relay rules New features: - accept rules do not need an explicit action, in which case alias table or .forward must provide one. - new "forward-only" action to force relaying and reject rcpts that expand as local delivery. - "!" (negation) modifier on rule matching conditions. - new "recipient" rule matching condition. - new "verify" option on listeners and relay rules to reject invalid certificates. Other changes: - remember the helo name advertised on incoming mail and use it for sending bounces. - bump envelope version (existing envelopes are updated on-the-fly).
2013-10-28Report the ssl certificate verification status in the mail header.Eric Faurot
Log ssl certificate validation errors. Fix several ssl-related leaks.
2013-10-27missing m_end()Eric 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-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-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-02-05- handle getaddrinfo() error as LKA_TEMPFAILGilles Chehade
- handle getsockname() error in smtp_connected() - accept '/' as part of user-part, expand to ':' as done by qmail - fix wrong check in mda leading to bogus Return-Path header - fix aliases parsing when there's a white space between key and separator - some cosmethic cleanup
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-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-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-13Make map_lookup() and make_compare() set errno on failure to distinguishEric Faurot
between "no match" and "internal error" (e.g. missing or broken db file). Adapt alias expansion and ruleset matching code to check for such errors, in which case the current processing is aborted, and a temporary failure is reported to the smtp session. ok gilles@
2012-09-30- add decision to the rule so that we can actually perform a reject matchGilles Chehade
ie: reject from 192.168.1.0/24 for domain "openbsd.org" accept from 192.168.0.0/16 for domain "openbsd.org" deliver to mbox it was documented but not working. ok eric@ & chl@
2012-09-29finally remove rule member from struct envelope.Eric Faurot
"wow!" gilles@
2012-09-28use xmemdup() and xcalloc() helpersCharles Longeau
ok eric@
2012-09-21Move ruleset_match() prototype to smtpd.h and make the envelope const.Eric Faurot
Adapt a lot of functions in chain to use const args where required. ok gilles@
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-19remove IS_RELAY and IS_MAILBOX macros.Eric Faurot
ok gilles@