|
|
ceae87 |
diff -up fetchmail-6.3.26/configure.ac.orig fetchmail-6.3.26/configure.ac
|
|
|
ceae87 |
--- fetchmail-6.3.26/configure.ac.orig 2013-04-23 22:51:10.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/configure.ac 2016-05-02 14:14:34.908139601 +0200
|
|
|
ceae87 |
@@ -803,6 +803,7 @@ fi
|
|
|
ceae87 |
|
|
|
ceae87 |
case "$LIBS" in *-lssl*)
|
|
|
ceae87 |
AC_CHECK_DECLS([SSLv2_client_method],,,[#include <openssl/ssl.h>])
|
|
|
ceae87 |
+ AC_CHECK_DECLS([SSLv3_client_method],,,[#include <openssl/ssl.h>])
|
|
|
ceae87 |
;;
|
|
|
ceae87 |
esac
|
|
|
ceae87 |
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/fetchmail.c.orig fetchmail-6.3.26/fetchmail.c
|
|
|
ceae87 |
--- fetchmail-6.3.26/fetchmail.c.orig 2013-04-23 22:00:45.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/fetchmail.c 2016-05-02 14:14:34.908139601 +0200
|
|
|
ceae87 |
@@ -263,6 +263,12 @@ int main(int argc, char **argv)
|
|
|
ceae87 |
#ifdef SSL_ENABLE
|
|
|
ceae87 |
"+SSL"
|
|
|
ceae87 |
#endif
|
|
|
ceae87 |
+#if HAVE_DECL_SSLV2_CLIENT_METHOD + 0 == 0
|
|
|
ceae87 |
+ "-SSLv2"
|
|
|
ceae87 |
+#endif
|
|
|
ceae87 |
+#if HAVE_DECL_SSLV3_CLIENT_METHOD + 0 == 0
|
|
|
ceae87 |
+ "-SSLv3"
|
|
|
ceae87 |
+#endif
|
|
|
ceae87 |
#ifdef OPIE_ENABLE
|
|
|
ceae87 |
"+OPIE"
|
|
|
ceae87 |
#endif /* OPIE_ENABLE */
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/fetchmail.h.orig fetchmail-6.3.26/fetchmail.h
|
|
|
ceae87 |
--- fetchmail-6.3.26/fetchmail.h.orig 2013-04-23 22:00:45.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/fetchmail.h 2016-05-02 14:14:34.905139590 +0200
|
|
|
ceae87 |
@@ -771,9 +771,9 @@ int servport(const char *service);
|
|
|
ceae87 |
int fm_getaddrinfo(const char *node, const char *serv, const struct addrinfo *hints, struct addrinfo **res);
|
|
|
ceae87 |
void fm_freeaddrinfo(struct addrinfo *ai);
|
|
|
ceae87 |
|
|
|
ceae87 |
-/* prototypes from tls.c */
|
|
|
ceae87 |
-int maybe_tls(struct query *ctl);
|
|
|
ceae87 |
-int must_tls(struct query *ctl);
|
|
|
ceae87 |
+/* prototypes from starttls.c */
|
|
|
ceae87 |
+int maybe_starttls(struct query *ctl);
|
|
|
ceae87 |
+int must_starttls(struct query *ctl);
|
|
|
ceae87 |
|
|
|
ceae87 |
/* prototype from rfc822valid.c */
|
|
|
ceae87 |
int rfc822_valid_msgid(const unsigned char *);
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/fetchmail.man.orig fetchmail-6.3.26/fetchmail.man
|
|
|
ceae87 |
--- fetchmail-6.3.26/fetchmail.man.orig 2013-04-23 22:51:17.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/fetchmail.man 2016-05-02 14:14:34.906139594 +0200
|
|
|
ceae87 |
@@ -412,23 +412,22 @@ from. The folder information is written
|
|
|
ceae87 |
.B \-\-ssl
|
|
|
ceae87 |
(Keyword: ssl)
|
|
|
ceae87 |
.br
|
|
|
ceae87 |
-Causes the connection to the mail server to be encrypted
|
|
|
ceae87 |
-via SSL. Connect to the server using the specified base protocol over a
|
|
|
ceae87 |
-connection secured by SSL. This option defeats opportunistic starttls
|
|
|
ceae87 |
-negotiation. It is highly recommended to use \-\-sslproto 'SSL3'
|
|
|
ceae87 |
-\-\-sslcertck to validate the certificates presented by the server and
|
|
|
ceae87 |
-defeat the obsolete SSLv2 negotiation. More information is available in
|
|
|
ceae87 |
-the \fIREADME.SSL\fP file that ships with fetchmail.
|
|
|
ceae87 |
-.IP
|
|
|
ceae87 |
-Note that fetchmail may still try to negotiate SSL through starttls even
|
|
|
ceae87 |
-if this option is omitted. You can use the \-\-sslproto option to defeat
|
|
|
ceae87 |
-this behavior or tell fetchmail to negotiate a particular SSL protocol.
|
|
|
ceae87 |
+Causes the connection to the mail server to be encrypted via SSL, by
|
|
|
ceae87 |
+negotiating SSL directly after connecting (SSL-wrapped mode). It is
|
|
|
ceae87 |
+highly recommended to use \-\-sslcertck to validate the certificates
|
|
|
ceae87 |
+presented by the server. Please see the description of \-\-sslproto
|
|
|
ceae87 |
+below! More information is available in the \fIREADME.SSL\fP file that
|
|
|
ceae87 |
+ships with fetchmail.
|
|
|
ceae87 |
+.IP
|
|
|
ceae87 |
+Note that even if this option is omitted, fetchmail may still negotiate
|
|
|
ceae87 |
+SSL in-band for POP3 or IMAP, through the STLS or STARTTLS feature. You
|
|
|
ceae87 |
+can use the \-\-sslproto option to modify that behavior.
|
|
|
ceae87 |
.IP
|
|
|
ceae87 |
If no port is specified, the connection is attempted to the well known
|
|
|
ceae87 |
port of the SSL version of the base protocol. This is generally a
|
|
|
ceae87 |
different port than the port used by the base protocol. For IMAP, this
|
|
|
ceae87 |
is port 143 for the clear protocol and port 993 for the SSL secured
|
|
|
ceae87 |
-protocol, for POP3, it is port 110 for the clear text and port 995 for
|
|
|
ceae87 |
+protocol; for POP3, it is port 110 for the clear text and port 995 for
|
|
|
ceae87 |
the encrypted variant.
|
|
|
ceae87 |
.IP
|
|
|
ceae87 |
If your system lacks the corresponding entries from /etc/services, see
|
|
|
ceae87 |
@@ -470,39 +469,77 @@ cause some complications in daemon mode.
|
|
|
ceae87 |
.IP
|
|
|
ceae87 |
Also see \-\-sslcert above.
|
|
|
ceae87 |
.TP
|
|
|
ceae87 |
-.B \-\-sslproto <name>
|
|
|
ceae87 |
+.B \-\-sslproto <value>
|
|
|
ceae87 |
(Keyword: sslproto)
|
|
|
ceae87 |
.br
|
|
|
ceae87 |
-Forces an SSL/TLS protocol. Possible values are \fB''\fP,
|
|
|
ceae87 |
-\&'\fBSSL2\fP' (not supported on all systems),
|
|
|
ceae87 |
-\&'\fBSSL23\fP', (use of these two values is discouraged
|
|
|
ceae87 |
-and should only be used as a last resort) \&'\fBSSL3\fP', and
|
|
|
ceae87 |
-\&'\fBTLS1\fP'. The default behaviour if this option is unset is: for
|
|
|
ceae87 |
-connections without \-\-ssl, use \&'\fBTLS1\fP' so that fetchmail will
|
|
|
ceae87 |
-opportunistically try STARTTLS negotiation with TLS1. You can configure
|
|
|
ceae87 |
-this option explicitly if the default handshake (TLS1 if \-\-ssl is not
|
|
|
ceae87 |
-used) does not work for your server.
|
|
|
ceae87 |
-.IP
|
|
|
ceae87 |
-Use this option with '\fBTLS1\fP' value to enforce a STARTTLS
|
|
|
ceae87 |
-connection. In this mode, it is highly recommended to also use
|
|
|
ceae87 |
-\-\-sslcertck (see below). Note that this will then cause fetchmail
|
|
|
ceae87 |
-v6.3.19 to force STARTTLS negotiation even if it is not advertised by
|
|
|
ceae87 |
-the server.
|
|
|
ceae87 |
-.IP
|
|
|
ceae87 |
-To defeat opportunistic TLSv1 negotiation when the server advertises
|
|
|
ceae87 |
-STARTTLS or STLS, and use a cleartext connection use \fB''\fP. This
|
|
|
ceae87 |
-option, even if the argument is the empty string, will also suppress the
|
|
|
ceae87 |
-diagnostic 'SERVER: opportunistic upgrade to TLS.' message in verbose
|
|
|
ceae87 |
-mode. The default is to try appropriate protocols depending on context.
|
|
|
ceae87 |
+This option has a dual use, out of historic fetchmail behaviour. It
|
|
|
ceae87 |
+controls both the SSL/TLS protocol version and, if \-\-ssl is not
|
|
|
ceae87 |
+specified, the STARTTLS behaviour (upgrading the protocol to an SSL or
|
|
|
ceae87 |
+TLS connection in-band). Some other options may however make TLS
|
|
|
ceae87 |
+mandatory.
|
|
|
ceae87 |
+.PP
|
|
|
ceae87 |
+Only if this option and \-\-ssl are both missing for a poll, there will
|
|
|
ceae87 |
+be opportunistic TLS for POP3 and IMAP, where fetchmail will attempt to
|
|
|
ceae87 |
+upgrade to TLSv1 or newer.
|
|
|
ceae87 |
+.PP
|
|
|
ceae87 |
+Recognized values for \-\-sslproto are given below. You should normally
|
|
|
ceae87 |
+chose one of the auto-negotiating options, i. e. '\fBauto\fP' or one of
|
|
|
ceae87 |
+the options ending in a plus (\fB+\fP) character. Note that depending
|
|
|
ceae87 |
+on OpenSSL library version and configuration, some options cause
|
|
|
ceae87 |
+run-time errors because the requested SSL or TLS versions are not
|
|
|
ceae87 |
+supported by the particular installed OpenSSL library.
|
|
|
ceae87 |
+.RS
|
|
|
ceae87 |
+.IP "\fB''\fP, the empty string"
|
|
|
ceae87 |
+Disable STARTTLS. If \-\-ssl is given for the same server, log an error
|
|
|
ceae87 |
+and pretend that '\fBauto\fP' had been used instead.
|
|
|
ceae87 |
+.IP '\fBauto\fP'
|
|
|
ceae87 |
+(default). Require TLS. Auto-negotiate TLSv1 or newer, disable SSLv3 downgrade.
|
|
|
ceae87 |
+(previous releases of fetchmail have auto-negotiated all protocols that
|
|
|
ceae87 |
+their OpenSSL library supported, including the broken SSLv3).
|
|
|
ceae87 |
+.IP "\&'\fBSSL23\fP'
|
|
|
ceae87 |
+see '\fBauto\fP'.
|
|
|
ceae87 |
+.IP \&'\fBSSL2\fP'
|
|
|
ceae87 |
+Require SSLv2 exactly. SSLv2 is broken, not supported on all systems, avoid it
|
|
|
ceae87 |
+if possible. This will make fetchmail negotiate SSLv2 only, and is the
|
|
|
ceae87 |
+only way to have fetchmail permit SSLv2.
|
|
|
ceae87 |
+.IP \&'\fBSSL3\fP'
|
|
|
ceae87 |
+Require SSLv3 exactly. SSLv3 is broken, not supported on all systems, avoid it
|
|
|
ceae87 |
+if possible. This will make fetchmail negotiate SSLv3 only, and is the
|
|
|
ceae87 |
+only way besides '\fBSSL3+\fP' to have fetchmail permit SSLv3.
|
|
|
ceae87 |
+.IP \&'\fBSSL3+\fP'
|
|
|
ceae87 |
+same as '\fBauto\fP', but permit SSLv3 as well. This is the only way
|
|
|
ceae87 |
+besides '\fBSSL3\fP' to have fetchmail permit SSLv3.
|
|
|
ceae87 |
+.IP \&'\fBTLS1\fP'
|
|
|
ceae87 |
+Require TLSv1. This does not negotiate TLSv1.1 or newer, and is
|
|
|
ceae87 |
+discouraged. Replace by TLS1+ unless the latter chokes your server.
|
|
|
ceae87 |
+.IP \&'\fBTLS1+\fP'
|
|
|
ceae87 |
+See '\fBauto\fP'.
|
|
|
ceae87 |
+.IP \&'\fBTLS1.1\fP'
|
|
|
ceae87 |
+Require TLS v1.1 exactly.
|
|
|
ceae87 |
+.IP \&'\fBTLS1.1+\fP'
|
|
|
ceae87 |
+Require TLS. Auto-negotiate TLSv1.1 or newer.
|
|
|
ceae87 |
+.IP \&'\fBTLS1.2\fP'
|
|
|
ceae87 |
+Require TLS v1.2 exactly.
|
|
|
ceae87 |
+.IP '\fBTLS1.2+\fP'
|
|
|
ceae87 |
+Require TLS. Auto-negotiate TLSv1.2 or newer.
|
|
|
ceae87 |
+.IP "Unrecognized parameters"
|
|
|
ceae87 |
+are treated the same as '\fBauto\fP'.
|
|
|
ceae87 |
+.RE
|
|
|
ceae87 |
+.IP
|
|
|
ceae87 |
+NOTE: you should hardly ever need to use anything other than '' (to
|
|
|
ceae87 |
+force an unencrypted connection) or 'auto' (to enforce TLS).
|
|
|
ceae87 |
.TP
|
|
|
ceae87 |
.B \-\-sslcertck
|
|
|
ceae87 |
(Keyword: sslcertck)
|
|
|
ceae87 |
.br
|
|
|
ceae87 |
-Causes fetchmail to strictly check the server certificate against a set of
|
|
|
ceae87 |
-local trusted certificates (see the \fBsslcertfile\fP and \fBsslcertpath\fP
|
|
|
ceae87 |
-options). If the server certificate cannot be obtained or is not signed by one
|
|
|
ceae87 |
-of the trusted ones (directly or indirectly), the SSL connection will fail,
|
|
|
ceae87 |
-regardless of the \fBsslfingerprint\fP option.
|
|
|
ceae87 |
+Causes fetchmail to require that SSL/TLS be used and disconnect if it
|
|
|
ceae87 |
+can not successfully negotiate SSL or TLS, or if it cannot successfully
|
|
|
ceae87 |
+verify and validate the certificate and follow it to a trust anchor (or
|
|
|
ceae87 |
+trusted root certificate). The trust anchors are given as a set of local
|
|
|
ceae87 |
+trusted certificates (see the \fBsslcertfile\fP and \fBsslcertpath\fP
|
|
|
ceae87 |
+options). If the server certificate cannot be obtained or is not signed
|
|
|
ceae87 |
+by one of the trusted ones (directly or indirectly), fetchmail will
|
|
|
ceae87 |
+disconnect, regardless of the \fBsslfingerprint\fP option.
|
|
|
ceae87 |
.IP
|
|
|
ceae87 |
Note that CRL (certificate revocation lists) are only supported in
|
|
|
ceae87 |
OpenSSL 0.9.7 and newer! Your system clock should also be reasonably
|
|
|
ceae87 |
@@ -1202,31 +1239,33 @@ capability response. Specify a user opti
|
|
|
ceae87 |
username and the part to the right as the NTLM domain.
|
|
|
ceae87 |
|
|
|
ceae87 |
.SS Secure Socket Layers (SSL) and Transport Layer Security (TLS)
|
|
|
ceae87 |
+.PP All retrieval protocols can use SSL or TLS wrapping for the
|
|
|
ceae87 |
+transport. Additionally, POP3 and IMAP retrival can also negotiate
|
|
|
ceae87 |
+SSL/TLS by means of STARTTLS (or STLS).
|
|
|
ceae87 |
.PP
|
|
|
ceae87 |
Note that fetchmail currently uses the OpenSSL library, which is
|
|
|
ceae87 |
severely underdocumented, so failures may occur just because the
|
|
|
ceae87 |
programmers are not aware of OpenSSL's requirement of the day.
|
|
|
ceae87 |
For instance, since v6.3.16, fetchmail calls
|
|
|
ceae87 |
OpenSSL_add_all_algorithms(), which is necessary to support certificates
|
|
|
ceae87 |
-using SHA256 on OpenSSL 0.9.8 -- this information is deeply hidden in the
|
|
|
ceae87 |
-documentation and not at all obvious. Please do not hesitate to report
|
|
|
ceae87 |
-subtle SSL failures.
|
|
|
ceae87 |
-.PP
|
|
|
ceae87 |
-You can access SSL encrypted services by specifying the \-\-ssl option.
|
|
|
ceae87 |
-You can also do this using the "ssl" user option in the .fetchmailrc
|
|
|
ceae87 |
-file. With SSL encryption enabled, queries are initiated over a
|
|
|
ceae87 |
-connection after negotiating an SSL session, and the connection fails if
|
|
|
ceae87 |
-SSL cannot be negotiated. Some services, such as POP3 and IMAP, have
|
|
|
ceae87 |
+using SHA256 on OpenSSL 0.9.8 -- this information is deeply hidden in
|
|
|
ceae87 |
+the documentation and not at all obvious. Please do not hesitate to
|
|
|
ceae87 |
+report subtle SSL failures.
|
|
|
ceae87 |
+.PP
|
|
|
ceae87 |
+You can access SSL encrypted services by specifying the options starting
|
|
|
ceae87 |
+with \-\-ssl, such as \-\-ssl, \-\-sslproto, \-\-sslcertck, and others.
|
|
|
ceae87 |
+You can also do this using the corresponding user options in the .fetchmailrc
|
|
|
ceae87 |
+file. Some services, such as POP3 and IMAP, have
|
|
|
ceae87 |
different well known ports defined for the SSL encrypted services. The
|
|
|
ceae87 |
encrypted ports will be selected automatically when SSL is enabled and
|
|
|
ceae87 |
-no explicit port is specified. The \-\-sslproto 'SSL3' option should be
|
|
|
ceae87 |
-used to select the SSLv3 protocol (default if unset: v2 or v3). Also,
|
|
|
ceae87 |
-the \-\-sslcertck command line or sslcertck run control file option
|
|
|
ceae87 |
-should be used to force strict certificate checking - see below.
|
|
|
ceae87 |
+no explicit port is specified. Also, the \-\-sslcertck command line or
|
|
|
ceae87 |
+sslcertck run control file option should be used to force strict
|
|
|
ceae87 |
+certificate checking - see below.
|
|
|
ceae87 |
.PP
|
|
|
ceae87 |
If SSL is not configured, fetchmail will usually opportunistically try to use
|
|
|
ceae87 |
-STARTTLS. STARTTLS can be enforced by using \-\-sslproto "TLS1". TLS
|
|
|
ceae87 |
-connections use the same port as the unencrypted version of the
|
|
|
ceae87 |
+STARTTLS. STARTTLS can be enforced by using \-\-sslproto\~auto and
|
|
|
ceae87 |
+defeated by using \-\-sslproto\~''.
|
|
|
ceae87 |
+TLS connections use the same port as the unencrypted version of the
|
|
|
ceae87 |
protocol and negotiate TLS via special command. The \-\-sslcertck
|
|
|
ceae87 |
command line or sslcertck run control file option should be used to
|
|
|
ceae87 |
force strict certificate checking - see below.
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/imap.c.orig fetchmail-6.3.26/imap.c
|
|
|
ceae87 |
--- fetchmail-6.3.26/imap.c.orig 2013-04-23 22:00:45.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/imap.c 2016-05-02 14:14:34.906139594 +0200
|
|
|
ceae87 |
@@ -405,6 +405,8 @@ static int imap_getauth(int sock, struct
|
|
|
ceae87 |
/* apply for connection authorization */
|
|
|
ceae87 |
{
|
|
|
ceae87 |
int ok = 0;
|
|
|
ceae87 |
+ char *commonname;
|
|
|
ceae87 |
+
|
|
|
ceae87 |
(void)greeting;
|
|
|
ceae87 |
|
|
|
ceae87 |
/*
|
|
|
ceae87 |
@@ -429,25 +431,21 @@ static int imap_getauth(int sock, struct
|
|
|
ceae87 |
return(PS_SUCCESS);
|
|
|
ceae87 |
}
|
|
|
ceae87 |
|
|
|
ceae87 |
-#ifdef SSL_ENABLE
|
|
|
ceae87 |
- if (maybe_tls(ctl)) {
|
|
|
ceae87 |
- char *commonname;
|
|
|
ceae87 |
-
|
|
|
ceae87 |
- commonname = ctl->server.pollname;
|
|
|
ceae87 |
- if (ctl->server.via)
|
|
|
ceae87 |
- commonname = ctl->server.via;
|
|
|
ceae87 |
- if (ctl->sslcommonname)
|
|
|
ceae87 |
- commonname = ctl->sslcommonname;
|
|
|
ceae87 |
+ commonname = ctl->server.pollname;
|
|
|
ceae87 |
+ if (ctl->server.via)
|
|
|
ceae87 |
+ commonname = ctl->server.via;
|
|
|
ceae87 |
+ if (ctl->sslcommonname)
|
|
|
ceae87 |
+ commonname = ctl->sslcommonname;
|
|
|
ceae87 |
|
|
|
ceae87 |
- if (strstr(capabilities, "STARTTLS")
|
|
|
ceae87 |
- || must_tls(ctl)) /* if TLS is mandatory, ignore capabilities */
|
|
|
ceae87 |
+#ifdef SSL_ENABLE
|
|
|
ceae87 |
+ if (maybe_starttls(ctl)) {
|
|
|
ceae87 |
+ if ((strstr(capabilities, "STARTTLS") && maybe_starttls(ctl))
|
|
|
ceae87 |
+ || must_starttls(ctl)) /* if TLS is mandatory, ignore capabilities */
|
|
|
ceae87 |
{
|
|
|
ceae87 |
- /* Use "tls1" rather than ctl->sslproto because tls1 is the only
|
|
|
ceae87 |
- * protocol that will work with STARTTLS. Don't need to worry
|
|
|
ceae87 |
- * whether TLS is mandatory or opportunistic unless SSLOpen() fails
|
|
|
ceae87 |
- * (see below). */
|
|
|
ceae87 |
+ /* Don't need to worry whether TLS is mandatory or
|
|
|
ceae87 |
+ * opportunistic unless SSLOpen() fails (see below). */
|
|
|
ceae87 |
if (gen_transact(sock, "STARTTLS") == PS_SUCCESS
|
|
|
ceae87 |
- && (set_timeout(mytimeout), SSLOpen(sock, ctl->sslcert, ctl->sslkey, "tls1", ctl->sslcertck,
|
|
|
ceae87 |
+ && (set_timeout(mytimeout), SSLOpen(sock, ctl->sslcert, ctl->sslkey, ctl->sslproto, ctl->sslcertck,
|
|
|
ceae87 |
ctl->sslcertfile, ctl->sslcertpath, ctl->sslfingerprint, commonname,
|
|
|
ceae87 |
ctl->server.pollname, &ctl->remotename)) != -1)
|
|
|
ceae87 |
{
|
|
|
ceae87 |
@@ -470,7 +468,7 @@ static int imap_getauth(int sock, struct
|
|
|
ceae87 |
{
|
|
|
ceae87 |
report(stdout, GT_("%s: upgrade to TLS succeeded.\n"), commonname);
|
|
|
ceae87 |
}
|
|
|
ceae87 |
- } else if (must_tls(ctl)) {
|
|
|
ceae87 |
+ } else if (must_starttls(ctl)) {
|
|
|
ceae87 |
/* Config required TLS but we couldn't guarantee it, so we must
|
|
|
ceae87 |
* stop. */
|
|
|
ceae87 |
set_timeout(0);
|
|
|
ceae87 |
@@ -492,6 +490,10 @@ static int imap_getauth(int sock, struct
|
|
|
ceae87 |
/* Usable. Proceed with authenticating insecurely. */
|
|
|
ceae87 |
}
|
|
|
ceae87 |
}
|
|
|
ceae87 |
+ } else {
|
|
|
ceae87 |
+ if (strstr(capabilities, "STARTTLS") && outlevel >= O_VERBOSE) {
|
|
|
ceae87 |
+ report(stdout, GT_("%s: WARNING: server offered STARTTLS but sslproto '' given.\n"), commonname);
|
|
|
ceae87 |
+ }
|
|
|
ceae87 |
}
|
|
|
ceae87 |
#endif /* SSL_ENABLE */
|
|
|
ceae87 |
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/Makefile.am.orig fetchmail-6.3.26/Makefile.am
|
|
|
ceae87 |
--- fetchmail-6.3.26/Makefile.am.orig 2013-04-23 22:00:45.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/Makefile.am 2016-05-02 14:14:34.906139594 +0200
|
|
|
ceae87 |
@@ -31,7 +31,7 @@ libfm_a_SOURCES= xmalloc.c base64.c rfc8
|
|
|
ceae87 |
servport.c ntlm.h smbbyteorder.h smbdes.h smbmd4.h \
|
|
|
ceae87 |
smbencrypt.h smbdes.c smbencrypt.c smbmd4.c smbutil.c \
|
|
|
ceae87 |
libesmtp/gethostbyname.h libesmtp/gethostbyname.c \
|
|
|
ceae87 |
- smbtypes.h fm_getaddrinfo.c tls.c rfc822valid.c \
|
|
|
ceae87 |
+ smbtypes.h fm_getaddrinfo.c starttls.c rfc822valid.c \
|
|
|
ceae87 |
xmalloc.h sdump.h sdump.c x509_name_match.c \
|
|
|
ceae87 |
fm_strl.h md5c.c
|
|
|
ceae87 |
if NTLM_ENABLE
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/Makefile.in.orig fetchmail-6.3.26/Makefile.in
|
|
|
ceae87 |
--- fetchmail-6.3.26/Makefile.in.orig 2013-04-23 23:36:56.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/Makefile.in 2016-05-02 14:14:34.906139594 +0200
|
|
|
ceae87 |
@@ -97,14 +97,14 @@ am__libfm_a_SOURCES_DIST = xmalloc.c bas
|
|
|
ceae87 |
rfc2047e.c servport.c ntlm.h smbbyteorder.h smbdes.h smbmd4.h \
|
|
|
ceae87 |
smbencrypt.h smbdes.c smbencrypt.c smbmd4.c smbutil.c \
|
|
|
ceae87 |
libesmtp/gethostbyname.h libesmtp/gethostbyname.c smbtypes.h \
|
|
|
ceae87 |
- fm_getaddrinfo.c tls.c rfc822valid.c xmalloc.h sdump.h sdump.c \
|
|
|
ceae87 |
+ fm_getaddrinfo.c starttls.c rfc822valid.c xmalloc.h sdump.h sdump.c \
|
|
|
ceae87 |
x509_name_match.c fm_strl.h md5c.c ntlmsubr.c
|
|
|
ceae87 |
@NTLM_ENABLE_TRUE@am__objects_1 = ntlmsubr.$(OBJEXT)
|
|
|
ceae87 |
am_libfm_a_OBJECTS = xmalloc.$(OBJEXT) base64.$(OBJEXT) \
|
|
|
ceae87 |
rfc822.$(OBJEXT) report.$(OBJEXT) rfc2047e.$(OBJEXT) \
|
|
|
ceae87 |
servport.$(OBJEXT) smbdes.$(OBJEXT) smbencrypt.$(OBJEXT) \
|
|
|
ceae87 |
smbmd4.$(OBJEXT) smbutil.$(OBJEXT) gethostbyname.$(OBJEXT) \
|
|
|
ceae87 |
- fm_getaddrinfo.$(OBJEXT) tls.$(OBJEXT) rfc822valid.$(OBJEXT) \
|
|
|
ceae87 |
+ fm_getaddrinfo.$(OBJEXT) starttls.$(OBJEXT) rfc822valid.$(OBJEXT) \
|
|
|
ceae87 |
sdump.$(OBJEXT) x509_name_match.$(OBJEXT) md5c.$(OBJEXT) \
|
|
|
ceae87 |
$(am__objects_1)
|
|
|
ceae87 |
libfm_a_OBJECTS = $(am_libfm_a_OBJECTS)
|
|
|
ceae87 |
@@ -483,7 +483,7 @@ libfm_a_SOURCES = xmalloc.c base64.c rfc
|
|
|
ceae87 |
servport.c ntlm.h smbbyteorder.h smbdes.h smbmd4.h \
|
|
|
ceae87 |
smbencrypt.h smbdes.c smbencrypt.c smbmd4.c smbutil.c \
|
|
|
ceae87 |
libesmtp/gethostbyname.h libesmtp/gethostbyname.c smbtypes.h \
|
|
|
ceae87 |
- fm_getaddrinfo.c tls.c rfc822valid.c xmalloc.h sdump.h sdump.c \
|
|
|
ceae87 |
+ fm_getaddrinfo.c starttls.c rfc822valid.c xmalloc.h sdump.h sdump.c \
|
|
|
ceae87 |
x509_name_match.c fm_strl.h md5c.c $(am__append_1)
|
|
|
ceae87 |
libfm_a_LIBADD = $(EXTRAOBJ)
|
|
|
ceae87 |
libfm_a_DEPENDENCIES = $(EXTRAOBJ)
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/NEWS.orig fetchmail-6.3.26/NEWS
|
|
|
ceae87 |
--- fetchmail-6.3.26/NEWS.orig 2013-04-23 23:35:49.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/NEWS 2016-05-02 14:14:34.907139597 +0200
|
|
|
ceae87 |
@@ -53,9 +53,33 @@ removed from a 6.4.0 or newer release.)
|
|
|
ceae87 |
fetchmail may switch to a different SSL library.
|
|
|
ceae87 |
* SSLv2 support will be removed from a future fetchmail release. It has been
|
|
|
ceae87 |
obsolete for more than a decade.
|
|
|
ceae87 |
-
|
|
|
ceae87 |
+* SSLv3 support may be removed from a future fetchmail release. It has been
|
|
|
ceae87 |
+ obsolete for many years and found insecure. Use TLS.
|
|
|
ceae87 |
--------------------------------------------------------------------------------
|
|
|
ceae87 |
|
|
|
ceae87 |
+## SECURITY FIXES THAT AFFECT BEHAVIOUR AND MAY WANT RECONFIGURATION
|
|
|
ceae87 |
+* Fetchmail no longer attempts to negotiate SSLv3 by default,
|
|
|
ceae87 |
+ even with --sslproto ssl23. Fetchmail can now use SSLv3, or TLSv1.1 or a newer
|
|
|
ceae87 |
+ TLS version, with STLS/STARTTLS (it would previously force TLSv1.0). If the
|
|
|
ceae87 |
+ OpenSSL version used at build and run-time supports these versions, -sslproto
|
|
|
ceae87 |
+ ssl3 can be used to enable this specific version. Doing so is discouraged
|
|
|
ceae87 |
+ because these protocols are broken.
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+ Along the lines suggested - as patch - by Kurt Roeckx, Debian Bug #768843.
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+ While this change is supposed to be compatible with common configurations,
|
|
|
ceae87 |
+ users are advised to change all explicit --sslproto ssl2, --sslproto
|
|
|
ceae87 |
+ ssl3, --sslproto tls1 to --sslproto auto, so that they can enable TLSv1.1 and
|
|
|
ceae87 |
+ TLSv1.2 on systems with OpenSSL 1.0.1 or newer.
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+ The --sslproto option now understands the values auto, tls1+, tls1.1+,
|
|
|
ceae87 |
+ tls1.2+ (case insensitively).
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+## CHANGES
|
|
|
ceae87 |
+* Fetchmail now supports --sslproto auto and --sslproto tls1+ (same as ssl23).
|
|
|
ceae87 |
+* --sslproto tls1.1+ and tls1.2+ are now supported for auto-negotiation with a
|
|
|
ceae87 |
+ minimum specified TLS protocol version.
|
|
|
ceae87 |
+
|
|
|
ceae87 |
fetchmail-6.3.26 (released 2013-04-23, 26180 LoC):
|
|
|
ceae87 |
|
|
|
ceae87 |
# NOTE THAT FETCHMAIL IS NO LONGER PUBLISHED THROUGH IBIBLIO.
|
|
|
ceae87 |
@@ -75,6 +99,11 @@ fetchmail-6.3.26 (released 2013-04-23, 2
|
|
|
ceae87 |
|
|
|
ceae87 |
Fixes Launchpad Bug#1171818.
|
|
|
ceae87 |
|
|
|
ceae87 |
+* Fix SSL-enabled build on systems that do not declare SSLv3_client_method().
|
|
|
ceae87 |
+ Related to Debian Bug#775255.
|
|
|
ceae87 |
+* Version report lists -SSLv3 on +SSL builds that omit SSLv3_client_method().
|
|
|
ceae87 |
+* Version report lists -SSLv2 on +SSL builds that omit SSLv2_client_method().
|
|
|
ceae87 |
+
|
|
|
ceae87 |
# KNOWN BUGS AND WORKAROUNDS
|
|
|
ceae87 |
(This section floats upwards through the NEWS file so it stays with the
|
|
|
ceae87 |
current release information)
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/pop3.c.orig fetchmail-6.3.26/pop3.c
|
|
|
ceae87 |
--- fetchmail-6.3.26/pop3.c.orig 2013-04-23 22:00:45.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/pop3.c 2016-05-02 14:14:34.907139597 +0200
|
|
|
ceae87 |
@@ -281,6 +281,7 @@ static int pop3_getauth(int sock, struct
|
|
|
ceae87 |
#endif /* OPIE_ENABLE */
|
|
|
ceae87 |
#ifdef SSL_ENABLE
|
|
|
ceae87 |
flag connection_may_have_tls_errors = FALSE;
|
|
|
ceae87 |
+ char *commonname;
|
|
|
ceae87 |
#endif /* SSL_ENABLE */
|
|
|
ceae87 |
|
|
|
ceae87 |
done_capa = FALSE;
|
|
|
ceae87 |
@@ -393,7 +394,7 @@ static int pop3_getauth(int sock, struct
|
|
|
ceae87 |
(ctl->server.authenticate == A_KERBEROS_V5) ||
|
|
|
ceae87 |
(ctl->server.authenticate == A_OTP) ||
|
|
|
ceae87 |
(ctl->server.authenticate == A_CRAM_MD5) ||
|
|
|
ceae87 |
- maybe_tls(ctl))
|
|
|
ceae87 |
+ maybe_starttls(ctl))
|
|
|
ceae87 |
{
|
|
|
ceae87 |
if ((ok = capa_probe(sock)) != PS_SUCCESS)
|
|
|
ceae87 |
/* we are in STAGE_GETAUTH => failure is PS_AUTHFAIL! */
|
|
|
ceae87 |
@@ -406,12 +407,12 @@ static int pop3_getauth(int sock, struct
|
|
|
ceae87 |
(ok == PS_SOCKET && !ctl->wehaveauthed))
|
|
|
ceae87 |
{
|
|
|
ceae87 |
#ifdef SSL_ENABLE
|
|
|
ceae87 |
- if (must_tls(ctl)) {
|
|
|
ceae87 |
+ if (must_starttls(ctl)) {
|
|
|
ceae87 |
/* fail with mandatory STLS without repoll */
|
|
|
ceae87 |
report(stderr, GT_("TLS is mandatory for this session, but server refused CAPA command.\n"));
|
|
|
ceae87 |
report(stderr, GT_("The CAPA command is however necessary for TLS.\n"));
|
|
|
ceae87 |
return ok;
|
|
|
ceae87 |
- } else if (maybe_tls(ctl)) {
|
|
|
ceae87 |
+ } else if (maybe_starttls(ctl)) {
|
|
|
ceae87 |
/* defeat opportunistic STLS */
|
|
|
ceae87 |
xfree(ctl->sslproto);
|
|
|
ceae87 |
ctl->sslproto = xstrdup("");
|
|
|
ceae87 |
@@ -431,24 +432,19 @@ static int pop3_getauth(int sock, struct
|
|
|
ceae87 |
}
|
|
|
ceae87 |
|
|
|
ceae87 |
#ifdef SSL_ENABLE
|
|
|
ceae87 |
- if (maybe_tls(ctl)) {
|
|
|
ceae87 |
- char *commonname;
|
|
|
ceae87 |
+ commonname = ctl->server.pollname;
|
|
|
ceae87 |
+ if (ctl->server.via)
|
|
|
ceae87 |
+ commonname = ctl->server.via;
|
|
|
ceae87 |
+ if (ctl->sslcommonname)
|
|
|
ceae87 |
+ commonname = ctl->sslcommonname;
|
|
|
ceae87 |
|
|
|
ceae87 |
- commonname = ctl->server.pollname;
|
|
|
ceae87 |
- if (ctl->server.via)
|
|
|
ceae87 |
- commonname = ctl->server.via;
|
|
|
ceae87 |
- if (ctl->sslcommonname)
|
|
|
ceae87 |
- commonname = ctl->sslcommonname;
|
|
|
ceae87 |
-
|
|
|
ceae87 |
- if (has_stls
|
|
|
ceae87 |
- || must_tls(ctl)) /* if TLS is mandatory, ignore capabilities */
|
|
|
ceae87 |
+ if (maybe_starttls(ctl)) {
|
|
|
ceae87 |
+ if (has_stls || must_starttls(ctl)) /* if TLS is mandatory, ignore capabilities */
|
|
|
ceae87 |
{
|
|
|
ceae87 |
- /* Use "tls1" rather than ctl->sslproto because tls1 is the only
|
|
|
ceae87 |
- * protocol that will work with STARTTLS. Don't need to worry
|
|
|
ceae87 |
- * whether TLS is mandatory or opportunistic unless SSLOpen() fails
|
|
|
ceae87 |
- * (see below). */
|
|
|
ceae87 |
+ /* Don't need to worry whether TLS is mandatory or
|
|
|
ceae87 |
+ * opportunistic unless SSLOpen() fails (see below). */
|
|
|
ceae87 |
if (gen_transact(sock, "STLS") == PS_SUCCESS
|
|
|
ceae87 |
- && (set_timeout(mytimeout), SSLOpen(sock, ctl->sslcert, ctl->sslkey, "tls1", ctl->sslcertck,
|
|
|
ceae87 |
+ && (set_timeout(mytimeout), SSLOpen(sock, ctl->sslcert, ctl->sslkey, ctl->sslproto, ctl->sslcertck,
|
|
|
ceae87 |
ctl->sslcertfile, ctl->sslcertpath, ctl->sslfingerprint, commonname,
|
|
|
ceae87 |
ctl->server.pollname, &ctl->remotename)) != -1)
|
|
|
ceae87 |
{
|
|
|
ceae87 |
@@ -475,7 +471,7 @@ static int pop3_getauth(int sock, struct
|
|
|
ceae87 |
{
|
|
|
ceae87 |
report(stdout, GT_("%s: upgrade to TLS succeeded.\n"), commonname);
|
|
|
ceae87 |
}
|
|
|
ceae87 |
- } else if (must_tls(ctl)) {
|
|
|
ceae87 |
+ } else if (must_starttls(ctl)) {
|
|
|
ceae87 |
/* Config required TLS but we couldn't guarantee it, so we must
|
|
|
ceae87 |
* stop. */
|
|
|
ceae87 |
set_timeout(0);
|
|
|
ceae87 |
@@ -495,7 +491,11 @@ static int pop3_getauth(int sock, struct
|
|
|
ceae87 |
}
|
|
|
ceae87 |
}
|
|
|
ceae87 |
}
|
|
|
ceae87 |
- } /* maybe_tls() */
|
|
|
ceae87 |
+ } else { /* maybe_starttls() */
|
|
|
ceae87 |
+ if (has_stls && outlevel >= O_VERBOSE) {
|
|
|
ceae87 |
+ report(stdout, GT_("%s: WARNING: server offered STLS, but sslproto '' given.\n"), commonname);
|
|
|
ceae87 |
+ }
|
|
|
ceae87 |
+ } /* maybe_starttls() */
|
|
|
ceae87 |
#endif /* SSL_ENABLE */
|
|
|
ceae87 |
|
|
|
ceae87 |
/*
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/README.SSL.orig fetchmail-6.3.26/README.SSL
|
|
|
ceae87 |
--- fetchmail-6.3.26/README.SSL.orig 2013-01-02 23:38:24.000000000 +0100
|
|
|
ceae87 |
+++ fetchmail-6.3.26/README.SSL 2016-05-02 14:14:34.907139597 +0200
|
|
|
ceae87 |
@@ -11,36 +11,48 @@ specific to fetchmail.
|
|
|
ceae87 |
In case of troubles, mail the README.SSL-SERVER file to your ISP and
|
|
|
ceae87 |
have them check their server configuration against it.
|
|
|
ceae87 |
|
|
|
ceae87 |
-Unfortunately, fetchmail confuses SSL/TLS protocol levels with whether
|
|
|
ceae87 |
-a service needs to use in-band negotiation (STLS/STARTTLS for POP3/IMAP4) or is
|
|
|
ceae87 |
-totally SSL-wrapped on a separate port. For compatibility reasons, this cannot
|
|
|
ceae87 |
-be fixed in a bugfix release.
|
|
|
ceae87 |
+Unfortunately, fetchmail confuses SSL/TLS protocol levels with whether a
|
|
|
ceae87 |
+service needs to use in-band negotiation (STLS/STARTTLS for POP3/IMAP4)
|
|
|
ceae87 |
+or is totally SSL-wrapped on a separate port. For compatibility
|
|
|
ceae87 |
+reasons, this cannot be fixed in a bugfix or minor release.
|
|
|
ceae87 |
|
|
|
ceae87 |
-- Matthias Andree, 2009-05-09
|
|
|
ceae87 |
|
|
|
ceae87 |
+Also, fetchmail 6.4.0 and newer releases (this is also true for this release,
|
|
|
ceae87 |
+as the changes were backported from upstream - noted by Red Hat) changed
|
|
|
ceae87 |
+some of the semantics as the result of a bug-fix, and will auto-negotiate
|
|
|
ceae87 |
+TLSv1 or newer only. If your server does not support this, you may have
|
|
|
ceae87 |
+to specify --sslproto ssl3. This is in order to prefer the newer TLS
|
|
|
ceae87 |
+protocols, because SSLv2 and v3 are broken.
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+ -- Matthias Andree, 2015-01-16
|
|
|
ceae87 |
+
|
|
|
ceae87 |
|
|
|
ceae87 |
Quickstart
|
|
|
ceae87 |
----------
|
|
|
ceae87 |
|
|
|
ceae87 |
+Use an up-to-date release of OpenSSL 1.0.1 or newer, so as to get
|
|
|
ceae87 |
+TLSv1.2 support.
|
|
|
ceae87 |
+
|
|
|
ceae87 |
For use of SSL or TLS with in-band negotiation on the regular service's port,
|
|
|
ceae87 |
i. e. with STLS or STARTTLS, use these command line options
|
|
|
ceae87 |
|
|
|
ceae87 |
- --sslproto tls1 --sslcertck
|
|
|
ceae87 |
+ --sslproto auto --sslcertck
|
|
|
ceae87 |
|
|
|
ceae87 |
or these options in the rcfile (after the respective "user"... options)
|
|
|
ceae87 |
|
|
|
ceae87 |
- sslproto tls1 sslcertck
|
|
|
ceae87 |
+ sslproto auto sslcertck
|
|
|
ceae87 |
|
|
|
ceae87 |
|
|
|
ceae87 |
For use of SSL or TLS on a separate port, if the whole TCP connection is
|
|
|
ceae87 |
-SSL-encrypted from the very beginning, use these command line options (in the
|
|
|
ceae87 |
-rcfile, omit all leading "--"):
|
|
|
ceae87 |
+SSL-encrypted from the very beginning (SSL- or TLS-wrapped), use these
|
|
|
ceae87 |
+command line options (in the rcfile, omit all leading "--"):
|
|
|
ceae87 |
|
|
|
ceae87 |
- --ssl --sslproto ssl3 --sslcertck
|
|
|
ceae87 |
+ --ssl --sslproto auto --sslcertck
|
|
|
ceae87 |
|
|
|
ceae87 |
or these options in the rcfile (after the respective "user"... options)
|
|
|
ceae87 |
|
|
|
ceae87 |
- ssl sslproto ssl3 sslcertck
|
|
|
ceae87 |
+ ssl sslproto auto sslcertck
|
|
|
ceae87 |
|
|
|
ceae87 |
|
|
|
ceae87 |
Background and use (long version :-))
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/socket.c.orig fetchmail-6.3.26/socket.c
|
|
|
ceae87 |
--- fetchmail-6.3.26/socket.c.orig 2013-04-23 22:00:45.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/socket.c 2016-05-02 14:16:27.711570350 +0200
|
|
|
ceae87 |
@@ -876,6 +876,9 @@ int SSLOpen(int sock, char *mycert, char
|
|
|
ceae87 |
{
|
|
|
ceae87 |
struct stat randstat;
|
|
|
ceae87 |
int i;
|
|
|
ceae87 |
+ /* disable SSLv2 and SSLv3 by default. SSLv2 can be enabled with '--sslproto ssl2'.
|
|
|
ceae87 |
+ SSLv3 can be enabled with '--sslproto ssl3' or '--sslproto ssl3+' */
|
|
|
ceae87 |
+ int avoid_ssl_versions = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
|
|
|
ceae87 |
long sslopts = SSL_OP_ALL;
|
|
|
ceae87 |
|
|
|
ceae87 |
SSL_load_error_strings();
|
|
|
ceae87 |
@@ -910,21 +913,61 @@ int SSLOpen(int sock, char *mycert, char
|
|
|
ceae87 |
#if HAVE_DECL_SSLV2_CLIENT_METHOD + 0 > 0
|
|
|
ceae87 |
_ctx[sock] = SSL_CTX_new(SSLv2_client_method());
|
|
|
ceae87 |
#else
|
|
|
ceae87 |
- report(stderr, GT_("Your operating system does not support SSLv2.\n"));
|
|
|
ceae87 |
+ report(stderr, GT_("Your OpenSSL version does not support SSLv2.\n"));
|
|
|
ceae87 |
return -1;
|
|
|
ceae87 |
#endif
|
|
|
ceae87 |
+ avoid_ssl_versions &= ~SSL_OP_NO_SSLv2;
|
|
|
ceae87 |
} else if(!strcasecmp("ssl3",myproto)) {
|
|
|
ceae87 |
+#if HAVE_DECL_SSLV3_CLIENT_METHOD + 0 > 0
|
|
|
ceae87 |
_ctx[sock] = SSL_CTX_new(SSLv3_client_method());
|
|
|
ceae87 |
+#else
|
|
|
ceae87 |
+ report(stderr, GT_("Your OpenSSL version does not support SSLv3.\n"));
|
|
|
ceae87 |
+ return -1;
|
|
|
ceae87 |
+#endif
|
|
|
ceae87 |
+ avoid_ssl_versions &= ~SSL_OP_NO_SSLv3;
|
|
|
ceae87 |
+ } else if(!strcasecmp("ssl3+",myproto)) {
|
|
|
ceae87 |
+ avoid_ssl_versions &= ~SSL_OP_NO_SSLv3;
|
|
|
ceae87 |
+ myproto = NULL;
|
|
|
ceae87 |
} else if(!strcasecmp("tls1",myproto)) {
|
|
|
ceae87 |
_ctx[sock] = SSL_CTX_new(TLSv1_client_method());
|
|
|
ceae87 |
- } else if (!strcasecmp("ssl23",myproto)) {
|
|
|
ceae87 |
+ } else if(!strcasecmp("tls1+",myproto)) {
|
|
|
ceae87 |
+ myproto = NULL;
|
|
|
ceae87 |
+#if defined(TLS1_1_VERSION) && TLS_MAX_VERSION >= TLS1_1_VERSION
|
|
|
ceae87 |
+ } else if(!strcasecmp("tls1.1",myproto)) {
|
|
|
ceae87 |
+ _ctx[sock] = SSL_CTX_new(TLSv1_1_client_method());
|
|
|
ceae87 |
+ } else if(!strcasecmp("tls1.1+",myproto)) {
|
|
|
ceae87 |
+ myproto = NULL;
|
|
|
ceae87 |
+ avoid_ssl_versions |= SSL_OP_NO_TLSv1;
|
|
|
ceae87 |
+#else
|
|
|
ceae87 |
+ } else if(!strcasecmp("tls1.1",myproto) || !strcasecmp("tls1.1+", myproto)) {
|
|
|
ceae87 |
+ report(stderr, GT_("Your OpenSSL version does not support TLS v1.1.\n"));
|
|
|
ceae87 |
+ return -1;
|
|
|
ceae87 |
+#endif
|
|
|
ceae87 |
+#if defined(TLS1_2_VERSION) && TLS_MAX_VERSION >= TLS1_2_VERSION
|
|
|
ceae87 |
+ } else if(!strcasecmp("tls1.2",myproto)) {
|
|
|
ceae87 |
+ _ctx[sock] = SSL_CTX_new(TLSv1_2_client_method());
|
|
|
ceae87 |
+ } else if(!strcasecmp("tls1.2+",myproto)) {
|
|
|
ceae87 |
+ myproto = NULL;
|
|
|
ceae87 |
+ avoid_ssl_versions |= SSL_OP_NO_TLSv1;
|
|
|
ceae87 |
+ avoid_ssl_versions |= SSL_OP_NO_TLSv1_1;
|
|
|
ceae87 |
+#else
|
|
|
ceae87 |
+ } else if(!strcasecmp("tls1.2",myproto) || !strcasecmp("tls1.2+", myproto)) {
|
|
|
ceae87 |
+ report(stderr, GT_("Your OpenSSL version does not support TLS v1.2.\n"));
|
|
|
ceae87 |
+ return -1;
|
|
|
ceae87 |
+#endif
|
|
|
ceae87 |
+ } else if (!strcasecmp("ssl23",myproto) || 0 == strcasecmp("auto",myproto)) {
|
|
|
ceae87 |
myproto = NULL;
|
|
|
ceae87 |
} else {
|
|
|
ceae87 |
- report(stderr,GT_("Invalid SSL protocol '%s' specified, using default (SSLv23).\n"), myproto);
|
|
|
ceae87 |
+ report(stderr,GT_("Invalid SSL protocol '%s' specified, using default autoselect (SSL23).\n"), myproto);
|
|
|
ceae87 |
myproto = NULL;
|
|
|
ceae87 |
}
|
|
|
ceae87 |
}
|
|
|
ceae87 |
+ // do not combine into an else { } as myproto may be nulled
|
|
|
ceae87 |
+ // above!
|
|
|
ceae87 |
if(!myproto) {
|
|
|
ceae87 |
+ // SSLv23 is a misnomer and will in fact use the best
|
|
|
ceae87 |
+ // available protocol, subject to SSL_OP_NO*
|
|
|
ceae87 |
+ // constraints.
|
|
|
ceae87 |
_ctx[sock] = SSL_CTX_new(SSLv23_client_method());
|
|
|
ceae87 |
}
|
|
|
ceae87 |
if(_ctx[sock] == NULL) {
|
|
|
ceae87 |
@@ -938,7 +981,7 @@ int SSLOpen(int sock, char *mycert, char
|
|
|
ceae87 |
sslopts &= ~ SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
|
|
|
ceae87 |
}
|
|
|
ceae87 |
|
|
|
ceae87 |
- SSL_CTX_set_options(_ctx[sock], sslopts);
|
|
|
ceae87 |
+ SSL_CTX_set_options(_ctx[sock], sslopts | avoid_ssl_versions);
|
|
|
ceae87 |
|
|
|
ceae87 |
if (certck) {
|
|
|
ceae87 |
SSL_CTX_set_verify(_ctx[sock], SSL_VERIFY_PEER, SSL_ck_verify_callback);
|
|
|
ceae87 |
@@ -1017,6 +1060,24 @@ int SSLOpen(int sock, char *mycert, char
|
|
|
ceae87 |
return(-1);
|
|
|
ceae87 |
}
|
|
|
ceae87 |
|
|
|
ceae87 |
+ if (outlevel >= O_VERBOSE) {
|
|
|
ceae87 |
+ SSL_CIPHER const *sc;
|
|
|
ceae87 |
+ int bitsmax, bitsused;
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+ const char *ver;
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+ ver = SSL_get_version(_ssl_context[sock]);
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+ sc = SSL_get_current_cipher(_ssl_context[sock]);
|
|
|
ceae87 |
+ if (!sc) {
|
|
|
ceae87 |
+ report (stderr, GT_("Cannot obtain current SSL/TLS cipher - no session established?\n"));
|
|
|
ceae87 |
+ } else {
|
|
|
ceae87 |
+ bitsused = SSL_CIPHER_get_bits(sc, &bitsmax);
|
|
|
ceae87 |
+ report(stdout, GT_("SSL/TLS: using protocol %s, cipher %s, %d/%d secret/processed bits\n"),
|
|
|
ceae87 |
+ ver, SSL_CIPHER_get_name(sc), bitsused, bitsmax);
|
|
|
ceae87 |
+ }
|
|
|
ceae87 |
+ }
|
|
|
ceae87 |
+
|
|
|
ceae87 |
/* Paranoia: was the callback not called as we expected? */
|
|
|
ceae87 |
if (!_depth0ck) {
|
|
|
ceae87 |
report(stderr, GT_("Certificate/fingerprint verification was somehow skipped!\n"));
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/starttls.c.orig fetchmail-6.3.26/starttls.c
|
|
|
ceae87 |
--- fetchmail-6.3.26/starttls.c.orig 2016-05-02 14:14:34.908139601 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/starttls.c 2016-05-02 14:14:34.908139601 +0200
|
|
|
ceae87 |
@@ -0,0 +1,37 @@
|
|
|
ceae87 |
+/** \file tls.c - collect common TLS functionality
|
|
|
ceae87 |
+ * \author Matthias Andree
|
|
|
ceae87 |
+ * \date 2006
|
|
|
ceae87 |
+ */
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+#include "fetchmail.h"
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+#include <string.h>
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+#ifdef HAVE_STRINGS_H
|
|
|
ceae87 |
+#include <strings.h>
|
|
|
ceae87 |
+#endif
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+/** return true if user allowed opportunistic STARTTLS/STLS */
|
|
|
ceae87 |
+int maybe_starttls(struct query *ctl) {
|
|
|
ceae87 |
+#ifdef SSL_ENABLE
|
|
|
ceae87 |
+ /* opportunistic or forced TLS */
|
|
|
ceae87 |
+ return (!ctl->sslproto || strlen(ctl->sslproto))
|
|
|
ceae87 |
+ && !ctl->use_ssl;
|
|
|
ceae87 |
+#else
|
|
|
ceae87 |
+ (void)ctl;
|
|
|
ceae87 |
+ return 0;
|
|
|
ceae87 |
+#endif
|
|
|
ceae87 |
+}
|
|
|
ceae87 |
+
|
|
|
ceae87 |
+/** return true if user requires STARTTLS/STLS, note though that this
|
|
|
ceae87 |
+ * code must always use a logical AND with maybe_tls(). */
|
|
|
ceae87 |
+int must_starttls(struct query *ctl) {
|
|
|
ceae87 |
+#ifdef SSL_ENABLE
|
|
|
ceae87 |
+ return maybe_starttls(ctl)
|
|
|
ceae87 |
+ && (ctl->sslfingerprint || ctl->sslcertck
|
|
|
ceae87 |
+ || (ctl->sslproto && !strcasecmp(ctl->sslproto, "tls1")));
|
|
|
ceae87 |
+#else
|
|
|
ceae87 |
+ (void)ctl;
|
|
|
ceae87 |
+ return 0;
|
|
|
ceae87 |
+#endif
|
|
|
ceae87 |
+}
|
|
|
ceae87 |
diff -up fetchmail-6.3.26/tls.c.orig fetchmail-6.3.26/tls.c
|
|
|
ceae87 |
--- fetchmail-6.3.26/tls.c.orig 2013-04-23 22:00:45.000000000 +0200
|
|
|
ceae87 |
+++ fetchmail-6.3.26/tls.c 2016-05-02 14:14:34.908139601 +0200
|
|
|
ceae87 |
@@ -1,35 +0,0 @@
|
|
|
ceae87 |
-/** \file tls.c - collect common TLS functionality
|
|
|
ceae87 |
- * \author Matthias Andree
|
|
|
ceae87 |
- * \date 2006
|
|
|
ceae87 |
- */
|
|
|
ceae87 |
-
|
|
|
ceae87 |
-#include "fetchmail.h"
|
|
|
ceae87 |
-
|
|
|
ceae87 |
-#ifdef HAVE_STRINGS_H
|
|
|
ceae87 |
-#include <strings.h>
|
|
|
ceae87 |
-#endif
|
|
|
ceae87 |
-
|
|
|
ceae87 |
-/** return true if user allowed TLS */
|
|
|
ceae87 |
-int maybe_tls(struct query *ctl) {
|
|
|
ceae87 |
-#ifdef SSL_ENABLE
|
|
|
ceae87 |
- /* opportunistic or forced TLS */
|
|
|
ceae87 |
- return (!ctl->sslproto || !strcasecmp(ctl->sslproto,"tls1"))
|
|
|
ceae87 |
- && !ctl->use_ssl;
|
|
|
ceae87 |
-#else
|
|
|
ceae87 |
- (void)ctl;
|
|
|
ceae87 |
- return 0;
|
|
|
ceae87 |
-#endif
|
|
|
ceae87 |
-}
|
|
|
ceae87 |
-
|
|
|
ceae87 |
-/** return true if user requires TLS, note though that this code must
|
|
|
ceae87 |
- * always use a logical AND with maybe_tls(). */
|
|
|
ceae87 |
-int must_tls(struct query *ctl) {
|
|
|
ceae87 |
-#ifdef SSL_ENABLE
|
|
|
ceae87 |
- return maybe_tls(ctl)
|
|
|
ceae87 |
- && (ctl->sslfingerprint || ctl->sslcertck
|
|
|
ceae87 |
- || (ctl->sslproto && !strcasecmp(ctl->sslproto, "tls1")));
|
|
|
ceae87 |
-#else
|
|
|
ceae87 |
- (void)ctl;
|
|
|
ceae87 |
- return 0;
|
|
|
ceae87 |
-#endif
|
|
|
ceae87 |
-}
|