mirror of
https://github.com/MarkusMcNugen/docker-qBittorrentvpn
synced 2024-11-14 06:34:58 +00:00
now passing configuration to container by mounting /config
This commit is contained in:
parent
775d22c5d1
commit
0e4f1da9ce
@ -35,13 +35,14 @@ ADD transmission/runUpdates.sh /etc/service/portupdater/run
|
||||
RUN mkdir -p /etc/service/openvpn/
|
||||
ADD runOpenVpn.sh /etc/service/openvpn/run
|
||||
|
||||
VOLUME /config
|
||||
|
||||
# Add configuration and scripts
|
||||
ADD piaconfig/config.ovpn /etc/openvpn/config.ovpn
|
||||
ADD piaconfig/credentials.txt /etc/openvpn/credentials.txt
|
||||
ADD piaconfig/ca.crt /etc/openvpn/ca.crt
|
||||
ADD piaconfig/crl.pem /etc/openvpn/crl.pem
|
||||
ADD runOpenVpn.sh /etc/openvpn/start.sh
|
||||
ADD transmission/transmissionSettings.json /etc/transmission-daemon/settings.json
|
||||
ADD transmission/defaultSettings.json /etc/transmission-daemon/settings.json
|
||||
ADD transmission/updateTransmissionPort.sh /etc/transmission-daemon/updatePort.sh
|
||||
ADD transmission/periodicUpdates.sh /etc/transmission-daemon/periodicUpdates.sh
|
||||
|
||||
|
@ -9,7 +9,7 @@ persist-tun
|
||||
ca /etc/openvpn/ca.crt
|
||||
tls-client
|
||||
remote-cert-tls server
|
||||
auth-user-pass /etc/openvpn/credentials.txt
|
||||
auth-user-pass /config/pia-credentials.txt
|
||||
comp-lzo
|
||||
verb 1
|
||||
reneg-sec 0
|
||||
|
@ -1,2 +0,0 @@
|
||||
your-pia-username
|
||||
your-pia-password
|
@ -1,2 +1,10 @@
|
||||
#!/bin/sh
|
||||
exec /usr/bin/transmission-daemon -f -g /etc/transmission-daemon/
|
||||
|
||||
if [ -f /config/transmission/settings.json ];
|
||||
then
|
||||
echo "STARTING TRANSMISSION: Using custom config directory /config/transmission"
|
||||
exec /usr/bin/transmission-daemon -f -g /config/transmission/
|
||||
else
|
||||
echo "STARTING TRANSMISSION: No configuration provided, using defaults"
|
||||
exec /usr/bin/transmission-daemon -f -g /etc/transmission-daemon/
|
||||
fi
|
||||
|
@ -1,15 +1,25 @@
|
||||
#/bin/bash
|
||||
|
||||
# Settings
|
||||
PIA_PASSWD_FILE=/etc/openvpn/credentials.txt
|
||||
PIA_PASSWD_FILE=/config/pia-credentials.txt
|
||||
TRANSMISSION_PASSWD_FILE=/config/transmission-credentials.txt
|
||||
|
||||
username=$(head -1 $PIA_PASSWD_FILE)
|
||||
passwd=$(tail -1 $PIA_PASSWD_FILE)
|
||||
pia_username=$(head -1 $PIA_PASSWD_FILE)
|
||||
pia_passwd=$(tail -1 $PIA_PASSWD_FILE)
|
||||
transmission_username=$(head -1 $TRANSMISSION_PASSWD_FILE)
|
||||
transmission_passwd=$(tail -1 $TRANSMISSION_PASSWD_FILE)
|
||||
local_vpn_ip=$(ip addr show tun0 | grep inet | awk '{ print $2 }')
|
||||
pia_client_id_file=/etc/transmission-daemon/pia_client_id
|
||||
transmission_settings_file=/etc/transmission-daemon/settings.json
|
||||
port_assignment_url=https://www.privateinternetaccess.com/vpninfo/port_forward_assignment
|
||||
|
||||
if [ -f /config/transmission/settings.json ];
|
||||
then
|
||||
transmission_settings_file=/config/transmission/settings.json
|
||||
else
|
||||
transmission_settings_file=/etc/transmission-daemon/settings.json
|
||||
fi
|
||||
|
||||
#
|
||||
# First get a port from PIA
|
||||
#
|
||||
@ -25,7 +35,7 @@ if [[ -z "$pia_client_id" ]]; then
|
||||
fi
|
||||
|
||||
# Get the port
|
||||
pia_response=$(curl -d "user=$username&pass=$passwd&client_id=$pia_client_id&local_ip=$local_vpn_ip" $port_assignment_url)
|
||||
pia_response=$(curl -d "user=$pia_username&pass=$pia_passwd&client_id=$pia_client_id&local_ip=$local_vpn_ip" $port_assignment_url)
|
||||
|
||||
new_port=$(echo $pia_response | grep -oE "[0-9]+")
|
||||
echo "Got new port $new_port from pia"
|
||||
@ -39,7 +49,7 @@ auth_enabled=$(grep 'rpc-authentication-required\"' $transmission_settings_file
|
||||
if [[ "true" = "$auth_enabled" ]]
|
||||
then
|
||||
echo "transmission auth required"
|
||||
myauth="--auth username:password"
|
||||
myauth="--auth $transmission_username:$transmission_passwd"
|
||||
else
|
||||
echo "transmission auth not required"
|
||||
myauth=""
|
||||
|
Loading…
Reference in New Issue
Block a user