From 01cec65568b2e8f4b3c1b036a8b3ba8758eb0747 Mon Sep 17 00:00:00 2001 From: Ian Neubert Date: Sat, 23 May 2015 09:06:08 -0700 Subject: [PATCH 1/2] Renamed files in repo that end up as start.sh inside container to start.sh in the repo too. Updated all piaconfigs to force tun0 --- Dockerfile | 4 ++-- piaconfig/AU Melbourne.ovpn | 2 +- piaconfig/AU Sydney.ovpn | 2 +- piaconfig/CA North York.ovpn | 2 +- piaconfig/CA Toronto.ovpn | 2 +- piaconfig/France.ovpn | 2 +- piaconfig/Germany.ovpn | 2 +- piaconfig/Hong Kong.ovpn | 2 +- piaconfig/Israel.ovpn | 2 +- piaconfig/Japan.ovpn | 2 +- piaconfig/Mexico.ovpn | 2 +- piaconfig/Netherlands.ovpn | 2 +- piaconfig/Romania.ovpn | 2 +- piaconfig/Russia.ovpn | 2 +- piaconfig/Singapore.ovpn | 2 +- piaconfig/Sweden.ovpn | 2 +- piaconfig/Switzerland.ovpn | 2 +- piaconfig/UK London.ovpn | 2 +- piaconfig/UK Southampton.ovpn | 2 +- piaconfig/US California.ovpn | 2 +- piaconfig/US East.ovpn | 2 +- piaconfig/US Florida.ovpn | 2 +- piaconfig/US Midwest.ovpn | 2 +- piaconfig/US Seattle.ovpn | 2 +- piaconfig/US Silicon Valley.ovpn | 2 +- piaconfig/US Texas.ovpn | 2 +- piaconfig/US West.ovpn | 2 +- runOpenVpn.sh => start.sh | 0 transmission/{run.sh => start.sh} | 0 29 files changed, 28 insertions(+), 28 deletions(-) rename runOpenVpn.sh => start.sh (100%) rename transmission/{run.sh => start.sh} (100%) diff --git a/Dockerfile b/Dockerfile index e749218dbc..d5a6c732bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,10 +23,10 @@ ADD piaconfig/crl.pem /etc/openvpn/crl.pem ADD transmission/defaultSettings.tmpl /etc/transmission-daemon/settings.tmpl ADD transmission/updateTransmissionPort.sh /etc/transmission-daemon/updatePort.sh ADD transmission/periodicUpdates.sh /etc/transmission-daemon/periodicUpdates.sh -ADD transmission/run.sh /etc/transmission-daemon/start.sh +ADD transmission/start.sh /etc/transmission-daemon/start.sh ADD transmission/runUpdates.sh /etc/transmission-daemon/startPortUpdates.sh ADD transmission/down.sh /etc/transmission-daemon/stop.sh -ADD runOpenVpn.sh /etc/openvpn/start.sh +ADD start.sh /etc/openvpn/start.sh ENV PIA_USERNAME=**None** \ PIA_PASSWORD=**None** \ diff --git a/piaconfig/AU Melbourne.ovpn b/piaconfig/AU Melbourne.ovpn index b2be48ea22..a32dffa474 100644 --- a/piaconfig/AU Melbourne.ovpn +++ b/piaconfig/AU Melbourne.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote aus-melbourne.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/AU Sydney.ovpn b/piaconfig/AU Sydney.ovpn index 51061446f9..04fb526bda 100644 --- a/piaconfig/AU Sydney.ovpn +++ b/piaconfig/AU Sydney.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote aus.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/CA North York.ovpn b/piaconfig/CA North York.ovpn index 80853f201d..491482e5cd 100644 --- a/piaconfig/CA North York.ovpn +++ b/piaconfig/CA North York.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote ca.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/CA Toronto.ovpn b/piaconfig/CA Toronto.ovpn index 7baeb4bdb7..b52fa6207b 100644 --- a/piaconfig/CA Toronto.ovpn +++ b/piaconfig/CA Toronto.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote ca-toronto.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/France.ovpn b/piaconfig/France.ovpn index 140c3e9cce..b311bf0189 100644 --- a/piaconfig/France.ovpn +++ b/piaconfig/France.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote france.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Germany.ovpn b/piaconfig/Germany.ovpn index fa1cce72d1..c496a73d12 100644 --- a/piaconfig/Germany.ovpn +++ b/piaconfig/Germany.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote germany.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Hong Kong.ovpn b/piaconfig/Hong Kong.ovpn index 299f9840c9..328cfbf291 100644 --- a/piaconfig/Hong Kong.ovpn +++ b/piaconfig/Hong Kong.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote hk.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Israel.ovpn b/piaconfig/Israel.ovpn index bcf0d7686b..7a617e3f39 100644 --- a/piaconfig/Israel.ovpn +++ b/piaconfig/Israel.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote israel.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Japan.ovpn b/piaconfig/Japan.ovpn index 2a1d44e88c..e3a8c1b843 100644 --- a/piaconfig/Japan.ovpn +++ b/piaconfig/Japan.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote japan.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Mexico.ovpn b/piaconfig/Mexico.ovpn index 7199dd32d9..e2498dd2b6 100644 --- a/piaconfig/Mexico.ovpn +++ b/piaconfig/Mexico.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote mexico.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Netherlands.ovpn b/piaconfig/Netherlands.ovpn index 7293b2a802..4875fca4f3 100644 --- a/piaconfig/Netherlands.ovpn +++ b/piaconfig/Netherlands.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote nl.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Romania.ovpn b/piaconfig/Romania.ovpn index 15e4d3f946..5da65fdca3 100644 --- a/piaconfig/Romania.ovpn +++ b/piaconfig/Romania.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote ro.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Russia.ovpn b/piaconfig/Russia.ovpn index 1e885d6e25..106f565243 100644 --- a/piaconfig/Russia.ovpn +++ b/piaconfig/Russia.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote russia.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Singapore.ovpn b/piaconfig/Singapore.ovpn index 15f14ff61f..5cd195b84e 100644 --- a/piaconfig/Singapore.ovpn +++ b/piaconfig/Singapore.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote sg.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Sweden.ovpn b/piaconfig/Sweden.ovpn index cd8a96362e..9129a59cab 100644 --- a/piaconfig/Sweden.ovpn +++ b/piaconfig/Sweden.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote sweden.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/Switzerland.ovpn b/piaconfig/Switzerland.ovpn index 98bcef0b80..8113f20652 100644 --- a/piaconfig/Switzerland.ovpn +++ b/piaconfig/Switzerland.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote swiss.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/UK London.ovpn b/piaconfig/UK London.ovpn index ed5ceb558e..1c43b4de50 100644 --- a/piaconfig/UK London.ovpn +++ b/piaconfig/UK London.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote uk-london.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/UK Southampton.ovpn b/piaconfig/UK Southampton.ovpn index e0c426ac6d..a6686416df 100644 --- a/piaconfig/UK Southampton.ovpn +++ b/piaconfig/UK Southampton.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote uk-southampton.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/US California.ovpn b/piaconfig/US California.ovpn index 907d10c339..1b72cbb40c 100644 --- a/piaconfig/US California.ovpn +++ b/piaconfig/US California.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote us-california.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/US East.ovpn b/piaconfig/US East.ovpn index c67929f193..368eacdaaf 100644 --- a/piaconfig/US East.ovpn +++ b/piaconfig/US East.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote us-east.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/US Florida.ovpn b/piaconfig/US Florida.ovpn index b5937387c6..2af9e4ee48 100644 --- a/piaconfig/US Florida.ovpn +++ b/piaconfig/US Florida.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote us-florida.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/US Midwest.ovpn b/piaconfig/US Midwest.ovpn index ac68135467..446357fcb8 100644 --- a/piaconfig/US Midwest.ovpn +++ b/piaconfig/US Midwest.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote us-midwest.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/US Seattle.ovpn b/piaconfig/US Seattle.ovpn index 127dc4e48e..c428b8e53c 100644 --- a/piaconfig/US Seattle.ovpn +++ b/piaconfig/US Seattle.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote us-seattle.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/US Silicon Valley.ovpn b/piaconfig/US Silicon Valley.ovpn index 92eb68c080..71fdb84e3b 100644 --- a/piaconfig/US Silicon Valley.ovpn +++ b/piaconfig/US Silicon Valley.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote us-siliconvalley.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/US Texas.ovpn b/piaconfig/US Texas.ovpn index 289a73e305..470cb087aa 100644 --- a/piaconfig/US Texas.ovpn +++ b/piaconfig/US Texas.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote us-texas.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/piaconfig/US West.ovpn b/piaconfig/US West.ovpn index d09b1e87ce..a674271eb9 100644 --- a/piaconfig/US West.ovpn +++ b/piaconfig/US West.ovpn @@ -1,5 +1,5 @@ client -dev tun +dev tun0 proto udp remote us-west.privateinternetaccess.com 1194 resolv-retry infinite diff --git a/runOpenVpn.sh b/start.sh similarity index 100% rename from runOpenVpn.sh rename to start.sh diff --git a/transmission/run.sh b/transmission/start.sh similarity index 100% rename from transmission/run.sh rename to transmission/start.sh From ceab19795ba1971507ae1cd7eec483b6f6285174 Mon Sep 17 00:00:00 2001 From: Ian Neubert Date: Sat, 23 May 2015 09:30:58 -0700 Subject: [PATCH 2/2] Find IP of tun0 during transmission start up and set the configuration to bind to it. Closes #11 --- Dockerfile | 1 - start.sh | 6 +++--- transmission/defaultSettings.tmpl | 2 +- transmission/start.sh | 5 +++++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index d5a6c732bd..bc31bead95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,6 @@ ENV PIA_USERNAME=**None** \ "TRANSMISSION_ALT_SPEED_TIME_ENABLED=false" \ "TRANSMISSION_ALT_SPEED_TIME_END=1020" \ "TRANSMISSION_ALT_SPEED_UP=50" \ - "TRANSMISSION_BIND_ADDRESS_IPV4=0.0.0.0" \ "TRANSMISSION_BIND_ADDRESS_IPV6=::" \ "TRANSMISSION_BLOCKLIST_ENABLED=false" \ "TRANSMISSION_BLOCKLIST_URL=http://www.example.com/blocklist" \ diff --git a/start.sh b/start.sh index 8909c2a2f5..80f447f20f 100755 --- a/start.sh +++ b/start.sh @@ -38,13 +38,13 @@ fi echo $TRANSMISSION_RPC_USERNAME > /config/transmission-credentials.txt echo $TRANSMISSION_RPC_PASSWORD >> /config/transmission-credentials.txt - +# setup transmission configuration if [ ! -z ${KEEP_TRANSMISSION_STATE} ] then mkdir -p /data/transmission-data/ - dockerize -template /etc/transmission-daemon/settings.tmpl:/data/transmission-data/settings.json true + dockerize -template /etc/transmission-daemon/settings.tmpl:/data/transmission-data/settings.json /bin/true else - dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json true + dockerize -template /etc/transmission-daemon/settings.tmpl:/etc/transmission-daemon/settings.json /bin/true fi exec openvpn --config "$OPEN_VPN_CONFIG" diff --git a/transmission/defaultSettings.tmpl b/transmission/defaultSettings.tmpl index 3f3b11c7fb..a4de625610 100644 --- a/transmission/defaultSettings.tmpl +++ b/transmission/defaultSettings.tmpl @@ -6,7 +6,7 @@ "alt-speed-time-enabled": {{ .Env.TRANSMISSION_ALT_SPEED_TIME_ENABLED }}, "alt-speed-time-end": {{ .Env.TRANSMISSION_ALT_SPEED_TIME_END }}, "alt-speed-up": {{ .Env.TRANSMISSION_ALT_SPEED_UP }}, - "bind-address-ipv4": "{{ .Env.TRANSMISSION_BIND_ADDRESS_IPV4 }}", + "bind-address-ipv4": "!!BINDIPV4!!", "bind-address-ipv6": "{{ .Env.TRANSMISSION_BIND_ADDRESS_IPV6 }}", "blocklist-enabled": {{ .Env.TRANSMISSION_BLOCKLIST_ENABLED }}, "blocklist-url": "{{ .Env.TRANSMISSION_BLOCKLIST_URL }}", diff --git a/transmission/start.sh b/transmission/start.sh index 59a25f9128..75f9547f11 100755 --- a/transmission/start.sh +++ b/transmission/start.sh @@ -9,6 +9,11 @@ else exec /usr/bin/transmission-daemon -g /etc/transmission-daemon/ & fi +# determine IP of tun0, and bind to it +export TRANSMISSION_BIND_ADDRESS_IPV4=$(ifconfig tun0 | sed -n '2 p' | awk '{print $2}' | cut -d: -f2) +echo "BINDING TRANSMISSION to $TRANSMISSION_BIND_ADDRESS_IPV4" +perl -p -i -e 's/!!BINDIPV4!!/$ENV{"TRANSMISSION_BIND_ADDRESS_IPV4"}/' /etc/transmission-daemon/settings.json + exec /etc/transmission-daemon/startPortUpdates.sh & echo "STARTED PORT UPDATER"