Всем привет! Хочется мне качать торенты на своём сервере, через Web-интерфейс. Раньше качал, но после недавних событий, пришлось настраивать всё по новой.
Суть в том, что Web-морда transmission должна быть доступна по SSL, сертификаты сгенерил Let's Encrypt'ом, при переходе в суб-домен transmission.myservername.org выскакивает окно с аутентификацией и после ввода логина\пароля появляется снова такое окно и так до бесконечности. Если нажать отмена, то видим:
401: Unauthorized
Unauthorized User
А теперь конфиги:
$cat ~/.config/transmission-daemon/settings.json
{
"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": "/storage/Загрузки",
"download-limit": 100,
"download-limit-enabled": 0,
"download-queue-enabled": true,
"download-queue-size": 5,
"encryption": 1,
"idle-seeding-limit": 30,
"idle-seeding-limit-enabled": false,
"incomplete-dir": "/storage/Загрузки",
"incomplete-dir-enabled": false,
"lpd-enabled": false,
"max-peers-global": 200,
"message-level": 1,
"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": false,
"preallocation": 1,
"prefetch-enabled": true,
"queue-stalled-enabled": true,
"queue-stalled-minutes": 30,
"ratio-limit": 2,
"ratio-limit-enabled": false,
"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": "1234567890",
"rpc-port": 9091,
"rpc-url": "/transmission/",
"rpc-username": "anton",
"rpc-whitelist": "127.0.0.1",
"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": 022,
"upload-limit": 100,
"upload-limit-enabled": 0,
"upload-slots-per-torrent": 14,
"utp-enabled": true
}
$cat /etc/init.d/transmission-daemon
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: transmission-daemon
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop the transmission-daemon.
# Description: Enable service provided by transmission-daemon.
### END INIT INFO
NAME=transmission-daemon
DAEMON=/usr/bin/$NAME
USER=anton
STOP_TIMEOUT=30
export PATH="${PATH:+$PATH:}/sbin"
[ -x $DAEMON ] || exit 0
[ -e /etc/default/$NAME ] && . /etc/default/$NAME
. /lib/lsb/init-functions
start_daemon () {
if [ $ENABLE_DAEMON != 1 ]; then
log_progress_msg "(disabled)"
log_end_msg 255 || true
else
start-stop-daemon --start \
--chuid $USER \
$START_STOP_OPTIONS \
--exec $DAEMON -- $OPTIONS || log_end_msg $?
log_end_msg 0
fi
}
case "$1" in
start)
log_daemon_msg "Starting bittorrent daemon" "$NAME"
start_daemon
;;
stop)
log_daemon_msg "Stopping bittorrent daemon" "$NAME"
start-stop-daemon --stop --quiet \
--exec $DAEMON --retry $STOP_TIMEOUT \
--oknodo || log_end_msg $?
log_end_msg 0
;;
reload)
log_daemon_msg "Reloading bittorrent daemon" "$NAME"
start-stop-daemon --stop --quiet \
--exec $DAEMON \
--oknodo --signal 1 || log_end_msg $?
log_end_msg 0
;;
restart|force-reload)
log_daemon_msg "Restarting bittorrent daemon" "$NAME"
start-stop-daemon --stop --quiet \
--exec $DAEMON --retry $STOP_TIMEOUT \
--oknodo || log_end_msg $?
start_daemon
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
log_action_msg "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart|status}" || true
exit 2
;;
esac
exit 0
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName transmission.myservername.org
RewriteEngine On
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteCond %{SERVER_PORT} =80
RewriteRule ^/(.*)$ https://%{SERVER_NAME}:443/$1 [R,L]
RewriteCond %{SERVER_NAME} =transmission.myservername.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
ServerAdmin admin@myservername.org
ServerName transmission.myservername.org
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/transmission.myservername.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/transmission.myservername.org/privkey.pem
ProxyPass / http://0.0.0.0:9091/
ProxyPassReverse / hhttp://0.0.0.0:9091/
</VirtualHost>
$cat /etc/default/transmission-daemon
# defaults for transmission-daemon
# sourced by /etc/init.d/transmission-daemon
# Change to 0 to disable daemon
ENABLE_DAEMON=1
# This directory stores some runtime information, like torrent files
# and links to the config file, which itself can be found in
# /etc/transmission-daemon/settings.json
#CONFIG_DIR="/var/lib/transmission-daemon/info"
CONFIG_DIR="/home/anton/.config/transmission-daemon"
# Default options for daemon, see transmission-daemon(1) for more options
OPTIONS="--config-dir $CONFIG_DIR --logfile /var/log/transmission.log"
# (optional) extra options to start-stop-daemon
#START_STOP_OPTIONS="--iosched idle --nicelevel 10"
$ cat /var/log/transmission.log
cat: /var/log/transmission.log: No such file or directory