Skip to contentSkip to conversation

Exit early when external scripts are specified with script-security < 2

PATCH In review [email protected]... 3 participants 4 messages Feb 11, 2019 – Feb 16, 2019 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Exit early when external scripts are specified with script-security < 2

From: Selva Nair <[email protected]...>

Currently this raises a warning only. A fatal error is triggered later with a confusing message that script failed to execute.

This helps the Windows GUI to show a relevant error message when script-security is over-ridden as a security measure.

---
 src/openvpn/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/init.c +1 -1
index 3c44967..5863828 100644
@@ -3206,7 +3206,7 @@ do_option_warnings(struct context *c)
         }
         else
         {
-            msg(M_WARN, "NOTE: starting with " PACKAGE_NAME " 2.1, '--script-security 2' or higher is required to call user-defined scripts or executables");
+            msg(M_FATAL, "ERROR: starting with " PACKAGE_NAME " 2.1, '--script-security 2' or higher is required to call user-defined scripts or executables");
         }
     }
 }
Signature · 1 line
2.1.4
#1 lore raw
Quoted 18 lines · On 11/02/2019 21:46, [email protected]... wrote:

From: Selva Nair <[email protected]...>

Currently this raises a warning only. A fatal error is triggered later with a confusing message that script failed to execute.

This helps the Windows GUI to show a relevant error message when script-security is over-ridden as a security measure.

---
 src/openvpn/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/init.c +0 -0
index 3c44967..5863828 100644

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

Quoted 5 lines
src/openvpn/init.c +1 -1
@@ -3206,7 +3206,7 @@ do_option_warnings(struct context *c)
         }
         else
         {
-            msg(M_WARN, "NOTE: starting with " PACKAGE_NAME " 2.1, '--script-security 2' or higher is required to call user-defined scripts or executables");
+            msg(M_FATAL, "ERROR: starting with " PACKAGE_NAME " 2.1, '--script-security 2' or higher is required to call user-defined scripts or executables");

Generally speaking, I am fine with this (so Feature-ACK).

What I am struggling with though is that this may break existing configurations for users who do have an invalid configuration file. In this case trying to use scripts without --script-security *and* ignoring that their scripts does not work. The cynical me says "scr** them, they need to fix their configs".

But I also got lots of complaints from Fedora users when we changed _incorrect_ configurations to fail in similar ways. It's just amazing how few users who really *read* their log files. So with this in mind, I think this behavioural change should go in 2.5 only.

So I can give this a full ACK for git master only.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#2 lore raw

Hi,

Quoted 1 line · David Sommerseth

So I can give this a full ACK for git master only.

I can see your line of reasoning, but there is another aspect to it - we want to change the windows GUI to override script-security, to disarm possibly dangerous .ovpn files that have "--up $eviltrickery" in them.

With this change, the GUI has a chance to tell people "look, this is the problem. If you trust the source, you can enable scripts in this config (press <here>), if not, you better leave the ovpn alone!" - without, things will silently stop working for windows users...

But we *do* want this on windows, disable script-security unless explicitely activated *outside* the .ovpn file...

(I'm halfway tempted to make this an #ifdef _WIN32, but that cannot truly be the way forward)

So - I had planned to give this an ACK both for 2.4 and master, but since you have reservations, we need to find the best way forward.

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
author
#5 lore raw
In reply to a message not in the archive

Hi,

Quoted 66 lines · David Sommerseth
Quoted 4 lines · Selva Nair

Hi

On Fri, Feb 15, 2019 at 3:26 PM David Sommerseth
<[email protected]... <mailto:

[email protected]...>>

Quoted 3 lines

wrote:

    On 11/02/2019 21:46, [email protected]... <mailto:
Quoted 1 line · [email protected]...> wrote:
Quoted 1 line

From: Selva Nair <[email protected]... <mailto:

[email protected]...>>

Quoted 8 lines
Quoted 8 lines

Currently this raises a warning only. A fatal error is triggered later with a confusing message that script failed to execute.

This helps the Windows GUI to show a relevant error message when script-security is over-ridden as a security measure.

Quoted 15 lines
    <mailto:[email protected]...>>
    > ---
    >  src/openvpn/init.c | 2 +-
    >  1 file changed, 1 insertion(+), 1 deletion(-)
    >
    > diff --git a/src/openvpn/init.c b/src/openvpn/init.c
    > index 3c44967..5863828 100644
    > --- a/src/openvpn/init.c
    > +++ b/src/openvpn/init.c
    > @@ -3206,7 +3206,7 @@ do_option_warnings(struct context *c)
    >          }
    >          else
    >          {
    > -            msg(M_WARN, "NOTE: starting with " PACKAGE_NAME " 2.1,
    '--script-security 2' or higher is required to call user-defined

scripts

Quoted 2 lines

or executables");
> + msg(M_FATAL, "ERROR: starting with " PACKAGE_NAME "

2.1,

Quoted 1 line

'--script-security 2' or higher is required to call user-defined

scripts

Quoted 6 lines

or executables");

Generally speaking, I am fine with this (so Feature-ACK).

What I am struggling with though is that this may break existing configurations for users who do have an invalid configuration file.

In this

Quoted 1 line

case trying to use scripts without --script-security *and* ignoring

that their

Quoted 1 line

scripts does not work. The cynical me says "scr** them, they need

to fix

Quoted 3 lines

their configs".

I fail to get this.. Users cannot ignore it as currently they do get a

FATAL

Quoted 3 lines

error in such cases.
I'm only moving the error to happen earlier.
Am I missing something?

So another M_FATAL occurs later on? I haven't checked the code yet, but I was
quite sure there were scenarios where scripts failed to run - with with some
other complaints in the log.

Quoted 4 lines

If all script hooks results in M_FATAL later on (server and client configs),
then this is a non-issue.

That got me worried as I had checked this only with up/down scripts on client
in which case it causes a FATAL error later in openvpn_run_script.

But you are right, not all scripts cause FATAL error when not executed or failed..

In that case, a better option may be to get a proper error msg -- instead of "external program fork failed"
we want "script not executed because of script-security < xxx " or something like that..

Selva