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

Support Wireguard as a VPN connection #338

Merged
merged 5 commits into from
Oct 26, 2023
Merged

Conversation

milouse
Copy link
Contributor

@milouse milouse commented Aug 22, 2022

This MR is an up-to-date (continuously rebased) follow up of the #302 MR plus some little adjustments.

From my point of view every thing is working as expected, but I’m open to discussion :)

@crisconru
Copy link

Is this not moving forward? Wireguard is included even in Linux Kernel. It would be really nice that the Elementary OS supported by default. Since I used Wireguard for the first time I left OpenVPN. It's a bit pity when you try to add a Wireguard connection and it gives you an error.

@milouse
Copy link
Contributor Author

milouse commented Jul 24, 2023

@danirabbit I just rebase this MR on master. Do you mind have a look at it? I’d be great to have it merged. It’d help a lot for a day to day work with wireguard.

This MR is unrelated with the other I opened for the wingpanel applet. This MR build just fine and works exactly as expected.

Thank you very much.

@milouse milouse force-pushed the wireguard branch 3 times, most recently from 6a74a3e to c334192 Compare July 24, 2023 19:43
@zeebok
Copy link
Contributor

zeebok commented Sep 14, 2023

From what I can see here, the code looks alright. I do not have a way to quickly test this. Maybe @danirabbit can or knows somebody who can?

@milouse
Copy link
Contributor Author

milouse commented Sep 15, 2023

(rebase are better to read in a MR than wild merge. Do not hesitate to ask for a rebase :) )

@rasmus91
Copy link

rasmus91 commented Oct 3, 2023

Hey, naive question but should I be able to build and install this on the current version of elementary OS, or does this need to be on a newer build/release?

I have a wireguard config setup to be used with wgquick but it isn't picked up by the network manager. I can't see it in the switchboard plug or the wingpanel indicator. And as far as I can tell, this does not allow one to create WG configs from the switchboard.

@milouse
Copy link
Contributor Author

milouse commented Oct 3, 2023

Yes, you can have a try. The most simple way to test it is to do the following:

  1. First, be sure to make a backup of the current switchboard network plug: cp /usr/lib/switchboard/network/libnetworking.so ~/
  2. Ensure to close all instances of switchboard (settings app)
  3. Follow the instruction on the README. You might have to install the listed build dependencies first.
  4. Once the build suceeds, you should find a fresh libnetworking.so file in the ./build/src subfolder. Copy this file in /usr/lib/switchboard/network (overwriting the packaged one).

Nothing more to do. Try to start the settings app and go to the network section. You should see any wireguard configuration there. If anything goes wrong (settings app crashes…) just replace your built libnetworking.so file with the backup you made on step 1 and everything will come back as before.

That said, I’m not sure what "wg-quick" really is. The current MR only deals with wireguard connection configured through NetworkManager (i.e. your wireguard config must be setup/appear in nm-connection-editor).

@rasmus91
Copy link

rasmus91 commented Oct 4, 2023

  1. cp /usr/lib/switchboard

The directory there doesn't even exist. rather: /usr/lib/x86_64-linux-gnu/switchboard/network/libnetworking.so

But replacing that does not seem to do the trick. ( my wireguard config is visible as home with nm-connection-editor). And what i mean by the trick, is that I can neither see my existing wireguard conf or create a new one.

wg-quick is just a commandline tool for quickly bringing up a wireguard config

@milouse
Copy link
Contributor Author

milouse commented Oct 4, 2023

On which system are you? I’m on archlinux on my side, the install path to switchboard libs can vary from one distribution to another. For the same reason, you might have to change a little the README instruction to match your distribution environment.

But if it compiled without any error and produces a .so file in the end, it’s weird that you don’t see your home connection in the VPN list of switchboard. Maybe you’ll need to log-out/log in again your user session to make it works? Just in case (sorry for the stupid question), are you sure you cloned my "wireguard" branch from my own cloned repository (and not build from this repository) ?

@rasmus91
Copy link

rasmus91 commented Oct 6, 2023

Right, I figured it out. But for anyone reading this:

I have tested this on Ubuntu 22.04 with elementary Desktop installed (and will on elementary too, and update here accordingly)

procedure to install:

git clone https://github.com/milouse/switchboard-plug-network.git
cd switchboard-plug-network
git switch wireguard
meson build --prefix=/usr
cd build
ninja
sudo cp src/libnetworking.so /usr/lib/x86_64-linux-gnu/switchboard/network/libnetworking.so
sudo chmod 644 /usr/lib/x86_64-linux-gnu/switchboard/network/libnetworking.so
sudo chown root:root /usr/lib/x86_64-linux-gnu/switchboard/network/libnetworking.so

any wireguard connection you wish to manage this way should be set up using nm-connection-editor

On Ubuntu with elementary Desktop: It works very well.
On elmentary OS: It also works very well.

I've seen no inconsistency in functionality on either system, it just works.

Copy link
Contributor

@zeebok zeebok left a comment

Choose a reason for hiding this comment

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

Thanks for the good work!

@tintou tintou merged commit 4553bda into elementary:master Oct 26, 2023
4 checks passed
@milouse milouse deleted the wireguard branch November 2, 2023 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants