File tree Expand file tree Collapse file tree 4 files changed +11
-0
lines changed
netjsonconfig/backends/openwrt/converters Expand file tree Collapse file tree 4 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ def __intermediate_vpn(self, vpn):
1515 "enabled" : not vpn .pop ("disabled" , False ),
1616 }
1717 )
18+ if (cipher := vpn .get ('tls_cipher' )) and isinstance (cipher , str ):
19+ vpn ['tls_cipher' ] = [cipher ]
1820 return super ().__intermediate_vpn (vpn , remove = ["" ])
1921
2022 def __netjson_vpn (self , vpn ):
@@ -24,4 +26,7 @@ def __netjson_vpn(self, vpn):
2426 vpn ["disabled" ] = vpn .pop ("enabled" , "0" ) == "0"
2527 vpn ["name" ] = vpn .pop (".name" )
2628 del vpn [".type" ]
29+ if (cipher := vpn .get ('tls_cipher' )) and isinstance (cipher , list ) \
30+ and cipher :
31+ vpn ['tls_cipher' ] = cipher [0 ]
2732 return super ().__netjson_vpn (vpn )
Original file line number Diff line number Diff line change @@ -257,6 +257,7 @@ def test_client_mode(self):
257257 "status_version" : 1 ,
258258 "tls_client" : True ,
259259 "tls_auth" : "tls_auth.key 1" ,
260+ "tls_cipher" : "TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0" ,
260261 "topology" : "p2p" ,
261262 "tun_ipv6" : True ,
262263 "up" : "/home/user/up-command.sh" ,
@@ -302,6 +303,7 @@ def test_client_mode(self):
302303status /var/log/openvpn.status 30
303304status-version 1
304305tls-auth tls_auth.key 1
306+ tls-cipher TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0
305307tls-client
306308topology p2p
307309tun-ipv6
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ def test_parse_server(self):
7474script-security 0
7575status /var/log/openvpn.status 10
7676status-version 1
77+ tls-cipher TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0
7778tls-server
7879user nobody
7980verb 3
@@ -110,6 +111,7 @@ def test_parse_server(self):
110111 "script_security" : 0 ,
111112 "status" : "/var/log/openvpn.status 10" ,
112113 "status_version" : 1 ,
114+ "tls_cipher" : "TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0" ,
113115 "tls_server" : True ,
114116 "user" : "nobody" ,
115117 "verb" : 3 ,
Original file line number Diff line number Diff line change @@ -211,6 +211,7 @@ def test_parse_server_mode_data_ciphers(self):
211211 "script_security" : 1 ,
212212 "status" : "/var/log/openvpn.status 30" ,
213213 "status_version" : 1 ,
214+ "tls_cipher" : "TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0" ,
214215 "tls_client" : True ,
215216 "tun_ipv6" : True ,
216217 "up" : "/home/user/up-command.sh" ,
@@ -254,6 +255,7 @@ def test_parse_server_mode_data_ciphers(self):
254255 option script_security '1'
255256 option status '/var/log/openvpn.status 30'
256257 option status_version '1'
258+ list tls_cipher 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0'
257259 option tls_client '1'
258260 option tun_ipv6 '1'
259261 option up '/home/user/up-command.sh'
You can’t perform that action at this time.
0 commit comments