From: Wietse Venema
The examples that follow show how to create a server certificate @@ -1296,7 +1296,7 @@ EE records in preference to all types.
The pre-requisites for DANE support in the Postfix SMTP client are:
Note: The Postfix SMTP client's internal stub DNS resolver is DNSSEC-aware, but it does not itself validate DNSSEC records, rather it delegates DNSSEC validation to the operating system's configured -recursive DNS nameserver. The Postfix DNS resolver relies on a -secure-channel to the cache for DNSSEC integrity, but does not +recursive DNS nameserver. The Postfix DNS client relies on a secure +channel to the resolver's cache for DNSSEC integrity, but does not support TSIG to protect the transmission channel between itself and the nameserver. Therefore, it is strongly recommended (DANE security guarantee void otherwise) that each MTA run a local DNSSEC-validating diff --git a/postfix/html/posttls-finger.1.html b/postfix/html/posttls-finger.1.html new file mode 100644 index 000000000..45553369c --- /dev/null +++ b/postfix/html/posttls-finger.1.html @@ -0,0 +1,346 @@ + +
+ ++POSTTLS-FINGER(1) POSTTLS-FINGER(1) + +NAME + posttls-finger - Probe the TLS properties of an ESMTP or + LMTP server. + +SYNOPSIS + posttls-finger [options] [inet:]domain[:port] [match ...] + posttls-finger -S [options] unix:pathname [match ...] + +DESCRIPTION + posttls-finger(1) connects to the specified destination + and reports TLS-related information about the server. With + SMTP, the destination is a domainname; with LMTP it is + either a domainname prefixed with inet: or a pathname pre- + fixed with unix:. If Postfix is built without TLS sup- + port, the resulting posttls-finger program has very lim- + ited functionality, and only the -a, -c, -h, -o, -S, -t, + -T and -v options are available. + + Note: this is an unsupported test program. No attempt is + made to maintain compatibility between successive ver- + sions. + + For SMTP servers that don't support ESMTP, only the greet- + ing banner and the negative EHLO response are reported. + Otherwise, the reported EHLO response details further + server capabilities. + + If TLS support is enabled when posttls-finger(1) is com- + piled, and the server supports STARTTLS, a TLS handshake + is attempted. + + If DNSSEC support is available, the connection TLS secu- + rity level (-l option) defaults to dane; see TLS_README + for details. Otherwise, it defaults to secure. This set- + ting determines the certificate matching policy. + + If TLS negotiation succeeds, the TLS protocol and cipher + details are reported. The server certificate is then veri- + fied in accordance with the policy at the chosen (or + default) security level. With public CA-based trust, when + the -L option includes certmatch, (true by default) name + matching is performed even if the certificate chain is not + trusted. This logs the names found in the remote SMTP + server certificate and which if any would match, were the + certificate chain trusted. + + Note: posttls-finger(1) does not perform any table + lookups, so the TLS policy table and obsolete per-site + tables are not consulted. It does not communicate with + the tlsmgr(8) daemon (or any other Postfix daemons); its + TLS session cache is held in private memory, and disap- + pears when the process exits. + + With the -r delay option, if the server assigns a TLS ses- + sion id, the TLS session is cached. The connection is then + closed and re-opened after the specified delay, and post- + tls-finger(1) then reports whether the cached TLS session + was re-used. + + When the destination is a load-balancer, it may be dis- + tributing load between multiple server caches. Typically, + each server returns its unique name in its EHLO response. + If, upon reconnecting with -r, a new server name is + detected, another session is cached for the new server, + and the reconnect is repeated up to a maximum number of + times (default 5) that can be specified via the -m option. + + The choice of SMTP or LMTP (-S option) determines the syn- + tax of the destination argument. With SMTP, one can spec- + ify a service on a non-default port as host:service, and + disable MX (mail exchanger) DNS lookups with [host] or + [host]:port. The [] form is required when you specify an + IP address instead of a hostname. An IPv6 address takes + the form [ipv6:address]. The default port for SMTP is + taken from the smtp/tcp entry in /etc/services, defaulting + to 25 if the entry is not found. + + With LMTP, specify unix:pathname to connect to a local + server listening on a unix-domain socket bound to the + specified pathname; otherwise, specify an optional inet: + prefix followed by a domain and an optional port, with the + same syntax as for SMTP. The default TCP port for LMTP is + 24. + + Arguments: + + -a Address family preference: ipv4, ipv6 or any. When + using any, posttls-finger will randomly select one + of the two as the more preferred, and exhaust all + MX preferences for the first address family before + trying any addresses for the other. The default + value is any. + + -A A list of PEM trust-anchor files that overrides + CAfile and CApath trust chain verification. Spec- + ify the option multiple times to specify multiple + files. See the main.cf documentation for + smtp_tls_trust_anchor_file for details. + + -c Disable SMTP chat logging; only TLS-related infor- + mation is logged. + + -C Print the remote SMTP server certificate trust + chain in PEM format. The issuer DN, subject DN, + certificate and public key fingerprints (see -d + mdalg option below) are printed above each PEM cer- + tificate block. If you specify -F CAfile or -P + CApath, the OpenSSL library may augment the chain + with missing issuer certificates. To see the + actual chain sent by the remote SMTP server leave + CAfile and CApath unset. + + -d mdalg + The message digest algorithm to use for reporting + remote SMTP server fingerprints and matching + against user provided certificate fingerprints + (with DANE TLSA records the algorithm is specified + in the DNS). The default algorithm is sha1. + + -F CAfile.pem + The PEM formatted CAfile for remote SMTP server + certificate verification. By default no CAfile is + used and no public CAs are trusted. + + -h host_lookup + The hostname lookup methods used for the connec- + tion. See the documentation of smtp_host_lookup + for syntax and semantics. + + -l level + The security level for the connection, default dane + or secure depending on whether DNSSEC is available. + For syntax and semantics, see the documentation of + smtp_tls_security_level. When dane is supported + and selected, if no TLSA records are found, or all + the records found are unusable, the degraded level + will be secure. The main additional level to con- + sider is fingerprint, which allows you test cer- + tificate or public-key fingerprint matches before + you deploy them in the policy table. + + Note, since posttls-finger does not actually + deliver any email, the none, may and encrypt secu- + rity levels are not very useful. Since may and + encrypt don't require peer certificates, they will + often negotiate anonymous TLS ciphersuites, so you + won't learn much about the remote SMTP server's + certificates at these levels if it also supports + anonymous TLS (though you may learn that the server + supports anonymous TLS). + + -L logopts + Fine-grained TLS logging options. To tune the TLS + features logged during the TLS handshake, specify + one or more of: + + 0, none + These yield no TLS logging; you'll generally + want more, but this is handy if you just + want the trust chain: + $ posttls-finger -cC -L none destination + + 1, routine, summary + These synonymous values yield a normal one- + line summary of the TLS connection. + + 2, debug + These synonymous values combine routine, + ssl-debug, cache and verbose. + + 3, ssl-expert + These synonymous values combine debug with + ssl-handshake-packet-dump. For experts + only. + + 4, ssl-developer + These synonymous values combine ssl-expert + with ssl-session-packet-dump. For experts + only, and in most cases, use wireshark + instead. + + ssl-debug + Turn on OpenSSL logging of the progress of + the SSL handshake. + + ssl-handshake-packet-dump + Log hexadecimal packet dumps of the SSL + handshake; for experts only. + + ssl-session-packet-dump + Log hexadecimal packet dumps of the entire + SSL session; only useful to those who can + debug SSL protocol problems from hex dumps. + + untrusted + Logs trust chain verification problems. + This is turned on automatically at security + levels that use peer names signed by cer- + tificate authorities to validate certifi- + cates. So while this setting is recognized, + you should never need to set it explicitly. + + peercert + This logs a one line summary of the remote + SMTP server certificate subject, issuer, and + fingerprints. + + certmatch + This logs remote SMTP server certificate + matching, showing the CN and each subjec- + tAltName and which name matched. With DANE, + logs matching of TLSA record trust-anchor + and end-entity certificates. + + cache This logs session cache operations, showing + whether session caching is effective with + the remote SMTP server. Automatically used + when reconnecting with the -r option; rarely + needs to be set explicitly. + + verbose + Enables verbose logging in the Postfix TLS + driver; includes all of peercert..cache and + more. + + The default is routine,certmatch. After a recon- + nect, the log level is unconditionally rou- + tine,cache. + + -m count + When the -r delay option is specified, the -m + option determines the maximum number of reconnect + attempts to use with a server behind a load-bal- + acer, to see whether connection caching is likely + to be effective for this destination. Some MTAs + don't expose the underlying server identity in + their EHLO response; with these servers there will + never be more than 1 reconnection attempt. + + -o name=value + Specify zero or more times to override the value of + the main.cf parameter name with value. Possible + use-cases include overriding the values of TLS + library parameters or "myhostname" to configure the + SMTP EHLO name sent to the remote server. + + -P CApath/ + The OpenSSL CApath/ directory (indexed via + c_rehash(1)) for remote SMTP server certificate + verification. By default no CApath is used and no + public CAs are trusted. + + -r delay + With a cachable TLS session, disconnect and recon- + nect after delay seconds. Report whether the ses- + sion is re-used. Retry if a new server is encoun- + tered, up to 5 times or as specified with the -m + option. + + -S Disable SMTP; that is, connect to an LMTP server. + The default port for LMTP over TCP is 24. Alterna- + tive ports can specified by appending ":service- + name" or ":portnumber" to the destination argument. + + -t timeout + The TCP connection timeout to use. This is also + the timeout for reading the remote server's 220 + banner. + + -T timeout + The SMTP/LMTP command timeout for EHLO/LHLO, START- + TLS and QUIT. + + -v Enable more verbose logging. + + [inet:]domain[:port] + Connect via TCP to domain domain, port port. The + default port is smtp (or 24 with LMTP). With SMTP + an MX lookup is performed to resolve the domain to + a host, unless the domain is enclosed in []. If + you want to connect to a specific MX host, for + instance mx1.example.com, specify [mx1.example.com] + as the destination and example.com as a match argu- + ment. When using DNS, the destination domain is + assumed fully qualified and no default domain or + search suffixes are applied; you must use fully- + qualified names or also enable native host lookups + (these don't support dane as no DNSSEC validation + information is available via native lookups). + + unix:pathname + Connect to the UNIX-domain socket at pathname. LMTP + only. + + match ... + With no match arguments specified, certificate + peername matching uses the compiled-in default + strategies for each security level. If you specify + one or more arguments, these will be used as the + list of certificate or public-key digests to match + for the fingerprint level, or as the list of DNS + names to match in the certificate at the verify and + secure levels. If the security level is dane, and + usable TLSA records are found, the match names are + ignored, and hostname, nexthop strategies are used. + If no TLSA records are found or none are usable, + the level degrades to secure and the provided list + is used to match names in the certificate. + +ENVIRONMENT + MAIL_CONFIG + Read configuration parameters from a non-default + location. + + MAIL_VERBOSE + Same as -v option. + +SEE ALSO + smtp-source(1), SMTP/LMTP message source + smtp-sink(1), SMTP/LMTP message dump + +README FILES + TLS_README, Postfix STARTTLS howto + +LICENSE + The Secure Mailer license must be distributed with this + software. + +AUTHOR(S) + Wietse Venema + IBM T.J. Watson Research + P.O. Box 704 + Yorktown Heights, NY 10598, USA + + Viktor Dukhovni + + POSTTLS-FINGER(1) +diff --git a/postfix/man/Makefile.in b/postfix/man/Makefile.in index c8a80e53b..e096a364e 100644 --- a/postfix/man/Makefile.in +++ b/postfix/man/Makefile.in @@ -22,7 +22,7 @@ CONFIG = man5/access.5 man5/aliases.5 man5/canonical.5 man5/relocated.5 \ man5/generic.5 man5/bounce.5 man5/postfix-wrapper.5 \ man5/sqlite_table.5 TOOLS = man1/smtp-sink.1 man1/smtp-source.1 man1/qmqp-sink.1 \ - man1/qmqp-source.1 man1/qshape.1 + man1/qmqp-source.1 man1/qshape.1 man1/posttls-finger.1 update: $(DAEMONS) $(COMMANDS) $(CONFIG) $(TOOLS) @@ -322,6 +322,11 @@ man1/smtp-source.1: ../src/smtpstone/smtp-source.c (cmp -s junk $? || mv junk $?) && rm -f junk ../mantools/srctoman $? >$@ +man1/posttls-finger.1: ../src/posttls-finger/posttls-finger.c + ../mantools/fixman ../proto/postconf.proto $? >junk && \ + (cmp -s junk $? || mv junk $?) && rm -f junk + ../mantools/srctoman $? >$@ + man5/tcp_table.5: ../proto/tcp_table ../mantools/srctoman - $? >$@ diff --git a/postfix/man/man1/posttls-finger.1 b/postfix/man/man1/posttls-finger.1 new file mode 100644 index 000000000..b9855a7e1 --- /dev/null +++ b/postfix/man/man1/posttls-finger.1 @@ -0,0 +1,290 @@ +.TH POSTTLS-FINGER 1 +.ad +.fi +.SH NAME +posttls-finger +\- +Probe the TLS properties of an ESMTP or LMTP server. +.SH "SYNOPSIS" +.na +.nf +\fBposttls-finger\fR [\fIoptions\fR] [\fBinet:\fR]\fIdomain\fR[:\fIport\fR] [\fImatch ...\fR] +.br +\fBposttls-finger\fR -S [\fIoptions\fR] \fBunix:\fIpathname\fR [\fImatch ...\fR] +.SH DESCRIPTION +.ad +.fi +\fBposttls-finger\fR(1) connects to the specified destination +and reports TLS-related information about the server. With SMTP, the +destination is a domainname; with LMTP it is either a domainname +prefixed with \fBinet:\fR or a pathname prefixed with \fBunix:\fR. If +Postfix is built without TLS support, the resulting posttls-finger +program has very limited functionality, and only the \fB-a\fR, \fB-c\fR, +\fB-h\fR, \fB-o\fR, \fB-S\fR, \fB-t\fR, \fB-T\fR and \fB-v\fR options +are available. + +Note: this is an unsupported test program. No attempt is made +to maintain compatibility between successive versions. + +For SMTP servers that don't support ESMTP, only the greeting banner +and the negative EHLO response are reported. Otherwise, the reported +EHLO response details further server capabilities. + +If TLS support is enabled when \fBposttls-finger\fR(1) is compiled, and +the server supports \fBSTARTTLS\fR, a TLS handshake is attempted. + +If DNSSEC support is available, the connection TLS security level +(\fB-l\fR option) defaults to \fBdane\fR; see TLS_README for +details. Otherwise, it defaults to \fBsecure\fR. This setting +determines the certificate matching policy. + +If TLS negotiation succeeds, the TLS protocol and cipher details are +reported. The server certificate is then verified in accordance with +the policy at the chosen (or default) security level. With public +CA-based trust, when the \fB-L\fR option includes \fBcertmatch\fR, +(true by default) name matching is performed even if the certificate +chain is not trusted. This logs the names found in the remote SMTP +server certificate and which if any would match, were the certificate +chain trusted. + +Note: \fBposttls-finger\fR(1) does not perform any table lookups, so +the TLS policy table and obsolete per-site tables are not consulted. +It does not communicate with the \fBtlsmgr\fR(8) daemon (or any other +Postfix daemons); its TLS session cache is held in private memory, and +disappears when the process exits. + +With the \fB-r \fIdelay\fR option, if the server assigns a TLS +session id, the TLS session is cached. The connection is then closed +and re-opened after the specified delay, and \fBposttls-finger\fR(1) +then reports whether the cached TLS session was re-used. + +When the destination is a load-balancer, it may be distributing +load between multiple server caches. Typically, each server returns +its unique name in its EHLO response. If, upon reconnecting with +\fB-r\fR, a new server name is detected, another session is cached +for the new server, and the reconnect is repeated up to a maximum +number of times (default 5) that can be specified via the \fB-m\fR +option. + +The choice of SMTP or LMTP (\fB-S\fR option) determines the syntax of +the destination argument. With SMTP, one can specify a service on a +non-default port as \fIhost\fR:\fIservice\fR, and disable MX (mail +exchanger) DNS lookups with [\fIhost\fR] or [\fIhost\fR]:\fIport\fR. +The [] form is required when you specify an IP address instead of a +hostname. An IPv6 address takes the form [\fBipv6:\fIaddress\fR]. +The default port for SMTP is taken from the \fBsmtp/tcp\fR entry in +/etc/services, defaulting to 25 if the entry is not found. + +With LMTP, specify \fBunix:\fIpathname\fR to connect to a local server +listening on a unix-domain socket bound to the specified pathname; +otherwise, specify an optional \fBinet:\fR prefix followed by a +\fIdomain\fR and an optional port, with the same syntax as for +SMTP. The default TCP port for LMTP is 24. + +Arguments: +.IP "\fB-a\fR" +Address family preference: \fBipv4\fR, \fBipv6\fR or \fBany\fR. When +using \fBany\fR, posttls-finger will randomly select one of the two as +the more preferred, and exhaust all MX preferences for the first +address family before trying any addresses for the other. The +default value is \fBany\fR. +.IP "\fB-A\fR" +A list of PEM trust-anchor files that overrides CAfile and CApath +trust chain verification. Specify the option multiple times to +specify multiple files. See the main.cf documentation for +smtp_tls_trust_anchor_file for details. +.IP "\fB-c\fR" +Disable SMTP chat logging; only TLS-related information is logged. +.IP "\fB-C\fR" +Print the remote SMTP server certificate trust chain in PEM format. +The issuer DN, subject DN, certificate and public key fingerprints +(see \fB-d \fImdalg\fR option below) are printed above each PEM +certificate block. If you specify \fB-F \fICAfile\fR or +\fB-P \fICApath\fR, the OpenSSL library may augment the chain with +missing issuer certificates. To see the actual chain sent by the +remote SMTP server leave \fICAfile\fR and \fICApath\fR unset. +.IP "\fB-d \fImdalg\fR" +The message digest algorithm to use for reporting remote SMTP server +fingerprints and matching against user provided certificate +fingerprints (with DANE TLSA records the algorithm is specified +in the DNS). The default algorithm is sha1. +.IP "\fB-F \fICAfile.pem\fR" +The PEM formatted CAfile for remote SMTP server certificate +verification. By default no CAfile is used and no public CAs +are trusted. +.IP "\fB-h \fIhost_lookup\fR" +The hostname lookup methods used for the connection. See the +documentation of smtp_host_lookup for syntax and semantics. +.IP "\fB-l \fIlevel\fR" +The security level for the connection, default \fBdane\fR or +\fBsecure\fR depending on whether DNSSEC is available. For syntax +and semantics, see the documentation of smtp_tls_security_level. +When \fBdane\fR is supported and selected, if no TLSA records are +found, or all the records found are unusable, the \fIdegraded\fR +level will be \fBsecure\fR. The main additional level to consider +is \fBfingerprint\fR, which allows you test certificate or public-key +fingerprint matches before you deploy them in the policy table. +.IP +Note, since \fBposttls-finger\fR does not actually deliver any email, +the \fBnone\fR, \fBmay\fR and \fBencrypt\fR security levels are not +very useful. Since \fBmay\fR and \fBencrypt\fR don't require peer +certificates, they will often negotiate anonymous TLS ciphersuites, +so you won't learn much about the remote SMTP server's certificates +at these levels if it also supports anonymous TLS (though you may +learn that the server supports anonymous TLS). +.IP "\fB-L \fIlogopts\fR" +Fine-grained TLS logging options. To tune the TLS features logged +during the TLS handshake, specify one or more of: +.RS +.IP "0, none" +These yield no TLS logging; you'll generally want more, but this +is handy if you just want the trust chain: +.RS +.ad +.nf +$ posttls-finger -cC -L none destination +.fi +.RE +.IP "1, routine, summary" +These synonymous values yield a normal one-line summary of the TLS +connection. +.IP "2, debug" +These synonymous values combine routine, ssl-debug, cache and verbose. +.IP "3, ssl-expert" +These synonymous values combine debug with ssl-handshake-packet-dump. +For experts only. +.IP "4, ssl-developer" +These synonymous values combine ssl-expert with ssl-session-packet-dump. +For experts only, and in most cases, use wireshark instead. +.IP ssl-debug +Turn on OpenSSL logging of the progress of the SSL handshake. +.IP ssl-handshake-packet-dump +Log hexadecimal packet dumps of the SSL handshake; for experts only. +.IP ssl-session-packet-dump +Log hexadecimal packet dumps of the entire SSL session; only useful +to those who can debug SSL protocol problems from hex dumps. +.IP untrusted +Logs trust chain verification problems. This is turned on +automatically at security levels that use peer names signed +by certificate authorities to validate certificates. So while +this setting is recognized, you should never need to set it +explicitly. +.IP peercert +This logs a one line summary of the remote SMTP server certificate +subject, issuer, and fingerprints. +.IP certmatch +This logs remote SMTP server certificate matching, showing the CN +and each subjectAltName and which name matched. With DANE, logs +matching of TLSA record trust-anchor and end-entity certificates. +.IP cache +This logs session cache operations, showing whether session caching +is effective with the remote SMTP server. Automatically used when +reconnecting with the \fB-r\fR option; rarely needs to be set +explicitly. +.IP verbose +Enables verbose logging in the Postfix TLS driver; includes all of +peercert..cache and more. +.RE +.IP +The default is \fBroutine,certmatch\fR. After a reconnect, the log +level is unconditionally \fBroutine,cache\fR. +.IP "\fB-m \fIcount\fR" +When the \fB-r \fIdelay\fR option is specified, the \fB-m\fR option +determines the maximum number of reconnect attempts to use with +a server behind a load-balacer, to see whether connection caching +is likely to be effective for this destination. Some MTAs don't +expose the underlying server identity in their EHLO response; with +these servers there will never be more than 1 reconnection attempt. +.IP "\fB-o \fIname=value\fR" +Specify zero or more times to override the value of the main.cf +parameter \fIname\fR with \fIvalue\fR. Possible use-cases include +overriding the values of TLS library parameters or "myhostname" to +configure the SMTP EHLO name sent to the remote server. +.IP "\fB-P \fICApath/\fR" +The OpenSSL CApath/ directory (indexed via c_rehash(1)) for remote +SMTP server certificate verification. By default no CApath is used +and no public CAs are trusted. +.IP "\fB-r \fIdelay\fR" +With a cachable TLS session, disconnect and reconnect after \fIdelay\fR +seconds. Report whether the session is re-used. Retry if a new server +is encountered, up to 5 times or as specified with the \fB-m\fR option. +.IP "\fB-S\fR" +Disable SMTP; that is, connect to an LMTP server. The default port for +LMTP over TCP is 24. Alternative ports can specified by appending +"\fI:servicename\fR" or ":\fIportnumber\fR" to the destination +argument. +.IP "\fB-t \fItimeout\fR" +The TCP connection timeout to use. This is also the timeout for +reading the remote server's 220 banner. +.IP "\fB-T \fItimeout\fR" +The SMTP/LMTP command timeout for EHLO/LHLO, STARTTLS and QUIT. +.IP "\fB-v\fR" +Enable more verbose logging. +.IP "[\fBinet:\fR]\fIdomain\fR[:\fIport\fR]" +Connect via TCP to domain \fIdomain\fR, port \fIport\fR. The default +port is \fBsmtp\fR (or 24 with LMTP). With SMTP an MX lookup is +performed to resolve the domain to a host, unless the domain is +enclosed in \fB[]\fR. If you want to connect to a specific MX host, +for instance \fImx1.example.com\fR, specify [\fImx1.example.com\fR] +as the destination and \fIexample.com\fR as a \fBmatch\fR argument. +When using DNS, the destination domain is assumed fully qualified +and no default domain or search suffixes are applied; you must use +fully-qualified names or also enable \fBnative\fR host lookups +(these don't support \fBdane\fR as no DNSSEC validation information +is available via \fBnative\fR lookups). +.IP "\fBunix:\fIpathname\fR" +Connect to the UNIX-domain socket at \fIpathname\fR. LMTP only. +.IP "\fBmatch ...\fR" +With no match arguments specified, certificate peername matching uses +the compiled-in default strategies for each security level. If you +specify one or more arguments, these will be used as the list of +certificate or public-key digests to match for the \fBfingerprint\fR +level, or as the list of DNS names to match in the certificate at the +\fBverify\fR and \fBsecure\fR levels. If the security level is +\fBdane\fR, and usable TLSA records are found, the match names are +ignored, and \fBhostname, nexthop\fR strategies are used. If no +TLSA records are found or none are usable, the level \fIdegrades\fR +to \fBsecure\fR and the provided list is used to match names in +the certificate. +.ad +.fi +.SH "ENVIRONMENT" +.na +.nf +.ad +.fi +.IP \fBMAIL_CONFIG\fR +Read configuration parameters from a non-default location. +.IP \fBMAIL_VERBOSE\fR +Same as \fB-v\fR option. +.SH "SEE ALSO" +.na +.nf +smtp-source(1), SMTP/LMTP message source +smtp-sink(1), SMTP/LMTP message dump + +.SH "README FILES" +.na +.nf +.ad +.fi +Use "\fBpostconf readme_directory\fR" or "\fBpostconf +html_directory\fR" to locate this information. +.na +.nf +TLS_README, Postfix STARTTLS howto +.SH "LICENSE" +.na +.nf +.ad +.fi +The Secure Mailer license must be distributed with this software. +.SH "AUTHOR(S)" +.na +.nf +Wietse Venema +IBM T.J. Watson Research +P.O. Box 704 +Yorktown Heights, NY 10598, USA + +Viktor Dukhovni diff --git a/postfix/mantools/postlink b/postfix/mantools/postlink index 8b85aa42c..e8c6a3bbb 100755 --- a/postfix/mantools/postlink +++ b/postfix/mantools/postlink @@ -790,6 +790,7 @@ while (<>) { s/[
The examples that follow show how to create a server certificate
diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h
index e333c4012..db9bbf94f 100644
--- a/postfix/src/global/mail_version.h
+++ b/postfix/src/global/mail_version.h
@@ -20,7 +20,7 @@
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20130421"
+#define MAIL_RELEASE_DATE "20130422"
#define MAIL_VERSION_NUMBER "2.11"
#ifdef SNAPSHOT
diff --git a/postfix/src/posttls-finger/.indent.pro b/postfix/src/posttls-finger/.indent.pro
new file mode 120000
index 000000000..5c837eca6
--- /dev/null
+++ b/postfix/src/posttls-finger/.indent.pro
@@ -0,0 +1 @@
+../../.indent.pro
\ No newline at end of file
diff --git a/postfix/src/posttls-finger/Makefile.in b/postfix/src/posttls-finger/Makefile.in
new file mode 100644
index 000000000..9be25502b
--- /dev/null
+++ b/postfix/src/posttls-finger/Makefile.in
@@ -0,0 +1,99 @@
+SHELL = /bin/sh
+SRCS = posttls-finger.c tlsmgrmem.c
+OBJS = posttls-finger.o tlsmgrmem.o
+HDRS = tlsmgrmem.h
+TESTSRC =
+DEFS = -I. -I$(INC_DIR) -D$(SYSTYPE)
+CFLAGS = $(DEBUG) $(OPT) $(DEFS)
+TESTPROG=
+INC_DIR = ../../include
+PROG = posttls-finger
+LIBS = ../../lib/libtls.a ../../lib/libdns.a \
+ ../../lib/libglobal.a ../../lib/libutil.a
+
+.c.o:; $(CC) $(CFLAGS) -c $*.c
+
+all: $(PROG)
+
+$(OBJS): ../../conf/makedefs.out $(HDRS)
+
+Makefile: Makefile.in
+ cat ../../conf/makedefs.out $? >$@
+
+posttls-finger: $(OBJS) $(LIBS)
+ $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+
+test: $(TESTPROG)
+
+tests:
+
+root_tests:
+
+update: ../../bin/posttls-finger
+
+../../bin/posttls-finger: posttls-finger
+ cp $? $@
+
+printfck: $(OBJS) $(PROG)
+ rm -rf printfck
+ mkdir printfck
+ sed '1,/^# do not edit/!d' Makefile >printfck/Makefile
+ set -e; for i in *.c; do printfck -f .printfck $$i >printfck/$$i; done
+ cd printfck; make "INC_DIR=../../../include" `cd ..; ls *.o`
+
+lint:
+ lint $(DEFS) $(SRCS) $(LINTFIX)
+
+clean:
+ rm -f *.o *core $(PROG) $(TESTPROG) junk
+ rm -rf printfck
+
+tidy: clean
+
+depend: $(MAKES)
+ (sed '1,/^# do not edit/!d' Makefile.in; \
+ set -e; for i in [a-z][a-z0-9]*.c; do \
+ $(CC) -E $(DEFS) $(INCL) $$i | grep -v '[<>]' | sed -n -e '/^# *1 *"\([^"]*\)".*/{' \
+ -e 's//'`echo $$i|sed 's/c$$/o/'`': \1/' \
+ -e 's/o: \.\//o: /' -e p -e '}' ; \
+ done | sort -u) | grep -v '[.][o][:][ ][/]' >$$$$ && mv $$$$ Makefile.in
+ @$(EXPORT) make -f Makefile.in Makefile 1>&2
+
+# do not edit below this line - it is generated by 'make depend'
+posttls-finger.o: ../../include/argv.h
+posttls-finger.o: ../../include/chroot_uid.h
+posttls-finger.o: ../../include/dns.h
+posttls-finger.o: ../../include/dsn.h
+posttls-finger.o: ../../include/dsn_buf.h
+posttls-finger.o: ../../include/host_port.h
+posttls-finger.o: ../../include/inet_proto.h
+posttls-finger.o: ../../include/iostuff.h
+posttls-finger.o: ../../include/mail_conf.h
+posttls-finger.o: ../../include/mail_params.h
+posttls-finger.o: ../../include/mail_server.h
+posttls-finger.o: ../../include/msg.h
+posttls-finger.o: ../../include/msg_vstream.h
+posttls-finger.o: ../../include/myaddrinfo.h
+posttls-finger.o: ../../include/mymalloc.h
+posttls-finger.o: ../../include/name_code.h
+posttls-finger.o: ../../include/name_mask.h
+posttls-finger.o: ../../include/sane_connect.h
+posttls-finger.o: ../../include/smtp_stream.h
+posttls-finger.o: ../../include/sock_addr.h
+posttls-finger.o: ../../include/stringops.h
+posttls-finger.o: ../../include/sys_defs.h
+posttls-finger.o: ../../include/timed_connect.h
+posttls-finger.o: ../../include/tls.h
+posttls-finger.o: ../../include/vbuf.h
+posttls-finger.o: ../../include/vstream.h
+posttls-finger.o: ../../include/vstring.h
+posttls-finger.o: ../../include/vstring_vstream.h
+posttls-finger.o: posttls-finger.c
+posttls-finger.o: tlsmgrmem.h
+tlsmgrmem.o: ../../include/htable.h
+tlsmgrmem.o: ../../include/sys_defs.h
+tlsmgrmem.o: ../../include/tls_mgr.h
+tlsmgrmem.o: ../../include/vbuf.h
+tlsmgrmem.o: ../../include/vstring.h
+tlsmgrmem.o: tlsmgrmem.c
+tlsmgrmem.o: tlsmgrmem.h
diff --git a/postfix/src/posttls-finger/posttls-finger.c b/postfix/src/posttls-finger/posttls-finger.c
new file mode 100644
index 000000000..d5aed3816
--- /dev/null
+++ b/postfix/src/posttls-finger/posttls-finger.c
@@ -0,0 +1,1768 @@
+/*++
+/* NAME
+/* posttls-finger 1
+/* SUMMARY
+/* Probe the TLS properties of an ESMTP or LMTP server.
+/* SYNOPSIS
+/* \fBposttls-finger\fR [\fIoptions\fR] [\fBinet:\fR]\fIdomain\fR[:\fIport\fR] [\fImatch ...\fR]
+/* .br
+/* \fBposttls-finger\fR -S [\fIoptions\fR] \fBunix:\fIpathname\fR [\fImatch ...\fR]
+/* DESCRIPTION
+/* \fBposttls-finger\fR(1) connects to the specified destination
+/* and reports TLS-related information about the server. With SMTP, the
+/* destination is a domainname; with LMTP it is either a domainname
+/* prefixed with \fBinet:\fR or a pathname prefixed with \fBunix:\fR. If
+/* Postfix is built without TLS support, the resulting posttls-finger
+/* program has very limited functionality, and only the \fB-a\fR, \fB-c\fR,
+/* \fB-h\fR, \fB-o\fR, \fB-S\fR, \fB-t\fR, \fB-T\fR and \fB-v\fR options
+/* are available.
+/*
+/* Note: this is an unsupported test program. No attempt is made
+/* to maintain compatibility between successive versions.
+/*
+/* For SMTP servers that don't support ESMTP, only the greeting banner
+/* and the negative EHLO response are reported. Otherwise, the reported
+/* EHLO response details further server capabilities.
+/*
+/* If TLS support is enabled when \fBposttls-finger\fR(1) is compiled, and
+/* the server supports \fBSTARTTLS\fR, a TLS handshake is attempted.
+/*
+/* If DNSSEC support is available, the connection TLS security level
+/* (\fB-l\fR option) defaults to \fBdane\fR; see TLS_README for
+/* details. Otherwise, it defaults to \fBsecure\fR. This setting
+/* determines the certificate matching policy.
+/*
+/* If TLS negotiation succeeds, the TLS protocol and cipher details are
+/* reported. The server certificate is then verified in accordance with
+/* the policy at the chosen (or default) security level. With public
+/* CA-based trust, when the \fB-L\fR option includes \fBcertmatch\fR,
+/* (true by default) name matching is performed even if the certificate
+/* chain is not trusted. This logs the names found in the remote SMTP
+/* server certificate and which if any would match, were the certificate
+/* chain trusted.
+/*
+/* Note: \fBposttls-finger\fR(1) does not perform any table lookups, so
+/* the TLS policy table and obsolete per-site tables are not consulted.
+/* It does not communicate with the \fBtlsmgr\fR(8) daemon (or any other
+/* Postfix daemons); its TLS session cache is held in private memory, and
+/* disappears when the process exits.
+/*
+/* With the \fB-r \fIdelay\fR option, if the server assigns a TLS
+/* session id, the TLS session is cached. The connection is then closed
+/* and re-opened after the specified delay, and \fBposttls-finger\fR(1)
+/* then reports whether the cached TLS session was re-used.
+/*
+/* When the destination is a load-balancer, it may be distributing
+/* load between multiple server caches. Typically, each server returns
+/* its unique name in its EHLO response. If, upon reconnecting with
+/* \fB-r\fR, a new server name is detected, another session is cached
+/* for the new server, and the reconnect is repeated up to a maximum
+/* number of times (default 5) that can be specified via the \fB-m\fR
+/* option.
+/*
+/* The choice of SMTP or LMTP (\fB-S\fR option) determines the syntax of
+/* the destination argument. With SMTP, one can specify a service on a
+/* non-default port as \fIhost\fR:\fIservice\fR, and disable MX (mail
+/* exchanger) DNS lookups with [\fIhost\fR] or [\fIhost\fR]:\fIport\fR.
+/* The [] form is required when you specify an IP address instead of a
+/* hostname. An IPv6 address takes the form [\fBipv6:\fIaddress\fR].
+/* The default port for SMTP is taken from the \fBsmtp/tcp\fR entry in
+/* /etc/services, defaulting to 25 if the entry is not found.
+/*
+/* With LMTP, specify \fBunix:\fIpathname\fR to connect to a local server
+/* listening on a unix-domain socket bound to the specified pathname;
+/* otherwise, specify an optional \fBinet:\fR prefix followed by a
+/* \fIdomain\fR and an optional port, with the same syntax as for
+/* SMTP. The default TCP port for LMTP is 24.
+/*
+/* Arguments:
+/* .IP "\fB-a\fR"
+/* Address family preference: \fBipv4\fR, \fBipv6\fR or \fBany\fR. When
+/* using \fBany\fR, posttls-finger will randomly select one of the two as
+/* the more preferred, and exhaust all MX preferences for the first
+/* address family before trying any addresses for the other. The
+/* default value is \fBany\fR.
+/* .IP "\fB-A\fR"
+/* A list of PEM trust-anchor files that overrides CAfile and CApath
+/* trust chain verification. Specify the option multiple times to
+/* specify multiple files. See the main.cf documentation for
+/* smtp_tls_trust_anchor_file for details.
+/* .IP "\fB-c\fR"
+/* Disable SMTP chat logging; only TLS-related information is logged.
+/* .IP "\fB-C\fR"
+/* Print the remote SMTP server certificate trust chain in PEM format.
+/* The issuer DN, subject DN, certificate and public key fingerprints
+/* (see \fB-d \fImdalg\fR option below) are printed above each PEM
+/* certificate block. If you specify \fB-F \fICAfile\fR or
+/* \fB-P \fICApath\fR, the OpenSSL library may augment the chain with
+/* missing issuer certificates. To see the actual chain sent by the
+/* remote SMTP server leave \fICAfile\fR and \fICApath\fR unset.
+/* .IP "\fB-d \fImdalg\fR"
+/* The message digest algorithm to use for reporting remote SMTP server
+/* fingerprints and matching against user provided certificate
+/* fingerprints (with DANE TLSA records the algorithm is specified
+/* in the DNS). The default algorithm is sha1.
+/* .IP "\fB-F \fICAfile.pem\fR"
+/* The PEM formatted CAfile for remote SMTP server certificate
+/* verification. By default no CAfile is used and no public CAs
+/* are trusted.
+/* .IP "\fB-h \fIhost_lookup\fR"
+/* The hostname lookup methods used for the connection. See the
+/* documentation of smtp_host_lookup for syntax and semantics.
+/* .IP "\fB-l \fIlevel\fR"
+/* The security level for the connection, default \fBdane\fR or
+/* \fBsecure\fR depending on whether DNSSEC is available. For syntax
+/* and semantics, see the documentation of smtp_tls_security_level.
+/* When \fBdane\fR is supported and selected, if no TLSA records are
+/* found, or all the records found are unusable, the \fIdegraded\fR
+/* level will be \fBsecure\fR. The main additional level to consider
+/* is \fBfingerprint\fR, which allows you test certificate or public-key
+/* fingerprint matches before you deploy them in the policy table.
+/* .IP
+/* Note, since \fBposttls-finger\fR does not actually deliver any email,
+/* the \fBnone\fR, \fBmay\fR and \fBencrypt\fR security levels are not
+/* very useful. Since \fBmay\fR and \fBencrypt\fR don't require peer
+/* certificates, they will often negotiate anonymous TLS ciphersuites,
+/* so you won't learn much about the remote SMTP server's certificates
+/* at these levels if it also supports anonymous TLS (though you may
+/* learn that the server supports anonymous TLS).
+/* .IP "\fB-L \fIlogopts\fR"
+/* Fine-grained TLS logging options. To tune the TLS features logged
+/* during the TLS handshake, specify one or more of:
+/* .RS
+/* .IP "0, none"
+/* These yield no TLS logging; you'll generally want more, but this
+/* is handy if you just want the trust chain:
+/* .RS
+/* .ad
+/* .nf
+/* $ posttls-finger -cC -L none destination
+/* .fi
+/* .RE
+/* .IP "1, routine, summary"
+/* These synonymous values yield a normal one-line summary of the TLS
+/* connection.
+/* .IP "2, debug"
+/* These synonymous values combine routine, ssl-debug, cache and verbose.
+/* .IP "3, ssl-expert"
+/* These synonymous values combine debug with ssl-handshake-packet-dump.
+/* For experts only.
+/* .IP "4, ssl-developer"
+/* These synonymous values combine ssl-expert with ssl-session-packet-dump.
+/* For experts only, and in most cases, use wireshark instead.
+/* .IP ssl-debug
+/* Turn on OpenSSL logging of the progress of the SSL handshake.
+/* .IP ssl-handshake-packet-dump
+/* Log hexadecimal packet dumps of the SSL handshake; for experts only.
+/* .IP ssl-session-packet-dump
+/* Log hexadecimal packet dumps of the entire SSL session; only useful
+/* to those who can debug SSL protocol problems from hex dumps.
+/* .IP untrusted
+/* Logs trust chain verification problems. This is turned on
+/* automatically at security levels that use peer names signed
+/* by certificate authorities to validate certificates. So while
+/* this setting is recognized, you should never need to set it
+/* explicitly.
+/* .IP peercert
+/* This logs a one line summary of the remote SMTP server certificate
+/* subject, issuer, and fingerprints.
+/* .IP certmatch
+/* This logs remote SMTP server certificate matching, showing the CN
+/* and each subjectAltName and which name matched. With DANE, logs
+/* matching of TLSA record trust-anchor and end-entity certificates.
+/* .IP cache
+/* This logs session cache operations, showing whether session caching
+/* is effective with the remote SMTP server. Automatically used when
+/* reconnecting with the \fB-r\fR option; rarely needs to be set
+/* explicitly.
+/* .IP verbose
+/* Enables verbose logging in the Postfix TLS driver; includes all of
+/* peercert..cache and more.
+/* .RE
+/* .IP
+/* The default is \fBroutine,certmatch\fR. After a reconnect, the log
+/* level is unconditionally \fBroutine,cache\fR.
+/* .IP "\fB-m \fIcount\fR"
+/* When the \fB-r \fIdelay\fR option is specified, the \fB-m\fR option
+/* determines the maximum number of reconnect attempts to use with
+/* a server behind a load-balacer, to see whether connection caching
+/* is likely to be effective for this destination. Some MTAs don't
+/* expose the underlying server identity in their EHLO response; with
+/* these servers there will never be more than 1 reconnection attempt.
+/* .IP "\fB-o \fIname=value\fR"
+/* Specify zero or more times to override the value of the main.cf
+/* parameter \fIname\fR with \fIvalue\fR. Possible use-cases include
+/* overriding the values of TLS library parameters or "myhostname" to
+/* configure the SMTP EHLO name sent to the remote server.
+/* .IP "\fB-P \fICApath/\fR"
+/* The OpenSSL CApath/ directory (indexed via c_rehash(1)) for remote
+/* SMTP server certificate verification. By default no CApath is used
+/* and no public CAs are trusted.
+/* .IP "\fB-r \fIdelay\fR"
+/* With a cachable TLS session, disconnect and reconnect after \fIdelay\fR
+/* seconds. Report whether the session is re-used. Retry if a new server
+/* is encountered, up to 5 times or as specified with the \fB-m\fR option.
+/* .IP "\fB-S\fR"
+/* Disable SMTP; that is, connect to an LMTP server. The default port for
+/* LMTP over TCP is 24. Alternative ports can specified by appending
+/* "\fI:servicename\fR" or ":\fIportnumber\fR" to the destination
+/* argument.
+/* .IP "\fB-t \fItimeout\fR"
+/* The TCP connection timeout to use. This is also the timeout for
+/* reading the remote server's 220 banner.
+/* .IP "\fB-T \fItimeout\fR"
+/* The SMTP/LMTP command timeout for EHLO/LHLO, STARTTLS and QUIT.
+/* .IP "\fB-v\fR"
+/* Enable more verbose logging.
+/* .IP "[\fBinet:\fR]\fIdomain\fR[:\fIport\fR]"
+/* Connect via TCP to domain \fIdomain\fR, port \fIport\fR. The default
+/* port is \fBsmtp\fR (or 24 with LMTP). With SMTP an MX lookup is
+/* performed to resolve the domain to a host, unless the domain is
+/* enclosed in \fB[]\fR. If you want to connect to a specific MX host,
+/* for instance \fImx1.example.com\fR, specify [\fImx1.example.com\fR]
+/* as the destination and \fIexample.com\fR as a \fBmatch\fR argument.
+/* When using DNS, the destination domain is assumed fully qualified
+/* and no default domain or search suffixes are applied; you must use
+/* fully-qualified names or also enable \fBnative\fR host lookups
+/* (these don't support \fBdane\fR as no DNSSEC validation information
+/* is available via \fBnative\fR lookups).
+/* .IP "\fBunix:\fIpathname\fR"
+/* Connect to the UNIX-domain socket at \fIpathname\fR. LMTP only.
+/* .IP "\fBmatch ...\fR"
+/* With no match arguments specified, certificate peername matching uses
+/* the compiled-in default strategies for each security level. If you
+/* specify one or more arguments, these will be used as the list of
+/* certificate or public-key digests to match for the \fBfingerprint\fR
+/* level, or as the list of DNS names to match in the certificate at the
+/* \fBverify\fR and \fBsecure\fR levels. If the security level is
+/* \fBdane\fR, and usable TLSA records are found, the match names are
+/* ignored, and \fBhostname, nexthop\fR strategies are used. If no
+/* TLSA records are found or none are usable, the level \fIdegrades\fR
+/* to \fBsecure\fR and the provided list is used to match names in
+/* the certificate.
+/* .ad
+/* .fi
+/* ENVIRONMENT
+/* .ad
+/* .fi
+/* .IP \fBMAIL_CONFIG\fR
+/* Read configuration parameters from a non-default location.
+/* .IP \fBMAIL_VERBOSE\fR
+/* Same as \fB-v\fR option.
+/* SEE ALSO
+/* smtp-source(1), SMTP/LMTP message source
+/* smtp-sink(1), SMTP/LMTP message dump
+/*
+/* README FILES
+/* .ad
+/* .fi
+/* Use "\fBpostconf readme_directory\fR" or "\fBpostconf
+/* html_directory\fR" to locate this information.
+/* .na
+/* .nf
+/* TLS_README, Postfix STARTTLS howto
+/* LICENSE
+/* .ad
+/* .fi
+/* The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/* Wietse Venema
+/* IBM T.J. Watson Research
+/* P.O. Box 704
+/* Yorktown Heights, NY 10598, USA
+/*
+/* Viktor Dukhovni
+/*--*/
+
+ /*
+ * System library.
+ */
+#include