Skip to content

Commit

Permalink
add user/pass
Browse files Browse the repository at this point in the history
  • Loading branch information
aptalca authored and thelamer committed Aug 21, 2019
1 parent 0710f66 commit 23a993f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ docker create \
-e PGID=1000 \
-e TZ=Europe/London \
-e TRANSMISSION_WEB_HOME=/combustion-release/ `#optional` \
-e USER=username `#optional` \
-e PASS=password `#optional` \
-p 9091:9091 \
-p 51413:51413 \
-p 51413:51413/udp \
Expand Down Expand Up @@ -81,6 +83,8 @@ services:
- PGID=1000
- TZ=Europe/London
- TRANSMISSION_WEB_HOME=/combustion-release/ #optional
- USER=username #optional
- PASS=password #optional
volumes:
- <path to data>:/config
- <path to downloads>:/downloads
Expand All @@ -105,6 +109,8 @@ Container images are configured using parameters passed at runtime (such as thos
| `-e PGID=1000` | for GroupID - see below for explanation |
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London. |
| `-e TRANSMISSION_WEB_HOME=/combustion-release/` | Specify an alternative UI options are `/combustion-release/`, `/transmission-web-control/`, and `/kettu/` . |
| `-e USER=username` | Specify an optional username for the interface |
| `-e PASS=password` | Specify an optional password for the interface |
| `-v /config` | Where transmission should store config files and logs. |
| `-v /downloads` | Local path for downloads. |
| `-v /watch` | Watch folder for torrent files. |
Expand Down Expand Up @@ -220,6 +226,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Versions

* **21.08.19:** - Add optional user/pass environment variables, fix transmission shut down if user/pass are set.
* **19.07.19:** - Send SIGTERM in blocklist update to properly close pid.
* **28.06.19:** - Rebasing to alpine 3.10.
* **23.03.19:** - Switching to new Base images, shift to arm32v7 tag.
Expand Down
3 changes: 3 additions & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ cap_add_param: false
opt_param_usage_include_env: true
opt_param_env_vars:
- { env_var: "TRANSMISSION_WEB_HOME", env_value: "/combustion-release/", desc: "Specify an alternative UI options are `/combustion-release/`, `/transmission-web-control/`, and `/kettu/` ." }
- { env_var: "USER", env_value: "username", desc: "Specify an optional username for the interface" }
- { env_var: "PASS", env_value: "password", desc: "Specify an optional password for the interface" }
opt_param_usage_include_vols: false
opt_param_usage_include_ports: false
opt_param_device_map: false
Expand Down Expand Up @@ -81,6 +83,7 @@ app_setup_block: |
# changelog
changelogs:

- { date: "21.08.19:", desc: "Add optional user/pass environment variables, fix transmission shut down if user/pass are set." }
- { date: "19.07.19:", desc: "Send SIGTERM in blocklist update to properly close pid." }
- { date: "28.06.19:", desc: "Rebasing to alpine 3.10." }
- { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." }
Expand Down
8 changes: 8 additions & 0 deletions root/etc/cont-init.d/20-config
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ mkdir -p \
[[ ! -f /config/blocklist-update.sh ]] && cp \
/defaults/blocklist-update.sh /config/blocklist-update.sh

if [ ! -z "$USER" ] && [ ! -z "$PASS" ]; then
sed -i '/rpc-authentication-required/c\ "rpc-authentication-required": true,' /config/settings.json
sed -i "/rpc-username/c\ \"rpc-username\": \"$USER\"," /config/settings.json
sed -i "/rpc-password/c\ \"rpc-password\": \"$PASS\"," /config/settings.json
else
sed -i '/rpc-authentication-required/c\ "rpc-authentication-required": false,' /config/settings.json

This comment has been minimized.

Copy link
@gotson

gotson Aug 22, 2019

This should not modify existing configuration, which are not using the USER and PASSWORD argument. It breaks existing configurations by disabling rpc-authentication.

fi

# permissions
chown abc:abc \
/config/settings.json \
Expand Down
6 changes: 5 additions & 1 deletion root/etc/services.d/transmission/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

_term() {
echo "Caught SIGTERM signal!"
/usr/bin/transmission-remote --exit
if [ ! -z "$USER" ] && [ ! -z "$PASS" ]; then
/usr/bin/transmission-remote -n "$USER":"$PASS" --exit
else
/usr/bin/transmission-remote --exit
fi
}

trap _term SIGTERM
Expand Down

3 comments on commit 23a993f

@gotson
Copy link

@gotson gotson commented on 23a993f Aug 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks existing setups where the password is set in configuration. See here for details.

@thelamer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#82

@aptalca
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part actually fixes a bug where adding auth manually prevents graceful shutdown

Please sign in to comment.