Skip to content

Commit 8657df2

Browse files
author
dushixiang
committed
优化安全审计逻辑
1 parent 620a454 commit 8657df2

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

web/src/pages/Agents/AuditResultView.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,6 @@ const AuditResultView = ({result}: AuditResultViewProps) => {
127127
// 6. SSH Configuration Security Issues
128128
const sshConfig = result.assetInventory.userAssets?.sshConfig;
129129
if (sshConfig) {
130-
// 允许root密码登录
131-
if (sshConfig.permitRootLogin === 'yes' && sshConfig.passwordAuthentication) {
132-
risks.push({
133-
level: 'high',
134-
title: 'SSH允许root密码登录',
135-
description: 'SSH配置允许root用户使用密码登录,存在被暴力破解的风险,建议设置为 prohibit-password 或 no'
136-
});
137-
}
138-
139130
// 允许空密码登录
140131
if (sshConfig.permitEmptyPasswords) {
141132
risks.push({
@@ -145,15 +136,6 @@ const AuditResultView = ({result}: AuditResultViewProps) => {
145136
});
146137
}
147138

148-
// 仅使用密码认证,没有启用公钥认证
149-
if (sshConfig.passwordAuthentication && !sshConfig.pubkeyAuthentication) {
150-
risks.push({
151-
level: 'medium',
152-
title: 'SSH仅启用密码认证',
153-
description: 'SSH配置仅启用密码认证,建议启用公钥认证以提高安全性'
154-
});
155-
}
156-
157139
// 使用旧协议
158140
if (sshConfig.protocol && sshConfig.protocol.includes('1')) {
159141
risks.push({
@@ -162,6 +144,24 @@ const AuditResultView = ({result}: AuditResultViewProps) => {
162144
description: 'SSH配置使用Protocol 1,存在安全漏洞,应仅使用Protocol 2'
163145
});
164146
}
147+
148+
// 允许root密码登录
149+
if (sshConfig.permitRootLogin === 'yes' && sshConfig.passwordAuthentication) {
150+
risks.push({
151+
level: 'medium',
152+
title: 'SSH允许root密码登录',
153+
description: 'SSH配置允许root用户使用密码登录,建议配合fail2ban等防护措施,或设置为 prohibit-password'
154+
});
155+
}
156+
157+
// 仅使用密码认证,没有启用公钥认证
158+
if (sshConfig.passwordAuthentication && !sshConfig.pubkeyAuthentication) {
159+
risks.push({
160+
level: 'low',
161+
title: 'SSH仅启用密码认证',
162+
description: 'SSH配置仅启用密码认证,建议同时启用公钥认证以提高安全性'
163+
});
164+
}
165165
}
166166

167167
// 7. High Frequency Login IPs (区分内外网)

0 commit comments

Comments
 (0)