Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind transmission to tun0 #17

Merged
merged 2 commits into from
May 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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** \
Expand All @@ -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" \
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/AU Melbourne.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote aus-melbourne.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/AU Sydney.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote aus.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/CA North York.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote ca.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/CA Toronto.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote ca-toronto.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/France.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote france.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Germany.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote germany.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Hong Kong.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote hk.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Israel.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote israel.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Japan.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote japan.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Mexico.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote mexico.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Netherlands.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote nl.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Romania.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote ro.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Russia.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote russia.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Singapore.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote sg.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Sweden.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote sweden.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/Switzerland.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote swiss.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/UK London.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote uk-london.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/UK Southampton.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote uk-southampton.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/US California.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote us-california.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/US East.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote us-east.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/US Florida.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote us-florida.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/US Midwest.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote us-midwest.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/US Seattle.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote us-seattle.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/US Silicon Valley.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote us-siliconvalley.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/US Texas.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote us-texas.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
2 changes: 1 addition & 1 deletion piaconfig/US West.ovpn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
client
dev tun
dev tun0
proto udp
remote us-west.privateinternetaccess.com 1194
resolv-retry infinite
Expand Down
6 changes: 3 additions & 3 deletions runOpenVpn.sh → start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion transmission/defaultSettings.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}",
Expand Down
5 changes: 5 additions & 0 deletions transmission/run.sh → transmission/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"