Merge remote-tracking branch 'origin/dev' into transmission-resume-torrent

Conflicts:
	transmission/start.sh
	transmission/updatePort.sh
This commit is contained in:
Doug Daniels 2015-08-13 11:26:21 -05:00
commit 0faafc3a99
39 changed files with 252 additions and 186 deletions

View File

@ -1,6 +1,6 @@
# Transmission and OpenVPN
#
# Version 1.1
# Version 1.2
FROM ubuntu:14.04
MAINTAINER Kristian Haugene
@ -18,11 +18,12 @@ RUN apt-get update \
&& curl -L https://github.com/jwilder/dockerize/releases/download/v0.0.2/dockerize-linux-amd64-v0.0.2.tar.gz | tar -C /usr/local/bin -xzv
# Add configuration and scripts
ADD openvpn/* /etc/openvpn/
ADD transmission/* /etc/transmission-daemon/
ADD openvpn/ /etc/openvpn/
ADD transmission/ /etc/transmission/
ENV PIA_USERNAME=**None** \
PIA_PASSWORD=**None** \
ENV OPENVPN_USERNAME=**None** \
OPENVPN_PASSWORD=**None** \
OPENVPN_PROVIDER=PIA \
"TRANSMISSION_ALT_SPEED_DOWN=50" \
"TRANSMISSION_ALT_SPEED_ENABLED=false" \
"TRANSMISSION_ALT_SPEED_TIME_BEGIN=540" \

View File

@ -1,6 +1,8 @@
Private Internet Access OpenVPN - Transmission
===
This Docker container lets you run Transmission with WebUI while connecting to PIA VPN. It updates Transmission hourly with assigned open port from PIA. Please read the instructions below.
# Transmission with WebUI and OpenVPN
This Docker container lets you run Transmission with WebUI while connecting to either BTGUARD or PIA OpenVPN.
When using PIA as provider it will update Transmission hourly with assigned open port. Please read the instructions below.
NB: Support for BTGUARD is only available with the dev tag for now. Please use haugene/transmission-openvpn:dev if you want to use BTGUARD as provider. See readme for the different branches on GitHub.
## Run container from Docker registry
The container is available from the Docker registry and this is the simplest way to get it. To run the container use this command:
@ -8,38 +10,33 @@ The container is available from the Docker registry and this is the simplest way
```
$ docker run --privileged -d \
-v /your/storage/path/:/data \
-e "PIA_USERNAME=user" \
-e "PIA_PASSWORD=pass" \
-e "OPENVPN_PROVIDER=PIA" \
-e "OPENVPN_CONFIG=Netherlands" \
-e "OPENVPN_USERNAME=user" \
-e "OPENVPN_PASSWORD=pass" \
-p 9091:9091 \
haugene/transmission-openvpn
```
or you could optionally specify which vpn server to use by setting an environment variable to one of the ovpn configs avaliable [in this folder](https://github.com/haugene/docker-transmission-openvpn/tree/master/piaconfig).
The `OPENVPN_PROVIDER` and `OPENVPN_CONFIG` are optional variables. If no provider is given, it will default to PIA. If no config is given, a default config will be selected for the provider you have chosen.
The only mandatory environment variables are your OpenVPN username and password. You must set the environment variables `OPENVPN_USERNAME` and `OPENVPN_PASSWORD` to the credentials given by your OpenVPN provider.
```
$ docker run --privileged -d \
-v /your/storage/path/:/data \
-e "PIA_USERNAME=user" \
-e "PIA_PASSWORD=pass" \
-p 9091:9091 \
-e "OPEN_VPN_CONFIG=US West" \
haugene/transmission-openvpn
```
Find the OpenVPN configurations avaliable by looking in the openvpn folder of the GitHub repository.
As you can see, the container expects a data volume to be mounted. It is used for storing your downloads from Transmission. The container comes with a default Transmission `settings.json` file that expects the folders `completed`, `incomplete`, and `watch` to be present in /your/storage/path (aka /data). This is where Transmission will store your downloads, incomplete downloads and a watch directory to look for new .torrent files.
As you can see, the container also expects a data volume to be mounted. It is used for storing your downloads from Transmission. The container comes with a default Transmission `settings.json` file that expects the folders `completed`, `incomplete`, and `watch` to be present in /your/storage/path (aka /data). This is where Transmission will store your downloads, incomplete downloads and a watch directory to look for new .torrent files.
The only mandatory configuration is to set two environment variables for your PIA username and password. You must set the environment variables `PIA_USERNAME` and `PIA_PASSWORD` to your login credentials. The container will connect to the Private Internet Access VPN servers in Netherlands by default.
### Required environment options
| Variable | Function | Example |
|----------|----------|-------|
|`PIA_USERNAME`|Your login username for PIA|`PIA_USERNAME=asdf`|
|`PIA_PASSWORD`|Your login password for PIA|`PIA_PASSWORD=asdf`|
|`OPENVPN_USERNAME`|Your OpenVPN username |`OPENVPN_USERNAME=asdf`|
|`OPENVPN_PASSWORD`|Your OpenVPN password |`OPENVPN_PASSWORD=asdf`|
### Network configuration options
| Variable | Function | Example |
|----------|----------|-------|
|`OPEN_VPN_CONFIG` | Sets the PIA endpoint to connect to. | `OPEN_VPN_CONFIG=UK Southampton`|
|`OPENVPN_PROVIDER` | Sets the OpenVPN provider to use. | `OPENVPN_PROVIDER=BTGUARD`|
|`OPENVPN_CONFIG` | Sets the OpenVPN endpoint to connect to. | `OPENVPN_CONFIG=UK Southampton`|
|`RESOLV_OVERRIDE` | The value of this variable will be written to `/etc/resolv.conf`. | `RESOLV_OVERRIDE=nameserver 8.8.8.8\nnameserver 8.8.4.4\n`|
### Transmission configuration options
@ -65,22 +62,26 @@ To build this container, clone the repository and cd into it.
### Build it:
```
$ cd /repo/location/docker-transmission-openvpn
$ docker build -t="docker-transmission-openvpn" .
$ docker build -t docker-transmission-openvpn .
```
### Run it:
```
$ docker run --privileged -d \
-v /your/storage/path/:/data \
-e "PIA_USERNAME=user" \
-e "PIA_PASSWORD=pass" \
-e "OPENVPN_PROVIDER=PIA" \
-e "OPENVPN_CONFIG=Netherlands" \
-e "OPENVPN_USERNAME=user" \
-e "OPENVPN_PASSWORD=pass" \
-p 9091:9091 \
docker-transmission-openvpn
```
As described in the "Run container from Docker registry" section, this will start a container with default settings. This means that you should have the folders "completed, incomplete and watch" in /your/storage/path, and pia-credentials.txt in /your/config/path.
This will start a container as described in the "Run container from Docker registry" section. This means that you should have the folders "completed, incomplete and watch" in /your/storage/path, and pia-credentials.txt in /your/config/path.
### Issues
If you are having some issues running the local build then please ensure you are using the latest version of docker. Using the latest stable verison is always recommended. Support for older version is on a best-effort basis.
### Known issues
Some have encountered problems with DNS resolving inside the docker container. This causes trouble because OpenVPN will not be able to resolve the host to connect to. If you have this problem, please refer to issue #4 on GitHib and you might want to use the `RESOLV_OVERRIDE` flag described in "Network configuration options"
If you are having issues with this container please submit an issue on GitHub. Please provide logs, docker version and other information that can simplify reproducing the issue. Using the latest stable verison of Docker is always recommended. Support for older version is on a best-effort basis.
## Access the WebUI
But what's going on? My http://my-host:9091 isn't responding?
@ -90,8 +91,12 @@ This is because the VPN is active, and since docker is running in a different ip
There are several ways to fix this. You can pipe and do fancy iptables or ip route configurations on the host and in the Docker image. But I found that the simplest solution is just to proxy my traffic. Start a Nginx container like this:
```
$ docker run -d -v /path/to/nginx.conf:/etc/nginx/nginx.conf:ro -p 8080:8080 nginx
$ docker run -d \
-v /path/to/nginx.conf:/etc/nginx/nginx.conf:ro \
-p 8080:8080 \
nginx
```
Where /path/to/nginx.conf has this content:
```

View File

@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDcjCCAtugAwIBAgIJAPKjuBleHokmMA0GCSqGSIb3DQEBBQUAMIGDMQswCQYD
VQQGEwJERTEVMBMGA1UECBMMSGVzc2UtTmFzc2F1MRIwEAYDVQQHEwlGcmFua2Z1
cnQxEDAOBgNVBAoTB0JUR3VhcmQxEzARBgNVBAMTCkJUR3VhcmQgQ0ExIjAgBgkq
hkiG9w0BCQEWE3N1cHBvcnRAYnRndWFyZC5jb20wHhcNMTAwODA3MDc0NTA5WhcN
MjAwODA0MDc0NTA5WjCBgzELMAkGA1UEBhMCREUxFTATBgNVBAgTDEhlc3NlLU5h
c3NhdTESMBAGA1UEBxMJRnJhbmtmdXJ0MRAwDgYDVQQKEwdCVEd1YXJkMRMwEQYD
VQQDEwpCVEd1YXJkIENBMSIwIAYJKoZIhvcNAQkBFhNzdXBwb3J0QGJ0Z3VhcmQu
Y29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4cBR6VLQICqdpTsjosIQ5
9elQZSRNQFaxWW3MeRC1xpJqjkbLJ9B9IO/Q/UyOa4a3qYHg8rI43wIF/RR6bwNX
3sZ5w6TrdVBk0DFZq6lDQ8/4Kpg1dKbdAgJjvtxiyrHWFtB0jYVGTlxwBSPflc2J
RZDMAVVj83gQh8ODJeGjnwIDAQABo4HrMIHoMB0GA1UdDgQWBBQCj1U+EICMz8hF
++KZ8Ld1vR0sqTCBuAYDVR0jBIGwMIGtgBQCj1U+EICMz8hF++KZ8Ld1vR0sqaGB
iaSBhjCBgzELMAkGA1UEBhMCREUxFTATBgNVBAgTDEhlc3NlLU5hc3NhdTESMBAG
A1UEBxMJRnJhbmtmdXJ0MRAwDgYDVQQKEwdCVEd1YXJkMRMwEQYDVQQDEwpCVEd1
YXJkIENBMSIwIAYJKoZIhvcNAQkBFhNzdXBwb3J0QGJ0Z3VhcmQuY29tggkA8qO4
GV4eiSYwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQAgVeYTxvAonucE
qWloEvzCCUWs8bS/HJ6M85WzG7FPNAXx2QbWwN3EMwKxtGc7QF8f+APoMukzsvd2
vuI+1n0YwtD12cWMM9PLV2FhA2B+ajzssBTgvrbtX/SzKt0//lzrBp5Gyo6T/vO5
9KRb6DVfVWfB76+DLpTf9f3SLTgzKw==
-----END CERTIFICATE-----

View File

@ -0,0 +1,21 @@
client
dev tun0
proto udp
remote vpn.btguard.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
verb 3
mute 3
mute-replay-warnings
float
reneg-sec 0
ca /etc/openvpn/btguard/btguard.ca.crt
auth-user-pass /config/openvpn-credentials.txt
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -0,0 +1 @@
btguard.ovpn

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

View File

@ -12,11 +12,11 @@ comp-lzo
verb 1
reneg-sec 0
ca /etc/openvpn/ca.crt
auth-user-pass /config/pia-credentials.txt
crl-verify /etc/openvpn/crl.pem
ca /etc/openvpn/pia/ca.crt
auth-user-pass /config/openvpn-credentials.txt
crl-verify /etc/openvpn/pia/crl.pem
# OpenVPN control startup and shut down of transmission
script-security 2
up /etc/transmission-daemon/start.sh
down /etc/transmission-daemon/stop.sh
up /etc/transmission/start.sh
down /etc/transmission/stop.sh

1
openvpn/pia/default.ovpn Symbolic link
View File

@ -0,0 +1 @@
Netherlands.ovpn

View File

@ -1,19 +1,28 @@
#!/bin/sh
if [ ! -z "$OPEN_VPN_CONFIG" ]
if [ "$OPENVPN_PROVIDER" = "BTGUARD" ]
then
if [ -f /etc/openvpn/"${OPEN_VPN_CONFIG}".ovpn ]
then
echo "Starting OpenVPN using config ${OPEN_VPN_CONFIG}.ovpn"
OPEN_VPN_CONFIG=/etc/openvpn/${OPEN_VPN_CONFIG}.ovpn
echo "VPN PROVIDER: BTGUARD"
vpn_provider="btguard"
else
echo "Supplied config ${OPEN_VPN_CONFIG}.ovpn could not be found."
echo "Using default OpenVPN gateway: Netherlands"
OPEN_VPN_CONFIG=/etc/openvpn/Netherlands.ovpn
echo "VPN PROVIDER: PIA"
vpn_provider="pia"
fi
if [ ! -z "$OPENVPN_CONFIG" ]
then
if [ -f /etc/openvpn/$vpn_provider/"${OPENVPN_CONFIG}".ovpn ]
then
echo "Starting OpenVPN using config ${OPENVPN_CONFIG}.ovpn"
OPENVPN_CONFIG=/etc/openvpn/$vpn_provider/${OPENVPN_CONFIG}.ovpn
else
echo "Supplied config ${OPENVPN_CONFIG}.ovpn could not be found."
echo "Using default OpenVPN gateway for provider ${vpn_provider}"
OPENVPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn
fi
else
echo "No VPN configuration provided. Using default: Netherlands"
OPEN_VPN_CONFIG=/etc/openvpn/Netherlands.ovpn
echo "No VPN configuration provided. Using default."
OPENVPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn
fi
# override resolv.conf
@ -23,15 +32,15 @@ then
printf "$RESOLV_OVERRIDE" > /etc/resolv.conf
fi
# add PIA user/pass
if [ "${PIA_USERNAME}" = "**None**" ] || [ "${PIA_PASSWORD}" = "**None**" ] ; then
# add OpenVPN user/pass
if [ "${OPENVPN_USERNAME}" = "**None**" ] || [ "${OPENVPN_PASSWORD}" = "**None**" ] ; then
echo "PIA credentials not set. Exiting."
exit 1
else
echo "Setting PIA credentials..."
echo "Setting OPENVPN credentials..."
mkdir -p /config
echo $PIA_USERNAME > /config/pia-credentials.txt
echo $PIA_PASSWORD >> /config/pia-credentials.txt
echo $OPENVPN_USERNAME > /config/openvpn-credentials.txt
echo $OPENVPN_PASSWORD >> /config/openvpn-credentials.txt
fi
# add transmission credentials from env vars
@ -39,6 +48,6 @@ echo $TRANSMISSION_RPC_USERNAME > /config/transmission-credentials.txt
echo $TRANSMISSION_RPC_PASSWORD >> /config/transmission-credentials.txt
# Persist transmission settings for use by transmission-daemon
dockerize -template /etc/transmission-daemon/environment-variables.tmpl:/etc/transmission-daemon/environment-variables.sh /bin/true
dockerize -template /etc/transmission/environment-variables.tmpl:/etc/transmission/environment-variables.sh /bin/true
exec openvpn --config "$OPEN_VPN_CONFIG"
exec openvpn --config "$OPENVPN_CONFIG"

View File

@ -72,3 +72,5 @@ export TRANSMISSION_UTP_ENABLED={{ .Env.TRANSMISSION_UTP_ENABLED }}
export TRANSMISSION_WATCH_DIR={{ .Env.TRANSMISSION_WATCH_DIR }}
export TRANSMISSION_WATCH_DIR_ENABLED={{ .Env.TRANSMISSION_WATCH_DIR_ENABLED }}
# Transmission needs to know which VPN provider is used
export OPENVPN_PROVIDER={{ .Env.OPENVPN_PROVIDER }}

View File

@ -3,6 +3,6 @@
while [ 1 ]
do
sleep 1m
/etc/transmission-daemon/updatePort.sh
/etc/transmission/updatePort.sh
sleep 1h
done

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Source our persisted env variables from container startup
. /etc/transmission-daemon/environment-variables.sh
. /etc/transmission/environment-variables.sh
tun0ip=$(ifconfig tun0 | sed -n '2 p' | awk '{print $2}' | cut -d: -f2)
echo "Updating TRANSMISSION_BIND_ADDRESS_IPV4 to tun0 ip: ${tun0ip}"
@ -10,12 +10,17 @@ export TRANSMISSION_BIND_ADDRESS_IPV4=${tun0ip}
echo "Generating transmission settings.json from env variables"
# Ensure TRANSMISSION_HOME is created
mkdir -p ${TRANSMISSION_HOME}
dockerize -template /etc/transmission-daemon/settings.tmpl:${TRANSMISSION_HOME}/settings.json /bin/true
dockerize -template /etc/transmission/settings.tmpl:${TRANSMISSION_HOME}/settings.json /bin/true
echo "STARTING TRANSMISSION"
exec /usr/bin/transmission-daemon -g ${TRANSMISSION_HOME} &
if [ "$OPENVPN_PROVIDER" = "PIA" ]
then
echo "STARTING PORT UPDATER"
exec /etc/transmission-daemon/periodicUpdates.sh &
exec /etc/transmission/periodicUpdates.sh &
else
echo "NO PORT UPDATER FOR THIS PROVIDER"
fi
echo "Transmission startup script complete."

View File

@ -1,10 +1,10 @@
#! /bin/sh
# Source our persisted env variables from container startup
. /etc/transmission-daemon/environment-variables.sh
. /etc/transmission/environment-variables.sh
# Settings
PIA_PASSWD_FILE=/config/pia-credentials.txt
PIA_PASSWD_FILE=/config/openvpn-credentials.txt
TRANSMISSION_PASSWD_FILE=/config/transmission-credentials.txt
pia_username=$(head -1 $PIA_PASSWD_FILE)
@ -12,7 +12,7 @@ pia_passwd=$(tail -1 $PIA_PASSWD_FILE)
transmission_username=$(head -1 $TRANSMISSION_PASSWD_FILE)
transmission_passwd=$(tail -1 $TRANSMISSION_PASSWD_FILE)
local_vpn_ip=$(ip addr show tun0 | grep inet | awk '{ print $2 }')
pia_client_id_file=/etc/transmission-daemon/pia_client_id
pia_client_id_file=/etc/transmission/pia_client_id
transmission_settings_file=${TRANSMISSION_HOME}/settings.json
port_assignment_url=https://www.privateinternetaccess.com/vpninfo/port_forward_assignment