Gentoo/Vpnc Non Root
vpnc Non Root
End result, user can use own tool (I use knemo) to connect/disconnect from net-misc/vpnc.
The logic is to create tun device and allow users to access it, and wrapping the /sbin/ip and /sbin/resolvconf using sudo.
Setup
Linux Kernel Configuration: Add tap |
Device Drivers ---> [*] Network device support ---> <M> Universal TUN/TAP device driver support |
Setup portage overlay from here.
net-dns/openresolv is optional, but makes life much easier, see Gentoo/Openresolv.
It is very recommended to configure firewall on your computer, see firehol configuration.
Add:
rc_net_vpn0_need="firewall" # optional, if you setup firewall. rc_net_vpn0_provide="!net" tuntap_vpn0="tun" iproute2_vpn0="group users" config_vpn0="null" txqueuelen_vpn0="100" metric_vpn0="10"
Add the following to your configuration:
Interface name vpn0 Local Port 0 Pidfile /home/@USER@/vpnc/run/pid Script VAR_RUN="/home/@USER@/vpnc/run" ROUTE_METRIC="10" IPROUTE="sudo /sbin/ip" RESOLVCONF="sudo /sbin/resolvconf" /etc/vpnc/vpnc-script Xauth interactive
%users ALL=(ALL) NOPASSWD: /sbin/ip %users ALL=(ALL) NOPASSWD: /sbin/resolvconf
cli
Start:
Stop:
knemo
Dialogs
#!/bin/sh die() { local m="$1" echo "FATAL: $1" >&2 exit 1 } prompt="$1" [ -z "${prompt}" ] && die "usage: $0 prompt" kdialog --title "vpnc" --password "$prompt" || die "password"
Add the following to your configuration:
Password Program /home/@USER@/vpnc/vpnc-getpass
Start/stop same as cli above.
Maintainer
Authors
Originally written by: Alon Bar-Lev - 2012-08-15
Authors are people who have worked on this document and have made significant changes to its content. If you have edited this article and wish to add yourself to the authors list please read "Who are Authors".