summaryrefslogtreecommitdiff
path: root/data/templates/openvpn/service-override.conf.j2
blob: d7551eb924806ceb64c7d7a5aee518a526ee1dff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{% set options = namespace(value=0) %}
{% if openvpn_option is vyos_defined %}
{%     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 %}
{%         set options.value = options.value ~ ' --' ~ option %}
{%     endfor %}
{% endif %}
[Service]
ExecStart=
ExecStart=/usr/sbin/openvpn --daemon openvpn-%i --config %i.conf --status %i.status 30 --writepid %i.pid {{ options.value }}