diff --git a/Dockerfile b/Dockerfile index 53ae9c6..4a6b668 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM alpine:latest -RUN apk add bash openvpn openresolv +RUN apk add bash openvpn openresolv aria2 ADD https://raw.githubusercontent.com/alfredopalhares/openvpn-update-resolv-conf/master/update-resolv-conf.sh \ /etc/openvpn/update-resolv-conf COPY start-openvpn.sh /usr/local/bin/start-openvpn.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..17998d4 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Openvpn with torrent client + +Just add your openvpn configuration `config.ovpn` and the authorization file +`auth.txt` and modify `config.ovpn` to use the auth file: `auth-user-pass /opt/auth.txt` + +Next run `./start` to drop into a shell as your user in your home directory. +Now you can use aria2 to download everything over a VPN. diff --git a/start b/start new file mode 100755 index 0000000..42bf981 --- /dev/null +++ b/start @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +docker-compose run \ + -e OVPN_USER="$USER" \ + -e OVPN_HOME="$HOME" \ + -v "$HOME:$HOME" \ + openvpn sh diff --git a/start-openvpn.sh b/start-openvpn.sh index 8e7e521..8795120 100644 --- a/start-openvpn.sh +++ b/start-openvpn.sh @@ -10,6 +10,11 @@ connect_vpn() { openvpn --config "$OVPN_CONFIGURATION_FILE" --daemon } +switch_user() { + cd "$OVPN_HOME" + su "$OVPN_USER" +} + create_net_dev connect_vpn -"$@" +switch_user