Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transmission default password #167

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,15 @@ The default nefarious user/password is `admin`/`admin`. On first login you will
Jackett's **host** in the main settings should remain `jackett` and the port should remain `9117`. Copy your API Token from [Jackett](http://localhost:9117) into the appropriate nefarious section.
Don't forget to also add some indexers in Jackett to track your preferred content, and be sure to test them to see that they're working. Some popular examples are *The Pirate Bay*, *1337x*, *RARBG*.

Transmission's host should remain `transmission` and port should remain `9091`. It's possible to configure it with a username and password, but it defaults to keeping them both blank.
Entering both username and password in the nefarious settings should only be done if the Transmission settings of `transmission-settings.json` were also configured for your desired user/pass.
Transmission's host should remain `transmission` and port should remain `9091`. The default user & password is `admin`/`admin` and is defined in `.env` with variables `TRANSMISSION_USER` and `TRANSMISSION_PASS`.
Enter these values in the Transmission section of nefarious' settings.

Once all of your settings are updated, click `Save & Verify Settings` to save and verify they're valid.

##### Transmission Configuration

There is no default transmission user/pass, but feel free to edit the `transmission-settings.json` beforehand following the [official settings](https://github.com/transmission/transmission/wiki/Editing-Configuration-Files) to make any changes you'd like.
You shouldn't need to do any extra configuring to Transmission, but see [TRANSMISSION.md](docs/TRANSMISSION.md) for more details.

**NOTE** if you make any changes to `transmission-settings.json` you'll have to recreate the transmission container for the changes to take place:

docker-compose up -d --force-recreate transmission

### Usage

See [USAGE.md](docs/USAGE.md).
Expand Down
8 changes: 2 additions & 6 deletions docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ services:
NEFARIOUS_PASS: ${NEFARIOUS_PASS:-admin}
HOST_DOWNLOAD_PATH: ${HOST_DOWNLOAD_PATH:-/tmp/}
CONFIG_PATH: /nefarious-db
TRANSMISSION_USER: ${TRANSMISSION_USER-admin} # to pre-populate settings (can be empty)
TRANSMISSION_PASS: ${TRANSMISSION_PASS-admin} # to pre-populate settings (can be empty)
volumes:
# persistent named volume for sqlite database
- nefarious-db:/nefarious-db
Expand Down Expand Up @@ -79,12 +81,6 @@ services:
- "9091:9091"
- "51413:51413" # peer port
restart: always
environment:
- PUID=${HOST_DOWNLOAD_UID:-1000}
- PGID=${HOST_DOWNLOAD_GID:-1000}
volumes:
- ${HOST_DOWNLOAD_PATH:-/tmp}:/downloads
- ./transmission-settings.json:/config/settings.json:ro

# auto update service (to be extended)
# https://github.com/containrrr/watchtower
Expand Down
8 changes: 7 additions & 1 deletion docker-compose.transmission-vpn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ services:
volumes:
- ${HOST_DOWNLOAD_PATH:-/tmp}:/data
- /etc/localtime:/etc/localtime:ro
- transmission-config:/data/transmission-home
sysctls:
- net.ipv6.conf.all.disable_ipv6=${VPN_IPV6_DISABLED:-1} # 0=ipv6 enabled, 1=ipv6 disabled
environment:
# additional options may need to be specified based on your VPN provider
- OPENVPN_PROVIDER=${OPENVPN_PROVIDER}
- OPENVPN_USERNAME=${OPENVPN_USERNAME}
- OPENVPN_PASSWORD=${OPENVPN_PASSWORD}
Expand All @@ -56,7 +58,9 @@ services:
- CREATE_TUN_DEVICE=true
- PUID=${HOST_DOWNLOAD_UID:-1000}
- PGID=${HOST_DOWNLOAD_GID:-1000}
# additional options may need to be specified based on your VPN provider
- TRANSMISSION_RPC_USERNAME=${TRANSMISSION_USER-admin}
- TRANSMISSION_RPC_PASSWORD=${TRANSMISSION_PASS-admin}
- TRANSMISSION_RPC_AUTHENTICATION_REQUIRED=${TRANSMISSION_RPC_AUTHENTICATION_REQUIRED:-true}
logging:
driver: json-file
options:
Expand All @@ -81,3 +85,5 @@ volumes:
driver: local
jackett-config:
driver: local
transmission-config:
driver: local
14 changes: 13 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ services:
extends:
service: transmission-base
file: docker-compose.base.yml
image: linuxserver/transmission
image: lscr.io/linuxserver/transmission
environment:
- PUID=${HOST_DOWNLOAD_UID:-1000}
- PGID=${HOST_DOWNLOAD_GID:-1000}
- USER=${TRANSMISSION_USER-admin} # can be empty
- PASS=${TRANSMISSION_PASS-admin} # can be empty
volumes:
- ${HOST_DOWNLOAD_PATH:-/tmp}:/downloads
- ./transmission-settings.json:/tmp/settings.json:ro
- transmission-config:/config
# copy local settings and then run init entrypoint
entrypoint: bash -c "cp /tmp/settings.json /config/ && /init"

# auto update service
watchtower:
Expand All @@ -61,3 +72,4 @@ services:
volumes:
nefarious-db:
jackett-config:
transmission-config:
13 changes: 13 additions & 0 deletions docs/TRANSMISSION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Transmission

There is no need to edit Transmission's settings in `transmission-settings.json` unless you want more fine-grained control.
If you're making changes be sure to follow the [official settings](https://github.com/transmission/transmission/wiki/Editing-Configuration-Files).

The username and password default to `admin` / `admin` and are populated from the variables `TRANSMISSION_USER` and `TRANSMISSION_PASS` in the `.env` file.

**NOTE**: Do not change the values `download-dir` and `incomplete-dir` as they're internal to transmission's container and won't do what you think it may be doing.

**NOTE**: If you make any changes to `transmission-settings.json` you'll have to recreate the transmission container for the changes to take place:

docker-compose up -d --force-recreate transmission

25 changes: 20 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,30 @@
. $(dirname $0)/entrypoint-base.sh

# build django database/tables
su $(id -un ${RUN_AS_UID}) -c "/env/bin/python manage.py migrate"
su $(id -un ${RUN_AS_UID:-1000}) -c "/env/bin/python manage.py migrate"

# create default super user
su $(id -un ${RUN_AS_UID}) -c "/env/bin/python manage.py nefarious-init ${NEFARIOUS_USER-admin} ${NEFARIOUS_EMAIL-admin@localhost} ${NEFARIOUS_PASS-admin}"
# initialization script arguments (default nefarious user)
INIT_ARGS="\
--username ${NEFARIOUS_USER:-admin} \
--password ${NEFARIOUS_PASS:-admin} \
--email ${NEFARIOUS_EMAIL:-admin@localhost} \
"

# append transmission credentials if they exist
if [ ! -z ${TRANSMISSION_USER} ] && [ ! -z ${TRANSMISSION_PASS} ]; then
INIT_ARGS="${INIT_ARGS} \
--transmission_user ${TRANSMISSION_USER-admin} \
--transmission_pass ${TRANSMISSION_PASS-admin} \
"
fi

# run initialization script
su $(id -un ${RUN_AS_UID:-1000}) -c "/env/bin/python manage.py nefarious-init ${INIT_ARGS}"

# allow user to bind to port 80
touch /etc/authbind/byport/80
chmod 500 /etc/authbind/byport/80
chown ${RUN_AS_UID} /etc/authbind/byport/80
chown ${RUN_AS_UID:-1000} /etc/authbind/byport/80

# run as requested user
su $(id -un ${RUN_AS_UID}) -c "authbind /env/bin/uvicorn --workers 2 --host 0.0.0.0 --port 80 nefarious.asgi:application"
su $(id -un ${RUN_AS_UID:-1000}) -c "authbind /env/bin/uvicorn --workers 2 --host 0.0.0.0 --port 80 nefarious.asgi:application"
13 changes: 11 additions & 2 deletions env.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ HOST_DOWNLOAD_GID=1000
NUM_CELERY_WORKERS=0

#########################################################
# vpn settings - leave blank if not using a vpn
# https://haugene.github.io/docker-transmission-openvpn/
# transmission - without vpn
#########################################################
# leave values blank if you don't want authentication
TRANSMISSION_USER=admin
TRANSMISSION_PASS=admin

###############################################################
# transmission - with vpn (leave blank if not using a vpn)
# https://haugene.github.io/docker-transmission-openvpn/
###############################################################
OPENVPN_PROVIDER=
OPENVPN_USERNAME=
OPENVPN_PASSWORD=
Expand All @@ -28,3 +35,5 @@ LOCAL_NETWORK=192.168.1.0/24
# IPv6 - leave blank if your vpn doesn't require it
# 0=ipv6 enabled, 1=ipv6 disabled
VPN_IPV6_DISABLED=
# require authentication
TRANSMISSION_RPC_AUTHENTICATION_REQUIRED=true
20 changes: 14 additions & 6 deletions src/nefarious/management/commands/nefarious-init.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ class Command(BaseCommand):
help = 'Initialize Nefarious'

def add_arguments(self, parser):
parser.add_argument('username', type=str)
parser.add_argument('email', type=str)
parser.add_argument('password', type=str)
parser.add_argument('--username', type=str, required=True)
parser.add_argument('--email', type=str, required=True)
parser.add_argument('--password', type=str, required=True)
parser.add_argument('--transmission_user', type=str, default='') # optional
parser.add_argument('--transmission_pass', type=str, default='') # optional

def handle(self, *args, **options):

Expand All @@ -22,10 +24,16 @@ def handle(self, *args, **options):
options['username'], options['password'], options['email'])))

# create settings if they don't already exist
nefarious_settings, _ = NefariousSettings.objects.get_or_create()
nefarious_settings, was_created = NefariousSettings.objects.get_or_create(
defaults={
# set transmission user/pass
'transmission_user': options['transmission_user'],
'transmission_pass': options['transmission_pass'],
}
)

# populate tmdb configuration if necessary
if not nefarious_settings.tmdb_configuration or not nefarious_settings.tmdb_languages:
# populate tmdb configuration if settings were just created or tmdb conf absent
if was_created or not all([nefarious_settings.tmdb_configuration, nefarious_settings.tmdb_languages]):
tmdb_client = get_tmdb_client(nefarious_settings)
configuration = tmdb_client.Configuration()
nefarious_settings.tmdb_configuration = configuration.info()
Expand Down
69 changes: 66 additions & 3 deletions transmission-settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,70 @@
{
"alt-speed-down": 50,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 50,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 4,
"dht-enabled": true,
"download-dir": "/downloads/",
"download-queue-enabled": true,
"download-queue-size": 5,
"encryption": 1,
"idle-seeding-limit": 30,
"idle-seeding-limit-enabled": false,
"incomplete-dir": "/downloads/.incomplete",
"incomplete-dir-enabled": "true",
"rpc-whitelist": "*",
"rpc-host-whitelist-enabled": "false"
"incomplete-dir-enabled": true,
"lpd-enabled": false,
"message-level": 2,
"peer-congestion-algorithm": "",
"peer-id-ttl-hours": 6,
"peer-limit-global": 200,
"peer-limit-per-torrent": 50,
"peer-port": 51413,
"peer-port-random-high": 65535,
"peer-port-random-low": 49152,
"peer-port-random-on-start": false,
"peer-socket-tos": "default",
"pex-enabled": true,
"port-forwarding-enabled": true,
"preallocation": 1,
"prefetch-enabled": true,
"queue-stalled-enabled": true,
"queue-stalled-minutes": 30,
"ratio-limit": 2,
"ratio-limit-enabled": true,
"rename-partial-files": true,
"rpc-authentication-required": true,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-host-whitelist": "",
"rpc-host-whitelist-enabled": false,
"rpc-password": "",
"rpc-port": 9091,
"rpc-url": "/transmission/",
"rpc-username": "",
"rpc-whitelist": "",
"rpc-whitelist-enabled": false,
"scrape-paused-torrents-enabled": true,
"script-torrent-done-enabled": false,
"script-torrent-done-filename": "",
"seed-queue-enabled": false,
"seed-queue-size": 10,
"speed-limit-down": 100,
"speed-limit-down-enabled": false,
"speed-limit-up": 100,
"speed-limit-up-enabled": false,
"start-added-torrents": true,
"trash-original-torrent-files": false,
"umask": 2,
"upload-slots-per-torrent": 14,
"utp-enabled": false,
"watch-dir": "/watch",
"watch-dir-enabled": true
}