dlenski / vpn-slice

vpnc-script replacement for easy and secure split-tunnel VPN setup
GNU General Public License v3.0
744 stars 87 forks source link

Use syscall instead of subprocess #117

Open kunaltyagi opened 2 years ago

kunaltyagi commented 2 years ago

Currently, vpn-slice requires running as root because it has a subprocess call:

Running scripts with root access (even open source) is a sytem risk. By performing a syscall, we give the option to the users to:

The need for writing in /etc/hosts can be eliminated by assigning it a custom group and using sg

Proposal: Use SIOCADDRT and SIOCDELRT for the ioctl calls

dlenski commented 2 years ago

On Linux, OpenConnect doesn't just call ip route replace. It also…

While allowing fine-grained capabilities is a worthwhile idea, it also seems like a fair amount of work.

If you want to take a crack at a PR for it, please go ahead and I'll be happy to review it.

You'd need to figure out how to replace the route, firewall, hosts, and prep provider classes on Linux with new classes that are drop-in replacements.

kunaltyagi commented 2 years ago

cap_net_admin would cover the ip related permissions (all of them). Let me take a look at the code (around 11 August)