Skip to content

[feature] Added support for OpenVPN tls-auth option #174 - #217

Merged
nemesifier merged 6 commits into
masterfrom
issues/174-tls-auth
Mar 10, 2022
Merged

nemesifier merged 6 commits into
masterfrom
issues/174-tls-auth

Conversation

@pandafy

@pandafy pandafy commented Mar 8, 2022

Copy link
Copy Markdown
Member

The OpenVPN backend will automatically create a file for the
key present in "tls_auth" field and update the value of the
"tls-auth" parameter.

Closes #174

@coveralls

coveralls commented Mar 8, 2022 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.06%) to 99.883% when pulling e41c317 on issues/174-tls-auth into f2e692c on master.

@pandafy
pandafy force-pushed the issues/174-tls-auth branch from 8658840 to 490c240 Compare March 8, 2022 13:08
@pandafy pandafy self-assigned this Mar 8, 2022
@pandafy
pandafy force-pushed the issues/174-tls-auth branch from 490c240 to d594f50 Compare March 8, 2022 13:32
The OpenVPN backend will automatically create a file for the
key present in "tls_auth" field and update the value of the
"tls-auth" parameter.

Closes #174
@pandafy
pandafy force-pushed the issues/174-tls-auth branch from d594f50 to 2cd0e92 Compare March 8, 2022 13:53

@nemesifier nemesifier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress, see below.

if len(tls_auth.split(' ')) == 1:
# The TLS Auth key is present in the field.
ca_path = config.get('ca', '')
tls_auth_path = '/'.join(ca_path.split('/')[:-1] + ['tls_auth.key'])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there's multiple VPN servers or clients, do the files collide? If yes, please add a test for this and make sure the tls key is unique (eg: each config has a name which can be used for this).

Comment thread docs/source/backends/openvpn.rst Outdated
+--------------------------+---------+--------------+-------------------------------------------------------------+
| ``verb`` | integer | ``1`` | from ``0`` (disabled) to ``11`` (very verbose) |
+--------------------------+---------+--------------+-------------------------------------------------------------+
| ``tls_auth`` | string | | string containing TLS Auth key |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's move this after tls_cipher, in general, let's add new options where they make sense, not just at the end.

@nemesifier nemesifier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see two issues.

  1. the result in OpenWISP Controller doesn't match what I would expect

Screenshot from 2022-03-09 12-55-56

  1. I tried creating a server with the TLS auth key, then created the template client, but suprisingly the TLS auth key on the client was not autogenerated. Please add a specific test for the auto client feature.

Please pull my changes: 4145fc1.

),
"type": "string",
"format": "textarea",
"propertyOrder": 18,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has same propertyOrder as crl_verify.

"crl_verify": {
"title": "CRL",
"description": "Path to CRL file in PEM format",
"type": "string",
"pattern": "^(\\S*)$",
"propertyOrder": 18,
},

@pandafy

pandafy commented Mar 9, 2022

Copy link
Copy Markdown
Member Author

VPN server
Screenshot from 2022-03-09 22-08-23

VPN Client Template
Screenshot from 2022-03-09 22-11-38
Screenshot from 2022-03-09 22-11-54

Device
Screenshot from 2022-03-09 22-19-41
Screenshot from 2022-03-09 22-19-52

@nemesifier
nemesifier merged commit eecbba4 into master Mar 10, 2022
@nemesifier
nemesifier deleted the issues/174-tls-auth branch March 10, 2022 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

[feature] Add support for OpenVPN tls_auth option

3 participants