summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/ssl.c
AgeCommit message (Collapse)Author
2017-05-17Introduce more use of freezero(). Also, remove ptr conditionals beforeTheo de Raadt
many functions which are free(NULL)-compat ok gilles
2017-03-30Disable client-initiated renegotiation.Joel Sing
ok gilles@ eric@ deraadt@
2016-09-02turn server preference for ciphers on by defaultGilles Chehade
ok jsing@
2016-04-21Use automatic DH parameters, instead of fixed ones. Also disable DHE byJoel Sing
default since it is computationally expensive and a potential DoS vector. ok gilles@
2015-12-13refactor a bit to move the SNI handling away from smtp_session into smtpGilles Chehade
ok sunil@, jung@
2015-12-12remove CA from pki and no longer allow specifying a CA with 'pki' keyword.Gilles Chehade
introduce 'ca' keyword to allow specifying a custom CA. making CA part of pki was a bad idea and several people hit use-cases that plain couldn't work. instead of: pki foobar.org ca "/etc/mail/CA.pem" use now: ca foobar.org certificate "/etc/mail/CA.pem" ok sunil@, jung@
2015-12-12do not prevent group from reading key, it prevents a certificate fromGilles Chehade
being shared between smtpd and another daemon
2015-12-12allow overriding the default cipher-suiteGilles Chehade
ok jung@, sunil@, millert@
2015-12-12bump DH params to 2048, it's been part of smtpd releases for a long timeGilles Chehade
and I've been running with it since June with no side-effect ok sunil@, jung@, millert@
2015-12-05Remove a few NULL-checks before free().mmcc
2015-11-05replace u_char and u_int* with standard stdint.h types to ease portable versionJoerg Jung
also remove trailing whitespaces while here no binary change ok sunil millert gilles
2015-10-21Use SSL_CTX_set_ecdh_auto() instead of rolling our own version.Joel Sing
ok gilles@
2015-10-16Use SSL_get_version() not SSL_get_cipher_version(); the former gives the TLSStuart Henderson
version used for the connection, the latter gives "the SSL/TLS protocol version that first defined the cipher". Fixes "TLS version=TLSv1/SSLv3" in received/log lines. ok millert@ "I was going to commit this today, so yes definitely" ok gilles@
2015-03-13Missing free(3) in error pathGiovanni Bechis
2015-02-06Rename SSL_CTX_use_certificate_chain() to SSL_CTX_use_certificate_chain_mem().Reyk Floeter
As discussed with beck@ jsing@ and others OK beck@
2015-01-16SSL_CTX_use_certificate_chain() has been added to LibreSSL and thereReyk Floeter
is no need to keep a local copy in ssl_privsep.c. This adds a little burden on OpenSMTPD-portable because it will have to put it in openbsd-compat for compatibility with legacy OpenSSL. OK gilles@
2015-01-16The SSL/TLS session Id context is limited to 32 bytes. Instead ofReyk Floeter
using the name of relayd relay or smtpd pki, use a 32 byte arc4random buffer that should be unique for the context. This fixes an issue in OpenSMTPD when a long pki name could break the configuration. OK gilles@ benno@
2014-10-16disable SSLv3Gilles Chehade
ok jsing@
2014-10-02avoid a double freeTheo de Raadt
ok gilles
2014-08-25Delete secret or secret-derived data with explicit_bzero.Doug Hogan
concept ok deraadt@ diff looks ok tedu@
2014-07-10add additional includes required to build with -DOPENSSL_NO_DEPRECATEDJonathan Gray
ok eric@ gilles@
2014-07-08zap trailing tabEric Faurot
2014-05-20Unify the SSL privsep key loading functions.Reyk Floeter
ok eric@
2014-05-20Deep down inside OpenSSL, err... LibreSSL, RSA_set_ex_data attempts toReyk Floeter
free() the external data when releasing the RSA object. The RSA_GET_EX_NEW_INDEX(3) manual page doesn't mention that this is the default behaviour - it just describes the possible free_func() callback - and the code path in libcrypto is hiding the fact behind layers of abstraction. Fix possible double free by allocating and copying the external data reference that is used for RSA privsep (pkiname in smtpd's case). ok eric@ gilles@
2014-05-10Fix SSL breakage that I accidentally introduced with my previous commit.Reyk Floeter
2014-05-06Fix two memory leaks: EVP_PKEY_get1_RSA() returns a referenced keyReyk Floeter
that requires to call RSA_free() to dereference it after use. Also free a temporary key that was read by PEM_read_PrivateKey() and immediately written into a bio. ok markus@
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-29It is only required to load the keys and certs into the same SSLReyk Floeter
context once. Simplify the code path by moving the loading from three different places into ssl_ctx_create(): ok gilles@
2014-04-19(void) cast a snprintf() call that can't possibly truncate unless weGilles Chehade
suddenly supported a cipher with a name that's > 200 bytes long ... ... in which case harmless truncation would occur and we'd have to readjust our buffer
2014-02-17fix possible NULL-deref in error code pathEric Faurot
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-11-28fix loading of passphrase-protected keys.Eric Faurot
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-26%i -> %d in format stringsEric Faurot
2013-07-19tls perfect forward secrecy with ecdheEric Faurot
suggested by djm@ on hackers@, diff ok djm@
2013-05-24sync with OpenSMTPD 5.3.2Eric Faurot
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-23knfEric Faurot
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-14enforce different permissions on different files in ssl_load_file()Alexander Hall
with gilles and eric, tested by me and gilles ok gilles@
2012-10-09Reject ssl key/certs/CA/DH files if their ownership/permissions are notEric Faurot
correct (uid 0, no rights for g/o). Initial diff by Sunil Nimmagadda. ok gilles@ chl@
2012-09-14Remove s_ssl from the smtp session since it is duplicated in the io struct.Eric Faurot
Change ssl_session_init to ssl_smtp_init and make it simpler: only create an SSL* from the SSL_CTX* passed as parameter, so it does not have to know about the struct session itself. Kill some dead prototypes while there. ok chl@ gilles@
2012-08-19coding style: replace all occurences of u_int* with uint*Charles Longeau
ok eric@
2012-01-29Rewrite io code in smtp and mta using the iobuf/ioev interface to haveEric Faurot
a better separation between io and protocol logic. As a side-effect, it fixes a couple of long-standing issues in the io path, and hopefully add fresh ones instead. Kill client.c in the process. ok gilles@
2012-01-11enable back CA support, just don't verify client ...Gilles Chehade
tested @ home
2011-12-21disable temporarily CA support, it prevents some remote hosts fromCharles Longeau
establishing a ssl session. will be investigated and reenabled soon asked and commited on behalf of gilles@ ok gilles@
2011-12-14add missing prototypeEric Faurot
ok gilles@
2011-12-13*finally* make use of certificate authority file if available !Gilles Chehade
bits from relayd, ok chl@, ok eric@
2011-10-27Don't offer or negotiate SSLv2 and, since we don't do SSL sessionPhilip Guenthe
caching, don't try to negotiate an RFC 4507-style session ticket, as it would be useless and some (broken and non-compliant) servers choke on TLS extension negotiation. ok gilles@