Remove warps ACL rules completely when wg-quick@wgcf service is inactive
This commit is contained in:
@ -115,17 +115,13 @@ if [ -f "$CONFIG_FILE" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! systemctl is-active --quiet wg-quick@wgcf.service; then
|
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)
|
tmpfile=$(mktemp)
|
||||||
jq '
|
jq '
|
||||||
.outbounds = (.outbounds | map(select(.name != "warps"))) |
|
.outbounds = (.outbounds | map(select(.name != "warps"))) |
|
||||||
.acl.inline = (.acl.inline | map(
|
.acl.inline = (.acl.inline | map(
|
||||||
if test("^warps\\(") then
|
select(test("^warps\\(") | not)
|
||||||
sub("^warps\\("; "direct(")
|
|
||||||
else
|
|
||||||
.
|
|
||||||
end
|
|
||||||
))
|
))
|
||||||
' "$CONFIG_FILE" > "$tmpfile"
|
' "$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
|
chown hysteria:hysteria /etc/hysteria/ca.key /etc/hysteria/ca.crt
|
||||||
chmod 640 /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
|
python3 "$CLI_PATH" restart-hysteria2 > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error: Restart service failed'."
|
echo "Error: Restart service failed'."
|
||||||
|
|||||||
Reference in New Issue
Block a user