This commit is contained in:
midoks
2022-11-20 20:07:50 +08:00
parent a646cbacb5
commit 6e4f671628
+2 -2
View File
@@ -308,10 +308,10 @@ class firewall_api:
conf = mw.readFile(file)
if status == '1':
rep = "(#)PasswordAuthentication\s+(\w*)\s*\n"
rep = "(#)?PasswordAuthentication\s+(\w*)\s*\n"
conf = re.sub(rep, "PasswordAuthentication yes\n", conf)
else:
rep = "(#)PasswordAuthentication\s+(\w*)\s*\n"
rep = "(#)?PasswordAuthentication\s+(\w*)\s*\n"
conf = re.sub(rep, "PasswordAuthentication no\n", conf)
mw.writeFile(file, conf)
mw.execShell("systemctl restart sshd.service")