From c239f35382ecb03e367404871326de4c8166a663 Mon Sep 17 00:00:00 2001 From: dami Date: Wed, 2 Sep 2026 08:25:34 +0800 Subject: [PATCH] Update firewall.py --- web/utils/firewall.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/utils/firewall.py b/web/utils/firewall.py index 170e44094..1c0f5f372 100644 --- a/web/utils/firewall.py +++ b/web/utils/firewall.py @@ -502,7 +502,7 @@ class Firewall(object): rep = r"PasswordAuthentication\s+(\w*)\s*\n" conf = re.sub(rep, "PasswordAuthentication no\n", conf) mw.writeFile(file, conf) - mw.execShell("systemctl restart sshd") + mw.execShell("which systemctl && systemctl restart sshd") mw.writeLog("SSH管理", msg) return mw.returnData(True, msg) @@ -530,7 +530,7 @@ class Firewall(object): rep = r"PubkeyAuthentication\s+(\w*)\s*\n" content = re.sub(rep, "PubkeyAuthentication no\n", content) mw.writeFile(file, content) - mw.execShell("systemctl restart sshd") + mw.execShell("which systemctl && systemctl restart sshd") mw.writeLog("SSH管理", msg) return mw.returnData(True, msg)