From 9793dc28e76d9f55960ba047703a22b76479b057 Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Sun, 27 Apr 2025 18:32:18 +0330 Subject: [PATCH] Remove warps ACL rules completely when wg-quick@wgcf service is inactive --- core/scripts/hysteria2/restore.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/core/scripts/hysteria2/restore.sh b/core/scripts/hysteria2/restore.sh index 19163f8..c581103 100644 --- a/core/scripts/hysteria2/restore.sh +++ b/core/scripts/hysteria2/restore.sh @@ -115,17 +115,13 @@ if [ -f "$CONFIG_FILE" ]; then fi if ! systemctl is-active --quiet wg-quick@wgcf.service; then - echo "wgcf service is NOT active. Removing warps outbound and fixing ACL rules..." + echo "wgcf service is NOT active. Removing warps outbound and any ACL rules..." tmpfile=$(mktemp) jq ' .outbounds = (.outbounds | map(select(.name != "warps"))) | .acl.inline = (.acl.inline | map( - if test("^warps\\(") then - sub("^warps\\("; "direct(") - else - . - end + select(test("^warps\\(") | not) )) ' "$CONFIG_FILE" > "$tmpfile" @@ -139,6 +135,7 @@ echo "Hysteria configuration restored and updated successfully." chown hysteria:hysteria /etc/hysteria/ca.key /etc/hysteria/ca.crt chmod 640 /etc/hysteria/ca.key /etc/hysteria/ca.crt + python3 "$CLI_PATH" restart-hysteria2 > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "Error: Restart service failed'."