xref: /netbsd-src/external/ibm-public/postfix/dist/html/FORWARD_SECRECY_README.html (revision afab4e300d3a9fb07dd8c80daf53d0feb3345706)
1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2        "http://www.w3.org/TR/html4/loose.dtd">
3
4<html>
5
6<head>
7
8<title>TLS Forward Secrecy in Postfix</title>
9
10<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
11
12</head>
13
14<body>
15
16<h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">
17TLS Forward Secrecy in Postfix
18</h1>
19
20<hr>
21
22<h2> Warning </h2>
23
24<p> Forward secrecy does not protect against active attacks such
25as forged DNS replies or forged TLS server certificates. If such
26attacks are a concern, then the SMTP client will need to authenticate
27the remote SMTP server in a sufficiently-secure manner.  For example,
28by the fingerprint of a (CA or leaf) public key or certificate.
29Conventional PKI relies on many trusted parties and is easily
30subverted by a state-funded adversary.  </p>
31
32<h2> Overview </h2>
33
34<p> Postfix supports forward secrecy of TLS network communication
35since version 2.2. This support was adopted from Lutz J&auml;nicke's
36"Postfix TLS patch" for earlier Postfix versions.  This document
37will focus on TLS Forward Secrecy in the Postfix SMTP client and
38server.  See <a href="TLS_README.html">TLS_README</a> for a general
39description of Postfix TLS support. </p>
40
41<p> Topics covered in this document: </p>
42
43<ul>
44
45<li> <p> Give me some background on forward secrecy in Postfix </p>
46
47<ul>
48
49<li><a href="#dfn_fs">What is Forward Secrecy</a>
50
51<li><a href="#tls_fs">Forward Secrecy in TLS</a>
52
53<li><a href="#server_fs">Forward Secrecy in the Postfix SMTP Server</a>
54
55<li><a href="#client_fs">Forward Secrecy in the Postfix SMTP Client</a>
56
57</ul>
58
59<li> <p> Never mind, just show me what it takes to get forward
60secrecy </p>
61
62<ul>
63
64<li><a href="#quick-start">Getting started, quick and dirty</a>
65
66<li><a href="#test">How can I see that a connection has forward secrecy?</a>
67
68<li><a href="#ciphers"> What ciphers provide forward secrecy? </a>
69
70<li><a href="#status"> What do "Anonymous", "Untrusted", etc. in
71Postfix logging mean? </a>
72
73</ul>
74
75<li> <p> <a href="#credits"> Credits </a> </p>
76
77</ul>
78
79<h2><a name="dfn_fs">What is Forward Secrecy</a></h2>
80
81<p> The term "Forward Secrecy" (or sometimes "Perfect Forward Secrecy")
82is used to describe security protocols in which the confidentiality
83of past traffic is not compromised when long-term keys used by either
84or both sides are later disclosed.  </p>
85
86<p> Forward secrecy is accomplished by negotiating session keys
87using per-session cryptographically-strong random numbers that are
88not saved, and signing the exchange with long-term authentication
89keys.  Later disclosure of the long-term keys allows impersonation
90of the key holder from that point on, but not recovery of prior
91traffic, since with forward secrecy, the discarded random key
92agreement inputs are not available to the attacker. </p>
93
94<p> Forward secrecy is only "perfect" when brute-force attacks on
95the key agreement algorithm are impractical even for the best-funded
96adversary and the random-number generators used by both parties are
97sufficiently strong.  Otherwise, forward secrecy leaves the attacker
98with the challenge of cracking the key-agreement protocol, which
99is likely quite computationally intensive, but may be feasible for
100sessions of sufficiently high value.  Thus forward secrecy places
101cost constraints on the efficacy of bulk surveillance, recovering
102all past traffic is generally infeasible, and even recovery of
103individual sessions may be infeasible given a sufficiently-strong
104key agreement method. </p>
105
106<h2><a name="tls_fs">Forward Secrecy in TLS</a></h2>
107
108<p> Early implementations of the SSL protocol do not provide forward
109secrecy (some provide it only with artificially-weakened "export"
110cipher suites, but we will ignore those here). The client
111sends a random "pre-master secret" to the server encrypted with the
112server's RSA public key.  The server decrypts this with its private
113key, and uses it together with other data exchanged in the clear
114to generate the session key.  An attacker with access to the server's
115private key can perform the same computation at any later time.
116The TLS library in Windows XP and Windows Server 2003 only supported
117cipher suites of this type, and Exchange 2003 servers largely do
118not support forward secrecy.  </p>
119
120<p> Later revisions to the TLS protocol introduced forward-secrecy
121cipher suites in which the client and server implement a key exchange
122protocol based on ephemeral secrets.  Sessions encrypted with one
123of these newer cipher suites are not compromised by future disclosure
124of long-term authentication keys. </p>
125
126<p> The key-exchange algorithms used for forward secrecy require
127the TLS server to designate appropriate "parameters" consisting of a
128mathematical "group" and an element of that group called a "generator".
129Presently, there are two flavors of "groups" that work with PFS: </p>
130
131<ul>
132
133<li> <p> <b> Prime-field groups (EDH):</b>  The server needs to be
134configured with a suitably-large prime and a corresponding "generator".
135The acronym for forward secrecy over prime fields is EDH for Ephemeral
136Diffie-Hellman (also abbreviated as DHE).
137</p>
138
139<li> <p> <b> Elliptic-curve groups (EECDH): </b>  The server needs
140to be configured with a "named curve".  These offer better security
141at lower computational cost than prime field groups, but are not
142as widely implemented.  The acronym for the elliptic curve version
143is EECDH which is short for Ephemeral Elliptic Curve Diffie-Hellman
144(also abbreviated as ECDHE). </p>
145
146</ul>
147
148<p> It is not essential to know what these are, but one does need
149to know that OpenSSL supports EECDH with version 1.0.0 or later.
150Thus the configuration parameters related to Elliptic-Curve forward
151secrecy are available when Postfix is linked with OpenSSL &ge; 1.0.0
152(provided EC support has not been disabled by the vendor, as in
153some versions of RedHat Linux).  </p>
154
155<p> Elliptic curves used in cryptography are typically identified
156by a "name" that stands for a set of well-known parameter values,
157and it is these "names" (or associated ASN.1 object identifiers)
158that are used in the TLS protocol.  On the other hand, with TLS there
159are no specially designated prime field groups, so each server is
160free to select its own suitably-strong prime and generator.  </p>
161
162<h2><a name="server_fs">Forward Secrecy in the Postfix SMTP Server</a></h2>
163
164<p> The Postfix &ge; 2.2 SMTP server supports forward secrecy in
165its default configuration.  If the remote SMTP client prefers cipher
166suites with forward secrecy, then the traffic between the server
167and client will resist decryption even if the server's long-term
168authentication keys are <i>later</i> compromised. </p>
169
170<p> Some remote SMTP clients may support forward secrecy, but prefer
171cipher suites <i>without</i> forward secrecy. In that case, Postfix
172&ge; 2.8 could be configured to ignore the client's preference with
173the <a href="postconf.5.html">main.cf</a> setting "<a href="postconf.5.html#tls_preempt_cipherlist">tls_preempt_cipherlist</a> = yes".  However, this
174will likely cause interoperability issues with older Exchange servers
175and is not recommended for now.  </p>
176
177<h3> EDH Server support </h3>
178
179<p> Postfix &ge; 2.2 supports 1024-bit-prime EDH out of the box,
180with no additional configuration, but you may want to override the
181default prime to be 2048 bits long, and you may want to regenerate
182your primes periodically. See the <a href="#quick-start">quick-start</a>
183section for details.  With Postfix &ge; 3.1 the out of the box
184(compiled-in) EDH prime size is 2048 bits.  </p>
185
186<p> With prime-field EDH, OpenSSL wants the server to provide
187two explicitly-selected (prime, generator) combinations.  One for
188the now long-obsolete "export" cipher suites, and another for
189non-export cipher suites.  Postfix has two such default combinations
190compiled in, but also supports explicitly-configured overrides.
191</p>
192
193<ul>
194
195<li> <p> The "export" EDH parameters are used only with the obsolete
196"export" ciphers.  To use a non-default prime, generate a 512-bit
197DH parameter file and set <a href="postconf.5.html#smtpd_tls_dh512_param_file">smtpd_tls_dh512_param_file</a> to the filename
198(see the <a href="#quick-start">quick-start</a> section for details).
199With Postfix releases after the middle of 2015 the default opportunistic
200TLS cipher grade (<a href="postconf.5.html#smtpd_tls_ciphers">smtpd_tls_ciphers</a>) is "medium" or stronger, and
201export ciphers are no longer used.  </p>
202
203<li> <p> The non-export EDH parameters are used for all other EDH
204cipher suites.  To use a non-default prime, generate a 1024-bit or
2052048-bit DH parameter file and set <a href="postconf.5.html#smtpd_tls_dh1024_param_file">smtpd_tls_dh1024_param_file</a> to
206the filename.  Despite the name this is simply the non-export
207parameter file and the prime need not actually be 1024 bits long
208(see the <a href="#quick-start">quick-start</a> section for details).
209</p>
210
211</ul>
212
213<p> As of mid-2015, SMTP clients are starting to reject TLS
214handshakes with primes smaller than 2048 bits.  Each site needs to
215determine which prime size works best for the majority of its
216clients.  See the <a href="#quick-start">quick-start</a> section
217for the recommended configuration to work around this issue.  </p>
218
219<h3> EECDH Server support </h3>
220
221<p> Postfix &ge; 2.6 supports NIST P-256 EECDH when built with OpenSSL
222&ge; 1.0.0.  When the remote SMTP client also supports EECDH and
223implements the P-256 curve, forward secrecy just works.  </p>
224
225<blockquote> <p> Note: With Postfix 2.6 and 2.7, enable EECDH by
226setting the <a href="postconf.5.html">main.cf</a> parameter <a href="postconf.5.html#smtpd_tls_eecdh_grade">smtpd_tls_eecdh_grade</a> to "strong".
227</p> </blockquote>
228
229<p> The elliptic curve standards are evolving, with new curves
230introduced in <a href="https://tools.ietf.org/html/rfc8031">RFC 8031</a> to augment or replace the NIST curves tarnished
231by the Snowden revelations.  Fortunately, TLS clients advertise
232their list of supported curves to the server so that servers can
233choose newer stronger curves when mutually supported.  OpenSSL 1.0.2
234released in January 2015 was the first release to implement negotiation
235of supported curves in TLS servers.  In older OpenSSL releases, the
236server is limited to selecting a single widely supported curve.  </p>
237
238<p> With Postfix prior to 3.2 or OpenSSL prior to 1.0.2, only a
239single server-side curve can be configured, by specifying a suitable
240EECDH "grade": </p>
241
242<blockquote>
243<pre>
244    <a href="postconf.5.html#smtpd_tls_eecdh_grade">smtpd_tls_eecdh_grade</a> = strong | ultra
245    # Underlying curves, best not changed:
246    # <a href="postconf.5.html#tls_eecdh_strong_curve">tls_eecdh_strong_curve</a> = prime256v1
247    # <a href="postconf.5.html#tls_eecdh_ultra_curve">tls_eecdh_ultra_curve</a> = secp384r1
248</pre>
249</blockquote>
250
251<p> Postfix &ge; 3.2 supports the curve negotiation API of OpenSSL
252&ge; 1.0.2.  When using this software combination, the default setting
253of "<a href="postconf.5.html#smtpd_tls_eecdh_grade">smtpd_tls_eecdh_grade</a>" changes to "auto", which selects a curve
254that is supported by both the server and client.  The list of
255candidate curves can be configured via "<a href="postconf.5.html#tls_eecdh_auto_curves">tls_eecdh_auto_curves</a>",
256which can be used to configure a prioritized list of supported
257curves (most preferred first) on both the server and client.
258The default list is suitable for most users. </p>
259
260<h2> <a name="client_fs">Forward Secrecy in the Postfix SMTP Client</a> </h2>
261
262<p> The Postfix &ge; 2.2 SMTP client supports forward secrecy in
263its default configuration.  All supported OpenSSL releases support
264EDH key exchange.  OpenSSL releases &ge; 1.0.0 also support EECDH
265key exchange (provided elliptic-curve support has not been disabled
266by the vendor as in some versions of RedHat Linux).  If the
267remote SMTP server supports cipher suites with forward secrecy (and
268does not override the SMTP client's cipher preference), then the
269traffic between the server and client will resist decryption even
270if the server's long-term authentication keys are <i>later</i>
271compromised.  </p>
272
273<p> Postfix &ge; 3.2 supports the curve negotiation API of OpenSSL
274&ge; 1.0.2.  The list of candidate curves can be changed via the
275"<a href="postconf.5.html#tls_eecdh_auto_curves">tls_eecdh_auto_curves</a>" configuration parameter, which can be used
276to select a prioritized list of supported curves (most preferred
277first) on both the Postfix SMTP server and SMTP client.  The default
278list is suitable for most users. </p>
279
280<p> The default Postfix SMTP client cipher lists are correctly
281ordered to prefer EECDH and EDH cipher suites ahead of similar
282cipher suites that don't implement forward secrecy.  Administrators
283are strongly discouraged from changing the cipher list definitions. </p>
284
285<p> The default minimum cipher grade for opportunistic TLS is
286"medium" for Postfix releases after the middle of 2015, "export"
287for older releases. Changing the minimum cipher grade does not
288change the cipher preference order.  Note that cipher grades higher
289than "medium" exclude Exchange 2003 and likely other MTAs, thus a
290"high" cipher grade should be chosen only on a case-by-case basis
291via the <a href="TLS_README.html#client_tls_policy">TLS policy</a>
292table. </p>
293
294<h2><a name="quick-start">Getting started, quick and dirty</a></h2>
295
296<h3> EECDH Client support (Postfix &ge; 2.2 with OpenSSL &ge; 1.0.0) </h3>
297
298<p> This works "out of the box" with no need for additional
299configuration. </p>
300
301<p> Postfix &ge; 3.2 supports the curve negotiation API of OpenSSL
302&ge; 1.0.2.  The list of candidate curves can be changed via the
303"<a href="postconf.5.html#tls_eecdh_auto_curves">tls_eecdh_auto_curves</a>" configuration parameter, which can be used
304to select a prioritized list of supported curves (most preferred
305first) on both the Postfix SMTP server and SMTP client.  The default
306list is suitable for most users. </p>
307
308<h3> EECDH Server support (Postfix &ge; 2.6 with OpenSSL &ge; 1.0.0) </h3>
309
310<p> With Postfix 2.6 and 2.7, enable elliptic-curve support in the
311Postfix SMTP server. This is the default with Postfix
312&ge; 2.8. Note, however, that elliptic-curve support may be disabled
313by the vendor, as in some versions of RedHat Linux. </p>
314
315<blockquote>
316<pre>
317/etc/postfix/<a href="postconf.5.html">main.cf</a>:
318    # Postfix 2.6 &amp; 2.7 only. EECDH is on by default with Postfix &ge; 2.8.
319    # The default grade is "auto" with Postfix &ge; 3.2.
320    <a href="postconf.5.html#smtpd_tls_eecdh_grade">smtpd_tls_eecdh_grade</a> = strong
321</pre>
322</blockquote>
323
324<h3> EDH Client support (Postfix &ge; 2.2, all supported OpenSSL
325versions) </h3>
326
327<p> This works "out of the box" without additional configuration. </p>
328
329<h3> EDH Server support (Postfix &ge; 2.2, all supported OpenSSL
330versions) </h3>
331
332<p> Optionally generate non-default Postfix SMTP server EDH parameters
333for improved security against pre-computation attacks and for
334compatibility with Debian-patched Exim SMTP clients that require a
335&ge; 2048-bit length for the non-export prime. </p>
336
337<p> With Postfix &ge; 3.7 built against OpenSSL version is 3.0.0 or later, when
338the value of <a href="postconf.5.html#smtpd_tls_dh1024_param_file">smtpd_tls_dh1024_param_file</a> is either empty or "<b>auto</b>", the
339EDH parameter selection is delegated to the OpenSSL library, which selects
340appropriate parameters based on the TLS handshake.  This choice is likely to be
341the most interoperable with SMTP clients using various TLS libraries, and
342custom local parameters are no longer recommended when using Postfix &ge; 3.7
343built against OpenSSL 3.0.0.  Just leave <a href="postconf.5.html#smtpd_tls_dh1024_param_file">smtpd_tls_dh1024_param_file</a> at its
344default value (both in <a href="postconf.5.html">main.cf</a>(5) and any <a href="master.5.html">master.cf</a>(5) overrides, and let
345OpenSSL do the work.  </p>
346
347<p> Otherwise, execute as root (prime group generation can take a
348few seconds to a few minutes): </p>
349
350<blockquote>
351<pre>
352# cd /etc/postfix
353# umask 022
354# openssl dhparam -out dh512.tmp 512 &amp;&amp; mv dh512.tmp dh512.pem
355# openssl dhparam -out dh1024.tmp 1024 &amp;&amp; mv dh1024.tmp dh1024.pem
356# openssl dhparam -out dh2048.tmp 2048 &amp;&amp; mv dh2048.tmp dh2048.pem
357# chmod 644 dh512.pem dh1024.pem dh2048.pem
358</pre>
359</blockquote>
360
361<p> The Postfix SMTP server EDH parameter files are not secret,
362after all these parameters are sent to all remote SMTP clients in
363the clear. Mode 0644 is appropriate. </p>
364
365<p> You can improve security against pre-computation attacks further
366by regenerating the Postfix SMTP server EDH parameters periodically
367(an hourly or daily cron job running the above commands as root can
368automate this task). </p>
369
370<p> Once the parameters are in place, update <a href="postconf.5.html">main.cf</a> as follows: </p>
371
372<blockquote>
373<pre>
374/etc/postfix/<a href="postconf.5.html">main.cf</a>:
375    <a href="postconf.5.html#smtpd_tls_dh1024_param_file">smtpd_tls_dh1024_param_file</a> = ${<a href="postconf.5.html#config_directory">config_directory</a>}/dh2048.pem
376    <a href="postconf.5.html#smtpd_tls_dh512_param_file">smtpd_tls_dh512_param_file</a> = ${<a href="postconf.5.html#config_directory">config_directory</a>}/dh512.pem
377</pre>
378</blockquote>
379
380<p> If some of your MSA clients don't support 2048-bit EDH, you may
381need to adjust the submission entry in <a href="master.5.html">master.cf</a> accordingly: </p>
382
383<blockquote>
384<pre>
385/etc/postfix/<a href="master.5.html">master.cf</a>:
386    submission inet n       -       n       -       -       smtpd
387        # Some submission clients may not yet do 2048-bit EDH, if such
388        # clients use your MSA, configure 1024-bit EDH instead.  However,
389        # as of mid-2015, many submission clients no longer accept primes
390        # with less than 2048-bits.  Each site needs to determine which
391        # type of client is more important to support.
392        -o <a href="postconf.5.html#smtpd_tls_dh1024_param_file">smtpd_tls_dh1024_param_file</a>=${<a href="postconf.5.html#config_directory">config_directory</a>}/dh1024.pem
393        -o <a href="postconf.5.html#smtpd_tls_security_level">smtpd_tls_security_level</a>=encrypt
394        -o <a href="postconf.5.html#smtpd_sasl_auth_enable">smtpd_sasl_auth_enable</a>=yes
395        ...
396</pre>
397</blockquote>
398
399<h2><a name="test">How can I see that a connection has forward
400secrecy? </a> </h2>
401
402<p> Postfix can be configured to report information about the
403negotiated cipher, the corresponding key lengths, and the remote
404peer certificate or public-key verification status.  </p>
405
406<ul>
407
408<li> <p> With "<a href="postconf.5.html#smtp_tls_loglevel">smtp_tls_loglevel</a> = 1" and "<a href="postconf.5.html#smtpd_tls_loglevel">smtpd_tls_loglevel</a> = 1",
409the Postfix SMTP client and server will log TLS connection information
410to the maillog file. The general logfile format is shown below.
411With TLS 1.3 there may be additional properties logged after the
412cipher name and bits. </p>
413
414<blockquote>
415<pre>
416postfix/smtp[<i>process-id</i>]: Untrusted TLS connection established
417to host.example.com[192.168.0.2]:25: TLSv1 with cipher <i>cipher-name</i>
418(<i>actual-key-size</i>/<i>raw-key-size</i> bits)
419
420postfix/smtpd[<i>process-id</i>]: Anonymous TLS connection established
421from host.example.com[192.168.0.2]: TLSv1 with cipher <i>cipher-name</i>
422(<i>actual-key-size</i>/<i>raw-key-size</i> bits)
423</pre>
424</blockquote>
425
426<li> <p> With "<a href="postconf.5.html#smtpd_tls_received_header">smtpd_tls_received_header</a> = yes", the Postfix SMTP
427server will record TLS connection information in the Received:
428header in the form of comments (text inside parentheses). The general
429format depends on the <a href="postconf.5.html#smtpd_tls_ask_ccert">smtpd_tls_ask_ccert</a> setting. With TLS 1.3 there
430may be additional properties logged after the cipher name and bits. </p>
431
432<blockquote>
433<pre>
434Received: from host.example.com (host.example.com [192.168.0.2])
435        (using TLSv1 with cipher <i>cipher-name</i>
436        (<i>actual-key-size</i>/<i>raw-key-size</i> bits))
437        (Client CN "host.example.com", Issuer "John Doe" (not verified))
438
439Received: from host.example.com (host.example.com [192.168.0.2])
440        (using TLSv1 with cipher <i>cipher-name</i>
441        (<i>actual-key-size</i>/<i>raw-key-size</i> bits))
442        (No client certificate requested)
443</pre>
444</blockquote>
445
446<p> TLS 1.3 examples.  Some of the new attributes may not appear when not
447applicable or not available in older versions of the OpenSSL library.  </p>
448
449<blockquote>
450<pre>
451Received: from localhost (localhost [127.0.0.1])
452        (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
453         key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
454        (No client certificate requested)
455
456Received: from localhost (localhost [127.0.0.1])
457        (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
458         key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
459         client-signature ECDSA (P-256) client-digest SHA256)
460        (Client CN "example.org", Issuer "example.org" (not verified))
461</pre>
462</blockquote>
463
464<ul>
465<li> <p> The "key-exchange" attribute records the type of "Diffie-Hellman"
466group used for key agreement.  Possible values include "DHE", "ECDHE", "X25519"
467and "X448".  With "DHE", the bit size of the prime will be reported in
468parentheses after the algorithm name, with "ECDHE", the curve name. </p>
469
470<li> <p> The "server-signature" attribute shows the public key signature
471algorithm used by the server.  With "RSA-PSS", the bit size of the modulus will
472be reported in parentheses.  With "ECDSA", the curve name.  If, for example,
473the server has both an RSA and an ECDSA private key and certificate, it will be
474possible to track which one was used for a given connection. </p>
475
476<li> <p> The new "server-digest" attribute records the digest algorithm used by
477the server to prepare handshake messages for signing.  The Ed25519 and Ed448
478signature algorithms do not make use of such a digest, so no "server-digest"
479will be shown for these signature algorithms. </p>
480
481<li> <p> When a client certificate is requested with "<a href="postconf.5.html#smtpd_tls_ask_ccert">smtpd_tls_ask_ccert</a>" and
482the client uses a TLS client-certificate, the "client-signature" and
483"client-digest" attributes will record the corresponding properties of the
484client's TLS handshake signature.  </p> </ul>
485
486</ul>
487
488<p> The next sections will explain what <i>cipher-name</i>,
489<i>key-size</i>, and peer verification status information to expect.
490</p>
491
492<h2><a name="ciphers"> What ciphers provide forward secrecy? </a> </h2>
493
494<p> There are dozens of ciphers that support forward secrecy.  What
495follows is the beginning of a list of 51 ciphers available with
496OpenSSL 1.0.1e.  The list is sorted in the default Postfix preference
497order.  It excludes null ciphers that only authenticate and don't
498encrypt, together with export and low-grade ciphers whose encryption
499is too weak to offer meaningful secrecy. The first column shows the
500cipher name, and the second shows the key exchange method.  </p>
501
502<blockquote>
503<pre>
504$ openssl ciphers -v \
505        'aNULL:-aNULL:kEECDH:kEDH:+RC4:!eNULL:!EXPORT:!LOW:@STRENGTH' |
506    awk '{printf "%-32s %s\n", $1, $3}'
507AECDH-AES256-SHA                 Kx=ECDH
508ECDHE-RSA-AES256-GCM-SHA384      Kx=ECDH
509ECDHE-ECDSA-AES256-GCM-SHA384    Kx=ECDH
510ECDHE-RSA-AES256-SHA384          Kx=ECDH
511ECDHE-ECDSA-AES256-SHA384        Kx=ECDH
512ECDHE-RSA-AES256-SHA             Kx=ECDH
513ECDHE-ECDSA-AES256-SHA           Kx=ECDH
514ADH-AES256-GCM-SHA384            Kx=DH
515ADH-AES256-SHA256                Kx=DH
516ADH-AES256-SHA                   Kx=DH
517ADH-CAMELLIA256-SHA              Kx=DH
518DHE-DSS-AES256-GCM-SHA384        Kx=DH
519DHE-RSA-AES256-GCM-SHA384        Kx=DH
520DHE-RSA-AES256-SHA256            Kx=DH
521...
522</pre>
523</blockquote>
524
525<p> To date, all ciphers that support forward secrecy have one of
526five values for the first component of their OpenSSL name: "AECDH",
527"ECDHE", "ADH", "EDH" or "DHE".  Ciphers that don't implement forward
528secrecy have names that don't start with one of these prefixes.
529This pattern is likely to persist until some new key-exchange
530mechanism is invented that also supports forward secrecy.  </p>
531
532<p> The actual key length and raw algorithm key length
533are generally the same with non-export ciphers, but they may
534differ for the legacy export ciphers where the actual key
535is artificially shortened. </p>
536
537<p> Starting with TLS 1.3 the cipher name no longer contains enough
538information to determine which forward-secrecy scheme was employed,
539but TLS 1.3 <b>always</b> uses forward-secrecy.  On the client side,
540up-to-date Postfix releases log additional information for TLS 1.3
541connections, reporting the signature and key exchange algorithms.
542Two examples below (the long single line messages are folded across
543multiple lines for readability): </p>
544
545<blockquote>
546<pre>
547postfix/smtp[<i>process-id</i>]:
548  Untrusted TLS connection established to 127.0.0.1[127.0.0.1]:25:
549  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
550  key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
551  client-signature ECDSA (P-256) client-digest SHA256
552
553postfix/smtp[<i>process-id</i>]:
554  Untrusted TLS connection established to 127.0.0.1[127.0.0.1]:25:
555  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
556  key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256
557</pre>
558</blockquote>
559
560<p> In the above connections, the "key-exchange" value records the
561"Diffie-Hellman" algorithm used for key agreement.  The "server-signature" value
562records the public key algorithm used by the server to sign the key exchange.
563The "server-digest" value records any hash algorithm used to prepare the data
564for signing.  With "ED25519" and "ED448", no separate hash algorithm is used.
565</p>
566
567<p> Examples of Postfix SMTP server logging: </p>
568
569<blockquote>
570<pre>
571postfix/smtpd[<i>process-id</i>]:
572  Untrusted TLS connection established from localhost[127.0.0.1]:25:
573  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
574  key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
575  client-signature ECDSA (P-256) client-digest SHA256
576
577postfix/smtpd[<i>process-id</i>]:
578  Anonymous TLS connection established from localhost[127.0.0.1]:
579  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
580  server-signature RSA-PSS (2048 bits) server-digest SHA256
581
582postfix/smtpd[<i>process-id</i>]:
583  Anonymous TLS connection established from localhost[127.0.0.1]:
584  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
585  server-signature ED25519
586</pre>
587</blockquote>
588
589<p> Note that Postfix &ge; 3.4 server logging may also include a
590"to <i>sni-name</i>" element to record the use of an alternate
591server certificate chain for the connection in question. This happens
592when the client uses the TLS SNI extension, and the server selects
593a non-default certificate chain based on the client's SNI value:
594</p>
595
596<blockquote>
597<pre>
598postfix/smtpd[<i>process-id</i>]:
599  Untrusted TLS connection established from client.example[192.0.2.1]
600  to server.example: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
601  key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
602  client-signature ECDSA (P-256) client-digest SHA256
603</pre>
604</blockquote>
605
606<h2><a name="status"> What do "Anonymous", "Untrusted", etc. in
607Postfix logging mean? </a> </h2>
608
609<p> The verification levels below are subject to man-in-the-middle
610attacks to different degrees.  If such attacks are a concern, then
611the SMTP client will need to authenticate the remote SMTP server
612in a sufficiently-secure manner. For example, by the fingerprint
613of a (CA or leaf) public key or certificate.  Remember that
614conventional PKI relies on many trusted parties and is easily
615subverted by a state-funded adversary.  </p>
616
617<dl>
618
619<dt><b>Anonymous</b> (no peer certificate)</dt>
620
621<dd> <p> <b> Postfix SMTP client:</b> With opportunistic TLS (the "may" security level) the Postfix
622SMTP client does not verify any information in the peer certificate.
623In this case it enables and prefers anonymous cipher suites in which
624the remote SMTP server does not present a certificate (these ciphers
625offer forward secrecy of necessity).  When the remote SMTP server
626also supports anonymous TLS, and agrees to such a cipher suite, the
627verification status will be logged as "Anonymous".  </p> </dd>
628
629<dd> <p> <b> Postfix SMTP server:</b> This is by far most common,
630as client certificates are optional, and the Postfix SMTP server
631does not request client certificates by default (see <a href="postconf.5.html#smtpd_tls_ask_ccert">smtpd_tls_ask_ccert</a>).
632Even when client certificates are requested, the remote SMTP client
633might not send a certificate.  Unlike the Postfix SMTP client, the
634Postfix SMTP server "anonymous" verification status does not imply
635that the cipher suite is anonymous, which corresponds to the
636<i>server</i> not sending a certificate.  </p> </dd>
637
638<dt><b>Untrusted</b> (peer certificate not signed by trusted CA)</dt>
639
640<dd>
641
642<p> <b> Postfix SMTP client:</b> The remote SMTP server presented
643a certificate, but the Postfix SMTP client was unable to check the
644issuing CA signature.  With opportunistic TLS this is common with
645remote SMTP servers that don't support anonymous cipher suites.
646</p>
647
648<p> <b> Postfix SMTP server:</b> The remote SMTP client presented
649a certificate, but the Postfix SMTP server was unable to check the
650issuing CA signature.  This can happen when the server is configured
651to request client certificates (see <a href="postconf.5.html#smtpd_tls_ask_ccert">smtpd_tls_ask_ccert</a>).  </p>
652
653</dd>
654
655<dt><b>Trusted</b> (peer certificate signed by trusted CA, unverified
656peer name)</dt>
657
658<dd>
659
660<p> <b> Postfix SMTP client:</b> The remote SMTP server's certificate
661was signed by a CA that the Postfix SMTP client trusts, but either
662the client was not configured to verify the destination server name
663against the certificate, or the server certificate did not contain
664any matching names.  This is common with opportunistic TLS
665(<a href="postconf.5.html#smtp_tls_security_level">smtp_tls_security_level</a> is "may" or else "dane" with no usable
666TLSA DNS records) when the Postfix SMTP client's trusted CAs can
667verify the authenticity of the remote SMTP server's certificate,
668but the client is not configured or unable to verify the server
669name. </p>
670
671<p> <b> Postfix SMTP server:</b> The remote SMTP client certificate
672was signed by a CA that the Postfix SMTP server trusts.  The Postfix
673SMTP server never verifies the remote SMTP client name against the
674names in the client certificate. Since the client chooses to connect
675to the server, the Postfix SMTP server has no expectation of a
676particular client hostname. </p>
677
678</dd>
679
680<dt><b>Verified</b> (peer certificate signed by trusted CA and
681verified peer name; or: peer certificate with expected public-key
682or certificate fingerprint)</dt>
683
684<dd>
685
686<p> <b> Postfix SMTP client:</b> The remote SMTP server's certificate
687was signed by a CA that the Postfix SMTP client trusts, and the
688certificate name matches the destination or server name(s).  The
689Postfix SMTP client was configured to require a verified name,
690otherwise the verification status would have been just "Trusted".
691</p>
692
693<p> <b> Postfix SMTP client:</b> The "Verified" status may also
694mean that the Postfix SMTP client successfully matched the expected
695fingerprint against the remote SMTP server public key or certificate.
696The expected fingerprint may come from <a href="postconf.5.html#smtp_tls_policy_maps">smtp_tls_policy_maps</a> or from
697TLSA (secure) DNS records.  The Postfix SMTP client ignores the CA
698signature.  </p>
699
700<p> <b> Postfix SMTP server:</b> The status is never "Verified",
701because the Postfix SMTP server never verifies the remote SMTP
702client name against the names in the client certificate, and because
703the Postfix SMTP server does not expect a specific fingerprint in
704the client public key or certificate.  </p>
705
706</dd>
707
708</dl>
709
710<h2><a name="credits">Credits </a> </h2>
711
712<ul>
713
714<li> TLS support for Postfix was originally developed by  Lutz
715J&auml;nicke at Cottbus Technical University.
716
717<li> Wietse Venema adopted and restructured the code and documentation.
718
719<li> Viktor Dukhovni implemented support for many subsequent TLS
720features, including EECDH, and authored the initial version of this
721document.
722
723</ul>
724
725</body>
726
727</html>
728