diff --git a/.github/workflows/check-transmission-releases.yml b/.github/workflows/check-transmission-releases.yml new file mode 100644 index 0000000000..4c701b6c66 --- /dev/null +++ b/.github/workflows/check-transmission-releases.yml @@ -0,0 +1,26 @@ +name: Transmission Version Check + +on: + schedule: + - cron: 0 * * * * + workflow_dispatch: {} + +jobs: + get-transmission-version: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: dev + + - name: Check for new version of Transmission + run: | + LATEST_VERSION=$(curl -L https://api.github.com/repos/transmission/transmission/releases/latest | grep tag_name | awk '{print $2}' | sed -e 's/"//g' -e 's/,//') + CURRENT_VERSION=$(cat upstream/transmission-version.txt) + if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then + echo "$LATEST_VERSION" > upstream/transmission-version.txt + git add upstream/transmission-version.txt + git commit -m "update transmission build version to ${LATEST_VERSION}" + git push origin dev + fi diff --git a/.github/workflows/docker-image-builds.yml b/.github/workflows/docker-image-builds.yml index 9547fa9fdd..d8ae70e069 100644 --- a/.github/workflows/docker-image-builds.yml +++ b/.github/workflows/docker-image-builds.yml @@ -8,23 +8,65 @@ on: - 'v[0-9]+.[0-9]+.[0-9]+' jobs: - build-main-images: - uses: ./.github/workflows/image-build-template-workflow.yml - with: - image-name: haugene/transmission-openvpn - build-context: '.' - secrets: inherit + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + image-name: + - haugene/transmission-openvpn + - haugene/transmission-openvpn-proxy + - haugene/transmission-rss + include: + - image-name: haugene/transmission-openvpn + context: ./ + - image-name: haugene/transmission-openvpn-proxy + context: ./proxy + - image-name: haugene/transmission-rss + context: ./plugins/rss + steps: + - name: Checkout code + uses: actions/checkout@v4 - build-proxy-images: - uses: ./.github/workflows/image-build-template-workflow.yml - with: - image-name: haugene/transmission-openvpn-proxy - build-context: 'proxy' - secrets: inherit + # QEMU emulator to build for other platforms + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 - build-rss-plugin-images: - uses: ./.github/workflows/image-build-template-workflow.yml - with: - image-name: haugene/transmission-rss - build-context: 'plugins/rss' - secrets: inherit + # Buildx automates creating the multi-arch manifest build + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + # Authenticate so that we can push to Docker Hub + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # Generate image tags and labels + - name: Generate Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ${{ matrix.image-name }} + tags: | + type=edge + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + + # Finally, build and push the images + - name: Build image + uses: docker/build-push-action@v4 + with: + context: ${{ matrix.context }} + platforms: linux/amd64,linux/arm,linux/arm64 + build-args: | + REVISION=${{ github.sha }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha, scope=${{ github.workflow }} + cache-to: type=gha, scope=${{ github.workflow}} diff --git a/.github/workflows/image-build-template-workflow.yml b/.github/workflows/docker-transmission-builds.yml similarity index 51% rename from .github/workflows/image-build-template-workflow.yml rename to .github/workflows/docker-transmission-builds.yml index 785eacff3c..39b8fdad56 100644 --- a/.github/workflows/image-build-template-workflow.yml +++ b/.github/workflows/docker-transmission-builds.yml @@ -1,22 +1,25 @@ -name: Reusable workflow for building multi-arch images +name: Transmission Builds on: - workflow_call: - inputs: - image-name: - required: true - type: string - - build-context: - required: true - type: string + workflow_dispatch: {} + push: + branches: + - dev + paths: + - upstream/transmission-version.txt jobs: - setup-build-push: + build-transmission: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + # Get latest version of Transmission + - name: Get Transmission version + run: | + LATEST_VERSION=$(cat upstream/transmission-version.txt) + echo "TBT_VERSION=$LATEST_VERSION" >> $GITHUB_ENV # QEMU emulator to build for other platforms - name: Set up QEMU @@ -33,28 +36,25 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - # Generate image tags and labels + # Generate image tag and labels - name: Generate Docker metadata id: meta uses: docker/metadata-action@v4 with: - images: | - ${{ inputs.image-name }} - tags: | - type=edge - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - - # Finally, build and push the images + images: haugene/transmission-builder + tags: type=match,pattern=(\d+.\d+.\d+),group=1,value=${{ env.TBT_VERSION }} + + # Finally, build and push the image - name: Build image uses: docker/build-push-action@v4 with: - context: ${{ inputs.build-context }} - platforms: linux/arm,linux/arm64,linux/amd64 + context: upstream + platforms: linux/amd64,linux/arm,linux/arm64 build-args: | REVISION=${{ github.sha }} - push: ${{ github.event_name != 'pull_request' }} + TBT_VERSION=${{ env.TBT_VERSION }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha, scope=${{ github.workflow }} + cache-to: type=gha, scope=${{ github.workflow}} diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml index 2351e43634..22f1a12490 100644 --- a/.github/workflows/mkdocs.yml +++ b/.github/workflows/mkdocs.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v4 diff --git a/Dockerfile b/Dockerfile index 895624ac81..dc329d652f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.13 as TransmissionUIs +FROM alpine:latest as TransmissionUIs RUN apk --no-cache add curl jq \ && mkdir -p /opt/transmission-ui \ @@ -14,7 +14,10 @@ RUN apk --no-cache add curl jq \ && mv /opt/transmission-ui/kettu-master /opt/transmission-ui/kettu \ && echo "Install Transmission-Web-Control" \ && mkdir /opt/transmission-ui/transmission-web-control \ - && curl -sL $(curl -s https://api.github.com/repos/ronggang/transmission-web-control/releases/latest | jq --raw-output '.tarball_url') | tar -C /opt/transmission-ui/transmission-web-control/ --strip-components=2 -xz + && curl -sL $(curl -s https://api.github.com/repos/ronggang/transmission-web-control/releases/latest | jq --raw-output '.tarball_url') | tar -C /opt/transmission-ui/transmission-web-control/ --strip-components=2 -xz \ + && echo "Install Transmissionic" \ + && wget -qO- https://github.com/6c65726f79/Transmissionic/releases/download/v1.8.0/Transmissionic-webui-v1.8.0.zip | unzip -q - \ + && mv web /opt/transmission-ui/transmissionic FROM ubuntu:22.04 AS base @@ -38,20 +41,7 @@ RUN set -ex; \ libpsl-dev \ libssl-dev -FROM base as TransmissionBuilder - -ARG DEBIAN_FRONTEND=noninteractive - -RUN apt-get update && apt-get install -y curl \ - build-essential automake autoconf libtool pkg-config intltool libcurl4-openssl-dev \ - libglib2.0-dev libevent-dev libminiupnpc-dev libgtk-3-dev libappindicator3-dev libssl-dev cmake xz-utils - - -RUN mkdir -p /home/transmission4/ && cd /home/transmission4/ \ - && curl -L -o transmission4.tar.xz "https://github.com/transmission/transmission/releases/download/4.0.4/transmission-4.0.4.tar.xz" \ - && tar -xf transmission4.tar.xz && cd transmission-4.0.4* && mkdir build && cd build \ - && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make && make install - +FROM haugene/transmission-builder:4.0.4 as TransmissionBuilder FROM base @@ -59,17 +49,30 @@ VOLUME /data VOLUME /config COPY --from=TransmissionUIs /opt/transmission-ui /opt/transmission-ui -COPY --from=TransmissionBuilder /usr/local/bin /usr/local/bin -COPY --from=TransmissionBuilder /usr/local/share /usr/local/share +COPY --from=TransmissionBuilder /var/tmp/*.deb /var/tmp/ +ARG TBT_VERSION=4.0.4 ARG DEBIAN_FRONTEND=noninteractive + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN echo "installing Transmission" && set -x \ + && if [[ ${TBT_VERSION} =~ ^4 ]]; then \ + ls -alh /var/tmp/*.deb ;\ + debfile=$(compgen -G /var/tmp/transmission_*_$(dpkg --print-architecture).deb); \ + if [[ -n ${debfile} ]]; then \ + echo "Installing transmission ${TBT_VERSION}" && dpkg -i ${debfile} ;\ + else echo "No /var/tmp/transmission_*_$(dpkg --print-architecture).deb found. Exiting" \ + ; exit ; fi ; \ + else echo "Installing transmission from repository" \ + && export TBT_VERSION=3.00 \ + && apt-get install -y --no-install-recommends transmission-daemon transmission-cli; fi + RUN apt-get update && apt-get install -y \ dumb-init openvpn privoxy \ tzdata dnsutils iputils-ping ufw openssh-client git jq curl wget unrar unzip bc \ - && ln -s /usr/share/transmission/web/style /opt/transmission-ui/transmission-web-control \ - && ln -s /usr/share/transmission/web/images /opt/transmission-ui/transmission-web-control \ - && ln -s /usr/share/transmission/web/javascript /opt/transmission-ui/transmission-web-control \ - && ln -s /usr/share/transmission/web/index.html /opt/transmission-ui/transmission-web-control/index.original.html \ + && ln -s /usr/local/share/transmission/public_html/images /opt/transmission-ui/transmission-web-control \ + && ln -s /usr/local/share/transmission/public_html/transmission-app.js /opt/transmission-ui/transmission-web-control/transmission-app.js \ + && ln -s /usr/local/share/transmission/public_html/index.html /opt/transmission-ui/transmission-web-control/index.original.html \ && rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* \ && groupmod -g 1000 users \ && useradd -u 911 -U -d /config -s /bin/false abc \ diff --git a/README.md b/README.md index b44c1dcd6a..5a4b6b1edf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # OpenVPN and Transmission with WebUI +[![Docker Build](https://img.shields.io/github/actions/workflow/status/haugene/docker-transmission-openvpn/docker-image-builds.yml +)](https://hub.docker.com/r/haugene/transmission-openvpn/) [![Docker Pulls](https://img.shields.io/docker/pulls/haugene/transmission-openvpn.svg)](https://hub.docker.com/r/haugene/transmission-openvpn/) This container contains OpenVPN and Transmission with a configuration diff --git a/docs/config-options.md b/docs/config-options.md index 56af1a5b62..66a0d5e663 100755 --- a/docs/config-options.md +++ b/docs/config-options.md @@ -82,13 +82,14 @@ This container comes bundled with some alternative Web UIs: * [Transmission-Web-Control](https://github.com/ronggang/transmission-web-control/) * [Flood for Transmission](https://github.com/johman10/flood-for-transmission) * [Shift](https://github.com/killemov/Shift) +* [Transmissionic](https://github.com/6c65726f79/Transmissionic) To use one of them instead of the default Transmission UI you can set `TRANSMISSION_WEB_UI` -to either `combustion`, `kettu`, `transmission-web-control`, `flood-for-transmission` or `shift` respectively. +to either `combustion`, `kettu`, `transmission-web-control`, `flood-for-transmission`, `shift` or `transmissionic` respectively. | Variable | Function | Example | | ----------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -| `TRANSMISSION_WEB_UI` | Use the specified bundled web UI | `TRANSMISSION_WEB_UI=combustion`
`TRANSMISSION_WEB_UI=kettu`
`TRANSMISSION_WEB_UI=transmission-web-control`
`TRANSMISSION_WEB_UI=flood-for-transmission`
`TRANSMISSION_WEB_UI=shift` | +| `TRANSMISSION_WEB_UI` | Use the specified bundled web UI | `TRANSMISSION_WEB_UI=combustion`
`TRANSMISSION_WEB_UI=kettu`
`TRANSMISSION_WEB_UI=transmission-web-control`
`TRANSMISSION_WEB_UI=flood-for-transmission`
`TRANSMISSION_WEB_UI=shift`
`TRANSMISSION_WEB_UI=transmissionic` | ### User configuration options diff --git a/docs/faq.md b/docs/faq.md index d6288c7e14..7b923bb09d 100755 --- a/docs/faq.md +++ b/docs/faq.md @@ -168,11 +168,14 @@ if basic network connectivity is broken. You can write your own script and add i This container has the `autoheal` label by default so it is compatible with the [willfarrell/autoheal image](https://hub.docker.com/r/willfarrell/autoheal/) + ## Send Username and Password via a file -Depending on your setup, you may not want to send your VPN user/pass via environment variables (the main reason being, it is accessible via docker inspect). If you prefer, there is a way to configure the container to use a file instead. +Depending on your setup, you may not want to send your VPN user/pass via environment variables (the main reason being, it is accessible via docker inspect). If you prefer, there are two methods of avoiding credentials to be set via environment variables: + - Option 1: Configure the container to use a file. + - Option 2: Configure the container to use a `secret`. (Only available for Docker Swarm) -*Procedure* +*Procedure for Option 1: Configuring the container to use a file* 1. Create a text file with a username and password in it, each on a separate line. For this example, we will assume it is located at `./openvpn-credentials.txt` ``` @@ -226,6 +229,52 @@ services: image: haugene/transmission-openvpn ``` +*Procedure for Option 2: Configure the container to use a `secret`* + +Note: [Docker Secrets](https://docs.docker.com/engine/swarm/secrets/) are only available for Docker Swarm (`docker-compose`). If you run the container standalone, refer to Option 1. + +1. Create a text file with a username and password in it, each on a separate line. +For this example, we will assume it is located at `./openvpn-credentials.txt` +``` +this_is_my_username +this_is_my_password +``` + +1. Mount the file as a secret like below. *The name of the secret must be exactly `openvpn_creds`, which will be exposed to the container at `/run/secrets/openvpn_creds`. + +The example docker-compose.yml looks like this: + +``` +version: '3.3' +secrets: + openvpn_creds: + file: './openvpn-credentials.txt' +services: + transmission-openvpn: + cap_add: + - NET_ADMIN + volumes: + - '/your/storage/path/:/data' + environment: + - OPENVPN_PROVIDER=PIA + - OPENVPN_CONFIG=france + - OPENVPN_USERNAME=**None** + - OPENVPN_PASSWORD=**None** + - LOCAL_NETWORK=192.168.0.0/16 + logging: + driver: json-file + options: + max-size: 10m + secrets: + - openvpn_creds + ports: + - '9091:9091' + image: haugene/transmission-openvpn +``` + +Bonus tip: The same steps can be followed for `rpc_creds`, as shown in [[How do I enable authentication in the web ui](#how_do_i_enable_authentication_in_the_web_UI)]. + + ## AUTH: Received control message: AUTH_FAILED If your logs end like this, the wrong username/password was sent to your VPN provider. diff --git a/docs/provider-specific.md b/docs/provider-specific.md index c93eff7660..346d0138c3 100644 --- a/docs/provider-specific.md +++ b/docs/provider-specific.md @@ -7,6 +7,8 @@ I'm [on it (#1558)](https://github.com/haugene/docker-transmission-openvpn/issue The update script is based on the NordVPN API. The API sends back the best recommended OpenVPN configuration file based on the filters given. +You have to use your service credentials instead of your regular email and password. They can be found [here](https://my.nordaccount.com/dashboard/nordvpn/manual-configuration/). + Available ENV variables in the container to define via the NordVPN API the file to use are: | Variable | Function | Example | diff --git a/docs/supported-providers.md b/docs/supported-providers.md index 9a9b849f36..4db9f9d6a6 100755 --- a/docs/supported-providers.md +++ b/docs/supported-providers.md @@ -122,6 +122,8 @@ Compose sample: - /volume1/docker/ipvanish/:/etc/openvpn/custom/ ``` **Declare the Custom provider, the target server and login/password** +Also important to note here is that `OPENVPN_CONFIG` value needs to be the name of the ovpn file wanting to be referenced in the `/etc/openvpn/custom` volume. In the example below the ovpn file name is `ipvanish-UK-Maidenhead-lhr-c02.ovpn` + Compose sample: ``` - OPENVPN_PROVIDER=custom @@ -129,6 +131,13 @@ Compose sample: - OPENVPN_USERNAME=user - OPENVPN_PASSWORD=pass ``` +Docker ENV vars sample: +``` + -e OPENVPN_PROVIDER=custom \ + -e OPENVPN_CONFIG=ipvanish-UK-Maidenhead-lhr-c02 \ + -e OPENVPN_USERNAME=user \ + -e OPENVPN_PASSWORD=pass \ +``` ### Do not mount single config file diff --git a/openvpn/fetch-external-configs.sh b/openvpn/fetch-external-configs.sh index 26f65e1e01..82192f6ff2 100755 --- a/openvpn/fetch-external-configs.sh +++ b/openvpn/fetch-external-configs.sh @@ -6,7 +6,7 @@ set -o pipefail source /etc/openvpn/utils.sh -VPN_CONFIG_SOURCE_TYPE="${VPN_CONFIG_SOURCE_TYPE:-github_zip}" +VPN_CONFIG_SOURCE_TYPE="${VPN_CONFIG_SOURCE_TYPE:-github_clone}" # Set default GitHub config repo GITHUB_CONFIG_SOURCE_REPO="${GITHUB_CONFIG_SOURCE_REPO:-haugene/vpn-configs-contrib}" @@ -18,19 +18,18 @@ if [[ "${VPN_CONFIG_SOURCE_TYPE}" == "github_zip" ]]; then echo "Cleanup: deleting ${config_repo_temp_zip_file} and ${config_repo_temp_dir}" rm -rf "${config_repo_temp_zip_file}" "${config_repo_temp_dir}" } - - config_repo_temp_zip_file=$(mktemp) - config_repo_temp_dir=$(mktemp -d) trap cleanup EXIT # Concatenate URL for config bundle from the given GitHub repo GITHUB_CONFIG_BUNDLE_URL="https://github.com/${GITHUB_CONFIG_SOURCE_REPO}/archive/${GITHUB_CONFIG_SOURCE_REVISION}.zip" - + # Create a temporary file and download bundle to it + config_repo_temp_zip_file=$(mktemp) echo "Downloading configs from ${GITHUB_CONFIG_BUNDLE_URL} into ${config_repo_temp_zip_file}" curl -sSL --fail -o "${config_repo_temp_zip_file}" "${GITHUB_CONFIG_BUNDLE_URL}" # Create a temporary folder and extract configs there + config_repo_temp_dir=$(mktemp -d) echo "Extracting configs to ${config_repo_temp_dir}" unzip -q "${config_repo_temp_zip_file}" -d "${config_repo_temp_dir}" @@ -50,20 +49,28 @@ if [[ "${VPN_CONFIG_SOURCE_TYPE}" == "github_zip" ]]; then elif [[ "${VPN_CONFIG_SOURCE_TYPE}" == "github_clone" ]]; then GITHUB_CONFIG_REPO_URL="https://github.com/${GITHUB_CONFIG_SOURCE_REPO}.git" - config_repo=/tmp/config-repo + config_repo=/config/vpn-configs-contrib + + # Add safe directory for repo folder + git config --global --add safe.directory "${config_repo}" echo "Will get configs from ${GITHUB_CONFIG_REPO_URL}" # Check if git repo exists and clone or pull based on that if [[ -d ${config_repo} ]]; then - echo "Repository is already cloned, checking for update" - cd ${config_repo} - git pull - git checkout "${GITHUB_CONFIG_SOURCE_REVISION}" + GITHUB_CONFIG_SOURCE_LOCAL=$(git -C "${config_repo}" remote -v | head -1 | awk '{print $2}' | sed -e 's/https:\/\/github.com\///' -e 's/.git//') + if [ "$GITHUB_CONFIG_SOURCE_LOCAL" == "$GITHUB_CONFIG_SOURCE_REPO" ]; then + echo "Repository is already cloned, checking for update" + git -C "${config_repo}" pull + git -C "${config_repo}" checkout "${GITHUB_CONFIG_SOURCE_REVISION}" + else + echo "Cloning ${GITHUB_CONFIG_REPO_URL} into ${config_repo}" + config_repo_old="${config_repo}" + "_old" + mv "${config_repo}" "${config_repo_old}" + git clone -b "${GITHUB_CONFIG_SOURCE_REVISION}" "${GITHUB_CONFIG_REPO_URL}" "${config_repo}" + fi else echo "Cloning ${GITHUB_CONFIG_REPO_URL} into ${config_repo}" - git clone "${GITHUB_CONFIG_REPO_URL}" ${config_repo} - cd ${config_repo} - git checkout "${GITHUB_CONFIG_SOURCE_REVISION}" + git clone -b "${GITHUB_CONFIG_SOURCE_REVISION}" "${GITHUB_CONFIG_REPO_URL}" "${config_repo}" fi # Find the specified provider folder. Should be under //openvpn/ @@ -79,8 +86,7 @@ elif [[ "${VPN_CONFIG_SOURCE_TYPE}" == "github_clone" ]]; then cp -r "${provider_configs}" "${VPN_PROVIDER_HOME}" exit 0 - else - "ERROR: VPN config source type ${VPN_CONFIG_SOURCE_TYPE} does not exist..." - exit 1 + "ERROR: VPN config source type ${VPN_CONFIG_SOURCE_TYPE} does not exist..." + exit 1 fi diff --git a/openvpn/pia/update-port.sh b/openvpn/pia/update-port.sh index 62db29395d..54f32e36b6 100755 --- a/openvpn/pia/update-port.sh +++ b/openvpn/pia/update-port.sh @@ -16,6 +16,12 @@ transmission_passwd=$(tail -1 ${TRANSMISSION_PASSWD_FILE}) pia_client_id_file=/etc/transmission/pia_client_id transmission_settings_file=${TRANSMISSION_HOME}/settings.json +if [[ -z "${TRANSMISSION_RPC_URL}" ]]; then + # Fetch the default setting for `rpc-url`. + TRANSMISSION_RPC_URL="$(jq -r '."rpc-url"' /etc/transmission/default-settings.json)" +fi +TRANSMISSION_HOST="$(echo "http://localhost:${TRANSMISSION_RPC_PORT}${TRANSMISSION_RPC_URL}" | sed -E 's/(\/)$//g')" + sleep 5 ###### PIA Variables ###### @@ -96,13 +102,13 @@ fi # make sure transmission is running and accepting requests echo "waiting for transmission to become responsive" -until torrent_list="$(transmission-remote $TRANSMISSION_RPC_PORT $myauth -l)"; do sleep 10; done +until torrent_list="$(transmission-remote "${TRANSMISSION_HOST}" $myauth -l)"; do sleep 10; done echo "transmission became responsive" output="$(echo "$torrent_list" | tail -n 2)" echo "$output" # get current listening port -transmission_peer_port=$(transmission-remote $TRANSMISSION_RPC_PORT $myauth -si | grep Listenport | grep -oE '[0-9]+') +transmission_peer_port=$(transmission-remote "${TRANSMISSION_HOST}" $myauth -si | grep Listenport | grep -oE '[0-9]+') if [[ "$new_port" != "$transmission_peer_port" ]]; then if [[ "true" = "$ENABLE_UFW" ]]; then echo "Update UFW rules before changing port in Transmission" @@ -115,11 +121,11 @@ if [[ "$new_port" != "$transmission_peer_port" ]]; then fi echo "setting transmission port to $new_port" - transmission-remote ${TRANSMISSION_RPC_PORT} ${myauth} -p "$new_port" + transmission-remote "${TRANSMISSION_HOST}" ${myauth} -p "$new_port" echo "Checking port..." sleep 10 - transmission-remote ${TRANSMISSION_RPC_PORT} ${myauth} -pt + transmission-remote "${TRANSMISSION_HOST}" ${myauth} -pt else echo "No action needed, port hasn't changed" fi diff --git a/openvpn/start.sh b/openvpn/start.sh index bcd228bedb..6de5b577b4 100755 --- a/openvpn/start.sh +++ b/openvpn/start.sh @@ -245,7 +245,13 @@ function ufwAllowPort { portNum=${1} if [[ "${ENABLE_UFW,,}" == "true" ]] && [[ -n "${portNum-}" ]]; then echo "allowing ${portNum} through the firewall" - ufw allow ${portNum} + if [[ $portNum == *":"* ]]; + then + ufw allow ${portNum}/tcp + ufw allow ${portNum}/udp + else + ufw allow ${portNum} + fi fi } diff --git a/privoxy/scripts/start.sh b/privoxy/scripts/start.sh index 8201d6dd38..54c196d664 100755 --- a/privoxy/scripts/start.sh +++ b/privoxy/scripts/start.sh @@ -24,13 +24,14 @@ set_port() echo "Privoxy: Setting port to $1"; +# Remove the listen-address for IPv6 for now. IPv6 compatibility should come later + sed -i -E "s/^listen-address\s+\[\:\:1.*//" "$2" + # Set the port for the IPv4 interface adr=$(ip -4 a show eth0| grep -oP "(?<=inet )([^/]+)") adr=${adr:-"0.0.0.0"} - sed -i -E "s/^listen-address\s+127.*/listen-address ${adr}:$1/" "$2" + sed -i -E "s/^listen-address\s+.*/listen-address ${adr}:$1/" "$2" - # Remove the listen-address for IPv6 for now. IPv6 compatibility should come later - sed -i -E "s/^listen-address\s+\[\:\:1.*//" "$2" } if [[ "${WEBPROXY_ENABLED}" = "true" ]]; then diff --git a/scripts/healthcheck.sh b/scripts/healthcheck.sh index 8c5646c50f..bb431e8645 100755 --- a/scripts/healthcheck.sh +++ b/scripts/healthcheck.sh @@ -59,7 +59,7 @@ if [[ ${WEBPROXY_ENABLED} =~ [yY][eE]?[Ss]?|[tT][Rr][Uu][eE] ]]; then if [[ ${PROXY} -eq 0 ]]; then echo "Privoxy warning: process was stopped, restarting." fi - proxy_ip=$(grep -oP "(?<=^listen-address).*$" /etc/privoxy/config | sed 's/ //g') + proxy_ip=$(grep -oP "(?<=^listen-address )[0-9\.]+" /etc/privoxy/config) cont_ip=$(ip -j a show dev eth0 | jq -r .[].addr_info[].local) if [[ ${proxy_ip} != ${cont_ip} ]]; then echo "Privoxy error: container ip (${cont_ip} has changed: privoxy listening to ${proxy_ip}, restarting privoxy." diff --git a/transmission/start.sh b/transmission/start.sh index f6d45f92dd..94775afceb 100755 --- a/transmission/start.sh +++ b/transmission/start.sh @@ -56,6 +56,11 @@ if [[ "shift" = "$TRANSMISSION_WEB_UI" ]]; then export TRANSMISSION_WEB_HOME=/opt/transmission-ui/shift fi +if [[ "transmissionic" = "$TRANSMISSION_WEB_UI" ]]; then + echo "Using Transmissionic UI, overriding TRANSMISSION_WEB_HOME" + export TRANSMISSION_WEB_HOME=/opt/transmission-ui/transmissionic +fi + case ${TRANSMISSION_LOG_LEVEL,,} in "trace" | "debug" | "info" | "warn" | "error" | "critical") echo "Will exec Transmission with '--log-level=${TRANSMISSION_LOG_LEVEL,,}' argument" @@ -100,7 +105,7 @@ exec su --preserve-environment ${RUN_AS} -s /bin/bash -c "/usr/local/bin/transmi # Configure port forwarding if applicable -if [[ -x /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh && (-z $DISABLE_PORT_UPDATER || "false" = "$DISABLE_PORT_UPDATER") ]]; then +if [[ -f /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh && (-z $DISABLE_PORT_UPDATER || "false" = "$DISABLE_PORT_UPDATER") ]]; then echo "Provider ${OPENVPN_PROVIDER^^} has a script for automatic port forwarding. Will run it now." echo "If you want to disable this, set environment variable DISABLE_PORT_UPDATER=true" exec /etc/openvpn/${OPENVPN_PROVIDER,,}/update-port.sh & diff --git a/transmission/userSetup.sh b/transmission/userSetup.sh index 7bb38a0fdc..b05a3d0e31 100644 --- a/transmission/userSetup.sh +++ b/transmission/userSetup.sh @@ -48,7 +48,7 @@ if [ -n "$PUID" ] && [ ! "$(id -u root)" -eq "$PUID" ]; then if [ -z "$TRANSMISSION_UMASK" ] ; then # fetch from settings.json if not defined in environment # because updateSettings.py is called after this script is run - TRANSMISSION_UMASK=$(jq .umask ${TRANSMISSION_HOME}/settings.json) + TRANSMISSION_UMASK=$(jq .umask ${TRANSMISSION_HOME}/settings.json | tr -d \" ) fi TRANSMISSION_UMASK_OCTAL=$( printf "%o\n" "${TRANSMISSION_UMASK}" ) diff --git a/upstream/Dockerfile b/upstream/Dockerfile new file mode 100644 index 0000000000..50bdfbcfcb --- /dev/null +++ b/upstream/Dockerfile @@ -0,0 +1,41 @@ +FROM ubuntu:22.04 + +ARG DEBIAN_FRONTEND=noninteractive +ARG TBT_VERSION=4.0.4 + +RUN set -ex; \ + apt-get update; \ + apt-get dist-upgrade -y; \ + apt-get install -y --no-install-recommends \ + automake \ + autoconf \ + build-essential \ + ca-certificates \ + checkinstall \ + cmake \ + curl \ + intltool \ + iproute2 \ + libappindicator3-dev \ + libcurl4-openssl-dev \ + libdeflate-dev \ + libevent-dev \ + libfmt-dev \ + libglib2.0-dev \ + libgtk-3-dev \ + libminiupnpc-dev \ + libnatpmp-dev \ + libpsl-dev \ + libssl-dev \ + libtool \ + nano \ + net-tools \ + pkg-config \ + tzdata \ + xz-utils +#This will build the transmission image to re-use in our container +RUN mkdir -p /home/transmission4/ && cd /home/transmission4/ \ + && curl -L -o transmission4.tar.xz "https://github.com/transmission/transmission/releases/download/${TBT_VERSION}/transmission-${TBT_VERSION}.tar.xz" \ + && tar -xf transmission4.tar.xz && cd "transmission-${TBT_VERSION}" && mkdir build && cd build \ + && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make && make install \ + && checkinstall -y -D --pkgname transmission --pakdir /var/tmp --pkgversion=${TBT_VERSION} diff --git a/upstream/transmission-version.txt b/upstream/transmission-version.txt new file mode 100644 index 0000000000..7d666cb219 --- /dev/null +++ b/upstream/transmission-version.txt @@ -0,0 +1 @@ +4.0.4 \ No newline at end of file