From e870639b5f3418f5891e9bd4ef6c39e4e439cb58 Mon Sep 17 00:00:00 2001 From: redxef Date: Sat, 7 Aug 2021 20:09:36 +0200 Subject: [PATCH] Add aria2 and readme. --- Dockerfile | 2 +- README.md | 7 +++++++ start | 7 +++++++ start-openvpn.sh | 7 ++++++- 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 README.md create mode 100755 start 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