Linux distributions
TMA-ROCKY9-1.6.4
Ensure system wide crypto policy disables cbc for ssh
說明
Cipher Block Chaining (CBC) is an algorithm that uses a block cipher.
檢查方式
稽核方法: 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
檢查此主機
請在您有權稽核的機器上執行此指令。掃描為唯讀操作。
tmaegis scan --target linux