Page MenuHomeVyOS Platform

Cannot use quotes for openvpn-option --route-up
Closed, InvalidPublicBUG

Description

Somewhat related to T1246.

I'm trying to pass arguments to my --route-up script, like this:

set interfaces openvpn vtun0 openvpn-option "--route-up /config/auth/tun_up.sh arg1 arg2"

It doesn't work and openvpn will exit with:

Options error: the --route-up directive should have at most 1 parameter. To pass a list of arguments as one of the parameters, try enclosing them in double quotes ("").

The following doesn't work:

set interfaces openvpn vtun0 openvpn-option "--route-up '/config/auth/tun_up.sh arg1 arg2'"

and will give the error:

Cannot use the single quote (') character in a value string
Value validation failed
Set failed

Is there any solution for this?

Details

Version
1.2.0-rolling-20190416
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

I think this is a parser issue

vyos@vyos# set interfaces openvpn vtun0 openvpn-option "route-up \"echo arg1 arg2\""

  Cannot use the double quote (") character in a value string
  Value validation failed
  Set failed

Openvpn still uses old style templates and perl script, someone more knowledgeable in the parser and template code may be able to help.

$ cat templates-cfg/interfaces/openvpn/node.tag/openvpn-option/node.def 
multi:
type: txt
help: Additional OpenVPN options
lib/Vyatta/OpenVPN/Config.pm
    # extra options
    if (scalar(@{$self->{_options}}) > 0) {
        for my $option (@{$self->{_options}}) {
            if ($option =~ /^--/) {
                $cmd .= " $option";
            } else {
                $cmd .= " --$option";
            }
        }
    }

Even then we may need some escaping tricks to do this properly as the perl code may "eat" up added quotes (would need testing and documenting)

The documentation could also be improved, in particular the option may or may not have -- preceding it, in which case it is added:

syncer triaged this task as Normal priority.
syncer edited projects, added VyOS 1.3 Equuleus; removed VyOS 1.2 Crux.

Sounds like a duplicate of T1632

Please use: set interfaces openvpn vtun0 openvpn-option "--route-up "/config/auth/tun_up.sh arg1 arg2""

... I know it looks ugly!

Please also use a more recent VyOS build, e.g. 1.3 rolling or https://downloads.vyos.io/snapshot/vyos-1.2-snapshot-2019Q4-amd64.iso

c-po changed the task status from Open to Needs testing.Jan 26 2020, 11:09 AM
c-po set Is it a breaking change? to Unspecified (possibly destroys the router).

Closing, 1.3 has rewritten the perl code from scratch in python, but the functionality should be the same.

jjakob moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.