This commit is contained in:
Kristian Haugene
2018-02-22 18:33:41 +01:00
11 changed files with 88 additions and 4 deletions

View File

@@ -79,3 +79,5 @@
#TRANSMISSION_WATCH_DIR=/data/watch #TRANSMISSION_WATCH_DIR=/data/watch
#TRANSMISSION_WATCH_DIR_ENABLED=true #TRANSMISSION_WATCH_DIR_ENABLED=true
#TRANSMISSION_HOME=/data/transmission-home #TRANSMISSION_HOME=/data/transmission-home
#WEBPROXY_ENABLED=false
#WEBPROXY_PORT=8888

View File

@@ -18,6 +18,7 @@ RUN apt-get update \
&& unzip release.zip -d /opt/transmission-ui/ \ && unzip release.zip -d /opt/transmission-ui/ \
&& rm release.zip \ && rm release.zip \
&& git clone git://github.com/endor/kettu.git /opt/transmission-ui/kettu \ && git clone git://github.com/endor/kettu.git /opt/transmission-ui/kettu \
&& apt-get install -y tinyproxy telnet \
&& wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb \ && wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb \
&& dpkg -i dumb-init_1.2.0_amd64.deb \ && dpkg -i dumb-init_1.2.0_amd64.deb \
&& rm -rf dumb-init_1.2.0_amd64.deb \ && rm -rf dumb-init_1.2.0_amd64.deb \
@@ -29,6 +30,7 @@ RUN apt-get update \
ADD openvpn/ /etc/openvpn/ ADD openvpn/ /etc/openvpn/
ADD transmission/ /etc/transmission/ ADD transmission/ /etc/transmission/
ADD tinyproxy /opt/tinyproxy/
ENV OPENVPN_USERNAME=**None** \ ENV OPENVPN_USERNAME=**None** \
OPENVPN_PASSWORD=**None** \ OPENVPN_PASSWORD=**None** \
@@ -113,8 +115,11 @@ ENV OPENVPN_USERNAME=**None** \
PUID= \ PUID= \
PGID= \ PGID= \
TRANSMISSION_WEB_HOME= \ TRANSMISSION_WEB_HOME= \
DROP_DEFAULT_ROUTE= DROP_DEFAULT_ROUTE= \
WEBPROXY_ENABLED=false \
WEBPROXY_PORT=8888
# Expose port and run # Expose port and run
EXPOSE 9091 EXPOSE 9091
EXPOSE 8888
CMD ["dumb-init", "/etc/openvpn/start.sh"] CMD ["dumb-init", "/etc/openvpn/start.sh"]

View File

@@ -139,6 +139,18 @@ As you can see the variables are prefixed with `TRANSMISSION_`, the variable is
PS: `TRANSMISSION_BIND_ADDRESS_IPV4` will be overridden to the IP assigned to your OpenVPN tunnel interface. PS: `TRANSMISSION_BIND_ADDRESS_IPV4` will be overridden to the IP assigned to your OpenVPN tunnel interface.
This is to prevent leaking the host IP. This is to prevent leaking the host IP.
### Web proxy configuration options
This container also contains a web-proxy server to allow you to tunnel your web-browser traffic through the same OpenVPN tunnel.
This is useful if you are using a private tracker that needs to see you login from the same IP address you are torrenting from.
The default listening port is 8888. Note that only ports above 1024 can be specified as all ports below 1024 are privileged
and would otherwise require root permissions to run.
| Variable | Function | Example |
|----------|----------|-------|
|`WEBPROXY_ENABLED` | Enables the web proxy | `WEBPROXY_ENABLED=true`|
|`WEBPROXY_PORT` | Sets the listening port | `WEBPROXY_PORT=8888` |
### User configuration options ### User configuration options
By default everything will run as the root user. However, it is possible to change who runs the transmission process. By default everything will run as the root user. However, it is possible to change who runs the transmission process.

View File

@@ -13,6 +13,7 @@ services:
restart: always restart: always
ports: ports:
- "9091:9091" - "9091:9091"
- "8888:8888"
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@@ -25,7 +26,6 @@ services:
- OPENVPN_PASSWORD=password - OPENVPN_PASSWORD=password
- OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60 - OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60
- LOCAL_NETWORK=192.168.0.0/24 - LOCAL_NETWORK=192.168.0.0/24
proxy: proxy:
build: build:
context: ./proxy context: ./proxy

View File

@@ -9,6 +9,7 @@ services:
restart: always restart: always
ports: ports:
- "9091:9091" - "9091:9091"
- "8888:8888"
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
@@ -21,7 +22,6 @@ services:
- OPENVPN_PASSWORD=password - OPENVPN_PASSWORD=password
- OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60 - OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60
- LOCAL_NETWORK=192.168.0.0/24 - LOCAL_NETWORK=192.168.0.0/24
proxy: proxy:
image: haugene/transmission-openvpn-proxy image: haugene/transmission-openvpn-proxy
links: links:

View File

@@ -47,7 +47,7 @@ echo $TRANSMISSION_RPC_PASSWORD >> /config/transmission-credentials.txt
# Persist transmission settings for use by transmission-daemon # Persist transmission settings for use by transmission-daemon
dockerize -template /etc/transmission/environment-variables.tmpl:/etc/transmission/environment-variables.sh dockerize -template /etc/transmission/environment-variables.tmpl:/etc/transmission/environment-variables.sh
TRANSMISSION_CONTROL_OPTS="--script-security 2 --up-delay --up /etc/transmission/start.sh --down /etc/transmission/stop.sh" TRANSMISSION_CONTROL_OPTS="--script-security 2 --up-delay --up /etc/openvpn/tunnelUp.sh --down /etc/openvpn/tunnelDown.sh"
if [ "true" = "$ENABLE_UFW" ]; then if [ "true" = "$ENABLE_UFW" ]; then
# Enable firewall # Enable firewall

4
openvpn/tunnelDown.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
/etc/transmission/stop.sh
/opt/tinyproxy/stop.sh

4
openvpn/tunnelUp.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
/etc/transmission/start.sh
/opt/tinyproxy/start.sh

46
tinyproxy/start.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/sh
# Source our persisted env variables from container startup
. /etc/transmission/environment-variables.sh
PROXY_CONF='/etc/tinyproxy.conf'
DEFAULT_PORT=8888
set_port()
{
expr $1 + 0 1>/dev/null 2>&1
statut=$?
if test $statut -gt 1
then
echo "Port [$1]: Not a number" >&2; exit 1
fi
# Port: Specify the port which tinyproxy will listen on. Please note
# that should you choose to run on a port lower than 1024 you will need
# to start tinyproxy using root.
if test $1 -lt 1024
then
echo "tinyproxy: $1 is lower than 1024. Ports below 1024 are not permitted.";
exit 1
fi
echo "Setting tinyproxy port to $1";
sed -i -e"s,^Port .*,Port $1," $2
}
if [ "${WEBPROXY_ENABLED}" = "true" ]; then
echo "STARTING TINYPROXY"
if [ -z "$WEBPROXY_PORT" ] ; then
set_port ${WEBPROXY_PORT} ${PROXY_CONF}
else
# Always default back to port 8888
set_port ${DEFAULT_PORT} ${PROXY_CONF}
fi
/etc/init.d/tinyproxy start
echo "Tinyproxy startup script complete."
fi

7
tinyproxy/stop.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
if [ "${WEBPROXY_ENABLED}" = "true" ]; then
/etc/init.d/tinyproxy stop
fi

View File

@@ -81,6 +81,10 @@ export TRANSMISSION_WEB_UI={{ .Env.TRANSMISSION_WEB_UI }}
export PUID={{ .Env.PUID }} export PUID={{ .Env.PUID }}
export PGID={{ .Env.PGID }} export PGID={{ .Env.PGID }}
# Need to pass through our tinyproxy settings
export WEBPROXY_ENABLED={{ .Env.WEBPROXY_ENABLED }}
export WEBPROXY_PORT={{ .Env.WEBPROXY_PORT }}
# Support custom web frontend # Support custom web frontend
{{ if .Env.TRANSMISSION_WEB_HOME }} export TRANSMISSION_WEB_HOME={{ .Env.TRANSMISSION_WEB_HOME }} {{end}} {{ if .Env.TRANSMISSION_WEB_HOME }} export TRANSMISSION_WEB_HOME={{ .Env.TRANSMISSION_WEB_HOME }} {{end}}