OpenBSD CVS

CVS log for src/usr.sbin/smtpd/ssl.c


[BACK] Up to [local] / src / usr.sbin / smtpd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.100 / (download) - annotate - [select for diffs], Sun Jun 25 08:08:03 2023 UTC (11 months, 1 week ago) by op
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.99: +1 -24 lines
Diff to previous 1.99 (colored)

remove ssl_init()

it's a noop; nowadays both LibreSSL and OpenSSL libcrypto and libssl
initialize themselves automatically before doing anything.

noticed by jsing, ok tb

Revision 1.99 / (download) - annotate - [select for diffs], Sun Jun 11 10:30:10 2023 UTC (11 months, 3 weeks ago) by op
Branch: MAIN
Changes since 1.98: +2 -2 lines
Diff to previous 1.98 (colored)

fix typo: 'hash buffer to small' -> too small

Revision 1.98 / (download) - annotate - [select for diffs], Fri Feb 18 16:57:36 2022 UTC (2 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.97: +57 -0 lines
Diff to previous 1.97 (colored)

Revert changes to use the new libtls signer api
There are bugs in the new libtls signer that can lead to a crash.
OK tb@ jsing@

Revision 1.97 / (download) - annotate - [select for diffs], Sat Feb 12 18:22:04 2022 UTC (2 years, 3 months ago) by eric
Branch: MAIN
Changes since 1.96: +1 -58 lines
Diff to previous 1.96 (colored)

use new libtls signer api

ok tb@

Revision 1.96 / (download) - annotate - [select for diffs], Mon Jun 14 17:58:16 2021 UTC (2 years, 11 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.95: +4 -19 lines
Diff to previous 1.95 (colored)

add required headers for smtpd.h and remove unnecessary ones in other files.

ok jung@

Revision 1.95 / (download) - annotate - [select for diffs], Wed May 26 07:05:50 2021 UTC (3 years ago) by eric
Branch: MAIN
Changes since 1.94: +3 -194 lines
Diff to previous 1.94 (colored)

remove unused code

ok millert@

Revision 1.94 / (download) - annotate - [select for diffs], Fri Mar 5 12:37:32 2021 UTC (3 years, 2 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.93: +57 -1 lines
Diff to previous 1.93 (colored)

Start porting smtpd to libtls.

Note that it changes the way SNI works: The certificate to use is now
selected by looking at the names found in the certificates themselves,
rather than the names of the pki entries in the configuration file.
The set of certificates for a tls listener must be defined explicitly by
using the pki listener option multiple times.

ok tb@

Revision 1.93 / (download) - annotate - [select for diffs], Wed Jun 5 06:40:13 2019 UTC (4 years, 11 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.92: +11 -3 lines
Diff to previous 1.92 (colored)

a long long time ago, in a galaxy quite close actually, reyk@ introduced an
RSA privsep engine to isolate private keys in the ca process. ECDSA support
in smtpd is become a frequent request so here's an ECDSA privsep engine and
the code required for smtpd to load ECDSA certificates and use them.

Revision 1.92 / (download) - annotate - [select for diffs], Fri May 24 16:29:41 2019 UTC (5 years ago) by gilles
Branch: MAIN
Changes since 1.91: +2 -2 lines
Diff to previous 1.91 (colored)

ERR_R_SSL_LIB is defined to ERR_LIB_SSL which works for both LibreSSL and
OpenSSL, so use that one instead to reduce delta in portable branch

Revision 1.91 / (download) - annotate - [select for diffs], Tue May 21 06:38:44 2019 UTC (5 years ago) by otto
Branch: MAIN
Changes since 1.90: +9 -4 lines
Diff to previous 1.90 (colored)

Use malloc_ and calloc_conceal() to allocate memory for sensitive,
private key data. We leave the corresponding freezero() calls since
the code might be ported to a system not having the conceal functions.
This also makes sure the stdio bufer is concealed.  And zap a
redundant free(buf); ok gilles@

Revision 1.90 / (download) - annotate - [select for diffs], Thu Dec 20 19:40:13 2018 UTC (5 years, 5 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.89: +2 -2 lines
Diff to previous 1.89 (colored)

change the format of ssl_to_text() to match that of io's, this only affect
smtp and mta "tls" log lines and tls event reporting

Revision 1.89 / (download) - annotate - [select for diffs], Wed May 17 14:00:06 2017 UTC (7 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.88: +9 -15 lines
Diff to previous 1.88 (colored)

Introduce more use of freezero().  Also, remove ptr conditionals before
many functions which are free(NULL)-compat
ok gilles

Revision 1.88 / (download) - annotate - [select for diffs], Thu Mar 30 15:41:04 2017 UTC (7 years, 2 months ago) by jsing
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.87: +2 -1 lines
Diff to previous 1.87 (colored)

Disable client-initiated renegotiation.

ok gilles@ eric@ deraadt@

Revision 1.87 / (download) - annotate - [select for diffs], Fri Sep 2 09:43:54 2016 UTC (7 years, 9 months ago) by gilles
Branch: MAIN
Changes since 1.86: +2 -1 lines
Diff to previous 1.86 (colored)

turn server preference for ciphers on by default

ok jsing@

Revision 1.86 / (download) - annotate - [select for diffs], Thu Apr 21 14:27:41 2016 UTC (8 years, 1 month ago) by jsing
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.85: +2 -112 lines
Diff to previous 1.85 (colored)

Use automatic DH parameters, instead of fixed ones. Also disable DHE by
default since it is computationally expensive and a potential DoS vector.

ok gilles@

Revision 1.85 / (download) - annotate - [select for diffs], Sun Dec 13 09:52:44 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.84: +6 -2 lines
Diff to previous 1.84 (colored)

refactor a bit to move the SNI handling away from smtp_session into smtp

ok sunil@, jung@

Revision 1.84 / (download) - annotate - [select for diffs], Sat Dec 12 20:02:31 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.83: +4 -4 lines
Diff to previous 1.83 (colored)

remove CA from pki and no longer allow specifying a CA with 'pki' keyword.
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@

Revision 1.83 / (download) - annotate - [select for diffs], Sat Dec 12 18:30:39 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.82: +2 -2 lines
Diff to previous 1.82 (colored)

do not prevent group from reading key, it prevents a certificate from
being shared between smtpd and another daemon

Revision 1.82 / (download) - annotate - [select for diffs], Sat Dec 12 17:16:56 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.81: +7 -5 lines
Diff to previous 1.81 (colored)

allow overriding the default cipher-suite

ok jung@, sunil@, millert@

Revision 1.81 / (download) - annotate - [select for diffs], Sat Dec 12 17:14:40 2015 UTC (8 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.80: +34 -25 lines
Diff to previous 1.80 (colored)

bump DH params to 2048, it's been part of smtpd releases for a long time
and I've been running with it since June with no side-effect

ok sunil@, jung@, millert@

Revision 1.80 / (download) - annotate - [select for diffs], Sat Dec 5 21:27:42 2015 UTC (8 years, 5 months ago) by mmcc
Branch: MAIN
Changes since 1.79: +2 -3 lines
Diff to previous 1.79 (colored)

Remove a few NULL-checks before free().

Revision 1.79 / (download) - annotate - [select for diffs], Thu Nov 5 12:35:58 2015 UTC (8 years, 6 months ago) by jung
Branch: MAIN
Changes since 1.78: +4 -4 lines
Diff to previous 1.78 (colored)

replace u_char and u_int* with standard stdint.h types to ease portable version
also remove trailing whitespaces while here

no binary change

ok sunil millert gilles

Revision 1.78 / (download) - annotate - [select for diffs], Wed Oct 21 16:45:13 2015 UTC (8 years, 7 months ago) by jsing
Branch: MAIN
Changes since 1.77: +2 -27 lines
Diff to previous 1.77 (colored)

Use SSL_CTX_set_ecdh_auto() instead of rolling our own version.

ok gilles@

Revision 1.77 / (download) - annotate - [select for diffs], Fri Oct 16 21:13:33 2015 UTC (8 years, 7 months ago) by sthen
Branch: MAIN
Changes since 1.76: +2 -2 lines
Diff to previous 1.76 (colored)

Use SSL_get_version() not SSL_get_cipher_version(); the former gives the TLS
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@

Revision 1.76 / (download) - annotate - [select for diffs], Fri Mar 13 13:42:54 2015 UTC (9 years, 2 months ago) by giovanni
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.75: +2 -1 lines
Diff to previous 1.75 (colored)

Missing free(3) in error path

Revision 1.75 / (download) - annotate - [select for diffs], Fri Feb 6 01:37:11 2015 UTC (9 years, 3 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.74: +2 -2 lines
Diff to previous 1.74 (colored)

Rename SSL_CTX_use_certificate_chain() to SSL_CTX_use_certificate_chain_mem().

As discussed with beck@ jsing@ and others
OK beck@

Revision 1.74 / (download) - annotate - [select for diffs], Fri Jan 16 15:08:52 2015 UTC (9 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (colored)

SSL_CTX_use_certificate_chain() has been added to LibreSSL and there
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@

Revision 1.73 / (download) - annotate - [select for diffs], Fri Jan 16 14:34:51 2015 UTC (9 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.72: +9 -4 lines
Diff to previous 1.72 (colored)

The SSL/TLS session Id context is limited to 32 bytes.  Instead of
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@

Revision 1.72 / (download) - annotate - [select for diffs], Thu Oct 16 09:40:46 2014 UTC (9 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

disable SSLv3

ok jsing@

Revision 1.71 / (download) - annotate - [select for diffs], Thu Oct 2 18:30:21 2014 UTC (9 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.70: +2 -1 lines
Diff to previous 1.70 (colored)

avoid a double free
ok gilles

Revision 1.70 / (download) - annotate - [select for diffs], Mon Aug 25 07:50:26 2014 UTC (9 years, 9 months ago) by doug
Branch: MAIN
Changes since 1.69: +3 -3 lines
Diff to previous 1.69 (colored)

Delete secret or secret-derived data with explicit_bzero.

concept ok deraadt@
diff looks ok tedu@

Revision 1.69 / (download) - annotate - [select for diffs], Thu Jul 10 20:16:48 2014 UTC (9 years, 10 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.68: +4 -1 lines
Diff to previous 1.68 (colored)

add additional includes required to build with -DOPENSSL_NO_DEPRECATED
ok eric@ gilles@

Revision 1.68 / (download) - annotate - [select for diffs], Tue Jul 8 14:22:38 2014 UTC (9 years, 10 months ago) by eric
Branch: MAIN
Changes since 1.67: +2 -2 lines
Diff to previous 1.67 (colored)

zap trailing tab

Revision 1.67 / (download) - annotate - [select for diffs], Tue May 20 17:33:36 2014 UTC (10 years ago) by reyk
Branch: MAIN
Changes since 1.66: +32 -31 lines
Diff to previous 1.66 (colored)

Unify the SSL privsep key loading functions.

ok eric@

Revision 1.66 / (download) - annotate - [select for diffs], Tue May 20 14:21:45 2014 UTC (10 years ago) by reyk
Branch: MAIN
Changes since 1.65: +32 -25 lines
Diff to previous 1.65 (colored)

Deep down inside OpenSSL, err... LibreSSL, RSA_set_ex_data attempts to
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@

Revision 1.65 / (download) - annotate - [select for diffs], Sat May 10 21:34:07 2014 UTC (10 years ago) by reyk
Branch: MAIN
Changes since 1.64: +2 -1 lines
Diff to previous 1.64 (colored)

Fix SSL breakage that I accidentally introduced with my previous commit.

Revision 1.64 / (download) - annotate - [select for diffs], Tue May 6 11:03:03 2014 UTC (10 years ago) by reyk
Branch: MAIN
Changes since 1.63: +15 -10 lines
Diff to previous 1.63 (colored)

Fix two memory leaks: EVP_PKEY_get1_RSA() returns a referenced key
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@

Revision 1.63 / (download) - annotate - [select for diffs], Tue Apr 29 19:13:14 2014 UTC (10 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.62: +92 -7 lines
Diff to previous 1.62 (colored)

Implement RSA privilege separation for OpenSMTPD, based on my previous
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@

Revision 1.62 / (download) - annotate - [select for diffs], Tue Apr 29 10:08:55 2014 UTC (10 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.61: +17 -12 lines
Diff to previous 1.61 (colored)

It is only required to load the keys and certs into the same SSL
context once.  Simplify the code path by moving the loading from three
different places into ssl_ctx_create():

ok gilles@

Revision 1.61 / (download) - annotate - [select for diffs], Sat Apr 19 14:09:19 2014 UTC (10 years, 1 month ago) by gilles
Branch: MAIN
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored)

(void) cast a snprintf() call that can't possibly truncate unless we
	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

Revision 1.60 / (download) - annotate - [select for diffs], Mon Feb 17 19:50:09 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.59: +3 -2 lines
Diff to previous 1.59 (colored)

fix possible NULL-deref in error code path

Revision 1.59 / (download) - annotate - [select for diffs], Tue Feb 4 13:44:41 2014 UTC (10 years, 3 months ago) by eric
Branch: MAIN
Changes since 1.58: +30 -26 lines
Diff to previous 1.58 (colored)

pki code cleanup

- 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

Revision 1.58 / (download) - annotate - [select for diffs], Thu Dec 26 17:25:32 2013 UTC (10 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.57: +3 -3 lines
Diff to previous 1.57 (colored)

bcopy -> memmove
bzero -> memset

Revision 1.57 / (download) - annotate - [select for diffs], Thu Nov 28 12:50:40 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.56: +49 -8 lines
Diff to previous 1.56 (colored)

fix loading of passphrase-protected keys.

Revision 1.56 / (download) - annotate - [select for diffs], Wed Nov 6 10:01:29 2013 UTC (10 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.55: +23 -53 lines
Diff to previous 1.55 (colored)

Much much improved config parser and related changes.
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).

Revision 1.55 / (download) - annotate - [select for diffs], Sat Oct 26 12:27:59 2013 UTC (10 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (colored)

%i -> %d in format strings

Revision 1.54 / (download) - annotate - [select for diffs], Fri Jul 19 09:04:06 2013 UTC (10 years, 10 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.53: +26 -1 lines
Diff to previous 1.53 (colored)

tls perfect forward secrecy with ecdhe

suggested by djm@ on hackers@, diff ok djm@

Revision 1.53 / (download) - annotate - [select for diffs], Fri May 24 17:03:14 2013 UTC (11 years ago) by eric
Branch: MAIN
Changes since 1.52: +2 -5 lines
Diff to previous 1.52 (colored)

sync with OpenSMTPD 5.3.2

ok gilles@

Revision 1.52 / (download) - annotate - [select for diffs], Sat Jan 26 09:37:24 2013 UTC (11 years, 4 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.51: +148 -229 lines
Diff to previous 1.51 (colored)

Sync with our smtpd repo:

* 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@

Revision 1.51 / (download) - annotate - [select for diffs], Fri Nov 23 10:55:25 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.50: +14 -13 lines
Diff to previous 1.50 (colored)

knf

ok gilles@

Revision 1.50 / (download) - annotate - [select for diffs], Mon Nov 12 14:58:53 2012 UTC (11 years, 6 months ago) by eric
Branch: MAIN
Changes since 1.49: +22 -10 lines
Diff to previous 1.49 (colored)

Cleanups and improvements:

* 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@

Revision 1.49 / (download) - annotate - [select for diffs], Sun Oct 14 14:26:31 2012 UTC (11 years, 7 months ago) by halex
Branch: MAIN
Changes since 1.48: +16 -11 lines
Diff to previous 1.48 (colored)

enforce different permissions on different files in ssl_load_file()

with gilles and eric, tested by me and gilles

ok gilles@

Revision 1.48 / (download) - annotate - [select for diffs], Tue Oct 9 20:32:25 2012 UTC (11 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.47: +22 -6 lines
Diff to previous 1.47 (colored)

Reject ssl key/certs/CA/DH files if their ownership/permissions are not
correct (uid 0, no rights for g/o).

Initial diff by Sunil Nimmagadda.

ok gilles@ chl@

Revision 1.47 / (download) - annotate - [select for diffs], Fri Sep 14 19:22:04 2012 UTC (11 years, 8 months ago) by eric
Branch: MAIN
Changes since 1.46: +8 -13 lines
Diff to previous 1.46 (colored)

Remove s_ssl from the smtp session since it is duplicated in the io struct.
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@

Revision 1.46 / (download) - annotate - [select for diffs], Sun Aug 19 14:16:58 2012 UTC (11 years, 9 months ago) by chl
Branch: MAIN
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored)

coding style: replace all occurences of u_int* with uint*

ok eric@

Revision 1.45 / (download) - annotate - [select for diffs], Sun Jan 29 11:37:32 2012 UTC (12 years, 4 months ago) by eric
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.44: +52 -371 lines
Diff to previous 1.44 (colored)

Rewrite io code in smtp and mta using the iobuf/ioev interface to have
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@

Revision 1.44 / (download) - annotate - [select for diffs], Wed Jan 11 20:00:37 2012 UTC (12 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.43: +1 -4 lines
Diff to previous 1.43 (colored)

enable back CA support, just don't verify client ...

tested @ home

Revision 1.43 / (download) - annotate - [select for diffs], Wed Dec 21 21:10:15 2011 UTC (12 years, 5 months ago) by chl
Branch: MAIN
Changes since 1.42: +3 -1 lines
Diff to previous 1.42 (colored)

disable temporarily CA support, it prevents some remote hosts from
establishing a ssl session. will be investigated and reenabled soon

asked and commited on behalf of gilles@

ok gilles@

Revision 1.42 / (download) - annotate - [select for diffs], Wed Dec 14 17:51:38 2011 UTC (12 years, 5 months ago) by eric
Branch: MAIN
Changes since 1.41: +3 -1 lines
Diff to previous 1.41 (colored)

add missing prototype

ok gilles@

Revision 1.41 / (download) - annotate - [select for diffs], Tue Dec 13 23:55:00 2011 UTC (12 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.40: +18 -3 lines
Diff to previous 1.40 (colored)

*finally* make use of certificate authority file if available !

bits from relayd, ok chl@, ok eric@

Revision 1.40 / (download) - annotate - [select for diffs], Thu Oct 27 04:23:19 2011 UTC (12 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.39: +3 -2 lines
Diff to previous 1.39 (colored)

Don't offer or negotiate SSLv2 and, since we don't do SSL session
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@

Revision 1.39 / (download) - annotate - [select for diffs], Sun Oct 23 10:44:20 2011 UTC (12 years, 7 months ago) by chl
Branch: MAIN
Changes since 1.38: +2 -1 lines
Diff to previous 1.38 (colored)

add a missing DH_free() after ssl_set_ephemeral_key_exchange().

tested by gilles@

ok gilles@ eric@

Revision 1.38 / (download) - annotate - [select for diffs], Thu Oct 13 10:54:40 2011 UTC (12 years, 7 months ago) by eric
Branch: MAIN
Changes since 1.37: +2 -1 lines
Diff to previous 1.37 (colored)

Drop a reference to the client SSL_CTX after SSL_new(), so that it is
correctly freed by SSL_free() at the end of the session.

Plug a leak in the mta.

ok! gilles@

Revision 1.37 / (download) - annotate - [select for diffs], Thu Sep 1 19:56:49 2011 UTC (12 years, 9 months ago) by eric
Branch: MAIN
Changes since 1.36: +11 -19 lines
Diff to previous 1.36 (colored)

Introduce a small set of functions to manage stat counters in a
simpler and hopefully saner way.

ok gilles@ chl@

Revision 1.36 / (download) - annotate - [select for diffs], Sat May 21 17:01:58 2011 UTC (13 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.35: +3 -3 lines
Diff to previous 1.35 (colored)

make the "no DH parameters" warning a log_info()

Revision 1.35 / (download) - annotate - [select for diffs], Tue May 17 16:32:58 2011 UTC (13 years ago) by gilles
Branch: MAIN
Changes since 1.34: +2 -1 lines
Diff to previous 1.34 (colored)

somehow a previous sync with relayd missed one line...
if a ssl_connect() call needs to retry because of SSL_WANT_READ or
SSL_WANT_WRITE, set the proper event flag instead of keeping the default
one which is both read and write.

Revision 1.34 / (download) - annotate - [select for diffs], Sat May 14 11:08:23 2011 UTC (13 years ago) by gilles
Branch: MAIN
Changes since 1.33: +4 -4 lines
Diff to previous 1.33 (colored)

more clang warnings fixed

Revision 1.33 / (download) - annotate - [select for diffs], Sun May 1 12:57:11 2011 UTC (13 years, 1 month ago) by eric
Branch: MAIN
Changes since 1.32: +14 -14 lines
Diff to previous 1.32 (colored)

the smtpd env is meant to be global, so do not pass it all around.

discussed with and ok gilles@

Revision 1.32 / (download) - annotate - [select for diffs], Tue Mar 15 19:24:55 2011 UTC (13 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.31: +109 -60 lines
Diff to previous 1.31 (colored)

let smtpd use user-provided Diffie-Hellman parameters for ephemeral key
exchange. if no DH parameters are found, fallback to builtin parameters
as was done until now.

since we now accept user-provided DH parameters, make smtpd more strict
and fatal() if the parameters are bogus.

bump the key size of the DH parameters from 512bits to 1024bits, it might
be bumped further after some more research.

thanks to mikeb@ for his suggestions

diff ok mikeb@ , man ok jmc@

Revision 1.31 / (download) - annotate - [select for diffs], Sun Nov 28 13:56:43 2010 UTC (13 years, 6 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.30: +3 -1 lines
Diff to previous 1.30 (colored)

a bit of .h cleanups, no functionnal change

Revision 1.30 / (download) - annotate - [select for diffs], Wed Nov 24 23:27:04 2010 UTC (13 years, 6 months ago) by todd
Branch: MAIN
Changes since 1.29: +5 -1 lines
Diff to previous 1.29 (colored)

add *maxactive stats
"ok and no need to keep them for yourself" gilles@

Revision 1.29 / (download) - annotate - [select for diffs], Sat Oct 9 22:05:35 2010 UTC (13 years, 7 months ago) by gilles
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

backout the "new" queue code commited 4 months ago. it has many good ideas,
is way more optimized than what we had earlier and there's definitely stuff
we want to keep, however it is early optimization that doesn't account for
many features and makes them hard (if not impossible) to write without
ugly workarounds that ruin the purpose of the optimizations.

the backout goes to 30 May's right before the commit and catches up on all
the non-queue related commits that happened since then.

i'll work on reintroducing the ideas from this queue when the basic
features we expect from a MTA are implemented.

suggested on tech@ about a week ago, no objections, several "please make
smtpd move forward" mails from hackers and tech readers.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jun 1 23:06:25 2010 UTC (14 years ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

new queue, again; gcc2 compile tested by deraadt

Revision 1.27 / (download) - annotate - [select for diffs], Tue Jun 1 19:47:09 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.26: +1 -1 lines
Diff to previous 1.26 (colored)

New queue doesn't compile on gcc2, back out.  Spotted by deraadt@

Revision 1.26 / (download) - annotate - [select for diffs], Mon May 31 23:38:56 2010 UTC (14 years ago) by jacekm
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

Rewrite entire queue code.

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.

Revision 1.25 / (download) - annotate - [select for diffs], Wed May 26 13:56:08 2010 UTC (14 years ago) by nicm
Branch: MAIN
Changes since 1.24: +6 -6 lines
Diff to previous 1.24 (colored)

Rename some imsg bits to make namespace collisions less likely buf to
ibuf, buf_read to ibuf_read, READ_BUF_SIZE to IBUF_READ_SIZE.

ok henning gilles claudio jacekm deraadt

Revision 1.24 / (download) - annotate - [select for diffs], Wed May 19 20:57:10 2010 UTC (14 years ago) by gilles
Branch: MAIN
Changes since 1.23: +1 -2 lines
Diff to previous 1.23 (colored)

cleanup-only commit, removes unrequired includes, no functionnal change

Revision 1.23 / (download) - annotate - [select for diffs], Wed Nov 11 15:36:10 2009 UTC (14 years, 6 months ago) by jacekm
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.22: +8 -3 lines
Diff to previous 1.22 (colored)

Check if the receive buffer has any unused space before reading from socket in
buf_read (and in ssl_buf_read).

Revision 1.22 / (download) - annotate - [select for diffs], Sat Oct 3 07:59:55 2009 UTC (14 years, 8 months ago) by jacekm
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

dont dereference garbage pointer, from martynas@

Revision 1.21 / (download) - annotate - [select for diffs], Tue Sep 22 08:23:09 2009 UTC (14 years, 8 months ago) by jj
Branch: MAIN
Changes since 1.20: +59 -2 lines
Diff to previous 1.20 (colored)

fix handling of certificates to unbreak DSA; allows starttls(8) instructions to work with smtpd; ok jacekm@, on behalf of gilles@ who doesnt have access to a safe machine

Revision 1.20 / (download) - annotate - [select for diffs], Tue Sep 15 16:50:06 2009 UTC (14 years, 8 months ago) by jacekm
Branch: MAIN
Changes since 1.19: +65 -44 lines
Diff to previous 1.19 (colored)

Extend SMTP client_* API to support SSL+AUTH, and use it in the mta
process to relay mails.  ok gilles@

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jun 2 22:23:36 2009 UTC (15 years ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.18: +5 -5 lines
Diff to previous 1.18 (colored)

make env->sc_listeners and env->sc_ssl pointers, one step further toward
configuration reloading without killing active sessions; ok jacekm@

Revision 1.18 / (download) - annotate - [select for diffs], Mon Jun 1 18:02:41 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

fix function name in log_debug

Revision 1.17 / (download) - annotate - [select for diffs], Sat May 30 23:53:41 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.16: +28 -3 lines
Diff to previous 1.16 (colored)

It is now possible to specify a certificate to use when relaying to another
host which requests client certificates:

	accept [...] relay via [...] ssl certificate "mycert"

diff from Josh Elsasser <josh@elsasser.org>, tested and okayed by me with
no change but the addition of status 554 to the state machine to deal with
remote host telling us it doesn't like our certificate.

Revision 1.16 / (download) - annotate - [select for diffs], Sun May 24 14:22:24 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.15: +7 -9 lines
Diff to previous 1.15 (colored)

Instead of keeping stats private to each process, and querying every
process individually whenever stats need to be fetched, keep stats
in MAP_ANON shared memory allocated by parent.

This means control has direct access to stats and can respond very
quickly without troubling any other daemon processes.

ok gilles@

Revision 1.15 / (download) - annotate - [select for diffs], Tue May 19 22:41:35 2009 UTC (15 years ago) by gilles
Branch: MAIN
Changes since 1.14: +1 -4 lines
Diff to previous 1.14 (colored)

remove useless check on NULL ssl cert and key, the check cannot be reached
as we would exit earlier if either one is NULL.

diff by giovanni <qgiovanni@gmail.com>, had been sitting in my mbox for a
while, okayed by jacek and I

Revision 1.14 / (download) - annotate - [select for diffs], Mon May 18 20:23:35 2009 UTC (15 years ago) by jacekm
Branch: MAIN
Changes since 1.13: +5 -3 lines
Diff to previous 1.13 (colored)

Complete rework of bufferevent event masking allowing for  more
strictness:
- Drop clients attempting command pipelining; protects the daemon
from all kinds of abuse.
- Replace F_EVLOCKED flag with F_WRITEONLY which has cleaner sematics:
when up, session must not be destroyed nor read from, but may be
written to.
- Write callback becomes a central place for enabling EV_READ.
- Delay bufferevent creation until after ssl handshake is completed.

A bunch of session error stats were added to smtpctl's "show stats".
These could help spotting event masking errors in the future.

ok gilles@

Revision 1.13 / (download) - annotate - [select for diffs], Wed Apr 15 20:34:59 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.12: +4 -4 lines
Diff to previous 1.12 (colored)

s/ssmtp/smtps/; ok gilles@

Revision 1.12 / (download) - annotate - [select for diffs], Thu Apr 9 19:49:34 2009 UTC (15 years, 1 month ago) by jacekm
Branch: MAIN
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored)

change syntax of the "listen on" and "relay via" directives:
1) kill the ssmtp keyword in "ssmtp listen on ...";
2) kill the use keyword in "... use certificate foo";
3) tls no longer implicit, user must explicitely use the tls or smtps option.
4) for "relay via", move the tls/smtps options to right after the
port specification; makes it similar to "listen on".

These directives:

  ssmtp listen on fxp0 use ceritifate "foo"
  accept for all relay via tls "mx.bar.com"

now become:

  listen on fxp0 smtps certificate "foo"
  accept for all relay via "mx.bar.com" tls

ok gilles@

Revision 1.11 / (download) - annotate - [select for diffs], Sun Mar 15 19:32:11 2009 UTC (15 years, 2 months ago) by gilles
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

since we are going to share code in smtp sessions and mta sessions, we need
to also share the statistics structure, still being worked on

Revision 1.10 / (download) - annotate - [select for diffs], Thu Feb 5 21:25:19 2009 UTC (15 years, 3 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.9: +8 -2 lines
Diff to previous 1.9 (colored)

when calling ssl_session_destroy() from mta, our session will have a NULL
s->s_l field. this commit fixes a crash in mta caused by a NULL deref.

Revision 1.9 / (download) - annotate - [select for diffs], Fri Jan 30 21:52:55 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.8: +5 -3 lines
Diff to previous 1.8 (colored)

when decreasing ssl related counters, make sure the session was flagged as
F_SECURE. while at it, add "smtp.sessions.aborted" which keeps track of
sessions which were interrupted before completion.

Revision 1.8 / (download) - annotate - [select for diffs], Fri Jan 30 21:40:21 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.7: +19 -1 lines
Diff to previous 1.7 (colored)

improve statistics for smtp process. not only collect the current sessions
count, but also the total sessions count, ssmtp sessions (both current and
total) and starttls sessions (both current and total)

# ./smtpctl/smtpctl show stats|grep smtp.sessions
smtp.sessions = 0
smtp.sessions.active = 0
smtp.sessions.ssmtp = 0
smtp.sessions.ssmtp.active = 0
smtp.sessions.starttls = 0
smtp.sessions.starttls.active = 0
#

Revision 1.7 / (download) - annotate - [select for diffs], Thu Jan 29 14:25:55 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.6: +7 -2 lines
Diff to previous 1.6 (colored)

initial starttls support in mta, this allows:

	accept for domain "openbsd.org" relay via tls "mx.example.org"

to ensure the relaying of mail for whoever@openbsd.org will happen through
a secure tls (STARTTLS) session. failure to establish a tls session will be
considered as a permanent failure. As a side effect:

	accept for domain "openbsd.org" relay via ssl "mx.example.org"

can now work as well and ensure that the relaying happens through ssmtp OR
tls, but never through an unsafe channel. no need to specify a port, they
are automatically detected if not specified.

still a work in progress, don't expect that it will work flawlessly.

Revision 1.6 / (download) - annotate - [select for diffs], Thu Jan 29 13:00:12 2009 UTC (15 years, 4 months ago) by gilles
Branch: MAIN
Changes since 1.5: +85 -1 lines
Diff to previous 1.5 (colored)

bring initial support for SSL in the mta part of smtpd, allowing for:

	accept for domain "openbsd.org" relay via ssmtp "mx1.example.org"

to ensure that deliveries for whatever@openbsd.org goes through an SSL session
to mx1.example.org

Revision 1.5 / (download) - annotate - [select for diffs], Thu Jan 1 16:15:47 2009 UTC (15 years, 5 months ago) by jacekm
Branch: MAIN
Changes since 1.4: +1 -2 lines
Diff to previous 1.4 (colored)

remove unnecessary includes; ok gilles@

Revision 1.4 / (download) - annotate - [select for diffs], Thu Dec 11 23:01:16 2008 UTC (15 years, 5 months ago) by gilles
Branch: MAIN
Changes since 1.3: +5 -8 lines
Diff to previous 1.3 (colored)

- snprintf -> bsnprintf

Revision 1.3 / (download) - annotate - [select for diffs], Mon Nov 10 00:57:35 2008 UTC (15 years, 6 months ago) by gilles
Branch: MAIN
Changes since 1.2: +8 -5 lines
Diff to previous 1.2 (colored)

- snprintf() can return -1, make sure every call is checked properly

Revision 1.2 / (download) - annotate - [select for diffs], Wed Nov 5 12:14:45 2008 UTC (15 years, 6 months ago) by sobrado
Branch: MAIN
Changes since 1.1: +2 -0 lines
Diff to previous 1.1 (colored)

add a few missing id tags; there are a bunch of files, and developers
will probably miss this change when working on more important matters,
so it is probably better to sort them now.  there is a risk of losing
the tags if a change needs to be reverted too.

written with excellent advice from jmc@

ok gilles@

Revision 1.1 / (download) - annotate - [select for diffs], Sat Nov 1 21:35:28 2008 UTC (15 years, 7 months ago) by gilles
Branch: MAIN

smtpd is a smtp server implementation for OpenBSD. It is a work in progress
which still lacks many features. bringing it in tree will help working on it
more easily.

"at this stage it should go in" henning@, "move ahead" deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.