-
-
Notifications
You must be signed in to change notification settings - Fork 82
[fix] Make parameter tls_cipher an array #349 #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ def __intermediate_vpn(self, vpn): | |
| "enabled": not vpn.pop("disabled", False), | ||
| } | ||
| ) | ||
| if (cipher := vpn.get("tls_cipher")) and isinstance(cipher, str): | ||
| vpn["tls_cipher"] = [cipher] | ||
| return super().__intermediate_vpn(vpn, remove=[""]) | ||
|
|
||
| def __netjson_vpn(self, vpn): | ||
|
|
@@ -24,4 +26,6 @@ def __netjson_vpn(self, vpn): | |
| vpn["disabled"] = vpn.pop("enabled", "0") == "0" | ||
| vpn["name"] = vpn.pop(".name") | ||
| del vpn[".type"] | ||
| if (cipher := vpn.get("tls_cipher")) and isinstance(cipher, list) and cipher: | ||
| vpn["tls_cipher"] = cipher[0] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it is possible to have more than one cipher suite present in I think we should combine all the items in the list to one string instead of just using the first one. |
||
| return super().__netjson_vpn(vpn) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -211,6 +211,7 @@ def test_parse_server_mode_data_ciphers(self): | |
| "script_security": 1, | ||
| "status": "/var/log/openvpn.status 30", | ||
| "status_version": 1, | ||
| "tls_cipher": "TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to update this test to have multiple ciphers. |
||
| "tls_client": True, | ||
| "tun_ipv6": True, | ||
| "up": "/home/user/up-command.sh", | ||
|
|
@@ -254,6 +255,7 @@ def test_parse_server_mode_data_ciphers(self): | |
| option script_security '1' | ||
| option status '/var/log/openvpn.status 30' | ||
| option status_version '1' | ||
| list tls_cipher 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0' | ||
| option tls_client '1' | ||
| option tun_ipv6 '1' | ||
| option up '/home/user/up-command.sh' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we will need to split the value in tls_cipher with
:, but we will need to ensure that:@SECLEVELshould stay intact.E.g.:
TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0should become
TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0