Skip to content
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

networking: Add support for WireGuard #19024

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

subhoghoshX
Copy link
Member

@subhoghoshX subhoghoshX commented Jun 26, 2023

TODO:

Follow-ups:

Networking: Add support for WireGuard

The Networking page can now create and edit WireGuard VPN connections.

Screen Shot 2023-08-07 at 08 36 04

Screen Shot 2023-09-13 at 08 02 43

Many thanks to Subho Ghosh for adding this feature as part of his Google Summer of Code project! and thanks to Gil Obradors for his initial work.

test/verify/check-vpn Fixed Show fixed Hide fixed
@martinpitt martinpitt marked this pull request as draft June 27, 2023 03:25
@subhoghoshX
Copy link
Member Author

Oops, I should've written the new tests before pushing. The bot is not pleased at all.

@subhoghoshX
Copy link
Member Author

Rewrote tests using the browser object and some cleanup.

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Some initial early feedback. This is going well, thanks!

pkg/networkmanager/dialogs-common.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/dialogs-common.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/network-main.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/utils.js Outdated Show resolved Hide resolved
pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
test/verify/check-vpn Outdated Show resolved Hide resolved
test/verify/check-vpn Outdated Show resolved Hide resolved
test/verify/check-vpn Outdated Show resolved Hide resolved
@subhoghoshX

This comment was marked as outdated.

test/verify/check-vpn Fixed Show fixed Hide fixed
test/verify/check-vpn Fixed Show fixed Hide fixed
@subhoghoshX subhoghoshX force-pushed the wireguard branch 2 times, most recently from 301cee2 to 1ea465d Compare July 4, 2023 11:07
@subhoghoshX
Copy link
Member Author

Rebased. Renamed the test file and class to something proper. And introduced install_dialog if the wg binary is not found!

@martinpitt

This comment was marked as duplicate.

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thanks!

pkg/networkmanager/dialogs-common.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/manifest.json Outdated Show resolved Hide resolved
pkg/networkmanager/dialogs-common.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/dialogs-common.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/dialogs-common.jsx Outdated Show resolved Hide resolved
test/verify/check-networkmanager-wireguard Outdated Show resolved Hide resolved
test/verify/check-networkmanager-wireguard Outdated Show resolved Hide resolved
test/verify/check-networkmanager-wireguard Outdated Show resolved Hide resolved
test/verify/check-networkmanager-wireguard Outdated Show resolved Hide resolved
test/verify/check-networkmanager-wireguard Outdated Show resolved Hide resolved
@garrett
Copy link
Member

garrett commented Jul 5, 2023

This is looking great! I have some feedback about Martin's feedback and my own feedback based on the screenshot.

  • Missing space between input line and "Generate private key"

These elements are connected. It should probably be an input group with a text input and a button. (See design docs.) The button label should say "Generate"; the form element already has a label of "Private key".

  • Would be nice to make "Private key" a type=password, with a "reveal" button (like here)

No. This is not a password. It also needs to also be copyable. Do not make it a password entry and don't add a reveal button.


Additional feedback:

  • Public and private keys should be in a monospace font.
  • Numbers should be using tabular numbers or monospace. This isn't. (If they're just number entries, then monospace is fine.) (pitti: unclear what this means; it seems fine to me, there are no tables here and we still apply tabular numbers globally)
  • Listen port should be a number input that's restricted width (I think it does this by default). It should also have min/max set up; I haven't looked to see if it does.
  • Addresses should have input helperText (the form input helper text, not the helper text component) that explains which formats are accepted. (IPv4, IPv6, range of addresses, singular address, etc. — whatever is supported, we should show).
  • Is the addresses field space separated or comma separated? Or can it accept both? The helper text should probably state what is expected, and we should probably handle both space and/or comma separated, really.
  • Addresses field could also have examples as placeholder text, but these would have to follow PatternFly guidelines and be in addition to the helperText.
  • Is this a create dialog? Then it should say "Create VPN", not "Save". In edit mode, it should say "Save", however. -- pitti: that is shared between all existing dialogs, they have the same problem → separate PR
  • The title "WireGuard settings" should either be "Create WireGuard VPN" or "Edit WireGuard VPN", based on the mode of the modal. -- pitti: Likewise, shared dialog → separate PR

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

A few more small issues, but the bulk of TODOs are still in the previous rounds of open threads. Thanks!

pkg/networkmanager/interfaces.js Outdated Show resolved Hide resolved
pkg/networkmanager/interfaces.js Outdated Show resolved Hide resolved
pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
test/run Outdated Show resolved Hide resolved
@subhoghoshX

This comment was marked as resolved.

@subhoghoshX subhoghoshX force-pushed the wireguard branch 2 times, most recently from f2155e7 to 332f4bf Compare July 19, 2023 10:19
@subhoghoshX

This comment was marked as resolved.

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Thanks! I resolved all previous review threads, and for easier tracking I also moved all of mine and most of Garrett's UI review into threads. I'm happy to help with the two last generic "create vs. edit" issues in a separate PR, unless you want to do it yourself.

test/verify/check-networkmanager-wireguard Outdated Show resolved Hide resolved
pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
test/verify/check-networkmanager-wireguard Outdated Show resolved Hide resolved
test/verify/check-networkmanager-wireguard Outdated Show resolved Hide resolved
pkg/networkmanager/network-main.jsx Outdated Show resolved Hide resolved
test/verify/check-networkmanager-wireguard Outdated Show resolved Hide resolved
pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
@subhoghoshX subhoghoshX force-pushed the wireguard branch 3 times, most recently from aa0bc6c to a02131c Compare July 24, 2023 13:41
@subhoghoshX

This comment was marked as outdated.

@garrett
Copy link
Member

garrett commented Aug 23, 2023

(Yesterday evening and this morning, I've been working on mockups and sharing in Matrix; they're not here yet. I'll upload soon.)

@garrett
Copy link
Member

garrett commented Aug 24, 2023

Apologies for not uploading these sooner. Here are (what I think) are the current versions of the mockups in various states:

Default:

WireGuard VPN (9)

Popover help for the peers (some text kinda like this; subject to change; feel free to work on it further):

WireGuard VPN (10)

Paste (without private key):

WireGuard VPN (11)

Paste (with the key):

WireGuard VPN (15)

Edit:

WireGuard VPN (13)

@subhoghoshX

This comment was marked as resolved.

@subhoghoshX subhoghoshX force-pushed the wireguard branch 2 times, most recently from ba5df71 to b7a0e7a Compare September 5, 2023 12:00
@subhoghoshX

This comment was marked as resolved.

@subhoghoshX subhoghoshX force-pushed the wireguard branch 2 times, most recently from 59c1e9a to c20234c Compare September 5, 2023 14:31
@garrett

This comment was marked as resolved.

@subhoghoshX

This comment was marked as resolved.

@subhoghoshX subhoghoshX force-pushed the wireguard branch 2 times, most recently from 3991a87 to e49ec19 Compare September 12, 2023 13:18
@martinpitt
Copy link
Member

@garrett 's designs from above are implemented correctly (with the minor changes discussed afterwards). The ? icon position got fixed. I also extensively tested valiation/error messages with wrong values, pasting key, etc. This works really well now! 👏

This needs at least a pixel ref update, and we should also introduce a new pixel test for the dialog, as it has some non-trivial layout and e.g. the question mark position. I'll also go through the code once more.

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Great! Just some trivialities, I'll deal with them together with the pixel test updates.

pkg/networkmanager/wireguard.jsx Outdated Show resolved Hide resolved
test/verify/check-networkmanager-wireguard Outdated Show resolved Hide resolved
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

I updated the pixel test, added a new one for the dialog, fixed the two trivial issues above, and updated the release note to current screenshots. Let's land! once green! 🚀

@subhoghoshX congratulations! Can you please look at the two follow-ups in the description?

model,
modify,
{
fail_text: cockpit.format(_("Creating this $0 will break the connection to the server, and will make the administration UI unavailable."), type == 'vlan' ? 'VLAN' : type),
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test. Details

rollback_on_failure: type != 'vlan',
});
} catch (e) {
setDialogError(typeof e === 'string' ? e : e.message);
Copy link
Contributor

Choose a reason for hiding this comment

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

This added line is not executed by any test. Details

@martinpitt
Copy link
Member

I have the remaining test failures on my radar, they are unrelated.

@martinpitt martinpitt merged commit 8409619 into cockpit-project:main Sep 13, 2023
91 of 93 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants