Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upCould you add support for VPN service for android? #5
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Vilbrekin
Jan 30, 2014
Owner
Interesting idea indeed. However it would require an important amount of work which I can't deal with right now.
There's also a limitation on Android's VPN interface, which limit's it to TUN mode, while I mainly use TAP mode.
|
Interesting idea indeed. However it would require an important amount of work which I can't deal with right now. |
Vilbrekin
referenced this issue
Mar 11, 2014
Closed
VPN permissions (to access /dev/net/tun without Superuser) #6
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
msva
Mar 12, 2014
So, as far as I understand your comments from #6 and here — it is impossible to just give a vpn-group permission for application in android?
msva
commented
Mar 12, 2014
|
So, as far as I understand your comments from #6 and here — it is impossible to just give a vpn-group permission for application in android? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Vilbrekin
Mar 12, 2014
Owner
Indeed, I tried yesterday and the process didn't get access to /dev/tun either.
Looking at the documentation, I don't think this is the purpose of the BIND_VPN_SERVICE permission.
|
Indeed, I tried yesterday and the process didn't get access to /dev/tun either. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sandymac
Jun 24, 2014
My untested, unreliable understanding is this:
- Adding android.permission.BIND_VPN_SERVICE to the app's service give it's access to the vpn group and thus access to /dev/tun http://developer.android.com/reference/android/net/VpnService.html
- This would not grant root privileges so that ifconfig/route/ip could be executed. There apears to be a Builder inferface for this http://developer.android.com/reference/android/net/VpnService.Builder.html Sadly they only include add commands.
- It tinc_gui were to insert provided stub ifconfig/route/ip commands to the PATH for the tinc-up scripts and these commands communicated back to tinc_gui which add* command to execute you may be able to get a non-root tinc working correctly until a subnet-down was needed.
sandymac
commented
Jun 24, 2014
|
My untested, unreliable understanding is this:
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
gujiejie
commented
Jun 24, 2014
|
very well thanks |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Vilbrekin
Jun 24, 2014
Owner
@sandymac: thanks for your comments. However as per my testing, the BIND_VPN_SERVICE permission doesn't give the app access to /dev/tun device, which is needed for the standalone daemon to use it.
|
@sandymac: thanks for your comments. However as per my testing, the BIND_VPN_SERVICE permission doesn't give the app access to /dev/tun device, which is needed for the standalone daemon to use it. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
stv0g
Jul 6, 2014
Hi,
Probably we can work around tun/tap devices at all.
I think we can use tinc's "DeviceType" option to implement an alternative.
There's already a device type called "uml" which send/receive IP packets over standard Unix sockets.
TincGui would need to register an Android VPN service via android.net.VpnService and create a Unix socket via android.net.LocalSocket.
Androids VPN service interface provides a file descriptor for sending/receiving IP packets. This file descriptor must then be forwarded to the local Unix socket.
Unfortunately my Java skills are somehow limited to implement this. But I' willing to put some effort in creating the socket support for tinc.
Cheers,
Steffen
stv0g
commented
Jul 6, 2014
|
Hi, TincGui would need to register an Android VPN service via android.net.VpnService and create a Unix socket via android.net.LocalSocket. Androids VPN service interface provides a file descriptor for sending/receiving IP packets. This file descriptor must then be forwarded to the local Unix socket. Unfortunately my Java skills are somehow limited to implement this. But I' willing to put some effort in creating the socket support for tinc. Cheers, |
Vilbrekin
added
the
wontfix
label
Jul 24, 2014
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
culugyx
Jan 7, 2017
I have created a patchset for non-root/VpnService use. The repo is at https://github.com/culugyx/tinc_gui
It's not intensively tested/documented and might be unstable, but at least works here, on android M.
culugyx
commented
Jan 7, 2017
|
I have created a patchset for non-root/VpnService use. The repo is at https://github.com/culugyx/tinc_gui It's not intensively tested/documented and might be unstable, but at least works here, on android M. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
culugyx
Jan 7, 2017
@stv0g I think ics-openvpn has a similar architecture to your idea (sending/receiving file descriptors). Here I avoided fd transferring by linking tinc directly to tinc_gui and use JNI. Passing fds is much easier in a single process.
culugyx
commented
Jan 7, 2017
|
@stv0g I think ics-openvpn has a similar architecture to your idea (sending/receiving file descriptors). Here I avoided fd transferring by linking tinc directly to tinc_gui and use JNI. Passing fds is much easier in a single process. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Vilbrekin
Jan 7, 2017
Owner
Thanks for sharing. I'm surprised how few java code is actually required for this change.
Would be nice keeping both possibilities however (root + non root), as I think Android VPN services do not support TAP mode.
|
Thanks for sharing. I'm surprised how few java code is actually required for this change. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
culugyx
Jan 8, 2017
VpnService appears only to support TUN mode (IFF_TUN | IFF_NO_PI):
https://android.googlesource.com/platform/frameworks/base/+/android-6.0.1_r77/services/core/jni/com_android_server_connectivity_Vpn.cpp
If both modes are to be kept, maybe we can use pref_key_super_user to determine which mode to use. A few more Java code will be necessary (of which I'm not quite familiar). On the JNI side, tinc can be compiled twice as both shared lib and executable with different flags.
Currently, I tried to add reconnect_on_net_change function, but it still crashes occasionally on network changes.
culugyx
commented
Jan 8, 2017
|
VpnService appears only to support TUN mode (IFF_TUN | IFF_NO_PI): If both modes are to be kept, maybe we can use pref_key_super_user to determine which mode to use. A few more Java code will be necessary (of which I'm not quite familiar). On the JNI side, tinc can be compiled twice as both shared lib and executable with different flags. Currently, I tried to add reconnect_on_net_change function, but it still crashes occasionally on network changes. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
msva
Jan 11, 2017
It will definitely be nice to have possibility to use Mode=switch (tap) without root.
And, unfortunatelly, I can't see a way for that except like @stv0g said :(
msva
commented
Jan 11, 2017
|
It will definitely be nice to have possibility to use Mode=switch (tap) without root. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
culugyx
Jan 19, 2017
I've made changes so that both root and non-root mode can co-exist and switch depend on use_super_user.
culugyx
commented
Jan 19, 2017
|
I've made changes so that both root and non-root mode can co-exist and switch depend on use_super_user. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
codemac
commented
Feb 25, 2017
|
@culugyx do you have an apk or anything? Would really love this feature! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
culugyx
Feb 27, 2017
@codemac
Hi, I've uploaded an apk to my repository for preview.
https://github.com/culugyx/tinc_gui/wiki
https://github.com/culugyx/tinc_gui/releases (please read the warnings before trying it)
culugyx
commented
Feb 27, 2017
|
@codemac https://github.com/culugyx/tinc_gui/wiki |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
rkeene
Jun 23, 2017
Is this still "wontfix" ? It would be real handy if it was fixed, even if only supporting mode = route
rkeene
commented
Jun 23, 2017
|
Is this still "wontfix" ? It would be real handy if it was fixed, even if only supporting mode = route |
crocket commentedDec 16, 2013
People ported openvpn to android as ics-openvpn.
Perhaps, tinc could be ported to android with support for VPN service, too.
With built-in VPN service, I wouldn't have to root my device.