This commit is contained in:
2021-06-29 12:37:08 +03:00
commit 12fdc96d20
282 changed files with 13627 additions and 0 deletions

95
qbittorrent/CHANGELOG.md Normal file
View File

@@ -0,0 +1,95 @@
## 14.3.6.99202106272003-7387-ac8105c30ubuntu20.04.1-ls141 (28-06-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.5.99202106211645-7376-e25948e73ubuntu20.04.1-ls140 (22-06-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.5.99202106201814-7376-e25948e73ubuntu20.04.1-ls139 (21-06-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.5.99202106191735-7376-e25948e73ubuntu20.04.1-ls138 (20-06-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.5.99202106151345-7374-667d4e421ubuntu20.04.1-ls137 (16-06-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.5.99202106080759-7366-33e090cfcubuntu20.04.1-ls136 (09-06-2021)
- Update to latest version from linuxserver/docker-qbittorrent
- Add banner in log
- New option openvpn_alternative_mode, binds only ovpn to qbittorrent and not webui
## 14.3.5.99202105022253-7365-063844ed4ubuntu20.04.1-ls133 (11-05-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.5.99202105022253-7365-063844ed4ubuntu20.04.1-ls132 (04-05-2021)
- Update to latest version from linuxserver/docker-qbittorrent
- New option : use specific DNS instead of the router ones to avoid spamming, especially useful if using adguard home/pihole. Keep blank to use the router dns.
## 14.3.4.99202104300534-7354-9f8a6e8fbubuntu20.04.1-ls131 (01-05-2021)
- Update to latest version from linuxserver/docker-qbittorrent
- Robust the smb script to test for several common options
- smbv1 bit is not used anymore
## 14.3.4.99202104281424-7353-7dd9e7343ubuntu20.04.1-ls130 (29-04-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.4.99202104250604-7352-b2a43eeffubuntu20.04.1-ls129 (27-04-2021)
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.4.99202104250604-7352-b2a43eeffubuntu20.04.1-ls128
- Update to latest version from linuxserver/docker-qbittorrent
- Clarified steps to check in case of smb mount fail
- New option : set domain for smb share
- Addition of openvpn support
## 14.3.4.99202104180633-7350-2c8f322afubuntu20.04.1-ls127
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.4.99202104090418-7349-789803700ubuntu20.04.1-ls126
- Update to latest version from linuxserver/docker-qbittorrent
- Addition of ingress
- Viewtorrent as default ui
## 14.3.4.99202104031018-7348-2b6baa609ubuntu20.04.1-ls125
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.3.99202103251603-7345-332b173e0ubuntu20.04.1-ls122
- Update to latest version from linuxserver/docker-qbittorrent ; Rebase to focal.
## 14.3.3.99202101191832-7248-da0b276d5ubuntu20.04.1-ls120
- Update to latest version from linuxserver/docker-qbittorrent ; Stop creating /config/data directory on startup
## 14.3.3.99202101191832-7248-da0b276d5ubuntu20.04.1-ls119
- Update to latest version from linuxserver/docker-qbittorrent ; Fix adding search engine plugin
## 14.3.3.99202101191832-7248-da0b276d5ubuntu20.04.1-ls118
- Update to latest version from linuxserver/docker-qbittorrent
- Allow mounting shares named \ip\share in addition to //ip/share
## 14.3.3.99202101191832-7248-da0b276d5ubuntu20.04.1-ls117
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.3.99202101191832-7248-da0b276d5ubuntu20.04.1-ls116
- Correct VueTorrent link
## 14.3.3.99202101191832-7248-da0b276d5ubuntu20.04.1-ls115
- New configuration option : set download path
- New configuration option : set username for webUI
- New feature : mount smb share in protected mode
- New feature : mount multiple smb shares
- New config/feature : mount smbv1
- Changed path : changed smb mount path from /storage/externalcifs to /mnt/$NAS name
- Removed feature : ability to remove protection and mount local hdd, to increase the addon score
- Update to latest version from linuxserver/docker-qbittorrent
- Enabling of custom webUI from configuration
## 14.3.3.99202101191832-7248-da0b276d5ubuntu18.04.1-ls114
- Update to latest version from linuxserver/docker-qbittorrent
## 14.3.3.99202101191832-7248-da0b276d5ubuntu18.04.1-ls113
- Update to latest version from linuxserver/docker-qbittorrent
- Whitelist option
- Enables PUID/GUID options
- Addition of ssl options
- Addition of possibility to mount local disc or smb

107
qbittorrent/Dockerfile Normal file
View File

@@ -0,0 +1,107 @@
ARG BUILD_FROM
ARG BUILD_VERSION
ARG BUILD_UPSTREAM="14.3.6.99202106272003-7387-ac8105c30ubuntu20.04.1-ls141"
FROM ${BUILD_FROM}${BUILD_UPSTREAM}
# Base system
ARG BASHIO_VERSION=0.13.0
ARG TEMPIO_VERSION=2021.01.0
ARG BUILD_ARCH
RUN \
####################
# AVOID NTP ISSUES #
####################
yum install -y ntp && \
service ntpd stop && \
ntpdate pool.ntp.org && \
\
################
# Install apps #
################
apt-get update && \
apt-get install -y \
apt-transport-https \
jq \
curl \
cifs-utils \
keyutils \
nginx \
coreutils \
openvpn \
\
##################
# Install tempio #
##################
curl -L -f -s -o /usr/bin/tempio \
"https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" && \
chmod a+x /usr/bin/tempio && \
\
##############
# STATISTICS #
##############
curl -L -f -s -o /tmp/tmp \
"https://github.com/alexbelgium/downloads-tracker/archive/refs/tags/Qbittorrent.zip" && \
\
##################
# Install bashio #
##################
mkdir -p /tmp/bashio && \
curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" && \
| tar -xzf - --strip 1 -C /tmp/bashio && \
mv /tmp/bashio/lib /usr/lib/bashio && \
ln -s /usr/lib/bashio/bashio /usr/bin/bashio && \
rm -rf /tmp/bashio && \
\
########################################
# Correct upstream image folders links #
########################################
\
# Allow UID and GID setting
sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser && \
sed -i 's/{PUID:-911}/(bashio::config "PUID")/g' /etc/cont-init.d/10-adduser && \
sed -i 's/{PGID:-911}/(bashio::config "PGID")/g' /etc/cont-init.d/10-adduser && \
\
# Correct permissions
sed -i 's|/config|-R /config/qBittorrent|g' /etc/cont-init.d/10-adduser && \
sed -i 's= /config=/config/qBittorrent || true=g' /etc/cont-init.d/30-config && \
\
# Set download folder to /share
sed -i 's|/downloads/|/share/qBittorrent/|g' /defaults/qBittorrent.conf && \
\
# Remove fixed folders, allows connection to webUI
sed '11,13d' /defaults/qBittorrent.conf && \
echo 'WebUI\HostHeaderValidation=false' >> /defaults/qBittorrent.conf && \
echo 'WebUI\LocalHostAuth=false' >> /defaults/qBittorrent.conf
# Copy root filesystem
COPY rootfs /
VOLUME [ "/data" ]
### LABELS
ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_DESCRIPTION
ARG BUILD_NAME
ARG BUILD_REF
ARG BUILD_REPOSITORY
ARG BUILD_VERSION
LABEL \
io.hass.name="${BUILD_NAME}" \
io.hass.description="${BUILD_DESCRIPTION}" \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION} \
maintainer="alexbelgium (https://github.com/alexbelgium)" \
org.opencontainers.image.title="${BUILD_NAME}" \
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
org.opencontainers.image.vendor="Home Assistant Add-ons" \
org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://github.com/alexbelgium" \
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${BUILD_REF} \
org.opencontainers.image.version=${BUILD_VERSION}

61
qbittorrent/README.md Normal file
View File

@@ -0,0 +1,61 @@
# Home assistant add-on: qBittorrent
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield]
![Supports smb mounts][smb-shield] ![Supports openvpn][openvpn-shield] ![Supports ingress][ingress-shield] ![Supports ssl][ssl-shield]
## About
qBittorrent is a bittorrent client.
This addon is based on the [docker image](https://github.com/linuxserver/qbittorrent) from linuxserver.io.
## Installation
The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Hass.io add-on.
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
1. Install this add-on.
1. Click the `Save` button to store your configuration.
1. Start the add-on.
1. Check the logs of the add-on to see if everything went well.
1. Carefully configure the add-on to your preferences, see the official documentation for for that.
## Configuration
Webui can be found at <http://your-ip:8081>. The default username/password : described in the startup log. Configurations can be done through the app, except for the following options.
Network disk is mounted to /mnt/storagename
OpenVPN must be enabled from within qBittorrent options
```yaml
GUID: user
GPID: user
ssl: true/false
certfile: fullchain.pem #ssl certificate
keyfile: privkey.pem #sslkeyfile
whitelist: "localhost,192.168.0.0/16" # list ip subnets that won't need a password (optional)
Username: "admin" #username to access webui. Please change it as the default is admin for all installations.
customUI: selection from list # alternative webUI can be set here. Latest version set at each addon start.
SavePath: "/share/qbittorrent" # Define the download directory
DNS_servers : 8.8.8.8,1.1.1.1 # Keep blank to use routers DNS, or set custom DNS to avoid spamming in case of local DNS ad-remover
networkdisks: "//SERVER/SHARE" # optional, list of smb servers to mount, separated by commas
cifsusername: "username" # optional, smb username, same for all smb shares
cifspassword: "password" # optional, smb password, same for all smb shares)
openvpn_enabled: yes/no
openvpn_alternative_mode: true/false # if enabled, will tunnel only qbittorrent and not webui through vpn. Allows webui connection from external networks, but risk of decreased stability.
openvpn_config: must reference an openvpn config files stored in /config/openvpn
openvpn_username: openvpn username
openvpn_password": openvpn password
```
## Support
Create an issue on github, or ask on the [home assistant thread](https://community.home-assistant.io/t/home-assistant-addon-qbittorrent/279247)
[repository]: https://github.com/alexbelgium/hassio-addons
[smb-shield]: https://img.shields.io/badge/smb-yes-green.svg
[openvpn-shield]: https://img.shields.io/badge/openvpn-yes-green.svg
[ingress-shield]: https://img.shields.io/badge/ingress-yes-green.svg
[ssl-shield]: https://img.shields.io/badge/ssl-yes-green.svg
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg

50
qbittorrent/apparmor.txt Normal file
View File

@@ -0,0 +1,50 @@
#include <tunables/global>
profile db21ed7f_qbittorrent flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
capability,
file,
mount,
umount,
remount,
capability setgid,
capability setuid,
capability sys_admin,
capability dac_read_search,
capability net_admin,
capability dac_override,
# capability sys_rawio,
# S6-Overlay
/bin/** ix,
/usr/bin/** ix,
/usr/lib/bashio/** ix,
/etc/s6/** rix,
/run/s6/** rix,
/etc/services.d/** rwix,
/etc/cont-init.d/** rwix,
/etc/cont-finish.d/** rwix,
/init rix,
/var/run/** mrwkl,
/var/run/ mrwkl,
/dev/i2c-1 mrwkl,
# Files required
/dev/sda1 mrwkl,
/dev/sdb1 mrwkl,
/dev/mmcblk0p1 mrwkl,
/dev/* mrwkl,
/tmp/** mrkwl,
/dev/net/tun mrwkl,
# Data access
/data/** rw,
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
ptrace (trace,read) peer=docker-default,
# docker daemon confinement requires explict allow rule for signal
signal (receive) set=(kill,term) peer=/usr/bin/docker,
}

8
qbittorrent/build.json Normal file
View File

@@ -0,0 +1,8 @@
{
"build_from": {
"armv7": "linuxserver/qbittorrent:arm32v7-",
"armhf": "linuxserver/qbittorrent:arm32v7-",
"aarch64": "linuxserver/qbittorrent:arm64v8-",
"amd64": "linuxserver/qbittorrent:amd64-"
}
}

85
qbittorrent/config.json Normal file
View File

@@ -0,0 +1,85 @@
{
"name": "Qbittorrent",
"version": "14.3.6.99202106272003-7387-ac8105c30ubuntu20.04.1-ls141",
"upstream": "14.3.6.99202106272003-7387-ac8105c30ubuntu20.04.1-ls141",
"slug": "qbittorrent",
"description": "qBittorrent is a bittorrent client",
"url": "https://github.com/alexbelgium/hassio-addons",
"arch": [
"aarch64",
"amd64",
"armv7",
"armhf"
],
"ingress": true,
"ingress_port": 8099,
"panel_icon": "mdi:progress-download",
"ports": {
"8080/tcp": 8081,
"6881/tcp": 6881,
"6881/udp": 6881
},
"ports_description": {
"8080/tcp": "Web UI port (nor required for Ingress)",
"6881/tcp": "Peer port",
"6881/udp": "Peer port"
},
"map": [
"media:rw",
"config:rw",
"share:rw",
"ssl"
],
"apparmor": true,
"host_network": false,
"privileged": [
"SYS_ADMIN",
"DAC_READ_SEARCH",
"NET_ADMIN"
],
"devices": [
"/dev/net/tun"
],
"webui": "[PROTO:ssl]://[HOST]:[PORT:8080]",
"boot": "auto",
"environment": {
"WEBUI_PORT": "8080",
"PUID": "0",
"PGID": "0"
},
"options": {
"ssl": false,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"whitelist": "localhost,127.0.0.1,172.30.0.0/16,192.168.0.0/16",
"customUI": "vuetorrent",
"SavePath": "/share/qBittorrent",
"Username": "admin",
"DNS_server": "8.8.8.8,1.1.1.1",
"PUID": "0",
"PGID": "0"
},
"schema": {
"ssl": "bool",
"certfile": "str",
"keyfile": "str",
"whitelist": "str?",
"PUID": "int?",
"PGID": "int?",
"SavePath": "str?",
"Username": "str?",
"customUI": "list(|vuetorrent|qbit-matUI|qb-web)?",
"DNS_server": "str?",
"networkdisks": "str?",
"smbv1": "bool?",
"cifsusername": "str?",
"cifspassword": "str?",
"cifsdomain": "str?",
"openvpn_enabled": "bool?",
"openvpn_alternative_mode": "bool?",
"openvpn_config": "str?",
"openvpn_username": "str?",
"openvpn_password": "str?",
"TZ": "str?"
}
}

BIN
qbittorrent/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
qbittorrent/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -0,0 +1,39 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: Base Images
# Displays a simple add-on banner on startup
# ==============================================================================
if bashio::supervisor.ping; then
bashio::log.blue \
'-----------------------------------------------------------'
bashio::log.blue " Add-on: $(bashio::addon.name)"
bashio::log.blue " $(bashio::addon.description)"
bashio::log.blue \
'-----------------------------------------------------------'
bashio::log.blue " Add-on version: $(bashio::addon.version)"
if bashio::var.true "$(bashio::addon.update_available)"; then
bashio::log.magenta ' There is an update available for this add-on!'
bashio::log.magenta \
" Latest add-on version: $(bashio::addon.version_latest)"
bashio::log.magenta ' Please consider upgrading as soon as possible.'
else
bashio::log.green ' You are running the latest version of this add-on.'
fi
bashio::log.blue " System: $(bashio::info.operating_system)" \
" ($(bashio::info.arch) / $(bashio::info.machine))"
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
bashio::log.blue \
'-----------------------------------------------------------'
bashio::log.blue \
' Please, share the above information when looking for help'
bashio::log.blue \
' or support in, e.g., GitHub, forums or the Discord chat.'
bashio::log.green \
' https://github.com/alexbelgium/hassio-addons'
bashio::log.blue \
'-----------------------------------------------------------'
fi

View File

@@ -0,0 +1,38 @@
#!/usr/bin/with-contenv bashio
#################
# NGINX SETTING #
#################
declare admin_port
declare qbittorrent_protocol=http
# Generate Ingress configuration
if bashio::config.true 'ssl'; then
qbittorrent_protocol=https
fi
bashio::var.json \
interface "$(bashio::addon.ip_address)" \
port "^$(bashio::addon.ingress_port)" \
protocol "${qbittorrent_protocol}" \
certfile "$(bashio::config 'certfile')" \
keyfile "$(bashio::config 'keyfile')" \
ssl "^$(bashio::config 'ssl')" \
| tempio \
-template /etc/nginx/templates/ingress.gtpl \
-out /etc/nginx/servers/ingress.conf
######################
# VUETORRENT INSTALL #
######################
LATEST_RELEASE=$(curl -s -L https://api.github.com/repos/wdaan/vuetorrent/releases/latest \
| grep "browser_download_url.*zip" \
| cut -d : -f 2,3 \
| tr -d \" \
| xargs)
curl -s -S -O -J -L $LATEST_RELEASE
unzip -o vuetorrent.zip -d / >/dev/null
rm /vuetorrent.zip >/dev/null

View File

@@ -0,0 +1,28 @@
#!/usr/bin/with-contenv bashio
###############
# DNS SETTING #
###############
# Avoid usage of local dns such as adguard home or pihole\n"
if bashio::config.has_value 'DNS_server'; then
# Define variables
DNSSERVER=$(bashio::config 'DNS_server')
DNS=""
DNSLIST=""
# Get DNS servers
for server in ${DNSSERVER//,/ } # Separate comma separated values
do
DNS="${DNS}nameserver $server\n"
DNSLIST="$server $DNSLIST"
done
# Write resolv.conf
printf "${DNS}" > /etc/resolv.conf
chmod 644 /etc/resolv.conf
bashio::log.info "DNS SERVERS set to $DNSLIST"
else
bashio::log.info "DNS Servers option empty. Using default router (or HA) dns servers."
fi

View File

@@ -0,0 +1,128 @@
#!/usr/bin/with-contenv bashio
##########
# INIT #
##########
# Define preferences line
cd /config/qBittorrent/
LINE=$(sed -n '/Preferences/=' qBittorrent.conf)
LINE=$((LINE + 1))
##################
# Default folder #
##################
if bashio::config.has_value 'SavePath'; then
DOWNLOADS=$(bashio::config 'SavePath')
sed -i '/SavePath/d' qBittorrent.conf
sed -i "$LINE i\Downloads\\\SavePath=$DOWNLOADS" qBittorrent.conf
mkdir -p $DOWNLOADS || true
chown -R abc:abc $DOWNLOADS || bashio::log.info "Error, please check default save folder configuration in addon"
bashio::log.info "Downloads can be found in $DOWNLOADS"
else
mkdir -p /share/qBittorrent || true
chown -R abc:abc /share/qBittorrent
fi
################
# Correct Port #
################
sed -i '/PortRangeMin/d' qBittorrent.conf
sed -i "$LINE i\Connection\\\PortRangeMin=6881" qBittorrent.conf
################
# SSL CONFIG #
################
# Clean data
sed -i '/HTTPS/d' qBittorrent.conf
bashio::config.require.ssl
if bashio::config.true 'ssl'; then
bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths"
#set variables
CERTFILE=$(bashio::config 'certfile')
KEYFILE=$(bashio::config 'keyfile')
sed -i "$LINE i\WebUI\\\HTTPS\\\Enabled=True" qBittorrent.conf
sed -i "$LINE i\WebUI\\\HTTPS\\\CertificatePath=/ssl/$CERTFILE" qBittorrent.conf
sed -i "$LINE i\WebUI\\\HTTPS\\\KeyPath=/ssl/$KEYFILE" qBittorrent.conf
fi
################
# WHITELIST #
################
cd /config/qBittorrent/
if bashio::config.has_value 'whitelist'; then
WHITELIST=$(bashio::config 'whitelist')
#clean data
sed -i '/AuthSubnetWhitelist/d' qBittorrent.conf
sed -i "$LINE i\WebUI\\\AuthSubnetWhitelistEnabled=true" qBittorrent.conf
sed -i "$LINE i\WebUI\\\AuthSubnetWhitelist=$WHITELIST" qBittorrent.conf
bashio::log.info "Whitelisted subsets will not require a password : $WHITELIST"
fi
###############
# USERNAME #
###############
cd /config/qBittorrent/
if bashio::config.has_value 'Username'; then
USERNAME=$(bashio::config 'Username')
#clean data
sed -i '/WebUI\\\Username/d' qBittorrent.conf
#add data
sed -i "$LINE i\WebUI\\\Username=$USERNAME" qBittorrent.conf
bashio::log.info "WEBUI username set to $USERNAME"
fi
################
# Alternate UI #
################
# Clean data
sed -i '/AlternativeUIEnabled/d' qBittorrent.conf
sed -i '/RootFolder/d' qBittorrent.conf
rm -f -r /webui
mkdir -p /webui
chown abc:abc /webui
if bashio::config.has_value 'customUI'; then
### Variables
CUSTOMUI=$(bashio::config 'customUI')
bashio::log.info "Alternate UI enabled : $CUSTOMUI. If webui don't work, disable this option"
### Download WebUI
case $CUSTOMUI in
"vuetorrent")
curl -s -S -J -L -o /webui/release.zip $(curl -s https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*vuetorrent.zip") >/dev/null
;;
"qbit-matUI")
curl -s -S -J -L -o /webui/release.zip $(curl -s https://api.github.com/repos/bill-ahmed/qbit-matUI/releases/latest | grep -o "http.*Unix.*.zip") >/dev/null
;;
"qb-web")
curl -s -S -J -L -o /webui/release.zip $(curl -s https://api.github.com/repos/CzBiX/qb-web/releases | grep -o "http.*qb-web-.*zip") >/dev/null
;;
esac
### Install WebUI
mkdir -p /webui/$CUSTOMUI
unzip -q /webui/release.zip -d /webui/$CUSTOMUI
rm /webui/*.zip
CUSTOMUIDIR="$(dirname "$(find /webui/$CUSTOMUI -iname "public" -type d)")"
sed -i "$LINE i\WebUI\\\AlternativeUIEnabled=true" /config/qBittorrent/qBittorrent.conf
sed -i "$LINE i\WebUI\\\RootFolder=$CUSTOMUIDIR" /config/qBittorrent/qBittorrent.conf
fi
##########
# CLOSE #
##########
bashio::log.info "Default username/password : admin/adminadmin"
bashio::log.info "Configuration can be found in /config/qBittorrent"

View File

@@ -0,0 +1,62 @@
#!/usr/bin/with-contenv bashio
####################
# MOUNT SMB SHARES #
####################
if bashio::config.has_value 'networkdisks'; then
# Mount CIFS Share if configured and if Protection Mode is active
bashio::log.info 'Mounting smb share(s)...'
# Define variables
MOREDISKS=$(bashio::config 'networkdisks')
CIFS_USERNAME=$(bashio::config 'cifsusername')
CIFS_PASSWORD=$(bashio::config 'cifspassword')
MOUNTED=false
SMBVERS=""
SECVERS=""
if bashio::config.has_value 'cifsdomain'; then
DOMAIN=",domain=$(bashio::config 'cifsdomain')"
else
DOMAIN=""
fi
# Mounting disks
for disk in ${MOREDISKS//,/ } # Separate comma separated values
do
# Clean name of network share
disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name
diskname=${disk//\\//} #replace \ with /
diskname=${diskname##*/} # Get only last part of the name
# Prepare mount point
mkdir -p /mnt/$diskname
chown -R root:root /mnt/$diskname
#Tries to mount with default options
mount -t cifs -o rw,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$DOMAIN $disk /mnt/$diskname 2>ERRORCODE && MOUNTED=true || MOUNTED=false
# if Fail test different smb and sec versions
if [ $MOUNTED = false ]; then
for SMBVERS in ",vers=3" ",vers=1.0" ",vers=2.1" ",vers=3.0" ",nodfs" ",uid=0,gid=0,forceuid,forcegid" ",noforceuid,noforcegid" ",${DOMAIN}"
do
mount -t cifs -o rw,iocharset=utf8,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS $disk /mnt/$diskname 2>/dev/null && MOUNTED=true && break || MOUNTED=false
for SECVERS in ",sec=ntlmi" ",sec=ntlmv2" ",sec=ntlmv2i" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=ntlm" ",sec=krb5i" ",sec=krb5"
do
mount -t cifs -o rw,iocharset=utf8,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS$SECVERS $disk /mnt/$disk name 2>/dev/null && MOUNTED=true && break 2 && break || MOUNTED=false
done
done
fi
# Messages
if [ $MOUNTED = true ]; then
#Test write permissions
touch /mnt/$diskname/testaze && rm /mnt/$diskname/testaze && bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" || bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
else
# message if still fail
bashio::log.fatal "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD. Please check your remote share path, username, password, domain, try putting 0 in UID and GID" # Mount share
bashio::log.fatal "Error read : $(<ERRORCODE)" # Mount share
rm ERRORCODE
fi
done
fi

View File

@@ -0,0 +1,83 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
declare openvpn_config
declare openvpn_username
declare openvpn_password
if bashio::config.true 'openvpn_enabled'; then
bashio::log.info "Configuring openvpn"
#####################
# CONFIGURE OPENVPN #
#####################
openvpn_config=$(bashio::config 'openvpn_config')
cp "/config/openvpn/${openvpn_config}" /etc/openvpn/config.ovpn || bashio::log.error "openvpn config file not found in /config/openvpn/${openvpn_config}"
openvpn_username=$(bashio::config 'openvpn_username')
echo "${openvpn_username}" > /etc/openvpn/credentials
openvpn_password=$(bashio::config 'openvpn_password')
echo "${openvpn_password}" >> /etc/openvpn/credentials
sed -i 's/auth-user-pass.*/auth-user-pass \/etc\/openvpn\/credentials/g' /etc/openvpn/config.ovpn
# Permissions
chmod 600 /etc/openvpn/credentials
chmod 755 /etc/openvpn/up.sh
chmod 755 /etc/openvpn/down.sh
chmod 755 /etc/openvpn/up-qbittorrent.sh
chmod +x /etc/openvpn/up.sh
chmod +x /etc/openvpn/up-qbittorrent.sh
bashio::log.info "openvpn correctly set, qbittorrent will run tunnelled through openvpn"
#########################
# CONFIGURE QBITTORRENT #
#########################
QBT_CONFIG_FILE="/config/qBittorrent/qBittorrent.conf"
# Define preferences line
cd /config/qBittorrent/
LINE=$(sed -n '/Preferences/=' qBittorrent.conf)
LINE=$((LINE + 1))
# If qBittorrent.conf exists
if [ -f "$QBT_CONFIG_FILE" ]; then
# Remove previous line and bind tun0
sed -i '/Interface/d' qBittorrent.conf
# sed -i '/PortRangeMin/d' qBittorrent.conf
# Bind tun0
# sed -i "$LINE i\Connection\\\Interface=tun0" qBittorrent.conf
# sed -i "$LINE i\Connection\\\InterfaceName=tun0" qBittorrent.conf
else
bashio::log.error "qBittorrent config file doesn't exist, openvpn must be added manually to qbittorrent options "
exit 1
fi
#####################
# ALTERNATIVE MODE #
#####################
if bashio::config.true 'openvpn_alternative_mode'; then
# Remove previous line and bind tun0
sed -i '/Interface/d' qBittorrent.conf
# Bind tun0
sed -i "$LINE i\Connection\\\Interface=tun0" qBittorrent.conf
sed -i "$LINE i\Connection\\\InterfaceName=tun0" qBittorrent.conf
# Modify ovpn config
echo "route-nopull" >> /etc/openvpn/config.ovpn
fi
else
##################
# REMOVE OPENVPN #
##################
# Ensure no redirection by removing the direction tag
cd /config/qBittorrent/
sed -i '/Interface/d' qBittorrent.conf
bashio::log.info "Direct connection without VPN enabled"
fi

View File

@@ -0,0 +1,96 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
font/woff woff;
font/woff2 woff2;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc wmlc;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

View File

@@ -0,0 +1,15 @@
proxy_http_version 1.1;
proxy_ignore_client_abort off;
proxy_read_timeout 86400s;
proxy_redirect off;
proxy_send_timeout 86400s;
proxy_max_temp_file_size 0;
proxy_set_header Accept-Encoding "";
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Real-IP $remote_addr;

View File

@@ -0,0 +1 @@
resolver 127.0.0.11;

View File

@@ -0,0 +1,6 @@
root /dev/null;
server_name $hostname;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;

View File

@@ -0,0 +1,9 @@
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA;
ssl_ecdh_curve secp384r1;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;

View File

@@ -0,0 +1,3 @@
upstream backend {
server 127.0.0.1:8080;
}

View File

@@ -0,0 +1,56 @@
# Run nginx in foreground.
daemon off;
# This is run inside Docker.
user root;
# Pid storage location.
pid /var/run/nginx.pid;
# Set number of worker processes.
worker_processes 1;
# Enables the use of JIT for regular expressions to speed-up their processing.
pcre_jit on;
# Write error log to Hass.io add-on log.
error_log /proc/1/fd/1 error;
# Load allowed environment vars
env HASSIO_TOKEN;
# Load dynamic modules.
include /etc/nginx/modules/*.conf;
# Max num of simultaneous connections by a worker process.
events {
worker_connections 512;
}
http {
include /etc/nginx/includes/mime.types;
log_format hassio '[$time_local] $status '
'$http_x_forwarded_for($remote_addr) '
'$request ($http_user_agent)';
access_log /proc/1/fd/1 hassio;
client_max_body_size 4G;
default_type application/octet-stream;
gzip on;
keepalive_timeout 65;
sendfile on;
server_tokens off;
tcp_nodelay on;
tcp_nopush on;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include /etc/nginx/includes/resolver.conf;
include /etc/nginx/includes/upstream.conf;
include /etc/nginx/servers/*.conf;
}

View File

@@ -0,0 +1 @@
Without requirements or design, programming is the art of adding bugs to an empty text file. (Louis Srygley)

View File

@@ -0,0 +1,17 @@
server {
listen {{ .interface }}:{{ .port }} default_server;
server_name vue.torrent;
include /etc/nginx/includes/server_params.conf;
include /etc/nginx/includes/proxy_params.conf;
location / {
root /vuetorrent/public/;
}
location /api {
proxy_pass {{ .protocol }}://backend;
http2_push_preload on;
client_max_body_size 10M;
}
}

View File

@@ -0,0 +1,33 @@
#!/bin/sh
# Copyright (c) 2006-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
# If we have a service specific script, run this now
if [ -x /etc/openvpn/"${RC_SVCNAME}"-down.sh ] ; then
/etc/openvpn/"${RC_SVCNAME}"-down.sh "$@"
fi
# Restore resolv.conf to how it was
if [ "${PEER_DNS}" != "no" ]; then
if [ -x /sbin/resolvconf ] ; then
/sbin/resolvconf -d "${dev}"
elif [ -e /etc/resolv.conf-"${dev}".sv ] ; then
# Important that we cat instead of move incase resolv.conf is
# a symlink and not an actual file
cat /etc/resolv.conf-"${dev}".sv > /etc/resolv.conf
rm -f /etc/resolv.conf-"${dev}".sv
fi
fi
if [ -n "${RC_SVCNAME}" ]; then
# Re-enter the init script to start any dependant services
if /etc/init.d/"${RC_SVCNAME}" --quiet status ; then
export IN_BACKGROUND=true
/etc/init.d/"${RC_SVCNAME}" --quiet stop
fi
fi
exit 0
# vim: ts=4 :

View File

@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bashio
WEBUI_PORT=${WEBUI_PORT:-8080}
exec s6-setuidgid abc /usr/bin/qbittorrent-nox --webui-port="${WEBUI_PORT}"

View File

@@ -0,0 +1,94 @@
#!/bin/sh
# launch qbittorrent
/etc/openvpn/up-qbittorrent.sh "${4}" &
# Copyright (c) 2006-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
# Setup our resolv.conf
# Vitally important that we use the domain entry in resolv.conf so we
# can setup the nameservers are for the domain ONLY in resolvconf if
# we're using a decent dns cache/forwarder like dnsmasq and NOT nscd/libc.
# nscd/libc users will get the VPN nameservers before their other ones
# and will use the first one that responds - maybe the LAN ones?
# non resolvconf users just the the VPN resolv.conf
# FIXME:- if we have >1 domain, then we have to use search :/
# We need to add a flag to resolvconf to say
# "these nameservers should only be used for the listed search domains
# if other global nameservers are present on other interfaces"
# This however, will break compatibility with Debians resolvconf
# A possible workaround would be to just list multiple domain lines
# and try and let resolvconf handle it
if [ "${PEER_DNS}" != "no" ]; then
NS=
DOMAIN=
SEARCH=
i=1
while true ; do
eval opt=\$foreign_option_${i}
[ -z "${opt}" ] && break
if [ "${opt}" != "${opt#dhcp-option DOMAIN *}" ] ; then
if [ -z "${DOMAIN}" ] ; then
DOMAIN="${opt#dhcp-option DOMAIN *}"
else
SEARCH="${SEARCH}${SEARCH:+ }${opt#dhcp-option DOMAIN *}"
fi
elif [ "${opt}" != "${opt#dhcp-option DNS *}" ] ; then
NS="${NS}nameserver ${opt#dhcp-option DNS *}\n"
fi
i=$((${i} + 1))
done
if [ -n "${NS}" ] ; then
DNS="# Generated by openvpn for interface ${dev}\n"
if [ -n "${SEARCH}" ] ; then
DNS="${DNS}search ${DOMAIN} ${SEARCH}\n"
elif [ -n "${DOMAIN}" ]; then
DNS="${DNS}domain ${DOMAIN}\n"
fi
DNS="${DNS}${NS}"
if [ -x /sbin/resolvconf ] ; then
printf "${DNS}" | /sbin/resolvconf -a "${dev}"
else
# Preserve the existing resolv.conf
if [ -e /etc/resolv.conf ] ; then
cp /etc/resolv.conf /etc/resolv.conf-"${dev}".sv
fi
printf "${DNS}" > /etc/resolv.conf
chmod 644 /etc/resolv.conf
fi
fi
fi
# Below section is Gentoo specific
# Quick summary - our init scripts are re-entrant and set the RC_SVCNAME env var
# as we could have >1 openvpn service
if [ -n "${RC_SVCNAME}" ]; then
# If we have a service specific script, run this now
if [ -x /etc/openvpn/"${RC_SVCNAME}"-up.sh ] ; then
/etc/openvpn/"${RC_SVCNAME}"-up.sh "$@"
fi
# Re-enter the init script to start any dependant services
if ! /etc/init.d/"${RC_SVCNAME}" --quiet status ; then
export IN_BACKGROUND=true
/etc/init.d/${RC_SVCNAME} --quiet start
fi
fi
###############
# ALLOW WEBUI #
###############
/usr/sbin/ip route add 10.0.0.0/8 via 172.30.32.1
/usr/sbin/ip route add 192.168.0.0/16 via 172.30.32.1
/usr/sbin/ip route add 172.16.0.0/12 via 172.30.32.1
exit 0
# vim: ts=4 :

View File

@@ -0,0 +1,8 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Take down the S6 supervision tree when Nginx fails
# ==============================================================================
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Wait for transmission to become available
bashio::net.wait_for 8080 localhost 900
bashio::log.info "Starting NGinx..."
exec nginx

View File

@@ -0,0 +1,8 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Take down the S6 supervision tree when the server fails
# ==============================================================================
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bashio
WEBUI_PORT=${WEBUI_PORT:-8080}
if bashio::config.true 'openvpn_enabled'; then
exec /usr/sbin/openvpn --config /etc/openvpn/config.ovpn --script-security 2 --up /etc/openvpn/up.sh --down /etc/openvpn/down.sh
else
exec s6-setuidgid abc /usr/bin/qbittorrent-nox --webui-port="${WEBUI_PORT}"
fi