[SOLVED] Wireguard GUI configuration

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
stefan_o
Level 2
Level 2
Posts: 55
Joined: Wed Jan 11, 2017 4:40 pm

[SOLVED] Wireguard GUI configuration

Post by stefan_o »

Hi,
I have no problem using wireguard on the terminal to start/stop a client connection, but I recently installed Linux Mint for someone else (the kind of person that 95% of the time is just using the browser and would just assume it's another Windows version). But now there is the need for using Wireguard. On Windows Wireguard comes with a nice symbol in the tray to enable/disable it and see weather it's active, and I know you can start/stop OpenVPN or OpenConnect VPN connections as simple as that using network-manager on Mint. But there seems to be no support for wireguard. Is there a simple solution to start/stop wireguard using network-manager or another GUI application with a tray icon?

Best regards
Stefan
Last edited by LockBot on Wed Jul 19, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
KodiakCanoe
Level 3
Level 3
Posts: 113
Joined: Wed Nov 23, 2022 12:30 am

Re: Wireguard GUI configuration

Post by KodiakCanoe »

Are you using Linux Mint 21.1 Cinnamon? I'm on 20.3 so can't check the Network Manager version on 21.1

Code: Select all

/usr/sbin/NetworkManager --version
Later versions of Network Manager can handle wireguard connections, however they may not show the status in the panel:

https://www.xmodulo.com/wireguard-vpn-n ... r-gui.html
"For example, as of NetworkManager 1.26.2, when WireGuard VPN is up, the network indicator does not show the status icon for WireGuard."

Network Manager may be a good choice to use for connect/disconnect, and to show the status you could use the "bash sensors" Cinnamon applet as a workaround: https://cinnamon-spices.linuxmint.com/applets/view/231

If you're good with bash then it might be possible to also change the connection state (using nmcli) when the applet is clicked

To display status the command could be something like this, with unicode Green Checkmark = Connected, Red X = Disconnected (icons can also be used):

https://unix.stackexchange.com/question ... connection

Code: Select all

if nmcli -g GENERAL.STATE c s interfacename | grep -q 'activ'; then echo -e "\u2705"; else echo -e "\u274c"; fi
Not an expert and I haven't tried that myself, but I do something similar with the bash-sensors applet to show the up/down status of my NordVPN connection.
stefan_o
Level 2
Level 2
Posts: 55
Joined: Wed Jan 11, 2017 4:40 pm

Re: Wireguard GUI configuration

Post by stefan_o »

I'm on Mint 21.1 with NetworkManager version 1.36.6.

Ok, first I was a bit stupid: WireGuard is not listed as VPN connection, but as "virtual" connection, so it as actually supported, but not as VPN.

I was able to import wireguard settings, the wireguard connection shows up in the GUI where I can edit the settings. But not in the list of VPN connections to activate/deactivate. It's not listed at and I couldn't find a way to start/stop the connection using the GUI.

Additionally, for security the key is stored on an encrypted partition. It is set using PostUp in the wireguard conf. That doesn't seem to work with NetworkManager, I also couldn't find a way to manually set a keyfile instead of entering the password directly.

For me bash is horror, in my opinion even PHP is consistent and well-designed compared to bash scripts. No matter how simple the task is, I'd rather use Python instead (in fact, before starting Python, I used PHP for scripts).
KodiakCanoe
Level 3
Level 3
Posts: 113
Joined: Wed Nov 23, 2022 12:30 am

Re: Wireguard GUI configuration

Post by KodiakCanoe »

Unfortunately I'm unable to test it, my network manager version is only 1.22.10 with no wireguard support. I don't know what the problem could be with the keys.

There may be an easier solution out there, but the bash-sensors applet can run a command when the applet is clicked, so if you called a Python script I think that should also work.

Maybe just something simple using nmcli: check the status, if VPN is enabled then disable, if disabled then enable. (I don't know Python) Bash-sensors can refresh the status icon on a timer using the command I gave above, so that will update on it's own.

I think it's worth a shot anyway. I would check if clicking the applet can launch a Python script and then you're most of the way there! Good Luck!
User avatar
Coggy
Level 5
Level 5
Posts: 632
Joined: Thu Mar 31, 2022 10:34 am

Re: Wireguard GUI configuration

Post by Coggy »

In my laptop and desktop (both running Mint) I see an icon in the "system tray" next to the network, sound, bluetooth etc, icons. It's monochrome (like all the others of course) with something that looks like a figure 8, maybe supposed to be a coiled snake. Clicking this, I see a slide switch for each Wireguard VPN where I can turn them on and off.
I have vague memories of having to sudo chmod 755 /etc/wireguard to allow users to at least see the names of the wireguard VPN configuration files before the widget could show them though.
I can post more info when I get in front of a Mint 'puter this evening.

EDIT: Here is a screenshot of the widget:
Screenshot from 2023-01-20 20-48-12.png
Andre8900
Level 1
Level 1
Posts: 17
Joined: Sat Jan 30, 2021 10:49 am

Re: Wireguard GUI configuration

Post by Andre8900 »

I would like to have this feature as well. I want to connect to Wireguard VPNs as easy as I could connect to OpenVPN networks in the NetworkManager. I wasn't able to import my WG config graphically (got an error) and (after importing it via terminal) the connection is listed under its own category ("WireGuard"), but not under "VPN" and it can't be toggled in the GUI. This should not be hard to implement at all as it's just an easy command to execute:

Code: Select all

nmcli connection up 'My VPN'
Is this a bug or is the feature just not implemented yet?
Coggy wrote: Fri Jan 20, 2023 4:52 am In my laptop and desktop (both running Mint) I see an icon in the "system tray" next to the network, sound, bluetooth etc, icons.
Maybe you have installed the Cinnamon Applet for Wireguard that a user has published?
User avatar
Coggy
Level 5
Level 5
Posts: 632
Joined: Thu Mar 31, 2022 10:34 am

Re: Wireguard GUI configuration

Post by Coggy »

Ah, yes., that's it. Menu => Preferences => Applets. Download and install the WireGuard applet.
But I remember that I had to do sudo chmod 755 /etc/wireguard to allow the applet to see the names of the wireguard configuration files inside that folder - they are the names it shows in the applet.
stefan_o
Level 2
Level 2
Posts: 55
Joined: Wed Jan 11, 2017 4:40 pm

Re: Wireguard GUI configuration

Post by stefan_o »

Thanks, works perfectly!
The permissions of the config files in /etc/wireguard should be 600 to prevent everyone from reading the keys. The applet still works fine, as it only uses the filename.
Cattivello
Level 1
Level 1
Posts: 37
Joined: Fri Apr 02, 2021 12:42 pm

Re: [SOLVED] Wireguard GUI configuration

Post by Cattivello »

Hi,
You should check this out.
I just found it as the applet wanted me to change the folder permissions. As I gave folder permissions 700, I was not happy.
This is my configuration:

Code: Select all

mkdir -p /etc/wireguard

Code: Select all

chown root:root /etc/wireguard

Code: Select all

chmod 700 /etc/wireguard
(here is the doc for the above configuration: https://docs.pivpn.io/wireguard/ )

Than installed the GUI for wireguard: https://github.com/UnnoTed/wireguird
Works flawlessly. (assuming you have the .config in the right place)

I hope that makes it easy for your friend.
Dehumanizer
Level 1
Level 1
Posts: 18
Joined: Sat Jun 25, 2016 10:13 am

Re: [SOLVED] Wireguard GUI configuration

Post by Dehumanizer »

The wireguard applet does the trick, but it needs the /etc/wireguard configuration outside of network manager. So the original question is still valid, why it's not possible to activate wireguard from within the network manager applet in cinnamon? It's even possible in Mate in 21.1! I do have mate on one computer and cinnamon on the other, on mate the wireguard connection is among VPNs, in cinnamon it's not, even though I can configure it in connection manager :-/ Isn't there any newer version of network manager applet available for cinnamon which would solve this issue?
Locked

Return to “Networking”