diff --git a/Dockerfile b/Dockerfile index e749218..bc31bea 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** \ @@ -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/piaconfig/AU Melbourne.ovpn b/piaconfig/AU Melbourne.ovpn index b2be48e..a32dffa 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 5106144..04fb526 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 80853f2..491482e 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 7baeb4b..b52fa62 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 140c3e9..b311bf0 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 fa1cce7..c496a73 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 299f984..328cfbf 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 bcf0d76..7a617e3 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 2a1d44e..e3a8c1b 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 7199dd3..e2498dd 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 7293b2a..4875fca 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 15e4d3f..5da65fd 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 1e885d6..106f565 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 15f14ff..5cd195b 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 cd8a963..9129a59 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 98bcef0..8113f20 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 ed5ceb5..1c43b4d 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 e0c426a..a668641 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 907d10c..1b72cbb 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 c67929f..368eacd 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 b593738..2af9e4e 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 ac68135..446357f 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 127dc4e..c428b8e 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 92eb68c..71fdb84 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 289a73e..470cb08 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 d09b1e8..a674271 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 91% rename from runOpenVpn.sh rename to start.sh index 8909c2a..80f447f 100755 --- a/runOpenVpn.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 3f3b11c..a4de625 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/run.sh b/transmission/start.sh similarity index 59% rename from transmission/run.sh rename to transmission/start.sh index 59a25f9..75f9547 100755 --- a/transmission/run.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"