This commit is contained in:
CanbiZ 2025-11-22 17:41:01 +01:00
parent ba28ede3e3
commit 48fafb8c28

View File

@ -16,15 +16,15 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt install -y \ $STD apt install -y \
dnsutils \ dnsutils \
iputils-ping \ iputils-ping \
ufw \ ufw \
iproute2 iproute2
mkdir -p /etc/systemd/system-preset mkdir -p /etc/systemd/system-preset
echo "disable *" > /etc/systemd/system-preset/99-no-autostart.preset echo "disable *" >/etc/systemd/system-preset/99-no-autostart.preset
$STD apt install -y \ $STD apt install -y \
transmission-daemon \ transmission-daemon \
privoxy privoxy
rm -f /etc/systemd/system-preset/99-no-autostart.preset rm -f /etc/systemd/system-preset/99-no-autostart.preset
$STD systemctl preset-all $STD systemctl preset-all
$STD systemctl disable --now transmission-daemon $STD systemctl disable --now transmission-daemon
@ -49,12 +49,13 @@ chmod +x /opt/privoxy/*.sh
$STD ln -s /usr/bin/transmission-daemon /usr/local/bin/transmission-daemon $STD ln -s /usr/bin/transmission-daemon /usr/local/bin/transmission-daemon
$STD update-alternatives --set iptables /usr/sbin/iptables-legacy $STD update-alternatives --set iptables /usr/sbin/iptables-legacy
$STD update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy $STD update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
rm -rf /opt/docker-transmission-openvpn
msg_ok "Configured transmission-openvpn" msg_ok "Configured transmission-openvpn"
msg_info "Creating Service" msg_info "Creating Service"
LOCAL_SUBNETS=$( LOCAL_SUBNETS=$(
ip -o -4 addr show \ ip -o -4 addr show |
| awk '!/127.0.0.1/ { awk '!/127.0.0.1/ {
split($4, a, "/"); ip=a[1]; mask=a[2]; split($4, a, "/"); ip=a[1]; mask=a[2];
split(ip, o, "."); split(ip, o, ".");
if (mask < 8) { if (mask < 8) {
@ -66,12 +67,12 @@ LOCAL_SUBNETS=$(
} else { } else {
print o[1]"."o[2]"."o[3]".*"; print o[1]"."o[2]"."o[3]".*";
} }
}' \ }' |
| sort -u | paste -sd, - sort -u | paste -sd, -
) )
TRANSMISSION_RPC_WHITELIST="127.0.0.*,${LOCAL_SUBNETS}" TRANSMISSION_RPC_WHITELIST="127.0.0.*,${LOCAL_SUBNETS}"
mkdir -p /opt/transmission-openvpn mkdir -p /opt/transmission-openvpn
cat <<EOF > "/opt/transmission-openvpn/.env" cat <<EOF >"/opt/transmission-openvpn/.env"
OPENVPN_USERNAME="username" OPENVPN_USERNAME="username"
OPENVPN_PASSWORD="password" OPENVPN_PASSWORD="password"
OPENVPN_PROVIDER="PIA" OPENVPN_PROVIDER="PIA"
@ -111,7 +112,7 @@ LOG_TO_STDOUT="false"
HEALTH_CHECK_HOST="google.com" HEALTH_CHECK_HOST="google.com"
SELFHEAL="false" SELFHEAL="false"
EOF EOF
cat <<EOF > /etc/systemd/system/openvpn-custom.service cat <<EOF >/etc/systemd/system/openvpn-custom.service
[Unit] [Unit]
Description=Custom OpenVPN start service Description=Custom OpenVPN start service
After=network.target After=network.target
@ -126,15 +127,9 @@ EnvironmentFile=/opt/transmission-openvpn/.env
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl enable --now -q openvpn-custom.service systemctl enable -q --now openvpn-custom
msg_ok "Created Service" msg_ok "Created Service"
motd_ssh motd_ssh
customize customize
cleanup_lxc
msg_info "Cleaning up"
$STD apt -y autoremove
$STD apt -y autoclean
$STD apt -y clean
rm -rf /opt/docker-transmission-openvpn
msg_ok "Cleaned"