From 8877d7ea5573598447a29e520511650e95db02ed Mon Sep 17 00:00:00 2001 From: dami Date: Wed, 10 Sep 2025 21:58:08 +0800 Subject: [PATCH] Update firewall.py --- web/utils/firewall.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/utils/firewall.py b/web/utils/firewall.py index 101c7091e..0464bebfa 100644 --- a/web/utils/firewall.py +++ b/web/utils/firewall.py @@ -465,14 +465,14 @@ class Firewall(object): root_status = re.search(root_rep, conf) if not root_status: rep = r"(#)?PermitRootLogin\s+(\w*)\s*\n" - conf = re.sub(rep, "PermitRootLogin no\n", conf) + conf = re.sub(rep, "PermitRootLogin yes\n", conf) if status == '1': rep = r"PermitRootLogin\s+(\w*)\s*\n" - conf = re.sub(rep, "PermitRootLogin no\n", conf) + conf = re.sub(rep, "PermitRootLogin yes\n", conf) else: rep = r"PermitRootLogin\s+(\w*)\s*\n" - conf = re.sub(rep, "PermitRootLogin yes\n", conf) + conf = re.sub(rep, "PermitRootLogin no\n", conf) mw.writeFile(file, conf) mw.execShell("systemctl restart sshd") mw.writeLog("SSH管理", msg)