mirror of
https://github.com/andrey271192/WARP-Web-UI.git
synced 2026-09-20 11:55:34 +00:00
fix: harden relay service deploy
This commit is contained in:
3
app.py
3
app.py
@@ -694,6 +694,9 @@ def get_public_ipv4() -> str:
|
|||||||
|
|
||||||
def detect_relay_firewall():
|
def detect_relay_firewall():
|
||||||
if shutil.which("nft"):
|
if shutil.which("nft"):
|
||||||
|
code, _, err = run_cmd(["nft", "list", "ruleset"], timeout=5)
|
||||||
|
if code == 0 and "managed by iptables-nft" in (err or "") and shutil.which("iptables"):
|
||||||
|
return "iptables"
|
||||||
return "nftables"
|
return "nftables"
|
||||||
if shutil.which("iptables"):
|
if shutil.which("iptables"):
|
||||||
return "iptables"
|
return "iptables"
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ SERVICE_NAME="warp-webui"
|
|||||||
UNIT_DST="/etc/systemd/system/${SERVICE_NAME}.service"
|
UNIT_DST="/etc/systemd/system/${SERVICE_NAME}.service"
|
||||||
ALIASES_DIR="/etc/warp-webui"
|
ALIASES_DIR="/etc/warp-webui"
|
||||||
LOG_DIR="/var/log/warp-webui"
|
LOG_DIR="/var/log/warp-webui"
|
||||||
|
BACKUP_DIR="/var/backups/warp-webui"
|
||||||
RAW_BASE="${WARP_WEBUI_REPO_RAW:-https://raw.githubusercontent.com/andrey271192/WARP-Web-UI-Relay-Beta/main}"
|
RAW_BASE="${WARP_WEBUI_REPO_RAW:-https://raw.githubusercontent.com/andrey271192/WARP-Web-UI-Relay-Beta/main}"
|
||||||
|
|
||||||
if [[ "${EUID:-0}" -ne 0 ]]; then
|
if [[ "${EUID:-0}" -ne 0 ]]; then
|
||||||
@@ -96,7 +97,8 @@ fi
|
|||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Установка в ${INSTALL_DIR} ..."
|
echo "Установка в ${INSTALL_DIR} ..."
|
||||||
mkdir -p "${INSTALL_DIR}/scripts" "${ALIASES_DIR}" "${LOG_DIR}"
|
mkdir -p "${INSTALL_DIR}/scripts" "${ALIASES_DIR}" "${LOG_DIR}" "${BACKUP_DIR}" /etc/sysctl.d /etc/iptables
|
||||||
|
touch /etc/nftables.conf
|
||||||
install -m 0755 "${REPO_DIR}/app.py" "${INSTALL_DIR}/app.py"
|
install -m 0755 "${REPO_DIR}/app.py" "${INSTALL_DIR}/app.py"
|
||||||
install -m 0755 "${REPO_DIR}/scripts/warp-install-cf.sh" "${INSTALL_DIR}/scripts/warp-install-cf.sh"
|
install -m 0755 "${REPO_DIR}/scripts/warp-install-cf.sh" "${INSTALL_DIR}/scripts/warp-install-cf.sh"
|
||||||
install -m 0755 "${REPO_DIR}/scripts/warp-uninstall-cf.sh" "${INSTALL_DIR}/scripts/warp-uninstall-cf.sh"
|
install -m 0755 "${REPO_DIR}/scripts/warp-uninstall-cf.sh" "${INSTALL_DIR}/scripts/warp-uninstall-cf.sh"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ NoNewPrivileges=true
|
|||||||
PrivateTmp=true
|
PrivateTmp=true
|
||||||
ProtectSystem=full
|
ProtectSystem=full
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
ReadWritePaths=/run /var/log /etc/default/warp-webui /etc/warp-webui /var/backups/warp-webui
|
ReadWritePaths=/run /var/log /etc/default/warp-webui /etc/warp-webui /var/backups/warp-webui /etc/sysctl.d /etc/nftables.conf /etc/iptables
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
Reference in New Issue
Block a user