TMAegis
更多 ros 规则

TMA-ROS1-5.2.10

Ensure SSH root login is disabled

高级别 1自动化ros

说明

The PermitRootLogin parameter specifies if the root user can log in using ssh. The default is no. The audit requires PermitRootLogin no. The audit reads the effective sshd configuration (sshd -T, root). Host-level control from the CIS ROS Melodic benchmark (Ubuntu 18.04 robot hosts); run as root.

检查方式

审计方法: Shell 命令

shell
command -v sshd >/dev/null 2>&1 || exit 1
out=$(sshd -T -C user=root -C host="$(hostname)" -C addr="$(hostname -I 2>/dev/null | cut -d' ' -f1)" 2>/dev/null) || out=$(sshd -T 2>/dev/null) || exit 1
v=$(printf '%s\n' "$out" | awk 'tolower($1)=="permitrootlogin"{print tolower($2); exit}')
case "$v" in no) echo compliant ;; *) echo "PermitRootLogin ${v:-unset}" ;; esac
预期输出
compliant

修复方式

修复方法: 操作指南或基础设施补丁

Edit the /etc/ssh/sshd_config file to set the parameter as follows: PermitRootLogin no

属性

操作系统
任意
标签
rosros1melodicaccess-control
参考
CIS ROS Melodic Benchmark v1.0.0 - 5.2.10 Ensure SSH root login is disabled

检查本机

请在您有权审计的机器上运行此命令。扫描为只读操作。

shell
tmaegis scan --target ros