~smoser/ubuntu/oneiric/openvpn/lp-794916

« back to all changes in this revision

Viewing changes to debian/patches/debian_openssl_vulnkeys.patch

  • Committer: Bazaar Package Importer
  • Author(s): Alberto Gonzalez Iniesta
  • Date: 2008-08-16 13:34:24 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20080816133424-0i83yb6dw4hjglo1
Tags: 2.1~rc9-3
* debian/rules: run ./configure with path to 'route', for
  those build daemons without 'route'. (Closes: #495082)
* Created NEWS.Debian with info on new option script-security.
  (Closes: #494998)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: openvpn-2.1_rc8/init.c
 
1
Index: trunk/init.c
2
2
===================================================================
3
 
--- openvpn-2.1_rc8.orig/init.c 2008-07-23 10:46:18.622183899 +0200
4
 
+++ openvpn-2.1_rc8/init.c      2008-07-23 10:46:32.210385575 +0200
5
 
@@ -1474,8 +1474,24 @@
6
 
 do_init_crypto_static (struct context *c, const unsigned int flags)
7
 
 {
 
3
--- trunk/init.c        (revision 56669)
 
4
+++ trunk/init.c        (working copy)
 
5
@@ -1513,6 +1513,23 @@
8
6
   const struct options *options = &c->options;
9
 
+  char command_line[256];
10
7
   ASSERT (options->shared_secret_file);
11
8
 
12
9
+  /* CVE-2008-0166 (Debian weak key checks) */
16
13
+   * side and avoid wrong -vulnkey alerts. */
17
14
+  if (access (options->shared_secret_file, R_OK) == 0)
18
15
+    {
19
 
+      openvpn_snprintf(command_line, sizeof (command_line), "/usr/sbin/openvpn-vulnkey -q %s", options->shared_secret_file);
20
 
+      msg (M_INFO, "%s", command_line);
21
 
+      if (openvpn_system (command_line, c->c2.es, S_FATAL) != 0)
 
16
+      struct argv argv = argv_new ();
 
17
+      argv_printf (&argv, "/usr/sbin/openvpn-vulnkey -q %s", options->shared_secret_file);
 
18
+      argv_msg (M_INFO, &argv);
 
19
+      if (openvpn_execve (&argv, c->c2.es, 0) != 0)
22
20
+        {
23
21
+          msg (M_WARN, "******* WARNING *******: '%s' is a known vulnerable key. See 'man openvpn-vulnkey' for details.", options->shared_secret_file);
24
22
+        }
 
23
+      argv_reset (&argv);
25
24
+    }
26
25
+
27
26
   init_crypto_pre (c, flags);
28
27
 
29
28
   /* Initialize packet ID tracking */
30
 
@@ -1561,6 +1577,7 @@
 
29
@@ -1598,6 +1615,7 @@
31
30
 do_init_crypto_tls_c1 (struct context *c)
32
31
 {
33
32
   const struct options *options = &c->options;
35
34
 
36
35
   if (!c->c1.ks.ssl_ctx)
37
36
     {
38
 
@@ -1597,6 +1614,59 @@
 
37
@@ -1634,6 +1652,53 @@
39
38
                     options->ciphername_defined, options->authname,
40
39
                     options->authname_defined, options->keysize, true, true);
41
40
 
70
69
+                    }
71
70
+                  if (bn != NULL)
72
71
+                    {
73
 
+                      int size = strlen(bn) + 256;
74
 
+                      char *command_line = NULL;
75
 
+
76
 
+                      command_line = malloc(size);
77
 
+                      check_malloc_return(command_line);
78
 
+
79
 
+                      openvpn_snprintf(command_line, size, "/usr/bin/openssl-vulnkey -q -b %d -m %s", bits, bn);
 
72
+                      struct argv argv = argv_new ();
 
73
+                      argv_printf (&argv, "/usr/bin/openssl-vulnkey -q -b %d -m %s", bits, bn);
 
74
+                      OPENSSL_free(bn);
80
75
+                      msg (M_INFO, "/usr/bin/openssl-vulnkey -q -b %d -m <modulus omitted>", bits);
81
 
+                      if (openvpn_system (command_line, NULL, S_FATAL) != 0)
 
76
+                      if (openvpn_execve (&argv, NULL, 0) != 0)
82
77
+                        {
83
 
+                          msg (M_WARN, "******* WARNING *******: '%s' is a known vulnerable key. See 'man openssl-vulnkey' for details.", options->priv_key_file);
 
78
+                          msg (M_WARN, "******* WARNING *******: '%s' is a known vulnerable key. See 'man openvpn-vulnkey' for details.", options->shared_secret_file);
84
79
+                        }
85
 
+
86
 
+                      OPENSSL_free(bn);
87
 
+                      free(command_line);
 
80
+                      argv_reset (&argv);
88
81
+                    }
89
82
+                  EVP_PKEY_free (pkey);
90
83
+               }