summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-04 20:32:36 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-04 20:34:44 +0200
commit8257a5e67679fe6b7b74e8ba4b57547209a281d2 (patch)
tree3a70a1b7815d2ed61e4965862c246205c06c4ae8 /src
parentb142ab9f5093e10915cba08852f75a94be0b9ee6 (diff)
downloadvyos-1x-8257a5e67679fe6b7b74e8ba4b57547209a281d2.tar.gz
vyos-1x-8257a5e67679fe6b7b74e8ba4b57547209a281d2.zip
openvpn: T1617: T1632: support quotes in openvpn-option
The following CLI command can be used to add a raw option to OpenVPN which requires quotes: > set interfaces openvpn vtun10 openvpn-option 'push &quot;keepalive 1 10&quot;' The resulting config file will then have the following set: > push "keepalive 1 10"
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interface-openvpn.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/conf_mode/interface-openvpn.py b/src/conf_mode/interface-openvpn.py
index 4e5915d4e..91679084e 100755
--- a/src/conf_mode/interface-openvpn.py
+++ b/src/conf_mode/interface-openvpn.py
@@ -806,6 +806,11 @@ def generate(openvpn):
tmpl = jinja2.Template(config_tmpl)
config_text = tmpl.render(openvpn)
+
+ # we need to support quoting of raw parameters from OpenVPN CLI
+ # see https://phabricator.vyos.net/T1632
+ config_text = config_text.replace("&quot;",'"')
+
with open(get_config_name(interface), 'w') as f:
f.write(config_text)
os.chown(get_config_name(interface), uid, gid)