summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/vpn_sstp.py21
-rwxr-xr-xsrc/migration-scripts/sstp/0-to-113
2 files changed, 23 insertions, 11 deletions
diff --git a/src/conf_mode/vpn_sstp.py b/src/conf_mode/vpn_sstp.py
index 12d62ad70..e0ebb2ad9 100755
--- a/src/conf_mode/vpn_sstp.py
+++ b/src/conf_mode/vpn_sstp.py
@@ -91,12 +91,9 @@ gw-ip-address={{gw}}
{% if dnsv4 %}
[dns]
-{% if dnsv4['primary'] %}
-dns1={{dnsv4['primary']}}
-{% endif -%}
-{% if dnsv4['secondary'] %}
-dns2={{dnsv4['secondary']}}
-{% endif -%}
+{% for dns in dnsv4 -%}
+dns{{ loop.index }}={{ dns }}
+{% endfor -%}
{% endif %}
{% if authentication['mode'] == 'local' %}
@@ -252,7 +249,7 @@ def get_config():
},
'ip_pool' : [],
'gw' : None,
- 'dnsv4' : {},
+ 'dnsv4' : [],
'mtu' : None,
'ppp' : {},
}
@@ -352,10 +349,8 @@ def get_config():
config_data['ip_pool'] = c.return_values('network-settings client-ip-settings subnet')
if c.exists('network-settings client-ip-settings gateway-address'):
config_data['gw'] = c.return_value('network-settings client-ip-settings gateway-address')
- if c.exists('network-settings dns-server primary-dns'):
- config_data['dnsv4']['primary'] = c.return_value('network-settings dns-server primary-dns')
- if c.exists('network-settings dns-server secondary-dns'):
- config_data['dnsv4']['secondary'] = c.return_value('network-settings dns-server secondary-dns')
+ if c.exists('network-settings name-server'):
+ config_data['dnsv4'] = c.return_values('network-settings name-server')
if c.exists('network-settings mtu'):
config_data['mtu'] = c.return_value('network-settings mtu')
@@ -374,6 +369,7 @@ def get_config():
def verify(c):
if c == None:
return None
+
### vertify auth settings
if c['authentication']['mode'] == 'local':
if not c['authentication']['local-users']:
@@ -390,6 +386,9 @@ def verify(c):
if not c['authentication']['local-users'][usr]['upload']:
raise ConfigError('user ' + usr + ' requires upload speed value')
+ if len(c['dnsv4']) > 2:
+ raise ConfigError("Only 2 DNS name-servers can be configured")
+
if not c['certs']['ca'] or not c['certs']['server-key'] or not c['certs']['server-cert']:
raise ConfigError('service sstp-server sstp-settings ssl-certs needs the ssl certificates set up')
else:
diff --git a/src/migration-scripts/sstp/0-to-1 b/src/migration-scripts/sstp/0-to-1
index 0fe1a203f..88d3b4fb4 100755
--- a/src/migration-scripts/sstp/0-to-1
+++ b/src/migration-scripts/sstp/0-to-1
@@ -45,6 +45,19 @@ else:
config.copy(old_base, new_base)
config.delete(old_base)
+ # migrate DNS servers
+ dns_base = new_base + ['network-settings', 'dns-server']
+ if config.exists(dns_base):
+ if config.exists(dns_base + ['primary-dns']):
+ dns = config.return_value(dns_base + ['primary-dns'])
+ config.set(new_base + ['network-settings', 'name-server'], value=dns, replace=False)
+
+ if config.exists(dns_base + ['secondary-dns']):
+ dns = config.return_value(dns_base + ['secondary-dns'])
+ config.set(new_base + ['network-settings', 'name-server'], value=dns, replace=False)
+
+ config.delete(dns_base)
+
print(config.to_string())
sys.exit(1)