TMAegisBeta
更多 linux 规则

Linux distributions

TMA-ROCKY9-1.6.4

Ensure system wide crypto policy disables cbc for ssh

中级别 1自动化linux

说明

Cipher Block Chaining (CBC) is an algorithm that uses a block cipher.

检查方式

审计方法: Shell 命令

shell
alt0() { command -v grep >/dev/null 2>&1 || { echo "step1: grep not installed"; return 1; }; o=$(bash -c 'grep -Pi -- '"'"'^\h*cipher\h*=\h*([^#\n\r]+)?-CBC\b'"'"' /etc/crypto-' 2>&1); printf '%s\n' "$o" | tr -s ' \t' '  ' | sed 's/^ //;s/ $//' | grep -Fxq -- policies/state/CURRENT.pol || { echo step1: missing policies/state/CURRENT.pol; return 1; }; o=$(bash -c 'grep -Pi -- '"'"'^\h*cipher@(lib|open)ssh(-server|-client)?\h*=\h*([^#\n\r]+)?- CBC\b'"'"' /etc/crypto-policies/state/CURRENT.pol' 2>/dev/null); [ -z "$o" ] || { echo "step2: $o" | head -c 300; return 1; }; }; if alt0; then echo compliant; fi
预期输出
compliant

修复方式

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

Create or edit a file in /etc/crypto-policies/policies/modules/ ending in .pmod and add or modify one of the following lines: cipher@SSH = -*-CBC # Disables the CBC cipher for SSH Example: # printf '%s\n' "# This is a subpolicy to disable all CBC mode ciphers" "# for the SSH protocol (libssh and OpenSSH)" "cipher@SSH = -*-CBC" >> /etc/crypto-policies/policies/modules/NO-SSHCBC.pmod Run the following command to update the system-wide cryptographic policy # update-crypto-policies --set <CRYPTO_POLICY>:<CRYPTO_SUBPOLICY1>:<CRYPTO_SUBPOLICY2>:<CRYPTO_SUBPOLICY3> Example: # update-crypto-policies --set DEFAULT:NO-SHA1:NO-WEAKMAC:NO-SSHCBC Run the following command to reboot the system to make you…

属性

操作系统
rocky-9
标签
cis-convertedlinux
参考
CIS Rocky Linux 9 Benchmark v3.0.0 - 1.6.4

检查本机

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

shell
tmaegis scan --target linux