linuxmint / cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
GNU General Public License v2.0
4.49k stars 732 forks source link

[Feature request] Support WireGuard connections in the Network Manager applet (network@cinnamon.org) #10225

Closed siebenmann closed 9 months ago

siebenmann commented 3 years ago
 * Cinnamon version (cinnamon --version): Cinnamon 5.0.4
 * Distribution - Fedora 34 x86_64
 * Graphics hardware *and* driver used: Intel Corporation HD Graphics 620 (Dell XPS 13 9360), but I'm not sure what Xorg driver

Issue The Network Manager applet doesn't support WireGuard connections, although current versions of NetworkManager do. Such connections aren't shown in the list of networks that you can select (under any category) and there's no sign if one is active or inactive.

NetworkManager reports WireGuard connections as a new type, "wireguard", instead of as type "vpn". Based on looking at the code in files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js, a simple solution might be to add a case for WireGuard connections to the this._ctypes variable that maps NetworkManager types to categories, as a 'vpn' connection. Probably most people using WireGuard connections (especially through the applet) are using them as a form of VPN, instead of more complex usage cases that might want them to be treated separately.

Steps to reproduce Configure a WireGuard connection in NetworkManager, then attempt to see it in Cinnamon.

Expected behaviour You can activate and deactivate a WireGuard connection.

lpapadakos commented 2 years ago

It seems that network-manager-applet itself supports activating WireGuard connections, but cinnamon's applet (which from my understanding, depends on the original applet? not sure) does not.

I tried removing the cinnamon network applet from the taskbar and running nm-applet by itself. Sure enough, under VPN connections there are both WireGuard and OpenVPN entries to toggle.

basmevissen commented 2 years ago

It would also be nice if one could import wireguard configurations. From the command line, it can be done with: nmcli connection import type wireguard file <file>

Inrumpo commented 1 year ago

My search on how to toggle a WireGuard connection from my taskbar in Linux Mint (Cinnamon 5.4.12)brought me here.

For people wondering how to do this in a non-technical but somewhat cumbersome way until this issue is resolved:

To toggle on:

  1. open Network Connections
  2. select your WireGuard connection
  3. klick the options (gear) symbol
  4. Go to the General tab
  5. activate connect automatically with priority set to 0
  6. save and close

To toggle off:

  1. open Network Settings and note that your WireGuard connection is now (temporarily) listed
  2. toggle off
  3. (undo the steps above for toggling it on if you don't want to turn your WireGuard connection on automatically again)
poelstra commented 1 year ago

Same as above, and I found another solution:

image

image

Additionally, to make the status icon update based on the connection's status, save the following as e.g. /etc/NetworkManager/dispatcher.d/update-vpn-status.sh and adjust the 3 <xxx> markers:

#!/bin/sh

iface_name="<your_interface>"
applet_config_file="/home/<your_username>/.config/cinnamon/spices/app-launcher@mchilli/<some_number>.json"

if ! [ "$1" = "${iface_name}" ]
then
    exit 0
fi

if [ "$2" = "up" ]
then
    icon="network-vpn-symbolic"
elif [ "$2" = "down" ]
then
    icon="network-vpn-disabled-symbolic"
else
    exit 0
fi

new_json="$(jq ".[\"launcher-icon\"].value = \"${icon}\"" "${applet_config_file}")"
echo -E "${new_json}" > "${applet_config_file}"
timur-g commented 1 year ago

Also at https://github.com/linuxmint/cinnamon/issues/10854. In forum at https://forums.linuxmint.com/viewtopic.php?p=2232899&hilit=Wireguard#p2232899nd And https://forums.linuxmint.com/viewtopic.php?p=2328032&hilit=Wireguard#p2328032

claudiux commented 1 year ago

Did you try the VPN-Sentinel applet? I'm using Wireguard connections with it. https://cinnamon-spices.linuxmint.com/applets/view/368

timur-g commented 1 year ago

VPN-Sentinel works, but I still find this request appropriate (avoiding unnecesary additions for a single use of turning the connection on and off). I think I read that XFCE supports WireGuard in NM, just Cinnamon not.

Note (in addition to this request): not sure if this one can be made to work in Cinnamon, it assumes WireGuard is a type of VPN connection, which sounds OK, but needs a change of parameters for normal wireguard connections which have it's own type.. https://github.com/max-moser/network-manager-wireguard

claudiux commented 1 year ago

NM supports Wireguard since version 1.16. https://blogs.gnome.org/thaller/2019/03/15/wireguard-in-networkmanager/

To know what is your version: nmcli --version

Ogloppi commented 1 year ago

This is what I would like too. Wireguard should be under VPN section of Network Manager. This way I could easily specify what connections should use my Wireguard VPN connection and what should not. I remember that it's also possible to just import the client .conf file directly from Network Manager GUI on other platforms. It's bizarre how this is not possible on Linux Mint Cinnamon, while for example it is possible on Linux Mint Mate.

damnms commented 11 months ago

i used xfce with wireguard like a charm, i can turn on or off wireguard connections. but when i do that in cinnamons nm applet (turning off wireguard connection), its "gone". there is no way to activate it again in the gui, only with nm cli. that just s*cks. would be nice to have this basic functionality.

timur-g commented 11 months ago

One more aspect of this: today I tried to "import new VPN" via Network Connections using file with WireGuard configuration, it does not work. I added the file conf. via nmcli.

claudiux commented 11 months ago

The PR #11905 try to fix this issue. Can you test it (after saving the original applet.js script) please?

timur-g commented 10 months ago

As seen in PR comments, this works well and should be in merged in Cinnamon IMO. Also there are some detals to clarify.

timur-g commented 9 months ago

Thanks a lot @claudiux . As noted in PR, network connections have "Automatically connect to VPN" and there should also be another check box for "Automatically connect to Wireguard". If done, please link here.

claudiux commented 9 months ago

Screenshot from 2023-12-25 16-53-01

LinuxOnTheDesktop commented 6 months ago

It seems to me that it would be good to be able to prevent the network icon changing to the 'secure' icon. For, the key icon does not immediately put one in mind of networks, and (accordingly) one might have another program, such as the popular KeePassXC, whichuses the key icon. My panel is in the following unfortunate situation - note the two key icons.

image