]> sjero.net Git - wget/commitdiff
added PFS to --secure-protocol
authorTim Ruehsen <tim.ruehsen@gmx.de>
Tue, 3 Sep 2013 09:49:01 +0000 (11:49 +0200)
committerGiuseppe Scrivano <gscrivan@redhat.com>
Sat, 7 Sep 2013 11:22:15 +0000 (13:22 +0200)
doc/ChangeLog
doc/sample.wgetrc
doc/wget.texi
src/ChangeLog
src/gnutls.c
src/init.c
src/main.c
src/openssl.c
src/options.h

index 3064fd6af9afae5d9b60d72ec7f4d715b3a134ca..862b6f3b0825b023bdf814a71dd5152c39bbc658 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-04  Tim Ruehsen  <tim.ruehsen@gmx.de>
+
+       * sample.wgetrc: added "secureprotocol" example
+       * wget.texi (HTTPS (SSL/TLS) Options): Document PFS.
+
 2013-08-23  Tim Ruehsen  <tim.ruehsen@gmx.de>
 
        * sample.wgetrc: added "httpsonly" example
index 91b6e6ca9233e92cbbfc6ff1c539c572ae4a3a94..eaf2bc8129e3c27ce7c61e1911eed1b6f61e3644 100644 (file)
 
 # Turn on to prevent following non-HTTPS links when in recursive mode
 #httpsonly = off
+
+# Tune HTTPS security (auto, SSLv2, SSLv3, TLSv1, PFS)
+#secureprotocol = auto
index cced7edda118e268b6f290ae272380179044dbce..0b867758d711971d1ee736e6f82b5f9b7f0d7a29 100644 (file)
@@ -1595,16 +1595,21 @@ without SSL support, none of these options are available.
 @cindex SSL protocol, choose
 @item --secure-protocol=@var{protocol}
 Choose the secure protocol to be used.  Legal values are @samp{auto},
-@samp{SSLv2}, @samp{SSLv3}, and @samp{TLSv1}.  If @samp{auto} is used,
-the SSL library is given the liberty of choosing the appropriate
+@samp{SSLv2}, @samp{SSLv3}, @samp{TLSv1} and @samp{PFS}.  If @samp{auto}
+is used, the SSL library is given the liberty of choosing the appropriate
 protocol automatically, which is achieved by sending an SSLv2 greeting
 and announcing support for SSLv3 and TLSv1.  This is the default.
 
 Specifying @samp{SSLv2}, @samp{SSLv3}, or @samp{TLSv1} forces the use
 of the corresponding protocol.  This is useful when talking to old and
-buggy SSL server implementations that make it hard for OpenSSL to
-choose the correct protocol version.  Fortunately, such servers are
-quite rare.
+buggy SSL server implementations that make it hard for the underlying
+SSL library to choose the correct protocol version.  Fortunately, such
+servers are quite rare.
+
+Specifying @samp{PFS} enforces the use of the so-called Perfect Forward
+Security cipher suites. In short, PFS adds security by creating a one-time
+key for each SSL connection. It has a bit more CPU impact on client and server.
+We use known to be secure ciphers (e.g. no MD4) and the TLS protocol.
 
 @item --https-only
 When in recursive mode, only HTTPS links are followed.
index 03a1f6ad2107aef49d6d7322b95c922d7b24db0d..ee7a53e412a07a1bbaa06e254347238a156788da 100644 (file)
@@ -1,3 +1,10 @@
+2013-09-03  Tim Ruehsen  <tim.ruehsen@gmx.de>
+
+       * main.c: Add new value 'PFS' to --secure-protocol to
+         enforce the so-called Perfect Forward Security.
+       * init.c (cmd_spec_secure_protocol): added secure_protocol_pfs
+       * openssl.c, gnutls.c, options.h: likewise
+
 2013-08-22  Tim Ruehsen  <tim.ruehsen@gmx.de>
 
        * main.c: Add new option --https-only.
index 0499a2502c742109ab78d513df44e596996b2ec5..ce61d065a4b96db110ce7dfc6ecf0e200c03c089 100644 (file)
@@ -442,6 +442,13 @@ ssl_connect_wget (int fd, const char *hostname)
     case secure_protocol_tlsv1:
       err = gnutls_priority_set_direct (session, "NORMAL:-VERS-SSL3.0", NULL);
       break;
+    case secure_protocol_pfs:
+#if defined (GNUTLS_VERSION_NUMBER) && GNUTLS_VERSION_NUMBER >= 0x030204
+      err = gnutls_priority_set_direct (session, "PFS", NULL);
+#else
+      err = gnutls_priority_set_direct (session, "NORMAL:-RSA", NULL);
+#endif
+      break;
     default:
       abort ();
     }
index 033da4f7634159396cc18a4632b32ead857c9a80..84ae654cfc8e75b062548e157862f04eacaecf74 100644 (file)
@@ -1497,6 +1497,7 @@ cmd_spec_secure_protocol (const char *com, const char *val, void *place)
     { "sslv2", secure_protocol_sslv2 },
     { "sslv3", secure_protocol_sslv3 },
     { "tlsv1", secure_protocol_tlsv1 },
+    { "pfs", secure_protocol_pfs },
   };
   int ok = decode_string (val, choices, countof (choices), place);
   if (!ok)
index 8414f5e54d0e85caaa203405b51fa48b9be0cb37..19d7253d8b4b5d5f974b97f3a94fe84442d075a5 100644 (file)
@@ -635,7 +635,7 @@ HTTP options:\n"),
 HTTPS (SSL/TLS) options:\n"),
     N_("\
        --secure-protocol=PR     choose secure protocol, one of auto, SSLv2,\n\
-                                SSLv3, and TLSv1.\n"),
+                                SSLv3, TLSv1 and PFS.\n"),
     N_("\
        --https-only             only follow secure HTTPS links\n"),
     N_("\
index e2eec4f7c2932b704fd5cd63e0ed48a735f15813..7c92ac0bcb1c80908abb5ea2fce91e49335227dc 100644 (file)
@@ -194,6 +194,7 @@ ssl_init (void)
     case secure_protocol_sslv3:
       meth = SSLv3_client_method ();
       break;
+    case secure_protocol_pfs:
     case secure_protocol_tlsv1:
       meth = TLSv1_client_method ();
       break;
@@ -207,6 +208,12 @@ ssl_init (void)
   if (!ssl_ctx)
     goto error;
 
+  /* OpenSSL ciphers: https://www.openssl.org/docs/apps/ciphers.html
+   * Since we want a good protection, we also use HIGH (that excludes MD4 ciphers and some more)
+   */
+  if (opt.secure_protocol == secure_protocol_pfs)
+    SSL_CTX_set_cipher_list (ssl_ctx, "HIGH:MEDIUM:!RC4:!SRP:!PSK:!RSA:!aNULL@STRENGTH");
+
   SSL_CTX_set_default_verify_paths (ssl_ctx);
   SSL_CTX_load_verify_locations (ssl_ctx, opt.ca_cert, opt.ca_directory);
 
index 4460c6c60887594325cfc74dedcd4d8793e2d2b3..ad896275a4595fc757cde6fdc4fedac16efed656 100644 (file)
@@ -200,7 +200,8 @@ struct options
     secure_protocol_auto,
     secure_protocol_sslv2,
     secure_protocol_sslv3,
-    secure_protocol_tlsv1
+    secure_protocol_tlsv1,
+    secure_protocol_pfs
   } secure_protocol;           /* type of secure protocol to use. */
   bool check_cert;             /* whether to validate the server's cert */
   char *cert_file;             /* external client certificate to use. */