Ver código fonte

Merge branch 'master' of https://github.com/jandrews377/docker-transmission-openvpn into feature/proxy

master
Kristian Haugene 6 anos atrás
pai
commit
b3b97e4237

+ 2
- 0
DockerEnv Ver arquivo

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

+ 6
- 1
Dockerfile Ver arquivo

@@ -18,6 +18,7 @@ RUN apt-get update \
&& unzip release.zip -d /opt/transmission-ui/ \
&& rm release.zip \
&& 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 \
&& dpkg -i 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 transmission/ /etc/transmission/
ADD tinyproxy /opt/tinyproxy/

ENV OPENVPN_USERNAME=**None** \
OPENVPN_PASSWORD=**None** \
@@ -113,8 +115,11 @@ ENV OPENVPN_USERNAME=**None** \
PUID= \
PGID= \
TRANSMISSION_WEB_HOME= \
DROP_DEFAULT_ROUTE=
DROP_DEFAULT_ROUTE= \
WEBPROXY_ENABLED=false \
WEBPROXY_PORT=8888

# Expose port and run
EXPOSE 9091
EXPOSE 8888
CMD ["dumb-init", "/etc/openvpn/start.sh"]

+ 12
- 0
README.md Ver arquivo

@@ -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.
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

By default everything will run as the root user. However, it is possible to change who runs the transmission process.

+ 1
- 1
docker-compose-armhf.yml Ver arquivo

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

proxy:
build:
context: ./proxy

+ 1
- 1
docker-compose.yml Ver arquivo

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

proxy:
image: haugene/transmission-openvpn-proxy
links:

+ 1
- 1
openvpn/start.sh Ver arquivo

@@ -47,7 +47,7 @@ echo $TRANSMISSION_RPC_PASSWORD >> /config/transmission-credentials.txt
# Persist transmission settings for use by transmission-daemon
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
# Enable firewall

+ 4
- 0
openvpn/tunnelDown.sh Ver arquivo

@@ -0,0 +1,4 @@
#!/bin/sh

/etc/transmission/stop.sh
/opt/tinyproxy/stop.sh

+ 4
- 0
openvpn/tunnelUp.sh Ver arquivo

@@ -0,0 +1,4 @@
#!/bin/sh

/etc/transmission/start.sh
/opt/tinyproxy/start.sh

+ 46
- 0
tinyproxy/start.sh Ver arquivo

@@ -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
- 0
tinyproxy/stop.sh Ver arquivo

@@ -0,0 +1,7 @@
#!/bin/bash

if [ "${WEBPROXY_ENABLED}" = "true" ]; then

/etc/init.d/tinyproxy stop

fi

+ 4
- 0
transmission/environment-variables.tmpl Ver arquivo

@@ -81,6 +81,10 @@ export TRANSMISSION_WEB_UI={{ .Env.TRANSMISSION_WEB_UI }}
export PUID={{ .Env.PUID }}
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
{{ if .Env.TRANSMISSION_WEB_HOME }} export TRANSMISSION_WEB_HOME={{ .Env.TRANSMISSION_WEB_HOME }} {{end}}


Carregando…
Cancelar
Salvar