Parametrize wg.conf template
This commit is contained in:
parent
f5af9eeb59
commit
d704202e6e
|
@ -24,6 +24,8 @@ def create_app(test_config=None):
|
|||
'admin_mail': '',
|
||||
'wg_endpoint': '',
|
||||
'wg_port': '51820',
|
||||
'wg_allowed_nets': '',
|
||||
'wg_dns': False,
|
||||
'wg_key': '',
|
||||
'wg_net': '',
|
||||
'version': 0,
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
# PublicKey = {{ pubkey }}
|
||||
PrivateKey = # paste private key here
|
||||
Address = {{ ip }}
|
||||
{% if use_dns %}DNS = 212.235.188.28,212.235.188.29,fri1.uni-lj.si{% endif %}
|
||||
{%- if dns %}
|
||||
DNS = {{ dns }}
|
||||
{%- endif %}
|
||||
|
||||
[Peer]
|
||||
Endpoint = {{ server }}:{{ port }}
|
||||
PublicKey = {{ server_key }}
|
||||
PersistentKeepalive = 25
|
||||
AllowedIPs = 10.32.0.0/14
|
||||
AllowedIPs = 212.235.188.16/28
|
||||
AllowedIPs = 212.235.188.32/27
|
||||
AllowedIPs = 212.235.188.64/26
|
||||
{%- for net in allowed_nets.split() %}
|
||||
AllowedIPs = {{ net }}
|
||||
{%- endfor %}
|
||||
{% if add_default -%}
|
||||
AllowedIPs = 0.0.0.0/0
|
||||
{%- endif %}
|
||||
|
||||
|
|
|
@ -67,8 +67,9 @@ def new():
|
|||
'ip': str(ip),
|
||||
'timestamp': now,
|
||||
'name': name,
|
||||
'dns': settings.get('wg_dns') if flask.request.json.get('use_dns', True) else False,
|
||||
'allowed_nets': settings.get('wg_allowed_nets', []),
|
||||
'add_default': flask.request.json.get('add_default', False),
|
||||
'use_dns': flask.request.json.get('use_dns', True),
|
||||
}
|
||||
return flask.render_template('vpn/wg-fri.conf', **args)
|
||||
|
||||
|
|
Loading…
Reference in a new issue