Skip to contentSkip to conversation

Only print script warnings when a script is used. Remove stray mention of script-security system.

PATCH In review Arne Schwabe 3 participants 8 messages May 30, 2013 – May 31, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Only print script warnings when a script is used. Remove stray mention of script-security system.

---
 src/openvpn/common.h |    2 +-
 src/openvpn/init.c   |   19 +++++++++++++------
 2 files changed, 14 insertions(+), 7 deletions(-)
src/openvpn/common.h +1 -1
index dd2c83f..2f85bec 100644
@@ -100,6 +100,6 @@ typedef unsigned long ptr_type;
 /*
  * Script security warning
  */
-#define SCRIPT_SECURITY_WARNING "WARNING: External program may not be called unless '--script-security 2' or higher is enabled.  Use '--script-security 3 system' for backward compatibility with 2.1_rc8 and earlier.  See --help text or man page for detailed info."
+#define SCRIPT_SECURITY_WARNING "WARNING: External program may not be called unless '--script-security 2' or higher is enabled. See --help text or man page for detailed info."
 
 #endif
src/openvpn/init.c +13 -6
index 2a0ba85..1dc7ee7 100644
@@ -2542,12 +2542,19 @@ do_option_warnings (struct context *c)
     msg (M_WARN, "NOTE: --connect-timeout option is not supported on this OS");
 #endif
 
-  if (script_security >= SSEC_SCRIPTS)
-    msg (M_WARN, "NOTE: the current --script-security setting may allow this configuration to call user-defined scripts");
-  else if (script_security >= SSEC_PW_ENV)
-    msg (M_WARN, "WARNING: the current --script-security setting may allow passwords to be passed to scripts via environmental variables");
-  else
-    msg (M_WARN, "NOTE: " PACKAGE_NAME " 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables");
+ /* Check if a script is used and print approiate warnings */
+ if (o->up_script || o->ipchange || o->down_script || o->route_script
+     || o->route_predown_script || o->auth_user_pass_verify_script
+     || o->client_disconnect_script || o->client_connect_script
+     || o->learn_address_script || o->tls_verify)
+   {
+     if (script_security >= SSEC_SCRIPTS)
+       msg (M_WARN, "NOTE: the current --script-security setting may allow this configuration to call user-defined scripts");
+     else if (script_security >= SSEC_PW_ENV)
+       msg (M_WARN, "WARNING: the current --script-security setting may allow passwords to be passed to scripts via environmental variables");
+     else
+       msg (M_WARN, "NOTE: " PACKAGE_NAME " 2.1+ requires '--script-security 2' or higher to call user-defined scripts or executables");
+   }
 }
 
 static void
Signature · 1 line
1.7.9.5
#1 lore raw

ACK!

Quoted 48 lines · Arne Schwabe
---
 src/openvpn/common.h |    2 +-
 src/openvpn/init.c   |   19 +++++++++++++------
 2 files changed, 14 insertions(+), 7 deletions(-)
src/openvpn/common.h +1 -1
index dd2c83f..2f85bec 100644
@@ -100,6 +100,6 @@ typedef unsigned long ptr_type;
 /*
  * Script security warning
  */
-#define SCRIPT_SECURITY_WARNING "WARNING: External program may not be called unless '--script-security 2' or higher is enabled.  Use '--script-security 3 system' for backward compatibility with 2.1_rc8 and earlier.  See --help text or man page for detailed info."
+#define SCRIPT_SECURITY_WARNING "WARNING: External program may not be called unless '--script-security 2' or higher is enabled. See --help text or man page for detailed info."
 
 #endif
src/openvpn/init.c +13 -6
index 2a0ba85..1dc7ee7 100644
@@ -2542,12 +2542,19 @@ do_option_warnings (struct context *c)
     msg (M_WARN, "NOTE: --connect-timeout option is not supported on this OS");
 #endif
 
-  if (script_security >= SSEC_SCRIPTS)
-    msg (M_WARN, "NOTE: the current --script-security setting may allow this configuration to call user-defined scripts");
-  else if (script_security >= SSEC_PW_ENV)
-    msg (M_WARN, "WARNING: the current --script-security setting may allow passwords to be passed to scripts via environmental variables");
-  else
-    msg (M_WARN, "NOTE: " PACKAGE_NAME " 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables");
+ /* Check if a script is used and print approiate warnings */
+ if (o->up_script || o->ipchange || o->down_script || o->route_script
+     || o->route_predown_script || o->auth_user_pass_verify_script
+     || o->client_disconnect_script || o->client_connect_script
+     || o->learn_address_script || o->tls_verify)
+   {
+     if (script_security >= SSEC_SCRIPTS)
+       msg (M_WARN, "NOTE: the current --script-security setting may allow this configuration to call user-defined scripts");
+     else if (script_security >= SSEC_PW_ENV)
+       msg (M_WARN, "WARNING: the current --script-security setting may allow passwords to be passed to scripts via environmental variables");
+     else
+       msg (M_WARN, "NOTE: " PACKAGE_NAME " 2.1+ requires '--script-security 2' or higher to call user-defined scripts or executables");
+   }
 }
 
 static void
#2 lore raw
In reply to Arne Schwabe

Your patch has been applied to the master and release/2.3 branches.

commit 8476edbb1748e11de0e4fda8989c9e470285926b (master) commit 567bfc06d051b60e9cdca1f5bb468631b899682a (release/2.3)

Author: Arne Schwabe
Date:   Thu May 30 15:27:08 2013 +0200
     Only print script warnings when a script is used. Remove stray mention of script-security system.

     Acked-by: Jan Just Keijser <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/7625
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#3 lore raw
In reply to Arne Schwabe

Hi,

src/openvpn/init.c do_option_warnings (struct context *c) · line 2549

Quoted 4 lines · Arne Schwabe

+ if (o->up_script || o->ipchange || o->down_script || o->route_script

src/openvpn/init.c +3 -0
+     || o->route_predown_script || o->auth_user_pass_verify_script
+     || o->client_disconnect_script || o->client_connect_script
+     || o->learn_address_script || o->tls_verify)

... while I *do* like this approach, and jjk has acked it, buildbot send a strong signal that this is not good enough... if compiled with --disable-ssl, half of these options do not exist.

Postponing 2.3.2 a bit :-)

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#4 lore raw

PATCH 1/1 Move settings of user script into set_user_script function

This also fixes commit 567bfc06d051b60e9cdca1f5bb468631b899682a if not all script options are available by setting options->user_script_used

---
 src/openvpn/init.c    |    7 ++----
 src/openvpn/options.c |   59 ++++++++++++++++++++++++++++---------------------
 src/openvpn/options.h |    1 +
 3 files changed, 37 insertions(+), 30 deletions(-)
src/openvpn/init.c +2 -5
index 7488923..cf0498d 100644
@@ -2542,11 +2542,8 @@ do_option_warnings (struct context *c)
     msg (M_WARN, "NOTE: --connect-timeout option is not supported on this OS");
 #endif
 
- /* Check if a script is used and print approiate warnings */
- if (o->up_script || o->ipchange || o->down_script || o->route_script
-     || o->route_predown_script || o->auth_user_pass_verify_script
-     || o->client_disconnect_script || o->client_connect_script
-     || o->learn_address_script || o->tls_verify)
+  /* If a script is used, print appropiate warnings */
+  if (o->user_script_used)
    {
      if (script_security >= SSEC_SCRIPTS)
        msg (M_WARN, "NOTE: the current --script-security setting may allow this configuration to call user-defined scripts");
src/openvpn/options.c +34 -25

125 lines not on this page · raw message

src/openvpn/options.h +1 -0
index bdf828f..6a132a6 100644
@@ -285,6 +285,7 @@ struct options
   const char *writepid;
   const char *up_script;
   const char *down_script;
+  bool user_script_used;
   bool down_pre;
   bool up_delay;
   bool up_restart;
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 1/1 Move checking of script file access into set_user_script

In reply to Gert Doering

At the moment script are only checked if P2MP_SERVER is defined. For CLIENT_ONLY openvpn script were never checked.

---
 src/openvpn/options.c |   33 +++++++++++----------------------
 1 file changed, 11 insertions(+), 22 deletions(-)
src/openvpn/options.c +11 -22
index bbc1018..5e8bcc4 100644
@@ -2745,28 +2745,6 @@ options_postprocess_filechecks (struct options *options)
   errs |= check_file_access (CHKACC_FILE, options->tmp_dir,
                              R_OK|W_OK|X_OK, "Temporary directory (--tmp-dir)");
 
-  /* ** Script hooks that accept an optionally quoted and/or escaped executable path, ** */
-  /* ** optionally followed by arguments ** */
-  errs |= check_cmd_access (options->auth_user_pass_verify_script,
-                            "--auth-user-pass-verify script");
-  errs |= check_cmd_access (options->client_connect_script,
-                            "--client-connect script");
-  errs |= check_cmd_access (options->client_disconnect_script,
-                            "--client-disconnect script");
-  errs |= check_cmd_access (options->tls_verify,
-                            "--tls-verify script");
-  errs |= check_cmd_access (options->up_script,
-                            "--up script");
-  errs |= check_cmd_access (options->down_script,
-                            "--down script");
-  errs |= check_cmd_access (options->ipchange,
-                            "--ipchange script");
-  errs |= check_cmd_access (options->route_script,
-                            "--route-up script");
-  errs |= check_cmd_access (options->route_predown_script,
-                            "--route-pre-down script");
-  errs |= check_cmd_access (options->learn_address_script,
-                            "--learn-address script");
 #endif /* P2MP_SERVER */
 
   if (errs)
@@ -4037,6 +4015,17 @@ set_user_script (struct options *options,
   }
   *script = new_script;
   options->user_script_used = true;
+
+#ifndef ENABLE_SMALL
+  {
+    char script_name[100];
+    openvpn_snprintf (script_name, sizeof(script_name), 
+                      "--%s script", type);
+
+    if (check_cmd_access (*script, script_name))
+      msg (M_USAGE, "Please correct this error.");
+  }
+#endif
 }
 
 
Signature · 1 line
1.7.9.5
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: Move settings of user script into set_user_script function

In reply to Arne Schwabe

ACK.

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

commit 9b6a5028111cd915b0342fbd2ecd0b9dfd4aa94a (master) commit 8df20e540fd52077107b164a7c6ab9f1f2eca43f (release/2.3)

Author: Arne Schwabe
Date:   Thu May 30 22:26:43 2013 +0200
     Move settings of user script into set_user_script function

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

--
kind regards,

Gert Doering

#7 lore raw

[Openvpn-devel] [PATCH applied] Re: Move checking of script file access into set_user_script

In reply to Arne Schwabe

ACK.

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

commit e55681a9d802bf1639115d325c1685e5962865d0 (master) commit 05afd0b295a3e56c88b8ee0521d1b6dfb9c19d79 (release/2.3)

Author: Arne Schwabe
Date:   Thu May 30 23:02:17 2013 +0200
     Move checking of script file access into set_user_script

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

--
kind regards,

Gert Doering