From 91ccd7e3dd605763980664727cbffafc7687e47d Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Fri, 7 Aug 2015 23:07:55 +0200 Subject: [PATCH 1/9] modified startup scripts to support more vpn providers --- Dockerfile | 9 ++++---- README.md | 18 +++++++-------- docker-compose.yml | 0 openvpn/btguard/btguard.ca.crt | 21 +++++++++++++++++ openvpn/btguard/btguard.ovpn | 21 +++++++++++++++++ openvpn/btguard/default.ovpn | 1 + openvpn/{ => pia}/AU Melbourne.ovpn | 6 ++--- openvpn/{ => pia}/AU Sydney.ovpn | 6 ++--- openvpn/{ => pia}/CA North York.ovpn | 6 ++--- openvpn/{ => pia}/CA Toronto.ovpn | 6 ++--- openvpn/{ => pia}/France.ovpn | 6 ++--- openvpn/{ => pia}/Germany.ovpn | 6 ++--- openvpn/{ => pia}/Hong Kong.ovpn | 6 ++--- openvpn/{ => pia}/Israel.ovpn | 6 ++--- openvpn/{ => pia}/Japan.ovpn | 6 ++--- openvpn/{ => pia}/Mexico.ovpn | 6 ++--- openvpn/{ => pia}/Netherlands.ovpn | 6 ++--- openvpn/{ => pia}/Romania.ovpn | 6 ++--- openvpn/{ => pia}/Russia.ovpn | 6 ++--- openvpn/{ => pia}/Singapore.ovpn | 6 ++--- openvpn/{ => pia}/Sweden.ovpn | 6 ++--- openvpn/{ => pia}/Switzerland.ovpn | 6 ++--- openvpn/{ => pia}/UK London.ovpn | 6 ++--- openvpn/{ => pia}/UK Southampton.ovpn | 6 ++--- openvpn/{ => pia}/US California.ovpn | 6 ++--- openvpn/{ => pia}/US East.ovpn | 6 ++--- openvpn/{ => pia}/US Florida.ovpn | 6 ++--- openvpn/{ => pia}/US Midwest.ovpn | 6 ++--- openvpn/{ => pia}/US Seattle.ovpn | 6 ++--- openvpn/{ => pia}/US Silicon Valley.ovpn | 6 ++--- openvpn/{ => pia}/US Texas.ovpn | 6 ++--- openvpn/{ => pia}/US West.ovpn | 6 ++--- openvpn/{ => pia}/ca.crt | 0 openvpn/{ => pia}/crl.pem | 0 openvpn/pia/default.ovpn | 1 + openvpn/start.sh | 29 ++++++++++++++++-------- transmission/environment-variables.tmpl | 2 ++ transmission/start.sh | 9 ++++++-- transmission/updatePort.sh | 2 +- 39 files changed, 165 insertions(+), 104 deletions(-) create mode 100644 docker-compose.yml create mode 100644 openvpn/btguard/btguard.ca.crt create mode 100644 openvpn/btguard/btguard.ovpn create mode 120000 openvpn/btguard/default.ovpn rename openvpn/{ => pia}/AU Melbourne.ovpn (75%) rename openvpn/{ => pia}/AU Sydney.ovpn (75%) rename openvpn/{ => pia}/CA North York.ovpn (75%) rename openvpn/{ => pia}/CA Toronto.ovpn (75%) rename openvpn/{ => pia}/France.ovpn (75%) rename openvpn/{ => pia}/Germany.ovpn (75%) rename openvpn/{ => pia}/Hong Kong.ovpn (75%) rename openvpn/{ => pia}/Israel.ovpn (75%) rename openvpn/{ => pia}/Japan.ovpn (75%) rename openvpn/{ => pia}/Mexico.ovpn (75%) rename openvpn/{ => pia}/Netherlands.ovpn (75%) rename openvpn/{ => pia}/Romania.ovpn (75%) rename openvpn/{ => pia}/Russia.ovpn (75%) rename openvpn/{ => pia}/Singapore.ovpn (75%) rename openvpn/{ => pia}/Sweden.ovpn (75%) rename openvpn/{ => pia}/Switzerland.ovpn (75%) rename openvpn/{ => pia}/UK London.ovpn (75%) rename openvpn/{ => pia}/UK Southampton.ovpn (75%) rename openvpn/{ => pia}/US California.ovpn (75%) rename openvpn/{ => pia}/US East.ovpn (75%) rename openvpn/{ => pia}/US Florida.ovpn (75%) rename openvpn/{ => pia}/US Midwest.ovpn (75%) rename openvpn/{ => pia}/US Seattle.ovpn (75%) rename openvpn/{ => pia}/US Silicon Valley.ovpn (75%) rename openvpn/{ => pia}/US Texas.ovpn (75%) rename openvpn/{ => pia}/US West.ovpn (75%) rename openvpn/{ => pia}/ca.crt (100%) rename openvpn/{ => pia}/crl.pem (100%) create mode 120000 openvpn/pia/default.ovpn diff --git a/Dockerfile b/Dockerfile index 6258774..1f339b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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-daemon/ -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" \ diff --git a/README.md b/README.md index 0d45d7e..87ad93c 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ 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_USERNAME=user" \ + -e "OPENVPN_PASSWORD=pass" \ -p 9091:9091 \ haugene/transmission-openvpn ``` @@ -19,8 +19,8 @@ or you could optionally specify which vpn server to use by setting an environmen ``` $ docker run --privileged -d \ -v /your/storage/path/:/data \ - -e "PIA_USERNAME=user" \ - -e "PIA_PASSWORD=pass" \ + -e "OPENVPN_USERNAME=user" \ + -e "OPENVPN_PASSWORD=pass" \ -p 9091:9091 \ -e "OPEN_VPN_CONFIG=US West" \ haugene/transmission-openvpn @@ -28,13 +28,13 @@ $ docker run --privileged -d \ 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. -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. +The only mandatory configuration is to set two environment variables for your PIA username and password. You must set the environment variables `OPENVPN_USERNAME` and `OPENVPN_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 login username for PIA|`OPENVPN_USERNAME=asdf`| +|`OPENVPN_PASSWORD`|Your login password for PIA|`OPENVPN_PASSWORD=asdf`| ### Network configuration options | Variable | Function | Example | @@ -71,8 +71,8 @@ $ docker build -t="docker-transmission-openvpn" . ``` $ docker run --privileged -d \ -v /your/storage/path/:/data \ - -e "PIA_USERNAME=user" \ - -e "PIA_PASSWORD=pass" \ + -e "OPENVPN_USERNAME=user" \ + -e "OPENVPN_PASSWORD=pass" \ -p 9091:9091 \ docker-transmission-openvpn ``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e69de29 diff --git a/openvpn/btguard/btguard.ca.crt b/openvpn/btguard/btguard.ca.crt new file mode 100644 index 0000000..d3c3850 --- /dev/null +++ b/openvpn/btguard/btguard.ca.crt @@ -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----- diff --git a/openvpn/btguard/btguard.ovpn b/openvpn/btguard/btguard.ovpn new file mode 100644 index 0000000..a6d645f --- /dev/null +++ b/openvpn/btguard/btguard.ovpn @@ -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-daemon/start.sh +down /etc/transmission-daemon/stop.sh diff --git a/openvpn/btguard/default.ovpn b/openvpn/btguard/default.ovpn new file mode 120000 index 0000000..f85b2c0 --- /dev/null +++ b/openvpn/btguard/default.ovpn @@ -0,0 +1 @@ +btguard.ovpn \ No newline at end of file diff --git a/openvpn/AU Melbourne.ovpn b/openvpn/pia/AU Melbourne.ovpn similarity index 75% rename from openvpn/AU Melbourne.ovpn rename to openvpn/pia/AU Melbourne.ovpn index a32dffa..a6da1ee 100644 --- a/openvpn/AU Melbourne.ovpn +++ b/openvpn/pia/AU Melbourne.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/AU Sydney.ovpn b/openvpn/pia/AU Sydney.ovpn similarity index 75% rename from openvpn/AU Sydney.ovpn rename to openvpn/pia/AU Sydney.ovpn index 04fb526..15982e2 100644 --- a/openvpn/AU Sydney.ovpn +++ b/openvpn/pia/AU Sydney.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/CA North York.ovpn b/openvpn/pia/CA North York.ovpn similarity index 75% rename from openvpn/CA North York.ovpn rename to openvpn/pia/CA North York.ovpn index 491482e..b0799e2 100644 --- a/openvpn/CA North York.ovpn +++ b/openvpn/pia/CA North York.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/CA Toronto.ovpn b/openvpn/pia/CA Toronto.ovpn similarity index 75% rename from openvpn/CA Toronto.ovpn rename to openvpn/pia/CA Toronto.ovpn index b52fa62..ecab85c 100644 --- a/openvpn/CA Toronto.ovpn +++ b/openvpn/pia/CA Toronto.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/France.ovpn b/openvpn/pia/France.ovpn similarity index 75% rename from openvpn/France.ovpn rename to openvpn/pia/France.ovpn index b311bf0..cffcf9e 100644 --- a/openvpn/France.ovpn +++ b/openvpn/pia/France.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Germany.ovpn b/openvpn/pia/Germany.ovpn similarity index 75% rename from openvpn/Germany.ovpn rename to openvpn/pia/Germany.ovpn index c496a73..57334f5 100644 --- a/openvpn/Germany.ovpn +++ b/openvpn/pia/Germany.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Hong Kong.ovpn b/openvpn/pia/Hong Kong.ovpn similarity index 75% rename from openvpn/Hong Kong.ovpn rename to openvpn/pia/Hong Kong.ovpn index 328cfbf..0ec0745 100644 --- a/openvpn/Hong Kong.ovpn +++ b/openvpn/pia/Hong Kong.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Israel.ovpn b/openvpn/pia/Israel.ovpn similarity index 75% rename from openvpn/Israel.ovpn rename to openvpn/pia/Israel.ovpn index 7a617e3..961d740 100644 --- a/openvpn/Israel.ovpn +++ b/openvpn/pia/Israel.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Japan.ovpn b/openvpn/pia/Japan.ovpn similarity index 75% rename from openvpn/Japan.ovpn rename to openvpn/pia/Japan.ovpn index e3a8c1b..8368ab2 100644 --- a/openvpn/Japan.ovpn +++ b/openvpn/pia/Japan.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Mexico.ovpn b/openvpn/pia/Mexico.ovpn similarity index 75% rename from openvpn/Mexico.ovpn rename to openvpn/pia/Mexico.ovpn index e2498dd..b589eb8 100644 --- a/openvpn/Mexico.ovpn +++ b/openvpn/pia/Mexico.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Netherlands.ovpn b/openvpn/pia/Netherlands.ovpn similarity index 75% rename from openvpn/Netherlands.ovpn rename to openvpn/pia/Netherlands.ovpn index 4875fca..94e71d9 100644 --- a/openvpn/Netherlands.ovpn +++ b/openvpn/pia/Netherlands.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Romania.ovpn b/openvpn/pia/Romania.ovpn similarity index 75% rename from openvpn/Romania.ovpn rename to openvpn/pia/Romania.ovpn index 5da65fd..49442d7 100644 --- a/openvpn/Romania.ovpn +++ b/openvpn/pia/Romania.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Russia.ovpn b/openvpn/pia/Russia.ovpn similarity index 75% rename from openvpn/Russia.ovpn rename to openvpn/pia/Russia.ovpn index 106f565..9f74644 100644 --- a/openvpn/Russia.ovpn +++ b/openvpn/pia/Russia.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Singapore.ovpn b/openvpn/pia/Singapore.ovpn similarity index 75% rename from openvpn/Singapore.ovpn rename to openvpn/pia/Singapore.ovpn index 5cd195b..5d89d00 100644 --- a/openvpn/Singapore.ovpn +++ b/openvpn/pia/Singapore.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Sweden.ovpn b/openvpn/pia/Sweden.ovpn similarity index 75% rename from openvpn/Sweden.ovpn rename to openvpn/pia/Sweden.ovpn index 9129a59..6fc4044 100644 --- a/openvpn/Sweden.ovpn +++ b/openvpn/pia/Sweden.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/Switzerland.ovpn b/openvpn/pia/Switzerland.ovpn similarity index 75% rename from openvpn/Switzerland.ovpn rename to openvpn/pia/Switzerland.ovpn index 8113f20..863521d 100644 --- a/openvpn/Switzerland.ovpn +++ b/openvpn/pia/Switzerland.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/UK London.ovpn b/openvpn/pia/UK London.ovpn similarity index 75% rename from openvpn/UK London.ovpn rename to openvpn/pia/UK London.ovpn index 1c43b4d..f894dce 100644 --- a/openvpn/UK London.ovpn +++ b/openvpn/pia/UK London.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/UK Southampton.ovpn b/openvpn/pia/UK Southampton.ovpn similarity index 75% rename from openvpn/UK Southampton.ovpn rename to openvpn/pia/UK Southampton.ovpn index a668641..417c5e1 100644 --- a/openvpn/UK Southampton.ovpn +++ b/openvpn/pia/UK Southampton.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/US California.ovpn b/openvpn/pia/US California.ovpn similarity index 75% rename from openvpn/US California.ovpn rename to openvpn/pia/US California.ovpn index 1b72cbb..9698f75 100644 --- a/openvpn/US California.ovpn +++ b/openvpn/pia/US California.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/US East.ovpn b/openvpn/pia/US East.ovpn similarity index 75% rename from openvpn/US East.ovpn rename to openvpn/pia/US East.ovpn index 368eacd..829be8e 100644 --- a/openvpn/US East.ovpn +++ b/openvpn/pia/US East.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/US Florida.ovpn b/openvpn/pia/US Florida.ovpn similarity index 75% rename from openvpn/US Florida.ovpn rename to openvpn/pia/US Florida.ovpn index 2af9e4e..a63b848 100644 --- a/openvpn/US Florida.ovpn +++ b/openvpn/pia/US Florida.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/US Midwest.ovpn b/openvpn/pia/US Midwest.ovpn similarity index 75% rename from openvpn/US Midwest.ovpn rename to openvpn/pia/US Midwest.ovpn index 446357f..7ec8f24 100644 --- a/openvpn/US Midwest.ovpn +++ b/openvpn/pia/US Midwest.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/US Seattle.ovpn b/openvpn/pia/US Seattle.ovpn similarity index 75% rename from openvpn/US Seattle.ovpn rename to openvpn/pia/US Seattle.ovpn index c428b8e..054ade8 100644 --- a/openvpn/US Seattle.ovpn +++ b/openvpn/pia/US Seattle.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/US Silicon Valley.ovpn b/openvpn/pia/US Silicon Valley.ovpn similarity index 75% rename from openvpn/US Silicon Valley.ovpn rename to openvpn/pia/US Silicon Valley.ovpn index 71fdb84..40594dd 100644 --- a/openvpn/US Silicon Valley.ovpn +++ b/openvpn/pia/US Silicon Valley.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/US Texas.ovpn b/openvpn/pia/US Texas.ovpn similarity index 75% rename from openvpn/US Texas.ovpn rename to openvpn/pia/US Texas.ovpn index 470cb08..65ba1b3 100644 --- a/openvpn/US Texas.ovpn +++ b/openvpn/pia/US Texas.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/US West.ovpn b/openvpn/pia/US West.ovpn similarity index 75% rename from openvpn/US West.ovpn rename to openvpn/pia/US West.ovpn index a674271..ed2ccf0 100644 --- a/openvpn/US West.ovpn +++ b/openvpn/pia/US West.ovpn @@ -12,9 +12,9 @@ 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 diff --git a/openvpn/ca.crt b/openvpn/pia/ca.crt similarity index 100% rename from openvpn/ca.crt rename to openvpn/pia/ca.crt diff --git a/openvpn/crl.pem b/openvpn/pia/crl.pem similarity index 100% rename from openvpn/crl.pem rename to openvpn/pia/crl.pem diff --git a/openvpn/pia/default.ovpn b/openvpn/pia/default.ovpn new file mode 120000 index 0000000..d190674 --- /dev/null +++ b/openvpn/pia/default.ovpn @@ -0,0 +1 @@ +Netherlands.ovpn \ No newline at end of file diff --git a/openvpn/start.sh b/openvpn/start.sh index 211c1b3..e78c24e 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -1,19 +1,28 @@ #!/bin/sh +if [ "$OPENVPN_PROVIDER" = "BTGUARD" ] +then + echo "VPN PROVIDER: BTGUARD" + vpn_provider="btguard" +else + echo "VPN PROVIDER: PIA" + vpn_provider="pia" +fi + if [ ! -z "$OPEN_VPN_CONFIG" ] then - if [ -f /etc/openvpn/"${OPEN_VPN_CONFIG}".ovpn ] + if [ -f /etc/openvpn/$vpn_provider/"${OPEN_VPN_CONFIG}".ovpn ] then echo "Starting OpenVPN using config ${OPEN_VPN_CONFIG}.ovpn" - OPEN_VPN_CONFIG=/etc/openvpn/${OPEN_VPN_CONFIG}.ovpn + OPEN_VPN_CONFIG=/etc/openvpn/$vpn_provider/${OPEN_VPN_CONFIG}.ovpn 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 "Using default OpenVPN gateway for provider ${vpn_provider}" + OPEN_VPN_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." + OPEN_VPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn fi # override resolv.conf @@ -24,14 +33,14 @@ then fi # add PIA user/pass -if [ "${PIA_USERNAME}" = "**None**" ] || [ "${PIA_PASSWORD}" = "**None**" ] ; then +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 diff --git a/transmission/environment-variables.tmpl b/transmission/environment-variables.tmpl index 5959f7e..9127421 100644 --- a/transmission/environment-variables.tmpl +++ b/transmission/environment-variables.tmpl @@ -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 }} \ No newline at end of file diff --git a/transmission/start.sh b/transmission/start.sh index 8c5e76f..5c21ffb 100755 --- a/transmission/start.sh +++ b/transmission/start.sh @@ -13,7 +13,12 @@ dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-dae echo "STARTING TRANSMISSION" exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ & -echo "STARTING PORT UPDATER" -exec /etc/transmission-daemon/periodicUpdates.sh & +if [ "$OPENVPN_PROVIDER" = "PIA" ] +then + echo "STARTING PORT UPDATER" + exec /etc/transmission-daemon/periodicUpdates.sh & +else + echo "NO PORT UPDATER FOR THIS PROVIDER" +fi echo "Transmission startup script complete." diff --git a/transmission/updatePort.sh b/transmission/updatePort.sh index dae3703..d3fc527 100755 --- a/transmission/updatePort.sh +++ b/transmission/updatePort.sh @@ -1,7 +1,7 @@ #! /bin/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) From fd496f864dbd9066aedb46506cb4ab66230fb84f Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Sat, 8 Aug 2015 01:10:20 +0200 Subject: [PATCH 2/9] renamed variable plus updates for README --- README.md | 42 +++++++++++++++++++++--------------------- openvpn/start.sh | 16 ++++++++-------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 87ad93c..05fbea8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -Private Internet Access OpenVPN - Transmission +# Transmission with WebUI and OpenVPN === -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. +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. ## 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 +9,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 "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 "OPENVPN_USERNAME=user" \ - -e "OPENVPN_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 `OPENVPN_USERNAME` and `OPENVPN_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 | |----------|----------|-------| -|`OPENVPN_USERNAME`|Your login username for PIA|`OPENVPN_USERNAME=asdf`| -|`OPENVPN_PASSWORD`|Your login password for PIA|`OPENVPN_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 +61,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 "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? diff --git a/openvpn/start.sh b/openvpn/start.sh index e78c24e..f9ca392 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -9,20 +9,20 @@ else vpn_provider="pia" fi -if [ ! -z "$OPEN_VPN_CONFIG" ] +if [ ! -z "$OPENVPN_CONFIG" ] then - if [ -f /etc/openvpn/$vpn_provider/"${OPEN_VPN_CONFIG}".ovpn ] + if [ -f /etc/openvpn/$vpn_provider/"${OPENVPN_CONFIG}".ovpn ] then - echo "Starting OpenVPN using config ${OPEN_VPN_CONFIG}.ovpn" - OPEN_VPN_CONFIG=/etc/openvpn/$vpn_provider/${OPEN_VPN_CONFIG}.ovpn + echo "Starting OpenVPN using config ${OPENVPN_CONFIG}.ovpn" + OPENVPN_CONFIG=/etc/openvpn/$vpn_provider/${OPENVPN_CONFIG}.ovpn else - echo "Supplied config ${OPEN_VPN_CONFIG}.ovpn could not be found." + echo "Supplied config ${OPENVPN_CONFIG}.ovpn could not be found." echo "Using default OpenVPN gateway for provider ${vpn_provider}" - OPEN_VPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn + OPENVPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn fi else echo "No VPN configuration provided. Using default." - OPEN_VPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn + OPENVPN_CONFIG=/etc/openvpn/$vpn_provider/default.ovpn fi # override resolv.conf @@ -50,4 +50,4 @@ 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 -exec openvpn --config "$OPEN_VPN_CONFIG" +exec openvpn --config "$OPENVPN_CONFIG" From d0dae40148b0543ae24c02a8c949a4f0d1c43c5a Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Sat, 8 Aug 2015 01:14:58 +0200 Subject: [PATCH 3/9] used locally only --- docker-compose.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index e69de29..0000000 From 7909b71e2d13f5aa72ee7bf06fb4e04519e506b7 Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Sat, 8 Aug 2015 01:16:54 +0200 Subject: [PATCH 4/9] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 05fbea8..ea0fd4f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # 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. From adab8884f4df7d4b8476ce9827af9021c25f29ef Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Sat, 8 Aug 2015 01:22:25 +0200 Subject: [PATCH 5/9] update comment --- openvpn/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvpn/start.sh b/openvpn/start.sh index f9ca392..e575c60 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -32,7 +32,7 @@ then printf "$RESOLV_OVERRIDE" > /etc/resolv.conf fi -# add PIA user/pass +# add OpenVPN user/pass if [ "${OPENVPN_USERNAME}" = "**None**" ] || [ "${OPENVPN_PASSWORD}" = "**None**" ] ; then echo "PIA credentials not set. Exiting." exit 1 From 9076c96a2501d3e7b29f700657c8d9b34b86ae55 Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Sat, 8 Aug 2015 01:55:50 +0200 Subject: [PATCH 6/9] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ea0fd4f..0640e4f 100644 --- a/README.md +++ b/README.md @@ -89,8 +89,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: ``` From f5baa63609e809118d4bb05b739788b6b12e2d2c Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Sat, 8 Aug 2015 01:58:51 +0200 Subject: [PATCH 7/9] Update Dockerfile Bumped to version 1.2 after changes for issue #22 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1f339b4..a2dbc86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Transmission and OpenVPN # -# Version 1.1 +# Version 1.2 FROM ubuntu:14.04 MAINTAINER Kristian Haugene From 0949d82219b84066c82bf4aa7cef80112cf6aaca Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Sun, 9 Aug 2015 21:00:49 +0200 Subject: [PATCH 8/9] moved scripts and templates out of transmission daemon home folder. this allows mounting of /etc/transmission-daemon to keep state, ref issue #22 --- Dockerfile | 2 +- openvpn/btguard/btguard.ovpn | 4 ++-- openvpn/pia/AU Melbourne.ovpn | 4 ++-- openvpn/pia/AU Sydney.ovpn | 4 ++-- openvpn/pia/CA North York.ovpn | 4 ++-- openvpn/pia/CA Toronto.ovpn | 4 ++-- openvpn/pia/France.ovpn | 4 ++-- openvpn/pia/Germany.ovpn | 4 ++-- openvpn/pia/Hong Kong.ovpn | 4 ++-- openvpn/pia/Israel.ovpn | 4 ++-- openvpn/pia/Japan.ovpn | 4 ++-- openvpn/pia/Mexico.ovpn | 4 ++-- openvpn/pia/Netherlands.ovpn | 4 ++-- openvpn/pia/Romania.ovpn | 4 ++-- openvpn/pia/Russia.ovpn | 4 ++-- openvpn/pia/Singapore.ovpn | 4 ++-- openvpn/pia/Sweden.ovpn | 4 ++-- openvpn/pia/Switzerland.ovpn | 4 ++-- openvpn/pia/UK London.ovpn | 4 ++-- openvpn/pia/UK Southampton.ovpn | 4 ++-- openvpn/pia/US California.ovpn | 4 ++-- openvpn/pia/US East.ovpn | 4 ++-- openvpn/pia/US Florida.ovpn | 4 ++-- openvpn/pia/US Midwest.ovpn | 4 ++-- openvpn/pia/US Seattle.ovpn | 4 ++-- openvpn/pia/US Silicon Valley.ovpn | 4 ++-- openvpn/pia/US Texas.ovpn | 4 ++-- openvpn/pia/US West.ovpn | 4 ++-- openvpn/start.sh | 2 +- transmission/periodicUpdates.sh | 2 +- transmission/start.sh | 6 +++--- transmission/updatePort.sh | 2 +- 32 files changed, 61 insertions(+), 61 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1f339b4..c7dc019 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN apt-get update \ # Add configuration and scripts ADD openvpn/ /etc/openvpn/ -ADD transmission/ /etc/transmission-daemon/ +ADD transmission/ /etc/transmission/ ENV OPENVPN_USERNAME=**None** \ OPENVPN_PASSWORD=**None** \ diff --git a/openvpn/btguard/btguard.ovpn b/openvpn/btguard/btguard.ovpn index a6d645f..539dd54 100644 --- a/openvpn/btguard/btguard.ovpn +++ b/openvpn/btguard/btguard.ovpn @@ -17,5 +17,5 @@ auth-user-pass /config/openvpn-credentials.txt # 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 diff --git a/openvpn/pia/AU Melbourne.ovpn b/openvpn/pia/AU Melbourne.ovpn index a6da1ee..f7ae5dd 100644 --- a/openvpn/pia/AU Melbourne.ovpn +++ b/openvpn/pia/AU Melbourne.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/AU Sydney.ovpn b/openvpn/pia/AU Sydney.ovpn index 15982e2..e322b05 100644 --- a/openvpn/pia/AU Sydney.ovpn +++ b/openvpn/pia/AU Sydney.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/CA North York.ovpn b/openvpn/pia/CA North York.ovpn index b0799e2..95c4f1d 100644 --- a/openvpn/pia/CA North York.ovpn +++ b/openvpn/pia/CA North York.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/CA Toronto.ovpn b/openvpn/pia/CA Toronto.ovpn index ecab85c..ad7542a 100644 --- a/openvpn/pia/CA Toronto.ovpn +++ b/openvpn/pia/CA Toronto.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/France.ovpn b/openvpn/pia/France.ovpn index cffcf9e..cb86432 100644 --- a/openvpn/pia/France.ovpn +++ b/openvpn/pia/France.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Germany.ovpn b/openvpn/pia/Germany.ovpn index 57334f5..2e9b203 100644 --- a/openvpn/pia/Germany.ovpn +++ b/openvpn/pia/Germany.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Hong Kong.ovpn b/openvpn/pia/Hong Kong.ovpn index 0ec0745..63b4c54 100644 --- a/openvpn/pia/Hong Kong.ovpn +++ b/openvpn/pia/Hong Kong.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Israel.ovpn b/openvpn/pia/Israel.ovpn index 961d740..8d5dee1 100644 --- a/openvpn/pia/Israel.ovpn +++ b/openvpn/pia/Israel.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Japan.ovpn b/openvpn/pia/Japan.ovpn index 8368ab2..861c1ef 100644 --- a/openvpn/pia/Japan.ovpn +++ b/openvpn/pia/Japan.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Mexico.ovpn b/openvpn/pia/Mexico.ovpn index b589eb8..562d7ef 100644 --- a/openvpn/pia/Mexico.ovpn +++ b/openvpn/pia/Mexico.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Netherlands.ovpn b/openvpn/pia/Netherlands.ovpn index 94e71d9..69921c3 100644 --- a/openvpn/pia/Netherlands.ovpn +++ b/openvpn/pia/Netherlands.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Romania.ovpn b/openvpn/pia/Romania.ovpn index 49442d7..ba2ed65 100644 --- a/openvpn/pia/Romania.ovpn +++ b/openvpn/pia/Romania.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Russia.ovpn b/openvpn/pia/Russia.ovpn index 9f74644..844412c 100644 --- a/openvpn/pia/Russia.ovpn +++ b/openvpn/pia/Russia.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Singapore.ovpn b/openvpn/pia/Singapore.ovpn index 5d89d00..8ce8b3d 100644 --- a/openvpn/pia/Singapore.ovpn +++ b/openvpn/pia/Singapore.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Sweden.ovpn b/openvpn/pia/Sweden.ovpn index 6fc4044..2e191d6 100644 --- a/openvpn/pia/Sweden.ovpn +++ b/openvpn/pia/Sweden.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/Switzerland.ovpn b/openvpn/pia/Switzerland.ovpn index 863521d..fd1f468 100644 --- a/openvpn/pia/Switzerland.ovpn +++ b/openvpn/pia/Switzerland.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/UK London.ovpn b/openvpn/pia/UK London.ovpn index f894dce..c562eee 100644 --- a/openvpn/pia/UK London.ovpn +++ b/openvpn/pia/UK London.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/UK Southampton.ovpn b/openvpn/pia/UK Southampton.ovpn index 417c5e1..3bc0d56 100644 --- a/openvpn/pia/UK Southampton.ovpn +++ b/openvpn/pia/UK Southampton.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/US California.ovpn b/openvpn/pia/US California.ovpn index 9698f75..5f4b83a 100644 --- a/openvpn/pia/US California.ovpn +++ b/openvpn/pia/US California.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/US East.ovpn b/openvpn/pia/US East.ovpn index 829be8e..dc001c7 100644 --- a/openvpn/pia/US East.ovpn +++ b/openvpn/pia/US East.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/US Florida.ovpn b/openvpn/pia/US Florida.ovpn index a63b848..c0ad5ae 100644 --- a/openvpn/pia/US Florida.ovpn +++ b/openvpn/pia/US Florida.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/US Midwest.ovpn b/openvpn/pia/US Midwest.ovpn index 7ec8f24..e6759c9 100644 --- a/openvpn/pia/US Midwest.ovpn +++ b/openvpn/pia/US Midwest.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/US Seattle.ovpn b/openvpn/pia/US Seattle.ovpn index 054ade8..b8dc7fb 100644 --- a/openvpn/pia/US Seattle.ovpn +++ b/openvpn/pia/US Seattle.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/US Silicon Valley.ovpn b/openvpn/pia/US Silicon Valley.ovpn index 40594dd..108b654 100644 --- a/openvpn/pia/US Silicon Valley.ovpn +++ b/openvpn/pia/US Silicon Valley.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/US Texas.ovpn b/openvpn/pia/US Texas.ovpn index 65ba1b3..7a871ae 100644 --- a/openvpn/pia/US Texas.ovpn +++ b/openvpn/pia/US Texas.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/pia/US West.ovpn b/openvpn/pia/US West.ovpn index ed2ccf0..b5cf04d 100644 --- a/openvpn/pia/US West.ovpn +++ b/openvpn/pia/US West.ovpn @@ -18,5 +18,5 @@ 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 diff --git a/openvpn/start.sh b/openvpn/start.sh index e575c60..36bde8c 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -48,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 "$OPENVPN_CONFIG" diff --git a/transmission/periodicUpdates.sh b/transmission/periodicUpdates.sh index 2325b27..3bc3fe9 100755 --- a/transmission/periodicUpdates.sh +++ b/transmission/periodicUpdates.sh @@ -3,6 +3,6 @@ while [ 1 ] do sleep 1m - /etc/transmission-daemon/updatePort.sh + /etc/transmission/updatePort.sh sleep 1h done diff --git a/transmission/start.sh b/transmission/start.sh index 5c21ffb..ba76902 100755 --- a/transmission/start.sh +++ b/transmission/start.sh @@ -1,14 +1,14 @@ #!/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}" export TRANSMISSION_BIND_ADDRESS_IPV4=${tun0ip} echo "Generating transmission settings.json from env variables" -dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json /bin/true +dockerize -template /etc/transmission/settings.tmpl:/etc/transmission-daemon/settings.json /bin/true echo "STARTING TRANSMISSION" exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ & @@ -16,7 +16,7 @@ exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ & 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 diff --git a/transmission/updatePort.sh b/transmission/updatePort.sh index d3fc527..accae83 100755 --- a/transmission/updatePort.sh +++ b/transmission/updatePort.sh @@ -9,7 +9,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=/etc/transmission-daemon/settings.json port_assignment_url=https://www.privateinternetaccess.com/vpninfo/port_forward_assignment From e820db27c7636c642b83b15930fe7fc53939ad71 Mon Sep 17 00:00:00 2001 From: Kristian Haugene Date: Mon, 10 Aug 2015 20:45:24 +0200 Subject: [PATCH 9/9] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0640e4f..698609f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ 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: