Files
aaPanel/class_v2/safe_warning_v2/sw_ssh_notpass.py
T
Jack a24f2e23c6 Update to 7.25.0
1. Added Mail Marketing Automation trigger tasks
2. Added Mail Marketing Groups Import, Export, Merge
3. Added Mail Marketing Subscribers to support paste import
4. Added Mail Marketing Template Import Export Duplicate
5. Added Mail server add timed automatic reply
6. Added HTTPS Protection function for Website (disables automatic HTTP to HTTPS redirection when enabled)
7. Optimize Website Interface Button Integration
8. Optimize the response speed of WP Toolkit interface
2025-03-13 17:52:26 +08:00

49 lines
2.1 KiB
Python

#!/usr/bin/python
#coding: utf-8
# -------------------------------------------------------------------
# aapanel
# -------------------------------------------------------------------
# Copyright (c) 2015-2099 宝塔软件(http://www.aapanel.com) All rights reserved.
# -------------------------------------------------------------------
# Author: lkq <lkq@bt.cn>
# -------------------------------------------------------------------
# Time: 2022-08-10
# -------------------------------------------------------------------
# 禁止SSH空密码登录
# -------------------------------------------------------------------
import re,public,os
_title = 'Prohibit SSH login with empty password'
_version = 1.0 # 版本
_ps = "Prohibit SSH login with empty password" # 描述
_level = 3 # 风险级别: 1.提示(低) 2.警告(中) 3.危险(高)
_date = '2022-8-10' # 最后更新时间
_ignore = os.path.exists("data/warning/ignore/sw_ssh_notpasswd.pl")
_tips = [
"Set [PermitEmptyPasswords] in the [/etc/ssh/sshd_config] file to configure it to no",
"Tips: Set [PermitEmptyPasswords] in the [/etc/ssh/sshd_config] file to configure it to no"
]
_help = ''
_remind = 'This scheme prevents the server from logging in with an empty password. Note that the server cannot login with an empty password after the repair. Ensure that the login password is configured synchronously for related business access. '
def check_run():
'''
@name 检测禁止SSH空密码登录
@author lkq<2020-08-10>
@return tuple (status<bool>,msg<string>)
'''
if os.path.exists('/etc/ssh/sshd_config'):
try:
info_data = public.ReadFile('/etc/ssh/sshd_config')
if info_data:
if re.search('\nPermitEmptyPasswords\\s*yes', info_data):
return False, 'The [PermitEmptyPasswords] value is: yes, please set it to no'
else:
return True, 'Rick-free'
except:
return True, 'Rick-free'
return True, 'Rick-free'