Skip to contentSkip to conversation

Remove possibility of using --tls-auth with non OpenVPN Static key files

PATCH Superseded Arne Schwabe 3 participants 10 messages Nov 16, 2014 – Dec 6, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove possibility of using --tls-auth with non OpenVPN Static key files

In older version OpenVPN would hash a --tls-auth file if it does not conform to the expected format

---
 doc/openvpn.8        | 21 +++--------------
 src/openvpn/crypto.c | 65 ++++------------------------------------------------
 2 files changed, 7 insertions(+), 79 deletions(-)
doc/openvpn.8 +3 -18
index 8fca9aa..5a6c646 100644
@@ -4608,26 +4608,11 @@ bearing an incorrect HMAC signature can be dropped immediately without
 response.
 
 .B file
-(required) is a key file which can be in one of two formats:
-
-.B (1)
-An OpenVPN static key file generated by
+(required) is a file in OpenVPN static key format which can be generated by
 .B \-\-genkey
-(required if
-.B direction
-parameter is used).
-
-.B (2)
-A freeform passphrase file.  In this case the HMAC key will
-be derived by taking a secure hash of this file, similar to
-the
-.BR md5sum (1)
-or
-.BR sha1sum (1)
-commands.
 
-OpenVPN will first try format (1), and if the file fails to parse as
-a static key file, format (2) will be used.
+Older version supported a freeform passphrase file. This is no longer
+support in newer version.
 
 See the
 .B \-\-secret
src/openvpn/crypto.c +4 -61

80 lines not on this page · raw message

Signature · 1 line
1.9.3 (Apple Git-50)
#1 lore raw

Hi,

Feature-ACK for sure! Some minor comments though:

doc/openvpn.8 bearing an incorrect HMAC signature can be dropped immediately without · line 4615

Quoted 2 lines · Arne Schwabe
doc/openvpn.8 +2 -0
+Older version supported a freeform passphrase file. This is no longer
+support in newer version.

version -> versions.

Also, I think it would be nice to state the actual versions here (i.e. supported upto 2.3, dropped in 2.4+). This will help us later with deciding when to remove this statement altogether.

src/openvpn/crypto.c get_tls_handshake_key (const struct key_type *key_type, · line 779

Quoted 5 lines
src/openvpn/crypto.c +3 -2
-	    msg (M_INFO,
-		 "Control Channel Authentication: using '%s' as a free-form passphrase file",
+	    msg (M_ERR,
+		 "Control Channel Authentication: File '%s' does not have OpenVPN Static Key format. "
+		 "Using free-form passphrase file is not supported anymore",

Fine, but could we also add a big fat 'This stuff is DEPRECATED' to the message in the release/2.3 branch?

-Steffan

#2 lore raw

PATCH v2 1/1 Remove possibility of using --tls-auth with non OpenVPN Static key files

In older version OpenVPN would hash a --tls-auth file if it does not conform to the expected format

---
 doc/openvpn.8        | 21 +++--------------
 src/openvpn/crypto.c | 65 ++++------------------------------------------------
 2 files changed, 7 insertions(+), 79 deletions(-)
doc/openvpn.8 +3 -18
index 96ba555..532eda5 100644
@@ -4609,26 +4609,11 @@ bearing an incorrect HMAC signature can be dropped immediately without
 response.
 
 .B file
-(required) is a key file which can be in one of two formats:
-
-.B (1)
-An OpenVPN static key file generated by
+(required) is a file in OpenVPN static key format which can be generated by
 .B \-\-genkey
-(required if
-.B direction
-parameter is used).
-
-.B (2)
-A freeform passphrase file.  In this case the HMAC key will
-be derived by taking a secure hash of this file, similar to
-the
-.BR md5sum (1)
-or
-.BR sha1sum (1)
-commands.
 
-OpenVPN will first try format (1), and if the file fails to parse as
-a static key file, format (2) will be used.
+Older versions (up to 2.3) supported a freeform passphrase file.
+This is no longer supported in newer versions (2.4+).
 
 See the
 .B \-\-secret
src/openvpn/crypto.c +4 -61

80 lines not on this page · raw message

Signature · 1 line
1.9.3 (Apple Git-50)
#3 lore raw

PATCH 1/1 Warn that tls-auth with free form files is going to be removed from OpenVPN 2.4

---
 doc/openvpn.8        | 5 +++--
 src/openvpn/crypto.c | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
doc/openvpn.8 +3 -2
index 1fd53b0..3472778 100644
@@ -4580,14 +4580,15 @@ An OpenVPN static key file generated by
 .B direction
 parameter is used).
 
-.B (2)
+.B (2) DEPRECATED
 A freeform passphrase file.  In this case the HMAC key will
 be derived by taking a secure hash of this file, similar to
 the
 .BR md5sum (1)
 or
 .BR sha1sum (1)
-commands.
+commands. This option is deprecated and will stop working in OpenVPN 2.4 and 
+newer releases.
 
 OpenVPN will first try format (1), and if the file fails to parse as
 a static key file, format (2) will be used.
src/openvpn/crypto.c +1 -0
index 0a5e83f..475c253 100644
@@ -787,6 +787,7 @@ get_tls_handshake_key (const struct key_type *key_type,
 	    msg (M_INFO,
 		 "Control Channel Authentication: using '%s' as a free-form passphrase file",
 		 passphrase_file);
+	    msg (M_WARN, "DEPRECATED OPTION: Using freeform files for tls-auth is deprecated and is not  supported in OpenVPN 2.4 or newer versions");
 	  }
       }
       /* handle key direction */
Signature · 1 line
1.9.3 (Apple Git-50)
#4 lore raw
In reply to Arne Schwabe

Your patch has been applied to the master branch.

commit 8a95f62e3114b8fdaf0fd3ce2d80ed82d5e0db20

Author: Arne Schwabe
Date:   Sat Dec 6 14:15:03 2014 +0100
     Remove possibility of using --tls-auth with non OpenVPN Static key files

     Acked-by: Steffan Karger <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/9306
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw

PATCH v2 1/1 Remove possibility of using --tls-auth with non OpenVPN Static key files

In reply to Steffan Karger

In older version OpenVPN would hash a --tls-auth file if it does not conform to the expected format

---
 doc/openvpn.8        | 21 +++--------------
 src/openvpn/crypto.c | 65 ++++------------------------------------------------
 2 files changed, 7 insertions(+), 79 deletions(-)
doc/openvpn.8 +3 -18
index 96ba555..532eda5 100644
@@ -4609,26 +4609,11 @@ bearing an incorrect HMAC signature can be dropped immediately without
 response.
 
 .B file
-(required) is a key file which can be in one of two formats:
-
-.B (1)
-An OpenVPN static key file generated by
+(required) is a file in OpenVPN static key format which can be generated by
 .B \-\-genkey
-(required if
-.B direction
-parameter is used).
-
-.B (2)
-A freeform passphrase file.  In this case the HMAC key will
-be derived by taking a secure hash of this file, similar to
-the
-.BR md5sum (1)
-or
-.BR sha1sum (1)
-commands.
 
-OpenVPN will first try format (1), and if the file fails to parse as
-a static key file, format (2) will be used.
+Older versions (up to 2.3) supported a freeform passphrase file.
+This is no longer supported in newer versions (2.4+).
 
 See the
 .B \-\-secret
src/openvpn/crypto.c +4 -61

80 lines not on this page · raw message

Signature · 1 line
1.9.3 (Apple Git-50)
#6 lore raw

PATCH 1/1 Warn that tls-auth with free form files is going to be removed from OpenVPN 2.4

---
 doc/openvpn.8        | 5 +++--
 src/openvpn/crypto.c | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
doc/openvpn.8 +3 -2
index 1fd53b0..3472778 100644
@@ -4580,14 +4580,15 @@ An OpenVPN static key file generated by
 .B direction
 parameter is used).
 
-.B (2)
+.B (2) DEPRECATED
 A freeform passphrase file.  In this case the HMAC key will
 be derived by taking a secure hash of this file, similar to
 the
 .BR md5sum (1)
 or
 .BR sha1sum (1)
-commands.
+commands. This option is deprecated and will stop working in OpenVPN 2.4 and 
+newer releases.
 
 OpenVPN will first try format (1), and if the file fails to parse as
 a static key file, format (2) will be used.
src/openvpn/crypto.c +1 -0
index 0a5e83f..475c253 100644
@@ -787,6 +787,7 @@ get_tls_handshake_key (const struct key_type *key_type,
 	    msg (M_INFO,
 		 "Control Channel Authentication: using '%s' as a free-form passphrase file",
 		 passphrase_file);
+	    msg (M_WARN, "DEPRECATED OPTION: Using freeform files for tls-auth is deprecated and is not  supported in OpenVPN 2.4 or newer versions");
 	  }
       }
       /* handle key direction */
Signature · 1 line
1.9.3 (Apple Git-50)
#7 lore raw

Re: [Openvpn-devel] [PATCH] Warn that tls-auth with free form files is going to be removed from OpenVPN 2.4

ACK

-Steffan

Quoted 40 lines · Arne Schwabe
---
 doc/openvpn.8        | 5 +++--
 src/openvpn/crypto.c | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
doc/openvpn.8 +3 -2
index 1fd53b0..3472778 100644
@@ -4580,14 +4580,15 @@ An OpenVPN static key file generated by
 .B direction
 parameter is used).
 
-.B (2)
+.B (2) DEPRECATED
 A freeform passphrase file.  In this case the HMAC key will
 be derived by taking a secure hash of this file, similar to
 the
 .BR md5sum (1)
 or
 .BR sha1sum (1)
-commands.
+commands. This option is deprecated and will stop working in OpenVPN 2.4 and 
+newer releases.
 
 OpenVPN will first try format (1), and if the file fails to parse as
 a static key file, format (2) will be used.
src/openvpn/crypto.c +1 -0
index 0a5e83f..475c253 100644
@@ -787,6 +787,7 @@ get_tls_handshake_key (const struct key_type *key_type,
 	    msg (M_INFO,
 		 "Control Channel Authentication: using '%s' as a free-form passphrase file",
 		 passphrase_file);
+	    msg (M_WARN, "DEPRECATED OPTION: Using freeform files for tls-auth is deprecated and is not  supported in OpenVPN 2.4 or newer versions");
 	  }
       }
       /* handle key direction */
#8 lore raw

[Openvpn-devel] [PATCH applied] Re: Warn that tls-auth with free form files is going to be removed from OpenVPN 2.4

In reply to Arne Schwabe

Your patch has been applied to the release/2.3 branch.

commit 77c88554a711f94e81f0a7f74e7e04747a02c85a

Author: Arne Schwabe
Date:   Sat Dec 6 14:22:09 2014 +0100
     Warn that tls-auth with free form files is going to be removed from OpenVPN 2.4

     Acked-by: Steffan Karger <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/9309
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#9 lore raw
In reply to Arne Schwabe

ACK

-Steffan

Quoted 128 lines · Arne Schwabe

In older version OpenVPN would hash a --tls-auth file if it does not conform to the expected format

---
 doc/openvpn.8        | 21 +++--------------
 src/openvpn/crypto.c | 65 ++++------------------------------------------------
 2 files changed, 7 insertions(+), 79 deletions(-)
doc/openvpn.8 +3 -18
index 96ba555..532eda5 100644
@@ -4609,26 +4609,11 @@ bearing an incorrect HMAC signature can be dropped immediately without
 response.
 
 .B file
-(required) is a key file which can be in one of two formats:
-
-.B (1)
-An OpenVPN static key file generated by
+(required) is a file in OpenVPN static key format which can be generated by
 .B \-\-genkey
-(required if
-.B direction
-parameter is used).
-
-.B (2)
-A freeform passphrase file.  In this case the HMAC key will
-be derived by taking a secure hash of this file, similar to
-the
-.BR md5sum (1)
-or
-.BR sha1sum (1)
-commands.
 
-OpenVPN will first try format (1), and if the file fails to parse as
-a static key file, format (2) will be used.
+Older versions (up to 2.3) supported a freeform passphrase file.
+This is no longer supported in newer versions (2.4+).
 
 See the
 .B \-\-secret
src/openvpn/crypto.c +4 -61
index ef2bde1..eaef964 100644
@@ -770,22 +770,13 @@ get_tls_handshake_key (const struct key_type *key_type,
 	  }
 	else
 	  {
-	    int hash_size;
-
 	    CLEAR (key2);
 
-	    /* failed, now try to get hash from a freeform file */
-	    hash_size = read_passphrase_hash (passphrase_file,
-					      kt.digest,
-					      key2.keys[0].hmac,
-					      MAX_HMAC_KEY_LENGTH);
-	    ASSERT (hash_size == kt.hmac_length);
-
-	    /* suceeded */
-	    key2.n = 1;
+	    /* failed, now bail out */
 
-	    msg (M_INFO,
-		 "Control Channel Authentication: using '%s' as a free-form passphrase file",
+	    msg (M_ERR,
+		 "Control Channel Authentication: File '%s' does not have OpenVPN Static Key format. "
+		 "Using free-form passphrase file is not supported anymore",
 		 passphrase_file);
 	  }
       }
@@ -1012,54 +1003,6 @@ read_key_file (struct key2 *key2, const char *file, const unsigned int flags)
   gc_free (&gc);
 }
 
-int
-read_passphrase_hash (const char *passphrase_file,
-		      const md_kt_t *digest,
-		      uint8_t *output,
-		      int len)
-{
-  md_ctx_t md;
-
-  ASSERT (len >= md_kt_size(digest));
-  memset (output, 0, len);
-
-  md_ctx_init(&md, digest);
-
-  /* read passphrase file */
-  {
-    const int min_passphrase_size = 8;
-    uint8_t buf[64];
-    int total_size = 0;
-    int fd = platform_open (passphrase_file, O_RDONLY, 0);
-
-    if (fd == -1)
-      msg (M_ERR, "Cannot open passphrase file: '%s'", passphrase_file);
-
-    for (;;)
-      {
-	int size = read (fd, buf, sizeof (buf));
-	if (size == 0)
-	  break;
-	if (size == -1)
-	  msg (M_ERR, "Read error on passphrase file: '%s'",
-	       passphrase_file);
-	md_ctx_update(&md, buf, size);
-	total_size += size;
-      }
-    close (fd);
-
-    warn_if_group_others_accessible (passphrase_file);
-
-    if (total_size < min_passphrase_size)
-      msg (M_FATAL,
-	   "Passphrase file '%s' is too small (must have at least %d characters)",
-	   passphrase_file, min_passphrase_size);
-  }
-  md_ctx_final(&md, output);
-  md_ctx_cleanup(&md);
-  return md_kt_size(digest);
-}
-
 /*
  * Write key to file, return number of random bits
  * written.