Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[openwisp] Fixed openvpn integration (partially backward incompatible)
- Loading branch information
Showing
with
28 additions
and
26 deletions.
-
+1
−3
netjsonconfig/backends/openwisp/openwisp.py
-
+27
−23
tests/openwisp/test_backend.py
|
@@ -9,8 +9,7 @@ |
|
|
class OpenWisp(OpenWrt): |
|
|
""" OpenWisp 1.x Backend """ |
|
|
schema = schema |
|
|
openwisp_env = Environment(loader=PackageLoader('netjsonconfig.backends.openwisp', |
|
|
'templates'), |
|
|
openwisp_env = Environment(loader=PackageLoader('netjsonconfig.backends.openwisp', 'templates'), |
|
|
trim_blocks=True) |
|
|
|
|
|
def validate(self): |
|
@@ -48,7 +47,6 @@ def _get_install_context(self): |
|
|
if vpn.get('dev_type') != 'tap': |
|
|
continue |
|
|
tap = vpn.copy() |
|
|
tap['name'] = tap['config_value'] |
|
|
l2vpn.append(tap) |
|
|
# bridge list |
|
|
bridges = [] |
|
|
|
@@ -64,34 +64,38 @@ class TestBackend(unittest.TestCase, _TabsMixin): |
|
|
], |
|
|
"openvpn": [ |
|
|
{ |
|
|
"config_name": "openvpn", |
|
|
"config_value": "2693", |
|
|
"enabled": "1", |
|
|
"client": "1", |
|
|
"ca": "/tmp/owispmanager/openvpn/x509/ca_1_service.pem", |
|
|
"cert": "/tmp/owispmanager/openvpn/x509/l2vpn_client_2693.pem", |
|
|
"cipher": "AES-128-CBC", |
|
|
"comp_lzo": "yes", |
|
|
"dev": "tap0", |
|
|
"dev_type": "tap", |
|
|
"proto": "tcp-client", |
|
|
"remote": "vpn.openwisp.org 12128", |
|
|
"nobind": "1", |
|
|
"down": "/tmp/owispmanager/openvpn/vpn_2693_script_down.sh", |
|
|
"enabled": True, |
|
|
"keepalive": "5 40", |
|
|
"ns_cert_type": "server", |
|
|
"resolv_retry": "infinite", |
|
|
"comp_lzo": "yes", |
|
|
"tls_client": "1", |
|
|
"ca": "/tmp/owispmanager/openvpn/x509/ca_1_service.pem", |
|
|
"key": "/tmp/owispmanager/openvpn/x509/l2vpn_client_2693.pem", |
|
|
"cert": "/tmp/owispmanager/openvpn/x509/l2vpn_client_2693.pem", |
|
|
"log": "/tmp/openvpn_2693.log", |
|
|
"mode": "client", |
|
|
"mute": 10, |
|
|
"mute_replay_warnings": True, |
|
|
"name": "2693", |
|
|
"nobind": True, |
|
|
"ns_cert_type": "server", |
|
|
"persist_tun": True, |
|
|
"proto": "tcp-client", |
|
|
"remote": [ |
|
|
{ |
|
|
"host": "vpn.openwisp.org", |
|
|
"port": 12128 |
|
|
} |
|
|
], |
|
|
"resolv_retry": True, |
|
|
"script_security": 1, |
|
|
"tls_client": True, |
|
|
"up": "/tmp/owispmanager/openvpn/vpn_2693_script_up.sh", |
|
|
"down": "/tmp/owispmanager/openvpn/vpn_2693_script_down.sh", |
|
|
"cipher": "AES-128-CBC", |
|
|
"script_security": "3", |
|
|
"up_delay": "1", |
|
|
"up_restart": "1", |
|
|
"persist_tun": "1", |
|
|
"mute_replay_warnings": "1", |
|
|
"verb": "1", |
|
|
"mute": "10", |
|
|
"log": "/tmp/openvpn_2693.log" |
|
|
"up_delay": 1, |
|
|
"up_restart": True, |
|
|
"verb": 1 |
|
|
} |
|
|
], |
|
|
"tc_options": [ |
|
|