All Projects → wknapik → openvpn-unroot

wknapik / openvpn-unroot

Licence: MIT license
Run OpenVPN without root privileges

Programming Languages

shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to openvpn-unroot

Open2Nord
A Python script that makes connecting to NordVPN servers through OpenVPN GUI a lot easier, and adds extra functionality
Stars: ✭ 22 (-18.52%)
Mutual labels:  openvpn, vpn, openvpn-client
Cybernet-VPN
Android Cybernet VPN App
Stars: ✭ 28 (+3.7%)
Mutual labels:  openvpn, vpn, openvpn-client
desktop-app-ui
Official IVPN Desktop app (legacy version)
Stars: ✭ 23 (-14.81%)
Mutual labels:  openvpn, vpn
terraform-aws-pritunl-vpn-server
Pritunl VPN Server for your public/private like VPC on AWS
Stars: ✭ 40 (+48.15%)
Mutual labels:  openvpn, vpn
netmaker
Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
Stars: ✭ 4,147 (+15259.26%)
Mutual labels:  openvpn, vpn
alpine-qbittorrent-openvpn
qBittorrent docker container with OpenVPN client running as unprivileged user on alpine linux
Stars: ✭ 230 (+751.85%)
Mutual labels:  openvpn, openvpn-client
split-vpn
A split tunnel VPN script for Unifi OS routers (UDM, UXG, UDR) with policy based routing.
Stars: ✭ 589 (+2081.48%)
Mutual labels:  openvpn, vpn
killswitch-windows
VPN kill switch for windows.
Stars: ✭ 22 (-18.52%)
Mutual labels:  openvpn, vpn
Openvpn3 Linux
OpenVPN 3 Linux client
Stars: ✭ 186 (+588.89%)
Mutual labels:  openvpn, vpn
iit-kgp-network
Information repository and Solutions on IIT KGP Internet Problems.
Stars: ✭ 28 (+3.7%)
Mutual labels:  openvpn, vpn
droidovpn
An unofficial VPN Gate client for Android.
Stars: ✭ 65 (+140.74%)
Mutual labels:  openvpn, vpn
autovpn2
OpenVPN VPN Gate Client for Linux, connects you to a random Free VPN in a country of your choice by country code.
Stars: ✭ 30 (+11.11%)
Mutual labels:  vpn, openvpn-client
Openvpn Easy Setup
Bash script for easy and fast OpenVPN deploy
Stars: ✭ 230 (+751.85%)
Mutual labels:  openvpn, vpn
Django Netjsonconfig
Configuration manager for embedded devices, implemented as a reusable django-app
Stars: ✭ 213 (+688.89%)
Mutual labels:  openvpn, vpn
Openvpn Install
OpenVPN road warrior installer for Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS and Fedora
Stars: ✭ 14,199 (+52488.89%)
Mutual labels:  openvpn, vpn
terraform-openvpn
A sample terraform setup for OpenVPN using Let's Encrypt and Certbot to generate certificates
Stars: ✭ 43 (+59.26%)
Mutual labels:  openvpn, vpn
Raspberry-Pi-VPN-Gateway
Raspberry Pi VPN gateway installer for Private Internet Access
Stars: ✭ 44 (+62.96%)
Mutual labels:  openvpn, vpn
Tunnelkit
Non-official OpenVPN client library for Apple platforms.
Stars: ✭ 180 (+566.67%)
Mutual labels:  openvpn, vpn
Arch Rtorrentvpn
Docker build script for Arch Linux base with ruTorrent, rTorrent, autodl-irssi, Privoxy and OpenVPN
Stars: ✭ 185 (+585.19%)
Mutual labels:  openvpn, vpn
desktop-app-cli
Official IVPN command-line interface (CLI)
Stars: ✭ 18 (-33.33%)
Mutual labels:  openvpn, vpn
BETA WARNING: this is not mature code. The most basic tests pass on Arch,
Debian Stretch, Fedora Rawhide (development releases chosen due to bash >=4.4
requirement).

What is openvpn-unroot ?

openvpn-unroot is a script, that consumes an existing OpenVPN client config and produces everything necessary to run OpenVPN as an unprivileged user.

It is not a wrapper and only needs to be called once per config.

openvpn-unroot can infer everything it needs to know, but every aspect of its operation can be explicitly controlled.

Why use it ?

To minimize the impact of bugs and/or vulnerabilities on the system running OpenVPN.

How does it work ?

openvpn-unroot can produce any subset of the following:

  • A user and/or group to run OpenVPN as.
  • Sudoers entries necessary to call iproute and up/down scripts.
  • Sudo wrappers for iproute and up/down scripts.
  • A static tun/tap device and/or a systemd .netdev file to create the device on boot.
  • A systemd unit to run OpenVPN on boot.
  • An OpenVPN config, that puts all of the above together.

There are two modes of operation:

  • With the --automagic switch - that makes openvpn-unroot "do the needful", without requiring any input from the user, other than an existing OpenVPN client config file. In this mode any specific settings can still be overridden manually.
  • Without the --automagic switch - only the actions explicitly requested are performed and nothing is inferred.

How do I install/use it ?

TL;DR

Save the openvpn-unroot script somewhere, make it executable and run it as root:

$ openvpn-unroot -av foo.conf

To enable and start the systemd service:

$ systemctl enable [email protected]
$ systemctl start [email protected]

That is the bare minimum and should usually suffice.

Installation

openvpn-unroot is a standalone script. It can simply be downloaded, made executable and used.

Arch Linux users may choose to install the openvpn-unroot-git package from AUR instead.

Usage

It's a good idea to start by running openvpn-unroot with the --automagic, --pretend and --verbose options to see what would be done in the TL;DR scenario above. For example:

$ openvpn -apv /etc/openvpn/client/foo.conf
INFO: Adding group openvpn
INFO: Adding user openvpn
INFO: Generating sudoers file /etc/sudoers.d/foo-unrooted
INFO: Generating iproute file /etc/openvpn/client/ip-unrooted.sh
INFO: Generating up file /etc/openvpn/client/vpnfailsafe-unrooted.sh
INFO: Adding device tun0-unrooted
INFO: Generating netdev file /etc/systemd/network/tun0-unrooted.netdev
INFO: Generating config file /etc/openvpn/client/foo-unrooted.conf
INFO: Generating unit file /etc/systemd/system/[email protected]
$

If this is acceptable, the --pretend switch can be dropped, to perform all these actions. If any of the choices made automatically are not to the user's liking, they can be overridden using the switches described in the help message printed by openvpn-unroot -h.

Actions can be skipped entirely (using --no-<option>, or -S option1,option2), or modified (using --<option> alternate_value).

For non-interactive use, the --automagic switch should be dropped and each action should be explicitly specified instead. In that mode, if any options are missing, an error will be returned, along with a message specifying what switches to add.

What are the requirements/assumptions/limitations ?

Bash >=4.4 is required. Beyond that, dependencies are minimal and should be met by any system running OpenVPN (list available here).

The script needs to be run as root.

Filenames supplied can't contain whitespace.

The persist-tun option is turned off in generated configs, due to a bug in OpenVPN 2.4.0. This will be changed when version 2.4.1, containing a fix, is released.

If a file that the chosen unprivileged user needs to be able to read is not readable to them, a warning will be issued. For example, in Arch Linux, the /etc/openvpn/client directory is not world-readable, so if any files end up being placed there, it will trigger the warning. Arch users can pass -g network to openvpn-unroot, to avoid this issue.

What are the security implications of using openvpn-unroot ?

As for openvpn-unroot itself - it should not be made setuid root, nor allowed to be run with sudo by untrusted users, as that would allow them to run arbitrary commands with root privileges.

The unprivileged user supplied to openvpn-unroot will be allowed to run the ip command and the up/down scripts specified in the OpenVPN config (if any) as root. The impact of the former is described by man ip, the latter depends on the specific scripts. Anyone able to edit those scripts will also be able to run arbitrary code as root.

As for running OpenVPN as an unprivileged user - as mentioned above, this reduces the impact of bugs and expoitable vulnerabilities in OpenVPN, on the system running it. Quoting the OpenVPN wiki:

This is more secure than the built-in directives(--user and --group) because the openvpn process is never started with root permissions. Additionally, reconnects(including those which push fresh routes and configuration changes) which normally break after privileges are dropped via --user are handled without issue.

The "unrooting" can be combined with further security improvements.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].