-
-
Notifications
You must be signed in to change notification settings - Fork 311
feat: VPN toggle #689
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
base: main
Are you sure you want to change the base?
feat: VPN toggle #689
Conversation
- Added VPN service for wg-quick - Added VPN toggle to utilities quick toggles - Configuration in UtilitiesConfig (enabled, connectionName)
- Using nmcli monitor for state detection instead of polling - Added VPN toast notifications
Do you think you can add support for netbird? It's mesh VPN like tailscale with |
I'll take a look at it, shouldn't be much harder than making a provider/tunnel variable for the actual command, since the rest of this just checks for changes in the network and if any active connections match the named tunnel defined in config or not Edit: a little bit more involved actually it seems, but still doable :) |
- Added support for netbird and tailscale providers - Universal interface detection using ip link show - Provider-specific privilege handling (pkexec only for wireguard) - Updated README with VPN configuration examples
@Cleboost Added now, works great, I like how it didn't need sudo or pkexec so I made just wireguard use that explicitly, so super smooth experience to toggle it for netbird :) |
It's perfect thanks :) |
@PixelKhaos not sure if it's relatable but is it possible to add 1.1.1.1/warp in there as well? i believe there's quite a similar module in end4's configs, but please let me know :P |
It's kinda the same, with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works great, but for wireguard you have to add in a polkit rule and it has to return as YES
, not AUTH_SELF_KEEP
. other than that, everything works fine!
@AlmiWasFound Oh yeah, changed that now, not sure why but seems there was some change so I too encountered it not allowing to run it. I have also modified this whole bit to include a mapping of some default providers, and reworked to easily just define in the A simple setup of using any predefined one, like warp can be; "vpn": {
"enabled": true,
"provider": ["warp"]
} or as custom as; "vpn": {
"enabled": true,
"provider": [
{
"name": "wireguard",
"interface": "torguard",
"displayName": "Wireguard (Torguard)",
"connectCmd": ["pkexec", "wg-quick", "up", "torguard"],
"disconnectCmd": ["pkexec", "wg-quick", "down", "torguard"]
}
]
} It will default for most things here, but lets you override things if there would ever be any need for it, or of course, just add whatever other provider you want to use or aliases, etc. |
Awesome! Everything works as expected! Tysm for the help, really appreciate it :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments dont work in .json files as far as i know, which causes the shell to not process/parse the code/vars in the shell.json file. correct me if im wrong though. everything else works fine
Was thinking people would remove the comments, since it's not jsonc, but better to remove it alltogether probably yeah. |
yeah, prob. you have to somehow add them in at the FAQ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Just a few issues with style, I don't use a VPN personally so I didn't test this, but I trust that it works.
Oh yeah, understandable, in general it's all working with defaults, it's pretty straightforward check of whether configured interfaces are active or not, testing against defaults, but don't depend on any complex setups. all of these were free for me to test other than wireguard which I use myself and is the more particular one to setup. And appreciate the feedback, pretty new to QML so there's some things I have to unlearn and get used to convention wise :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All work fine for me :)
I think you forgot to update the readme with new config
{ | ||
"name": "wireguard", | ||
"interface": "your-connection-name", | ||
"displayName": "Wireguard (Your VPN)" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | |
"name": "wireguard", | |
"interface": "your-connection-name", | |
"displayName": "Wireguard (Your VPN)" | |
} | |
{ | |
"name": "wireguard", | |
"interface": "your-connection-name", | |
"displayName": "Wireguard (Your VPN)", | |
"connectCmd": ["pkexec", "wg-quick", "up", "torguard"], | |
"disconnectCmd": ["pkexec", "wg-quick", "down", "torguard"] | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, those two extra lines are super optional, just as a way to specify outside of any of the other patterns of up/down|connect/disconnect. I would assume it almost never be used, but wanted it supported just in case.
Fairly straightforward, optional toggle for using wireguard, netbird, tailscale VPN, using
[provider] [up|down]
on toggles andip link show
to list whether connections are available or not whenever a network change occurs.Including toasts for connecting/disconnecting, and whenever shell starts.
pkexec is used for the auth for wireguard, I did setup a polkit rule for a session, otherwise asked for password on every toggle.
No getting around wg-quick being root
Edit: polkit rule adjusted to Result.YES
Updated for providers to be user configured, shortform allowed to use defaults.
A simple setup of using any predefined one, like warp can be;
or as custom as;