~ubuntu-branches/ubuntu/trusty/postfix/trusty-updates

« back to all changes in this revision

Viewing changes to README_FILES/TLS_README

  • Committer: Package Import Robot
  • Author(s): LaMont Jones, LaMont Jones, localization folks
  • Date: 2014-02-11 07:44:30 UTC
  • mfrom: (58.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140211074430-kwkoxdz0fbajn0fj
Tags: 2.11.0-1
[LaMont Jones]

* New upstream release: 2.11.0

[localization folks]

* l10n: Updated German translations.  Closes: #734893 (Helge Kreutzmann)

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
encrypted, meaning: the key must be accessible without a password. The
87
87
certificate and private key may be in the same file, in which case the
88
88
certificate file should be owned by "root" and not be readable by any other
89
 
user. If the key is stored separately, this applies to the key file only, and
90
 
the certificate file may be "world-readable".
 
89
user. If the key is stored separately, this access restriction applies to the
 
90
key file only, and the certificate file may be "world-readable".
91
91
 
92
 
Public Internet MX hosts without certificates signed by a "reputable" CA must
93
 
generate, and be prepared to present to most clients, a self-signed or private-
94
 
CA signed certificate. The remote SMTP client will generally not be able to
95
 
authenticate the self-signed certificate, but unless the client is running
96
 
Postfix or similar software, it will still insist on a server certificate.
 
92
Public Internet MX hosts without certificates signed by a well-known public CA
 
93
must still generate, and be prepared to present to most clients, a self-signed
 
94
or private-CA signed certificate. The remote SMTP client will generally not be
 
95
able to verify the self-signed certificate, but unless the client is running
 
96
Postfix or similar software, it will only negotiate TLS ciphersuites that
 
97
require a server certificate.
97
98
 
98
99
For servers that are nnoott public Internet MX hosts, Postfix supports
99
100
configurations with no certificates. This entails the use of just the anonymous
106
107
new Postfix SMTP server configurations will not accidentally run with no
107
108
certificates.
108
109
 
109
 
RSA, DSA and ECDSA (Postfix >= 2.6) certificates are supported. Typically you
110
 
will only have RSA certificates issued by a commercial CA. In addition, the
111
 
tools supplied with OpenSSL will by default issue RSA certificates. You can
112
 
configure all three at the same time, in which case the cipher used determines
113
 
which certificate is presented. For Netscape and OpenSSL clients without
114
 
special cipher choices, the RSA certificate is preferred.
115
 
 
116
 
To enable a remote SMTP client to verify the Postfix SMTP server certificate,
117
 
the issuing CA certificates must be made available to the client. You should
118
 
include the required certificates in the server certificate file, the server
119
 
certificate first, then the issuing CA(s) (bottom-up order).
120
 
 
121
 
Example: the certificate for "server.example.com" was issued by "intermediate
122
 
CA" which itself has a certificate issued by "root CA". Create the server.pem
123
 
file with:
124
 
 
125
 
    % ccaatt sseerrvveerr__cceerrtt..ppeemm iinntteerrmmeeddiiaattee__CCAA..ppeemm >> sseerrvveerr..ppeemm
126
 
 
127
 
A Postfix SMTP server certificate supplied here must be usable as SSL server
 
110
RSA, DSA and ECDSA (Postfix >= 2.6) certificates are supported. Most sites only
 
111
have RSA certificates. You can configure all three at the same time, in which
 
112
case the ciphersuite negotiated with the remote SMTP client determines which
 
113
certificate is used. If your DNS zone is signed, and you want to publish RFC
 
114
6698 TLSA records, these must match any of the configured certificates. Since
 
115
the best practice is to publish "3 1 1" certificate associations, create a
 
116
separate TLSA record for each public-key certificate digest.
 
117
 
 
118
CCrreeaattiinngg tthhee sseerrvveerr cceerrttiiffiiccaattee ffiillee
 
119
 
 
120
To verify the Postfix SMTP server certificate, the remote SMTP client must
 
121
receive the issuing CA certificates via the TLS handshake or via public-key
 
122
infrastructure. This means that the Postfix server public-key certificate file
 
123
must include the server certificate first, then the issuing CA(s) (bottom-up
 
124
order). The Postfix SMTP server certificate must be usable as SSL server
128
125
certificate and hence pass the "openssl verify -purpose sslserver ..." test.
129
126
 
130
 
A client that trusts the root CA has a local copy of the root CA certificate,
131
 
so it is not necessary to include the root CA certificate here. Leaving it out
132
 
of the "server.pem" file reduces the overhead of the TLS exchange.
 
127
The examples that follow show how to create a server certificate file. We
 
128
assume that the certificate for "server.example.com" was issued by
 
129
"intermediate CA" which itself has a certificate issued by "root CA".
 
130
 
 
131
  * With legacy public CA trust verification, you can omit the root certificate
 
132
    from the "server.pem" certificate file. If the client trusts the root CA,
 
133
    it will already have a local copy of the root CA certificate. Omitting the
 
134
    root CA certificate reduces the size of the server TLS handshake.
 
135
 
 
136
        % ccaatt sseerrvveerr__cceerrtt..ppeemm iinntteerrmmeeddiiaattee__CCAA..ppeemm >> sseerrvveerr..ppeemm
 
137
 
 
138
  * If you publish RFC 6698 TLSA "2 0 1" or "2 1 1" records to specify root CA
 
139
    certificate digests, you must include the corresponding root CA
 
140
    certificates in the "server.pem" certificate file. See the documentation of
 
141
    the tls_dane_trust_anchor_digest_enable main.cf parameter.
 
142
 
 
143
        % ccaatt sseerrvveerr__cceerrtt..ppeemm iinntteerrmmeeddiiaattee__CCAA..ppeemm rroooott..ppeemm >> sseerrvveerr..ppeemm
 
144
 
 
145
    Remote SMTP clients will be able to use the TLSA record you publish (which
 
146
    only contains the certificate digest) only if they have access to the
 
147
    corresponding certificate. Failure to verify certificates per the server's
 
148
    published TLSA records will typically cause the SMTP client to defer mail
 
149
    delivery. The foregoing also applies to "2 0 2" and "2 1 2" TLSA records or
 
150
    any other digest of a CA certificate, but it is expected that SHA256 will
 
151
    be by far the most common digest for TLSA.
 
152
 
 
153
    As a best practice, publish either "3 0 1" or "3 1 1" TLSA associations
 
154
    that specify the SHA256 digest of the server certificate public key with
 
155
    the alias-expanded hostname of each STARTTLS capable SMTP server. These
 
156
    continue to work when a certificate is renewed with the same public/private
 
157
    key pair.
 
158
 
 
159
For instructions on how to compute the digest of a certificate or its public
 
160
key for use in TLSA records, see the documentation of the
 
161
smtpd_tls_fingerprint_digest main.cf parameter.
 
162
 
 
163
When a new key or certificate is generated, an additional TLSA record with the
 
164
new digest must be published in advance of the actual deployment of the new key
 
165
or certificate on the server. You must allow sufficient time for any TLSA
 
166
RRsets with only the old digest to expire from DNS caches. The safest practice
 
167
is to wait until the DNSSEC signature on the previous TLSA RRset expires, and
 
168
only then switch the server to use new keys published in the updated TLSA
 
169
RRset. Once the new certificate trust chain and private key are in effect, the
 
170
DNS should be updated once again to remove the old digest from the TLSA RRset.
133
171
 
134
172
If you want the Postfix SMTP server to accept remote SMTP client certificates
135
 
issued by these CAs, append the root certificate to $smtpd_tls_CAfile or
136
 
install it in the $smtpd_tls_CApath directory.
 
173
issued by one or more root CAs, append the root certificate to
 
174
$smtpd_tls_CAfile or install it in the $smtpd_tls_CApath directory.
 
175
 
 
176
CCoonnffiigguurriinngg tthhee sseerrvveerr cceerrttiiffiiccaattee aanndd kkeeyy ffiilleess
137
177
 
138
178
RSA key and certificate examples:
139
179
 
364
404
SSeerrvveerr--ssiiddee TTLLSS sseessssiioonn ccaacchhee
365
405
 
366
406
The Postfix SMTP server and the remote SMTP client negotiate a session, which
367
 
takes some computer time and network bandwidth. By default, this session
368
 
information is cached only in the smtpd(8) process actually using this session
369
 
and is lost when the process terminates. To share the session information
370
 
between multiple smtpd(8) processes, a persistent session cache can be used.
371
 
You can specify any database type that can store objects of several kbytes and
372
 
that supports the sequence operator. DBM databases are not suitable because
373
 
they can only store small objects. The cache is maintained by the tlsmgr(8)
374
 
process, so there is no problem with concurrent access. Session caching is
375
 
highly recommended, because the cost of repeatedly negotiating TLS session keys
376
 
is high.
 
407
takes some computer time and network bandwidth. SSL protocol versions other
 
408
than SSLv2 support resumption of cached sessions. Not only is this more CPU and
 
409
bandwidth efficient, it also reduces latency as only one network round-trip is
 
410
used to resume a session while it takes two round-trips to create a session
 
411
from scratch.
 
412
 
 
413
Since Postfix uses multiple smtpd(8) service processes, an in-memory cache is
 
414
not sufficient for session re-use. Clients store at most one cached session per
 
415
server and are very unlikely to repeatedly connect to the same server process.
 
416
Thus session caching in the Postfix SMTP server generally requires a shared
 
417
cache (an alternative available with Postfix >= 2.11 is described below).
 
418
 
 
419
To share the session information between multiple smtpd(8) processes, a session
 
420
cache database is used. You can specify any database type that can store
 
421
objects of several kbytes and that supports the sequence operator. DBM
 
422
databases are not suitable because they can only store small objects. The cache
 
423
is maintained by the tlsmgr(8) process, so there is no problem with concurrent
 
424
access. Session caching is highly recommended, because the cost of repeatedly
 
425
negotiating TLS session keys is high.
 
426
 
 
427
Starting with Postfix 2.11, linked with a compatible OpenSSL library (at least
 
428
0.9.8h, preferably 1.0.0 or later) the Postfix SMTP server supports RFC 5077
 
429
TLS session resumption without server-side state when the remote SMTP client
 
430
also supports RFC 5077. The session is encrypted by the server in a session
 
431
ticket returned to client for storage. When a client sends a valid session
 
432
ticket, the server decrypts it and resumes the session, provided neither the
 
433
ticket nor the session have expired. This makes it possible to resume cached
 
434
sessions without allocating space for a shared database on the server. This
 
435
feature can be disabled by setting the session cache timeout to zero, otherwise
 
436
the timeout must be at least 2 minutes and at most 100 days.
 
437
 
 
438
Note, session tickets can only be negotiated if the client disables SSLv2 and
 
439
does not use the legacy SSLv2 compatible HELLO message. This is true by default
 
440
with the Postfix >= 2.6 SMTP client.
377
441
 
378
442
Example:
379
443
 
395
459
    /etc/postfix/main.cf:
396
460
        smtpd_tls_session_cache_timeout = 3600s
397
461
 
 
462
As of Postfix 2.11 this setting cannot exceed 100 days. If set <= 0, session
 
463
caching is disabled. If set to a positive value less than 2 minutes, the
 
464
minimum value of 2 minutes is used instead.
 
465
 
398
466
When the Postfix SMTP server does not save TLS sessions to an external cache
399
 
database, client-side session caching is unlikely to be useful. To prevent such
400
 
wastage, the Postfix SMTP server can be configured to not issue TLS session
401
 
ids. By default the Postfix SMTP server always issues TLS session ids. This
402
 
works around known interoperability issues with some MUAs, and prevents
 
467
database, client-side session caching is unlikely to be useful. To reduce waste
 
468
of client resources, the Postfix SMTP server can be configured to not issue TLS
 
469
session ids. By default the Postfix SMTP server always issues TLS session ids.
 
470
This works around known interoperability issues with some MUAs, and prevents
403
471
possible interoperability issues with other MTAs.
404
472
 
405
473
Example:
540
608
This is enabled by explicitly setting "smtpd_tls_cert_file = none" and not
541
609
specifying an smtpd_tls_dcert_file or smtpd_tls_eccert_file.
542
610
 
543
 
Example, MSA that requires TLSv1, not SSLv2 or SSLv3, with high grade ciphers:
 
611
Example, MSA that requires TLSv1 or higher, not SSLv2 or SSLv3, with high grade
 
612
ciphers:
544
613
 
545
614
    /etc/postfix/main.cf:
546
615
        smtpd_tls_cert_file = /etc/postfix/cert.pem
548
617
        smtpd_tls_mandatory_ciphers = high
549
618
        smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5
550
619
        smtpd_tls_security_level = encrypt
551
 
        # Preferred form with Postfix >= 2.5:
 
620
        # Preferred syntax with Postfix >= 2.5:
552
621
        smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
553
 
        # Alternative form.
 
622
        # Legacy syntax:
554
623
        smtpd_tls_mandatory_protocols = TLSv1
555
624
 
556
 
If you want to take advantage of ciphers with ephemeral Diffie-Hellman (EDH)
557
 
key exchange (this offers "forward-secrecy"), DH parameters are needed. Instead
558
 
of using the built-in DH parameters for both 1024-bit (non-export ciphers) and
559
 
512-bit (export ciphers), it is better to generate your own parameters, since
560
 
otherwise it would "pay" for a possible attacker to start a brute force attack
561
 
against parameters that are used by everybody. Postfix defaults to compiled-in
562
 
parameters that are shared by all Postfix users who don't generate their own
563
 
settings.
564
 
 
565
 
To generate your own set of DH parameters, use:
566
 
 
567
 
    % ooppeennssssll ggeennddhh --oouutt //eettcc//ppoossttffiixx//ddhh__551122..ppeemm --22 551122
568
 
    % ooppeennssssll ggeennddhh --oouutt //eettcc//ppoossttffiixx//ddhh__11002244..ppeemm --22 11002244
569
 
 
570
 
Support for elliptic curve cryptography is available with Postfix 2.6 and
571
 
OpenSSL 1.0.0 or later. To enable ephemeral elliptic curve Diffie-Hellman
572
 
(EECDH) key-exchange, set "smtpd_tls_eecdh_grade = strong" or
573
 
"smtpd_tls_eecdh_grade = ultra". The "ultra" setting is substantially more CPU
574
 
intensive, and "strong" is sufficiently secure for most situations.
575
 
 
576
 
Examples:
577
 
 
578
 
    /etc/postfix/main.cf:
579
 
        smtpd_tls_dh1024_param_file = /etc/postfix/dh_1024.pem
580
 
        smtpd_tls_dh512_param_file = /etc/postfix/dh_512.pem
581
 
        # Postfix >= 2.6:
582
 
        smtpd_tls_eecdh_grade = strong
 
625
If you want to take maximal advantage of ciphers that offer forward secrecy see
 
626
the Getting started section of FORWARD_SECRECY_README. The full document
 
627
conveniently presents all information about Postfix "perfect" forward secrecy
 
628
support in one place: what forward secrecy is, how to tweak settings, and what
 
629
you can expect to see when Postfix uses ciphers with forward secrecy.
583
630
 
584
631
Postfix 2.8 and later, in combination with OpenSSL 0.9.7 and later allows TLS
585
 
servers to preempt the TLS client's cipher preference list. This is possible
586
 
only with SSLv3 and later, as in SSLv2 the client chooses the cipher from a
587
 
list supplied by the server.
588
 
 
589
 
By default, the OpenSSL server selects the client's most preferred cipher that
590
 
the server supports. With SSLv3 and later, the server may choose its own most
591
 
preferred cipher that is supported (offered) by the client. Setting
592
 
"tls_preempt_cipherlist = yes" enables server cipher preferences. The default
593
 
OpenSSL behavior applies with "tls_preempt_cipherlist = no".
594
 
 
595
 
While server cipher selection may in some cases lead to a more secure or
596
 
performant cipher choice, there is some risk of interoperability issues. In the
597
 
past, some SSL clients have listed lower priority ciphers that they did not
598
 
implement correctly. If the server chooses a cipher that the client prefers
599
 
less, it may select a cipher whose client implementation is flawed.
 
632
servers to preempt the TLS client's cipher-suite preference list. This is
 
633
possible only with SSLv3 and later, as in SSLv2 the client chooses the cipher-
 
634
suite from a list supplied by the server.
 
635
 
 
636
By default, the OpenSSL server selects the client's most preferred cipher-suite
 
637
that the server supports. With SSLv3 and later, the server may choose its own
 
638
most preferred cipher-suite that is supported (offered) by the client. Setting
 
639
"tls_preempt_cipherlist = yes" enables server cipher-suite preferences. The
 
640
default OpenSSL behavior applies with "tls_preempt_cipherlist = no".
 
641
 
 
642
While server cipher-suite selection may in some cases lead to a more secure or
 
643
performant cipher-suite choice, there is some risk of interoperability issues.
 
644
In the past, some SSL clients have listed lower priority ciphers that they did
 
645
not implement correctly. If the server chooses a cipher that the client prefers
 
646
less, it may select a cipher whose client implementation is flawed. Most
 
647
notably Windows 2003 Microsoft Exchange servers have flawed implementations of
 
648
DES-CBC3-SHA, which OpenSSL considers stronger than RC4-SHA. Enabling server
 
649
cipher-suite selection may create interoperability issues with Windows 2003
 
650
Microsoft Exchange clients.
600
651
 
601
652
MMiisscceellllaanneeoouuss sseerrvveerr ccoonnttrroollss
602
653
 
619
670
 
620
671
    /etc/postfix/main.cf:
621
672
        tls_disable_workarounds = 0xFFFFFFFF
622
 
        tls_disable_workarounds = CVE-2010-4180, LEGACY_SERVER_CONNECT
623
 
 
624
 
Note: Disabling LEGACY_SERVER_CONNECT is not wise at this time, lots of servers
625
 
are still unpatched and Postfix is not significantly vulnerable to the
626
 
renegotiation issue in the TLS protocol.
 
673
        tls_disable_workarounds = CVE-2010-4180
 
674
 
 
675
With Postfix >= 2.11, the tls_ssl_options parameter specifies a list or bit-
 
676
mask of OpenSSL options to enable. Specify one or more of the named options
 
677
below, or a hexadecimal bitmask of options found in the ssl.h file
 
678
corresponding to the run-time OpenSSL library. While it may be reasonable to
 
679
turn off all bug workarounds (see above), it is not a good idea to attempt to
 
680
turn on all features.
 
681
 
 
682
LLEEGGAACCYY__SSEERRVVEERR__CCOONNNNEECCTT
 
683
    See SSL_CTX_set_options(3).
 
684
NNOO__TTIICCKKEETT
 
685
    See SSL_CTX_set_options(3).
 
686
NNOO__CCOOMMPPRREESSSSIIOONN
 
687
    Disable SSL compression even if supported by the OpenSSL library.
 
688
    Compression is CPU-intensive, and compression before encryption does not
 
689
    always improve security.
 
690
Example:
 
691
 
 
692
    /etc/postfix/main.cf:
 
693
        tls_ssl_options = no_ticket, no_compression
 
694
 
 
695
You should only enable features via the hexadecimal mask when the need to
 
696
control the feature is critical (to deal with a new vulnerability or a serious
 
697
interoperability problem). Postfix DOES NOT promise backwards compatible
 
698
behavior with respect to the mask bits. A feature enabled via the mask in one
 
699
release may be enabled by other means in a later release, and the mask bit will
 
700
then be ignored. Therefore, use of the hexadecimal mask is only a temporary
 
701
measure until a new Postfix or OpenSSL release provides a better solution.
627
702
 
628
703
SSMMTTPP CClliieenntt ssppeecciiffiicc sseettttiinnggss
629
704
 
653
728
    Opportunistic TLS.
654
729
eennccrryypptt
655
730
    Mandatory TLS encryption.
 
731
ddaannee
 
732
    Opportunistic DANE TLS.
 
733
ddaannee--oonnllyy
 
734
    Mandatory DANE TLS.
656
735
ffiinnggeerrpprriinntt
657
736
    Certificate fingerprint verification.
658
737
vveerriiffyy
805
884
        [example.net]:msa encrypt protocols=TLSv1 ciphers=high
806
885
        [example.net]:submission encrypt protocols=TLSv1 ciphers=high
807
886
 
 
887
DDAANNEE TTLLSS aauutthheennttiiccaattiioonn..
 
888
 
 
889
The Postfix SMTP client supports two TLS security levels based on RFC6698 DANE
 
890
TLSA records. The opportunistic "dane" level and the mandatory "dane-only"
 
891
level.
 
892
 
 
893
The "dane" level is a stronger form of opportunistic TLS that is resistant to
 
894
man in the middle and downgrade attacks when the destination domain uses DNSSEC
 
895
to publish DANE TLSA records for its MX hosts. If a remote SMTP server has
 
896
"usable" (see RFC 6698) DANE TLSA records, the server connection will be
 
897
authenticated. When DANE authentication fails, there is no fallback to
 
898
unauthenticated or plaintext delivery.
 
899
 
 
900
If TLSA records are published for a given remote SMTP server (implying TLS
 
901
support), but are all "unusable" due to unsupported parameters or malformed
 
902
data, the Postfix SMTP client will use mandatory unauthenticated TLS.
 
903
Otherwise, when no TLSA records are published, the Postfix SMTP client behavior
 
904
is the same as with may.
 
905
 
 
906
TLSA records must be published in DNSSEC validated DNS zones. Any TLSA records
 
907
in DNS zones not protected via DNSSEC are ignored. The Postfix SMTP client will
 
908
not look for TLSA records associated with MX hosts whose "A" or "AAAA" records
 
909
lie in an "insecure" DNS zone. Such lookups have been observed to cause
 
910
interoperability issues with poorly implemented DNS servers, and are in any
 
911
case not expected to ever yield "secure" results, since that would require a
 
912
very unlikely DLV DNS trust anchor configured between the host record and the
 
913
associated "_25._tcp" child TLSA record.
 
914
 
 
915
The "dane-only" level is a form of secure-channel TLS based on the DANE PKI. If
 
916
"usable" TLSA records are present these are used to authenticate the remote
 
917
SMTP server. Otherwise, or when server certificate verification fails, delivery
 
918
via the server in question tempfails.
 
919
 
 
920
At both security levels, the TLS policy for the destination is obtained via
 
921
TLSA records validated with DNSSEC. For TLSA policy to be in effect, the
 
922
destination domain's containing DNS zone must be signed and the Postfix SMTP
 
923
client's operating system must be configured to send its DNS queries to a
 
924
recursive DNS nameserver that is able to validate the signed records. Each MX
 
925
host's DNS zone needs to also be signed, and needs to publish DANE TLSA (RFC
 
926
6698) records that specify how that MX host's TLS certificate is to be
 
927
verified.
 
928
 
 
929
TLSA records do not preempt the normal SMTP MX host selection algorithm, if
 
930
some MX hosts support TLSA and others do not, TLS security will vary from
 
931
delivery to delivery. It is up to the domain owner to configure their MX hosts
 
932
and their DNS sensibly. To configure the Postfix SMTP client for DNSSEC lookups
 
933
see the documentation for the smtp_dns_support_level main.cf parameter. The
 
934
tls_dane_trust_anchor_digest_enable main.cf parameter controls support for
 
935
trust-anchor digest TLSA records. The tls_dane_digests and
 
936
tls_dane_digest_agility parameters control the list of supported digests and
 
937
digest downgrade attack resistance.
 
938
 
 
939
DANE for SMTP MTAs deviates in some details from the baseline DANE protocol in
 
940
RFC 6698. Most notably, it is not expected that SMTP MTAs can reasonably
 
941
include every public CA that a remote SMTP server's administrator may believe
 
942
to be well-known. Nor is there an interactive user to "click OK" when
 
943
authentication fails.
 
944
 
 
945
Therefore, certificate usages "0" and "1" from RFC 6698 which are intended to
 
946
"constrain" existing PKI trust, are not supported. TLSA records with usage "0"
 
947
are treated as "unusable". TLSA records with usage "1" are instead treated as
 
948
"trust assertions" and mapped to usage "3". Specifically, with certificate
 
949
usage "1", Postfix will not require the remote SMTP server's certificate to be
 
950
trusted with respect to any locally defined public CAs, it is the domain
 
951
owner's responsibility to ensure that the certificate associations in their
 
952
TLSA records are appropriate to authenticate their SMTP servers.
 
953
 
 
954
The Postfix SMTP client supports only certificate usages "2" and "3" (with "1"
 
955
treated as though it were "3"). See tls_dane_trust_anchor_digest_enable for
 
956
usage "2" usability considerations. Support for certificate usage "1" is an
 
957
experiment, it may be withdrawn in the future. Server operators SHOULD NOT
 
958
publish TLSA records with usage "1".
 
959
 
 
960
When usable TLSA records are obtained for the remote SMTP server the Postfix
 
961
SMTP client sends the SNI TLS extension in its SSL client hello message. This
 
962
may help the remote SMTP server live up to its promise to provide a certificate
 
963
that matches its TLSA records.
 
964
 
 
965
For purposes of protocol and cipher selection, the "dane" security level is
 
966
treated like a "mandatory" TLS security level, and weak ciphers and protocols
 
967
are disabled. Since DANE authenticates server certificates the "aNULL" cipher-
 
968
suites are transparently excluded at this level, no need to configure this
 
969
manually. RFC 6698 (DANE) TLS authentication is available with Postfix 2.11 and
 
970
later.
 
971
 
 
972
When a DANE TLSA record specifies a trust-anchor (TA) certificate (that is an
 
973
issuing CA), the strategy used to verify the peername of the server certificate
 
974
is unconditionally "nexthop, hostname". Both the nexthop domain and the
 
975
hostname obtained from the DNSSEC-validated MX lookup are safe from forgery and
 
976
the server certificate must contain at least one of these names.
 
977
 
 
978
When a DANE TLSA record specifies an end-entity (EE) certificate, (that is the
 
979
actual server certificate), as with the fingerprint security level below, no
 
980
name checks or certificate expiration checks are applied. The server
 
981
certificate (or its public key) either matches the DANE record or not. Server
 
982
administrators should publish such EE records in preference to all other types.
 
983
 
 
984
The pre-requisites for DANE support in the Postfix SMTP client are:
 
985
 
 
986
  * A compile-time OpenSSL library that supports the TLS SNI extension and
 
987
    "SHA-2" message digests.
 
988
  * A compile-time DNS resolver library that supports DNSSEC. Postfix binaries
 
989
    built on an older system will not support DNSSEC even if deployed on a
 
990
    system with an updated resolver library.
 
991
  * The "smtp_dns_support_level" must be set to "dnssec".
 
992
  * The "smtp_host_lookup" parameter must include "dns".
 
993
  * A DNSSEC-validating recursive resolver (see note below).
 
994
 
 
995
The above client pre-requisites do not apply to the Postfix SMTP server. It
 
996
will support DANE provided it supports TLSv1 and its TLSA records are published
 
997
in a DNSSEC signed zone. To receive DANE secured mail for multiple domains, use
 
998
the same hostname to add the server to each domain's MX records. There are no
 
999
plans to implement SNI in the Postfix SMTP server.
 
1000
 
 
1001
Note: The Postfix SMTP client's internal stub DNS resolver is DNSSEC-aware, but
 
1002
it does not itself validate DNSSEC records, rather it delegates DNSSEC
 
1003
validation to the operating system's configured recursive DNS nameserver. The
 
1004
Postfix DNS client relies on a secure channel to the resolver's cache for
 
1005
DNSSEC integrity, but does not support TSIG to protect the transmission channel
 
1006
between itself and the nameserver. Therefore, it is strongly recommended (DANE
 
1007
security guarantee void otherwise) that each MTA run a local DNSSEC-validating
 
1008
recursive resolver ("unbound" from nlnetlabs.nl is a reasonable choice)
 
1009
listening on the loopback interface, and that the system be configured to use
 
1010
only this local nameserver. The local nameserver may forward queries to an
 
1011
upstream recursive resolver on another host if desired.
 
1012
 
 
1013
Note: When the operating system's recursive nameserver is not local, enabling
 
1014
EDNS0 expanded DNS packet sizes and turning on the DNSSEC "DO" bit in the DNS
 
1015
request and/or the new DNSSEC-specific records returned in the nameserver's
 
1016
replies may cause problems with older or buggy firewall and DNS server
 
1017
implementations. Therefore, Postfix does not enable DNSSEC by default. Since MX
 
1018
lookups happen before the security level is determined, DANE support is
 
1019
disabled for all destinations unless you set "smtp_dns_support_level = dnssec".
 
1020
To enable DNSSEC lookups selectively, define a new dedicated transport with a
 
1021
"-o smtp_dns_support_level=dnssec" override in master.cf and route selected
 
1022
domains to that transport. If DNSSEC proves to be sufficiently reliable for
 
1023
these domains, you can enable it for all destinations by changing the global
 
1024
smtp_dns_support_level in main.cf.
 
1025
 
 
1026
EExxaammppllee: "dane" security for selected destinations, with opportunistic TLS by
 
1027
default. This is the recommended configuration for early adopters.
 
1028
 
 
1029
  * The "example.com" destination uses DANE, but if TLSA records are not
 
1030
    present or are unusable, mail is deferred.
 
1031
 
 
1032
  * The "example.org" destination uses DANE if possible, but if no TLSA records
 
1033
    are found opportunistic TLS is used.
 
1034
 
 
1035
    main.cf:
 
1036
        indexed = ${default_database_type}:${config_directory}/
 
1037
        #
 
1038
        # default: Opportunistic TLS with no DNSSEC lookups.
 
1039
        #
 
1040
        smtp_tls_security_level = may
 
1041
        smtp_dns_support_level = enabled
 
1042
        #
 
1043
        # Per-destination TLS policy
 
1044
        #
 
1045
        smtp_tls_policy_maps = ${indexed}tls_policy
 
1046
        #
 
1047
        # default_transport = smtp, but some destinations are special:
 
1048
        #
 
1049
        transport_maps = ${indexed}transport
 
1050
 
 
1051
    transport:
 
1052
        example.com dane
 
1053
        example.org dane
 
1054
 
 
1055
    tls_policy:
 
1056
        example.com dane-only
 
1057
 
 
1058
    master.cf:
 
1059
        dane       unix  -       -       n       -       -       smtp
 
1060
          -o smtp_dns_support_level=dnssec
 
1061
          -o smtp_tls_security_level=dane
 
1062
 
808
1063
CCeerrttiiffiiccaattee ffiinnggeerrpprriinntt vveerriiffiiccaattiioonn
809
1064
 
810
 
Certificate fingerprint verification is available with Postfix 2.5 and later.
811
 
At this security level ("smtp_tls_security_level = fingerprint"), no trusted
812
 
certificate authorities are used or required. The certificate trust chain,
813
 
expiration date, ... are not checked. Instead, the
814
 
smtp_tls_fingerprint_cert_match parameter or the "match" attribute in the
815
 
policy table lists the remote SMTP server certificate fingerprint or public key
816
 
fingerprint (Postfix 2.9 and later).
 
1065
At the fingerprint security level, no trusted certificate authorities are used
 
1066
or required. The certificate trust chain, expiration date, etc., are not
 
1067
checked. Instead, the smtp_tls_fingerprint_cert_match parameter or the "match"
 
1068
attribute in the policy table lists the remote SMTP server certificate
 
1069
fingerprint or public key fingerprint. Certificate fingerprint verification is
 
1070
available with Postfix 2.5 and later, public-key fingerprint support is
 
1071
available with Postfix 2.9 and later.
817
1072
 
818
1073
If certificate fingerprints are exchanged securely, this is the strongest, and
819
1074
least scalable security level. The administrator needs to securely collect the
858
1113
        smtp_tls_fingerprint_digest = md5
859
1114
 
860
1115
    /etc/postfix/tls_policy:
861
 
        example.com     fingerprint
 
1116
        example.com fingerprint
862
1117
            match=3D:95:34:51:24:66:33:B9:D2:40:99:C0:C1:17:0B:D1
863
1118
            match=EC:3B:2D:B0:5B:B1:FB:6D:20:A3:9D:72:F6:8D:12:35
864
1119
 
892
1147
 
893
1148
MMaannddaattoorryy sseerrvveerr cceerrttiiffiiccaattee vveerriiffiiccaattiioonn
894
1149
 
895
 
At the "verify" TLS security level, messages are sent only over TLS encrypted
 
1150
At the verify TLS security level, messages are sent only over TLS encrypted
896
1151
sessions if the remote SMTP server certificate is valid (not expired or
897
1152
revoked, and signed by a trusted certificate authority) and where the server
898
1153
certificate name matches a known pattern. Mandatory server certificate
908
1163
specified, the certificate CommonName is checked. If you want mandatory
909
1164
encryption without server certificate verification, see above.
910
1165
 
 
1166
With Postfix >= 2.11 the "smtp_tls_trust_anchor_file" parameter or more
 
1167
typically the corresponding per-destination "tafile" attribute optionally
 
1168
modifies trust chain verification. If the parameter is not empty the root CAs
 
1169
in CAfile and CApath are no longer trusted. Rather, the Postfix SMTP client
 
1170
will only trust certificate-chains signed by one of the trust-anchors contained
 
1171
in the chosen files. The specified trust-anchor certificates and public keys
 
1172
are not subject to expiration, and need not be (self-signed) root CAs. They
 
1173
may, if desired, be intermediate certificates. Therefore, these certificates
 
1174
also may be found "in the middle" of the trust chain presented by the remote
 
1175
SMTP server, and any untrusted issuing parent certificates will be ignored.
 
1176
 
911
1177
Despite the potential for eliminating "man-in-the-middle" and other attacks,
912
1178
mandatory certificate trust chain and subject name verification is not viable
913
1179
as a default Internet mail delivery policy. Most MX hosts do not support TLS at
958
1224
specified, the CommonName is checked. If you want mandatory encryption without
959
1225
server certificate verification, see above.
960
1226
 
 
1227
With Postfix >= 2.11 the "smtp_tls_trust_anchor_file" parameter or more
 
1228
typically the corresponding per-destination "tafile" attribute optionally
 
1229
modifies trust chain verification. If the parameter is not empty the root CAs
 
1230
in CAfile and CApath are no longer trusted. Rather, the Postfix SMTP client
 
1231
will only trust certificate-chains signed by one of the trust-anchors contained
 
1232
in the chosen files. The specified trust-anchor certificates and public keys
 
1233
are not subject to expiration, and need not be (self-signed) root CAs. They
 
1234
may, if desired, be intermediate certificates. Therefore, these certificates
 
1235
also may be found "in the middle" of the trust chain presented by the remote
 
1236
SMTP server, and any untrusted issuing parent certificates will be ignored.
 
1237
 
961
1238
Despite the potential for eliminating "man-in-the-middle" and other attacks,
962
1239
mandatory secure server certificate verification is not viable as a default
963
1240
Internet mail delivery policy. Most MX hosts do not support TLS at all, and a
1210
1487
    /etc/postfix/main.cf:
1211
1488
        smtp_tls_session_cache_timeout = 3600s
1212
1489
 
 
1490
As of Postfix 2.11 this setting cannot exceed 100 days. If set <= 0, session
 
1491
caching is disabled. If set to a positive value less than 2 minutes, the
 
1492
minimum value of 2 minutes is used instead.
 
1493
 
1213
1494
CClliieenntt TTLLSS lliimmiittaattiioonnss
1214
1495
 
1215
1496
The security properties of TLS communication channels are application specific.
1258
1539
On the SMTP client, there are further complications. When delivering mail to a
1259
1540
given domain, in contrast to HTTPS, one rarely uses the domain name directly as
1260
1541
the target host of the SMTP session. More typically, one uses MX lookups -
1261
 
these are usually unauthenticated - to obtain the domain's SMTP server hostname
1262
 
(s). When, as is current practice, the client verifies the insecurely obtained
1263
 
MX hostname, it is subject to a DNS man-in-the-middle attack.
 
1542
- these are usually unauthenticated -- to obtain the domain's SMTP server
 
1543
hostname(s). When, as is current practice, the client verifies the insecurely
 
1544
obtained MX hostname, it is subject to a DNS man-in-the-middle attack.
 
1545
 
 
1546
Adoption of DNSSEC and RFC6698 (DANE) may gradually (as domains implement
 
1547
DNSSEC and publish TLSA records for their MX hosts) address the DNS man-in-the-
 
1548
middle risk and provide scalable key management for SMTP with TLS. Postfix >=
 
1549
2.11 supports the new dane and dane-only security levels that take advantage of
 
1550
these standards.
1264
1551
 
1265
1552
If clients instead attempted to verify the recipient domain name, an SMTP
1266
1553
server for multiple domains would need to list all its email domain names in
1341
1628
    overrides the main.cf smtp_tls_mandatory_ciphers parameter, and the
1342
1629
    optional "exclude" attribute (Postfix >= 2.6) overrides the main.cf
1343
1630
    smtp_tls_mandatory_exclude_ciphers parameter.
 
1631
ddaannee
 
1632
    Opportunistic DANE TLS. The TLS policy for the destination is obtained via
 
1633
    TLSA records in DNSSEC. If no TLSA records are found, the effective
 
1634
    security level used is may. If TLSA records are found, but none are usable,
 
1635
    the effective security level is encrypt. When usable TLSA records are
 
1636
    obtained for the remote SMTP server, SSLv2 is automatically disabled (see
 
1637
    smtp_tls_mandatory_protocols), and the server certificate must match the
 
1638
    TLSA records. RFC 6698 (DANE) TLS authentication and DNSSEC support is
 
1639
    available with Postfix 2.11 and later.
 
1640
ddaannee--oonnllyy
 
1641
    Mandatory DANE TLS. The TLS policy for the destination is obtained via TLSA
 
1642
    records in DNSSEC. If no TLSA records are found, or none are usable, no
 
1643
    connection is made to the server. When usable TLSA records are obtained for
 
1644
    the remote SMTP server, SSLv2 is automatically disabled (see
 
1645
    smtp_tls_mandatory_protocols), and the server certificate must match the
 
1646
    TLSA records. RFC 6698 (DANE) TLS authentication and DNSSEC support is
 
1647
    available with Postfix 2.11 and later.
1344
1648
ffiinnggeerrpprriinntt
1345
1649
    Certificate fingerprint verification. Available with Postfix 2.5 and later.
1346
1650
    At this security level, there are no trusted certificate authorities. The
1360
1664
    validated (not expired or revoked, and signed by a trusted certificate
1361
1665
    authority), and if the server certificate name matches the optional "match"
1362
1666
    attribute (or the main.cf smtp_tls_verify_cert_match parameter value when
1363
 
    no optional "match" attribute is specified).
 
1667
    no optional "match" attribute is specified). With Postfix >= 2.11 the
 
1668
    "tafile" attribute optionally modifies trust chain verification in the same
 
1669
    manner as the "smtp_tls_trust_anchor_file" parameter. The "tafile"
 
1670
    attribute may be specified multiple times to load multiple trust-anchor
 
1671
    files.
1364
1672
sseeccuurree
1365
1673
    Secure certificate verification. Mail is delivered only if the TLS
1366
1674
    handshake succeeds, if the remote SMTP server certificate can be validated
1367
1675
    (not expired or revoked, and signed by a trusted certificate authority),
1368
1676
    and if the server certificate name matches the optional "match" attribute
1369
1677
    (or the main.cf smtp_tls_secure_cert_match parameter value when no optional
1370
 
    "match" attribute is specified).
 
1678
    "match" attribute is specified). With Postfix >= 2.11 the "tafile"
 
1679
    attribute optionally modifies trust chain verification in the same manner
 
1680
    as the "smtp_tls_trust_anchor_file" parameter. The "tafile" attribute may
 
1681
    be specified multiple times to load multiple trust-anchor files.
1371
1682
Notes:
1372
1683
 
1373
1684
  * The "match" attribute is especially useful to verify TLS certificates for
1404
1715
    /etc/postfix/tls_policy:
1405
1716
        example.edu             none
1406
1717
        example.mil             may
1407
 
        example.gov             encrypt protocols=SSLv3:TLSv1 ciphers=high
1408
 
        example.com             verify
1409
 
                match=hostname:dot-nexthop protocols=SSLv3:TLSv1 ciphers=high
 
1718
        example.gov             encrypt ciphers=high
 
1719
        example.com             verify match=hostname:dot-nexthop ciphers=high
1410
1720
        example.net             secure
1411
1721
        .example.net            secure match=.example.net:example.net
1412
1722
        [mail.example.org]:587  secure match=nexthop
1413
1723
        # Postfix 2.5 and later
1414
1724
        [thumb.example.org]         fingerprint
1415
 
                match=EC:3B:2D:B0:5B:B1:FB:6D:20:A3:9D:72:F6:8D:12:35
1416
 
        match=3D:95:34:51:24:66:33:B9:D2:40:99:C0:C1:17:0B:D1
 
1725
            match=EC:3B:2D:B0:5B:B1:FB:6D:20:A3:9D:72:F6:8D:12:35
 
1726
            match=3D:95:34:51:24:66:33:B9:D2:40:99:C0:C1:17:0B:D1
1417
1727
        # Postfix 2.6 and later
1418
1728
        example.info            may protocols=!SSLv2 ciphers=medium
1419
1729
    exclude=3DES
1497
1807
        smtp_tls_exclude_ciphers = aNULL
1498
1808
        # Preferred form with Postfix >= 2.5:
1499
1809
        smtp_tls_mandatory_protocols = !SSLv2
1500
 
        # Alternative form.
 
1810
        # Legacy form for Postfix < 2.5:
1501
1811
        smtp_tls_mandatory_protocols = SSLv3, TLSv1
1502
1812
        # Also available with Postfix >= 2.6:
1503
1813
        smtp_tls_ciphers = export
1572
1882
    /etc/postfix/main.cf:
1573
1883
        smtp_starttls_timeout = 300s
1574
1884
 
 
1885
With Postfix 2.8 and later, the tls_disable_workarounds parameter specifies a
 
1886
list or bit-mask of OpenSSL bug work-arounds to disable. This may be necessary
 
1887
if one of the work-arounds enabled by default in OpenSSL proves to pose a
 
1888
security risk, or introduces an unexpected interoperability issue. Some bug
 
1889
work-arounds known to be problematic are disabled in the default value of the
 
1890
parameter when linked with an OpenSSL library that could be vulnerable.
 
1891
 
 
1892
Example:
 
1893
 
 
1894
    /etc/postfix/main.cf:
 
1895
        tls_disable_workarounds = 0xFFFFFFFF
 
1896
        tls_disable_workarounds = CVE-2010-4180, LEGACY_SERVER_CONNECT
 
1897
 
 
1898
Note: Disabling LEGACY_SERVER_CONNECT is not wise at this time, lots of servers
 
1899
are still unpatched and Postfix is not significantly vulnerable to the
 
1900
renegotiation issue in the TLS protocol.
 
1901
 
 
1902
With Postfix >= 2.11, the tls_ssl_options parameter specifies a list or bit-
 
1903
mask of OpenSSL options to enable. Specify one or more of the named options
 
1904
below, or a hexadecimal bitmask of options found in the ssl.h file
 
1905
corresponding to the run-time OpenSSL library. While it may be reasonable to
 
1906
turn off all bug workarounds (see above), it is not a good idea to attempt to
 
1907
turn on all features.
 
1908
 
 
1909
A future version of OpenSSL may by default no longer allow connections to
 
1910
servers that don't support secure renegotiation. Since the exposure for SMTP is
 
1911
minimal, and some SMTP servers may remain unpatched, you can add
 
1912
LEGACY_SERVER_CONNECT to the options to restore the more permissive default of
 
1913
current OpenSSL releases.
 
1914
 
 
1915
Example:
 
1916
 
 
1917
    /etc/postfix/main.cf:
 
1918
        tls_ssl_options = NO_TICKET, NO_COMPRESSION, LEGACY_SERVER_CONNECT
 
1919
 
 
1920
You should only enable features via the hexadecimal mask when the need to
 
1921
control the feature is critical (to deal with a new vulnerability or a serious
 
1922
interoperability problem). Postfix DOES NOT promise backwards compatible
 
1923
behavior with respect to the mask bits. A feature enabled via the mask in one
 
1924
release may be enabled by other means in a later release, and the mask bit will
 
1925
then be ignored. Therefore, use of the hexadecimal mask is only a temporary
 
1926
measure until a new Postfix or OpenSSL release provides a better solution.
 
1927
 
1575
1928
TTLLSS mmaannaaggeerr ssppeecciiffiicc sseettttiinnggss
1576
1929
 
1577
1930
The security of cryptographic software such as TLS depends critically on the
1751
2104
        /etc/postfix/main.cf:
1752
2105
            smtp_tls_CAfile = /etc/postfix/cacert.pem
1753
2106
            smtp_tls_session_cache_database =
1754
 
                btree:/var/lib/postfix/smtp_tls_session_cache
 
2107
                btree:/var/lib/postfix/smtp_tls_session_cache
1755
2108
            smtp_tls_security_level = may
1756
2109
            smtpd_tls_CAfile = /etc/postfix/cacert.pem
1757
2110
            smtpd_tls_cert_file = /etc/postfix/foo-cert.pem
1758
2111
            smtpd_tls_key_file = /etc/postfix/foo-key.pem
1759
2112
            smtpd_tls_received_header = yes
1760
2113
            smtpd_tls_session_cache_database =
1761
 
                btree:/var/lib/postfix/smtpd_tls_session_cache
 
2114
                btree:/var/lib/postfix/smtpd_tls_session_cache
1762
2115
            tls_random_source = dev:/dev/urandom
1763
2116
            smtpd_tls_security_level = may
1764
2117