Skip to content

Commit

Permalink
[openvpn] Differentiate server between manual, routed and bridged
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Sep 21, 2016
1 parent c7e51c6 commit dde3128
Show file tree
Hide file tree
Showing 6 changed files with 385 additions and 120 deletions.
3 changes: 3 additions & 0 deletions netjsonconfig/backends/openvpn/openvpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ def auto_client(self, host, server, ca_path=None, ca_contents=None,
c['proto'] = 'tcp-client'
else:
c['proto'] = 'udp'
# determine if pull must be True
if 'server' in server or 'server_bridge' in server:
c['pull'] = True
# tls_client
if 'tls_server' not in server or not server['tls_server']:
c['tls_client'] = False
Expand Down
3 changes: 3 additions & 0 deletions netjsonconfig/backends/openvpn/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def _transform_vpn(self, vpn):
config = deepcopy(vpn)
skip_keys = ['script_security', 'remote']
delete_keys = []
# allow server_bridge to be empty and still rendered
if config.get('server_bridge') == '':
config['server_bridge'] = True
for key, value in config.items():
if key in skip_keys:
continue
Expand Down
Loading

0 comments on commit dde3128

Please sign in to comment.