-
-
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?
Conversation
nemesifier
left a comment
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.
@okraits this change would be backward incompatible. Why is it needed?
Can you provide an example of a value that you can't supply now and you'd be able to supply with the list format?
I gave an example and the reasoning in the related issue. |
nemesifier
left a comment
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.
What about avoiding the schema change and change the code internally to convert the string to a list with 1 element so that it's rendered as a list?
Is the problem just the rendering of UCI option vs UCI list?
Or do we actually need to allow multiple lines with different values?
I think this would be an appropriate solution as well.
Rendering the parameter as an UCI list is required for the parameter to work. In the LuCI OpenVPN app it's possible to create multiple list items with different values but I think for most usecases of netjsonconfig it would be sufficient to have one list item. |
We can do this here: We need two tests:
Ok so it sounds to methat handling this internally it's the best option as it's just an output issue. |
7243175 to
e0f2824
Compare
Fixes #349 Signed-off-by: Oliver Kraitschy <[email protected]>
e0f2824 to
d2077a6
Compare
|
@nemesifier I implemented the change as suggested. Do you think we need more or other tests? |
|
@nemesifier Any opinion on this? |
pandafy
left a comment
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.
Thanks for your patience @okraits.
It took me some time to understand the working of the tls_cipher setting in OpenVPN, hence the delay.
| 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] |
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.
Since it is possible to have more than one cipher suite present in tls_cipher, it may be possible that there are more than 1 item in the list.
I think we should combine all the items in the list to one string instead of just using the first one.
| if (cipher := vpn.get("tls_cipher")) and isinstance(cipher, str): | ||
| vpn["tls_cipher"] = [cipher] |
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 :@SECLEVEL should stay intact.
E.g.:
TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0
should become
TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0
| "script_security": 1, | ||
| "status": "/var/log/openvpn.status 30", | ||
| "status_version": 1, | ||
| "tls_cipher": "TLS-DHE-RSA-WITH-AES-256-CBC-SHA:@SECLEVEL=0", |
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.
We need to update this test to have multiple ciphers.
Fixes #349
Checklist
Reference to Existing Issue
Closes #349.
Description of Changes
Made the parameter
tls_cipheran array and updated the documentation accordingly. There were no tests to update.