Update firewall_api.py

This commit is contained in:
midoks 2023-09-25 03:52:54 +08:00
parent 49a358ccfa
commit 8bc9500b23
1 changed files with 4 additions and 7 deletions

View File

@ -214,14 +214,11 @@ class firewall_api:
data['pass_prohibit_status'] = False
# 密码登陆配置检查
pass_rep = "#PasswordAuthentication\s+(\w*)\s*\n"
pass_rep = "^PasswordAuthentication\s+(\w*)\s*\n"
pass_status = re.search(pass_rep, conf)
if pass_status:
data['pass_prohibit_status'] = True
if not data['pass_prohibit_status']:
pass_rep = "PasswordAuthentication\s+(\w*)\s*\n"
pass_status = re.search(pass_rep, conf)
if not pass_status:
# pass_rep = "PasswordAuthentication\s+(\w*)\s*\n"
# pass_status = re.search(pass_rep, conf)
if pass_status and pass_status.groups(0)[0].strip() == 'no':
data['pass_prohibit_status'] = True