summaryrefslogtreecommitdiff
path: root/data/templates/openvpn/service-override.conf.tmpl
diff options
context:
space:
mode:
authorLulu Cathrinus Grimalkin <me@erkin.party>2021-11-24 14:27:08 +0300
committerGitHub <noreply@github.com>2021-11-24 14:27:08 +0300
commitc0eff50f7be4ee365d0b5ce828f64a66574c4f06 (patch)
treebcffc2c52f29d12ef20854fbea2d2e60b7f7627e /data/templates/openvpn/service-override.conf.tmpl
parentc0b09fe341c7ddced42479e0192a28ca553e30d6 (diff)
parent771301fea060467945e6c55379dd8e761aa9ad9d (diff)
downloadvyos-1x-c0eff50f7be4ee365d0b5ce828f64a66574c4f06.tar.gz
vyos-1x-c0eff50f7be4ee365d0b5ce828f64a66574c4f06.zip
Merge branch 'vyos:equuleus' into equuleus
Diffstat (limited to 'data/templates/openvpn/service-override.conf.tmpl')
-rw-r--r--data/templates/openvpn/service-override.conf.tmpl20
1 files changed, 20 insertions, 0 deletions
diff --git a/data/templates/openvpn/service-override.conf.tmpl b/data/templates/openvpn/service-override.conf.tmpl
new file mode 100644
index 000000000..069bdbd08
--- /dev/null
+++ b/data/templates/openvpn/service-override.conf.tmpl
@@ -0,0 +1,20 @@
+[Service]
+ExecStart=
+ExecStart=/usr/sbin/openvpn --daemon openvpn-%i --config %i.conf --status %i.status 30 --writepid %i.pid
+{%- if openvpn_option is defined and openvpn_option is not none %}
+{% for option in openvpn_option %}
+{# Remove the '--' prefix from variable if it is presented #}
+{% if option.startswith('--') %}
+{% set option = option.split('--', maxsplit=1)[1] %}
+{% endif %}
+{# Workaround to pass '--push' options properly. Previously openvpn accepted this option without values in double-quotes #}
+{# But now it stopped doing this, so we need to add them for compatibility #}
+{# HOWEVER! This is a raw option and we do not promise that this or any other trick will work for all the cases. #}
+{# Using 'openvpn-option' you take all responsibility for compatibility for yourself. #}
+{% if option.startswith('push') and not (option.startswith('push "') and option.endswith('"')) %}
+{% set option = 'push \"%s\"'|format(option.split('push ', maxsplit=1)[1]) %}
+{% endif %}
+ --{{ option }}
+{%- endfor %}
+{% endif %}
+