Notification command to toggle wireguard tunnel
See original GitHub issueIs your feature request related to a problem? Please describe.
I realize this one is probably kind of a long-shot since its specific to a not particularly popular app but figured it can’t hurt to ask 😃
I really like the community add-on for wireguard and have been using it for a bit to meet my home VPN needs. Sometime last year the Wireguard team worked with Tasker to add support for toggling a tunnel from Tasker. They did it generically though, all tasker actually does is fire an intent that Wireguard is listening for which means the HA android app could do it too.
I am not able to find an obvious documentation site for the Wireguard android app unfortunately. This post here by the lead developer does describe what Tasker had to do so we can borrow it.
The intents themselves are pretty straightforward, broadcast com.wireguard.android.action.SET_TUNNEL_UP
and com.wireguard.android.action.SET_TUNNEL_DOWN
with tunnel:<tunnel name>
in the extra to com.wireguard.android
. The tricky bit is they permission locked the intent. So in order to do this the HA companion app would have to add this to the manifest and declare a new permission:
<uses-permission android:name="com.wireguard.android.permission.CONTROL_TUNNELS"/>
The first time you try to toggle a tunnel will require user interaction since it will pop-up a prompt asking the user to accept this permission. After that the tunnel can be toggled on/off without any user interaction required. I use it currently for turning on the tunnel when I’m on any wifi other then a fixed list of trusted networks.
Describe the solution you’d like
Would love a new command like:
message: command_wireguard_tunnel
title: up/down or on/off
data:
channel: <tunnel name>
Describe alternatives you’ve considered, if any
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
So I’m not totally sure how it all works. But I can tell you I definitely saw the pop-up the first time I toggled the tunnel and had to accept it. And in permissions for tasker it says “additional permissions” that when clicked shows this So I think they did? Otherwise idk how else this would get here [EDIT] Just saw this picture on my mac, did not realize how huge it was lol. Making it a normal size
Makes sense. I was wondering about that too, seemed like a better way to do it. But I guess the challenge there is clearly any app can listen to intents (since that’s exactly what Tasker does). So if you just throw an encrypted value in an extra then another app could grab that encrypted value and reuse it.
But the idea of password-protecting an intent makes a lot of sense. Seems like something android should add. Like a “secure extra” concept that manages encryption/security of that data for you and only allows the value to be read by the targeted package.
Anyway this is all an aside, would be a feature request for android anyway. Thanks for looking into it.