xref: /netbsd-src/external/ibm-public/postfix/dist/html/FORWARD_SECRECY_README.html (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
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=us-ascii">
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 support 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 support 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="http://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> Execute as root (prime group generation can take a
338few seconds to a few minutes): </p>
339
340<blockquote>
341<pre>
342# cd /etc/postfix
343# umask 022
344# openssl dhparam -out dh512.tmp 512 &amp;&amp; mv dh512.tmp dh512.pem
345# openssl dhparam -out dh1024.tmp 1024 &amp;&amp; mv dh1024.tmp dh1024.pem
346# openssl dhparam -out dh2048.tmp 2048 &amp;&amp; mv dh2048.tmp dh2048.pem
347# chmod 644 dh512.pem dh1024.pem dh2048.pem
348</pre>
349</blockquote>
350
351<p> The Postfix SMTP server EDH parameter files are not secret,
352after all these parameters are sent to all remote SMTP clients in
353the clear. Mode 0644 is fine. </p>
354
355<p> You can improve security against pre-computation attacks further
356by regenerating the Postfix SMTP server EDH parameters periodically
357(an hourly or daily cron job running the above commands as root can
358automate this task). </p>
359
360<p> Once the parameters are in place, update <a href="postconf.5.html">main.cf</a> as follows: </p>
361
362<blockquote>
363<pre>
364/etc/postfix/<a href="postconf.5.html">main.cf</a>:
365    <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
366    <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
367</pre>
368</blockquote>
369
370<p> If some of your MSA clients don't support 2048-bit EDH, you may
371need to adjust the submission entry in <a href="master.5.html">master.cf</a> accordingly: </p>
372
373<blockquote>
374<pre>
375/etc/postfix/<a href="master.5.html">master.cf</a>:
376    submission inet n       -       n       -       -       smtpd
377        # Some submission clients may not yet do 2048-bit EDH, if such
378        # clients use your MSA, configure 1024-bit EDH instead.  However,
379        # as of mid-2015, many submission clients no longer accept primes
380        # with less than 2048-bits.  Each site needs to determine which
381        # type of client is more important to support.
382        -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
383        -o <a href="postconf.5.html#smtpd_tls_security_level">smtpd_tls_security_level</a>=encrypt
384        -o <a href="postconf.5.html#smtpd_sasl_auth_enable">smtpd_sasl_auth_enable</a>=yes
385        ...
386</pre>
387</blockquote>
388
389<h2><a name="test">How can I see that a connection has forward
390secrecy? </a> </h2>
391
392<p> Postfix can be configured to report information about the
393negotiated cipher, the corresponding key lengths, and the remote
394peer certificate or public-key verification status.  </p>
395
396<ul>
397
398<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",
399the Postfix SMTP client and server will log TLS connection information
400to the maillog file. The general logfile format is shown below.
401With TLS 1.3 there may be additional properties logged after the
402cipher name and bits. </p>
403
404<blockquote>
405<pre>
406postfix/smtp[<i>process-id</i>]: Untrusted TLS connection established
407to host.example.com[192.168.0.2]:25: TLSv1 with cipher <i>cipher-name</i>
408(<i>actual-key-size</i>/<i>raw-key-size</i> bits)
409
410postfix/smtpd[<i>process-id</i>]: Anonymous TLS connection established
411from host.example.com[192.168.0.2]: TLSv1 with cipher <i>cipher-name</i>
412(<i>actual-key-size</i>/<i>raw-key-size</i> bits)
413</pre>
414</blockquote>
415
416<li> <p> With "<a href="postconf.5.html#smtpd_tls_received_header">smtpd_tls_received_header</a> = yes", the Postfix SMTP
417server will record TLS connection information in the Received:
418header in the form of comments (text inside parentheses). The general
419format depends on the <a href="postconf.5.html#smtpd_tls_ask_ccert">smtpd_tls_ask_ccert</a> setting. With TLS 1.3 there
420may be additional properties logged after the cipher name and bits. </p>
421
422<blockquote>
423<pre>
424Received: from host.example.com (host.example.com [192.168.0.2])
425        (using TLSv1 with cipher <i>cipher-name</i>
426        (<i>actual-key-size</i>/<i>raw-key-size</i> bits))
427        (Client CN "host.example.com", Issuer "John Doe" (not verified))
428
429Received: from host.example.com (host.example.com [192.168.0.2])
430        (using TLSv1 with cipher <i>cipher-name</i>
431        (<i>actual-key-size</i>/<i>raw-key-size</i> bits))
432        (No client certificate requested)
433</pre>
434</blockquote>
435
436<p> TLS 1.3 examples.  Some of the new attributes may not appear when not
437applicable or not available in older versions of the OpenSSL library.  </p>
438
439<blockquote>
440<pre>
441Received: from localhost (localhost [127.0.0.1])
442        (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
443         key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
444        (No client certificate requested)
445
446Received: from localhost (localhost [127.0.0.1])
447        (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
448         key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
449         client-signature ECDSA (P-256) client-digest SHA256)
450        (Client CN "example.org", Issuer "example.org" (not verified))
451</pre>
452</blockquote>
453
454<ul>
455<li> <p> The "key-exchange" attribute records the type of "Diffie-Hellman"
456group used for key agreement.  Possible values include "DHE", "ECDHE", "X25519"
457and "X448".  With "DHE", the bit size of the prime will be reported in
458parentheses after the algorithm name, with "ECDHE", the curve name. </p>
459
460<li> <p> The "server-signature" attribute shows the public key signature
461algorithm used by the server.  With "RSA-PSS", the bit size of the modulus will
462be reported in parentheses.  With "ECDSA", the curve name.  If, for example,
463the server has both an RSA and an ECDSA private key and certificate, it will be
464possible to track which one was used for a given connection. </p>
465
466<li> <p> The new "server-digest" attribute records the digest algorithm used by
467the server to prepare handshake messages for signing.  The Ed25519 and Ed448
468signature algorithms do not make use of such a digest, so no "server-digest"
469will be shown for these signature algorithms. </p>
470
471<li> <p> When a client certificate is requested with "<a href="postconf.5.html#smtpd_tls_ask_ccert">smtpd_tls_ask_ccert</a>" and
472the client uses a TLS client-certificate, the "client-signature" and
473"client-digest" attributes will record the corresponding properties of the
474client's TLS handshake signature.  </p> </ul>
475
476</ul>
477
478<p> The next sections will explain what <i>cipher-name</i>,
479<i>key-size</i>, and peer verification status information to expect.
480</p>
481
482<h2><a name="ciphers"> What ciphers provide forward secrecy? </a> </h2>
483
484<p> There are dozens of ciphers that support forward secrecy.  What
485follows is the beginning of a list of 51 ciphers available with
486OpenSSL 1.0.1e.  The list is sorted in the default Postfix preference
487order.  It excludes null ciphers that only authenticate and don't
488encrypt, together with export and low-grade ciphers whose encryption
489is too weak to offer meaningful secrecy. The first column shows the
490cipher name, and the second shows the key exchange method.  </p>
491
492<blockquote>
493<pre>
494$ openssl ciphers -v \
495        'aNULL:-aNULL:kEECDH:kEDH:+RC4:!eNULL:!EXPORT:!LOW:@STRENGTH' |
496    awk '{printf "%-32s %s\n", $1, $3}'
497AECDH-AES256-SHA                 Kx=ECDH
498ECDHE-RSA-AES256-GCM-SHA384      Kx=ECDH
499ECDHE-ECDSA-AES256-GCM-SHA384    Kx=ECDH
500ECDHE-RSA-AES256-SHA384          Kx=ECDH
501ECDHE-ECDSA-AES256-SHA384        Kx=ECDH
502ECDHE-RSA-AES256-SHA             Kx=ECDH
503ECDHE-ECDSA-AES256-SHA           Kx=ECDH
504ADH-AES256-GCM-SHA384            Kx=DH
505ADH-AES256-SHA256                Kx=DH
506ADH-AES256-SHA                   Kx=DH
507ADH-CAMELLIA256-SHA              Kx=DH
508DHE-DSS-AES256-GCM-SHA384        Kx=DH
509DHE-RSA-AES256-GCM-SHA384        Kx=DH
510DHE-RSA-AES256-SHA256            Kx=DH
511...
512</pre>
513</blockquote>
514
515<p> To date, all ciphers that support forward secrecy have one of
516five values for the first component of their OpenSSL name: "AECDH",
517"ECDHE", "ADH", "EDH" or "DHE".  Ciphers that don't implement forward
518secrecy have names that don't start with one of these prefixes.
519This pattern is likely to persist until some new key-exchange
520mechanism is invented that also supports forward secrecy.  </p>
521
522<p> The actual key length and raw algorithm key length
523are generally the same with non-export ciphers, but may they
524differ for the legacy export ciphers where the actual key
525is artificially shortened. </p>
526
527<p> Starting with TLS 1.3 the cipher name no longer contains enough
528information to determine which forward-secrecy scheme was employed,
529but TLS 1.3 <b>always</b> uses forward-secrecy.  On the client side,
530up-to-date Postfix releases log additional information for TLS 1.3
531connections, reporting the signature and key exchange algorithms.
532Two examples below (the long single line messages are folded across
533multiple lines for readability): </p>
534
535<blockquote>
536<pre>
537postfix/smtp[<i>process-id</i>]:
538  Untrusted TLS connection established to 127.0.0.1[127.0.0.1]:25:
539  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
540  key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
541  client-signature ECDSA (P-256) client-digest SHA256
542
543postfix/smtp[<i>process-id</i>]:
544  Untrusted TLS connection established to 127.0.0.1[127.0.0.1]:25:
545  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
546  key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256
547</pre>
548</blockquote>
549
550<p> In the above connections, the "key-exchange" value records the
551"Diffie-Hellman" algorithm used for key agreement.  The "server-signature" value
552records the public key algorithm used by the server to sign the key exchange.
553The "server-digest" value records any hash algorithm used to prepare the data
554for signing.  With "ED25519" and "ED448", no separate hash algorithm is used.
555</p>
556
557<p> Examples of Postfix SMTP server logging: </p>
558
559<blockquote>
560<pre>
561postfix/smtpd[<i>process-id</i>]:
562  Untrusted TLS connection established from localhost[127.0.0.1]:25:
563  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
564  key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
565  client-signature ECDSA (P-256) client-digest SHA256
566
567postfix/smtpd[<i>process-id</i>]:
568  Anonymous TLS connection established from localhost[127.0.0.1]:
569  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
570  server-signature RSA-PSS (2048 bits) server-digest SHA256
571
572postfix/smtpd[<i>process-id</i>]:
573  Anonymous TLS connection established from localhost[127.0.0.1]:
574  TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
575  server-signature ED25519
576</pre>
577</blockquote>
578
579<p> Note that Postfix &ge; 3.4 server logging may also include a
580"to <i>sni-name</i>" element to record the use of an alternate
581server certificate chain for the connection in question. This happens
582when the client uses the TLS SNI extension, and the server selects
583a non-default certificate chain based on the client's SNI value:
584</p>
585
586<blockquote>
587<pre>
588postfix/smtpd[<i>process-id</i>]:
589  Untrusted TLS connection established from client.example[192.0.2.1]
590  to server.example: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
591  key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
592  client-signature ECDSA (P-256) client-digest SHA256
593</pre>
594</blockquote>
595
596<h2><a name="status"> What do "Anonymous", "Untrusted", etc. in
597Postfix logging mean? </a> </h2>
598
599<p> The verification levels below are subject to man-in-the-middle
600attacks to different degrees.  If such attacks are a concern, then
601the SMTP client will need to authenticate the remote SMTP server
602in a sufficiently-secure manner. For example, by the fingerprint
603of a (CA or leaf) public key or certificate.  Remember that
604conventional PKI relies on many trusted parties and is easily
605subverted by a state-funded adversary.  </p>
606
607<dl>
608
609<dt><b>Anonymous</b> (no peer certificate)</dt>
610
611<dd> <p> <b> Postfix SMTP client:</b> With opportunistic TLS (the "may" security level) the Postfix
612SMTP client does not verify any information in the peer certificate.
613In this case it enables and prefers anonymous cipher suites in which
614the remote SMTP server does not present a certificate (these ciphers
615offer forward secrecy of necessity).  When the remote SMTP server
616also supports anonymous TLS, and agrees to such a cipher suite, the
617verification status will be logged as "Anonymous".  </p> </dd>
618
619<dd> <p> <b> Postfix SMTP server:</b> This is by far most common,
620as client certificates are optional, and the Postfix SMTP server
621does not request client certificates by default (see <a href="postconf.5.html#smtpd_tls_ask_ccert">smtpd_tls_ask_ccert</a>).
622Even when client certificates are requested, the remote SMTP client
623might not send a certificate.  Unlike the Postfix SMTP client, the
624Postfix SMTP server "anonymous" verification status does not imply
625that the cipher suite is anonymous, which corresponds to the
626<i>server</i> not sending a certificate.  </p> </dd>
627
628<dt><b>Untrusted</b> (peer certificate not signed by trusted CA)</dt>
629
630<dd>
631
632<p> <b> Postfix SMTP client:</b> The remote SMTP server presented
633a certificate, but the Postfix SMTP client was unable to check the
634issuing CA signature.  With opportunistic TLS this is common with
635remote SMTP servers that don't support anonymous cipher suites.
636</p>
637
638<p> <b> Postfix SMTP server:</b> The remote SMTP client presented
639a certificate, but the Postfix SMTP server was unable to check the
640issuing CA signature.  This can happen when the server is configured
641to request client certificates (see <a href="postconf.5.html#smtpd_tls_ask_ccert">smtpd_tls_ask_ccert</a>).  </p>
642
643</dd>
644
645<dt><b>Trusted</b> (peer certificate signed by trusted CA, unverified
646peer name)</dt>
647
648<dd>
649
650<p> <b> Postfix SMTP client:</b> The remote SMTP server's certificate
651was signed by a CA that the Postfix SMTP client trusts, but either
652the client was not configured to verify the destination server name
653against the certificate, or the server certificate did not contain
654any matching names.  This is common with opportunistic TLS
655(<a href="postconf.5.html#smtp_tls_security_level">smtp_tls_security_level</a> is "may" or else "dane" with no usable
656TLSA DNS records) when the Postfix SMTP client's trusted CAs can
657verify the authenticity of the remote SMTP server's certificate,
658but the client is not configured or unable to verify the server
659name. </p>
660
661<p> <b> Postfix SMTP server:</b> The remote SMTP client certificate
662was signed by a CA that the Postfix SMTP server trusts.  The Postfix
663SMTP server never verifies the remote SMTP client name against the
664names in the client certificate. Since the client chooses to connect
665to the server, the Postfix SMTP server has no expectation of a
666particular client hostname. </p>
667
668</dd>
669
670<dt><b>Verified</b> (peer certificate signed by trusted CA and
671verified peer name; or: peer certificate with expected public-key
672or certificate fingerprint)</dt>
673
674<dd>
675
676<p> <b> Postfix SMTP client:</b> The remote SMTP server's certificate
677was signed by a CA that the Postfix SMTP client trusts, and the
678certificate name matches the destination or server name(s).  The
679Postfix SMTP client was configured to require a verified name,
680otherwise the verification status would have been just "Trusted".
681</p>
682
683<p> <b> Postfix SMTP client:</b> The "Verified" status may also
684mean that the Postfix SMTP client successfully matched the expected
685fingerprint against the remote SMTP server public key or certificate.
686The expected fingerprint may come from <a href="postconf.5.html#smtp_tls_policy_maps">smtp_tls_policy_maps</a> or from
687TLSA (secure) DNS records.  The Postfix SMTP client ignores the CA
688signature.  </p>
689
690<p> <b> Postfix SMTP server:</b> The status is never "Verified",
691because the Postfix SMTP server never verifies the remote SMTP
692client name against the names in the client certificate, and because
693the Postfix SMTP server does not expect a specific fingerprint in
694the client public key or certificate.  </p>
695
696</dd>
697
698</dl>
699
700<h2><a name="credits">Credits </a> </h2>
701
702<ul>
703
704<li> TLS support for Postfix was originally developed by  Lutz
705J&auml;nicke at Cottbus Technical University.
706
707<li> Wietse Venema adopted and restructured the code and documentation.
708
709<li> Viktor Dukhovni implemented support for many subsequent TLS
710features, including EECDH, and authored the initial version of this
711document.
712
713</ul>
714
715</body>
716
717</html>
718