Linux distributions
TMA-ROCKY9-1.2.1.5
Ensure weak dependencies are configured
说明
The RPM packaging specification allows for 3 levels of dependencies to be declared: • hard dependencies (Requires / Provides) for packages which must be installed for a minimal installation of the application to function • weak dependencies (Recommends / Supplements) for packages which provide additional features, but which are not required for a minimal installation to function • hints (Suggests / Enhances) for packages which offer add-ons which might be useful.
检查方式
审计方法: Shell 命令
alt0() { o=$(bash -c 'grep -Pi -- '"'"'^\h*install_weak_deps\h*=\h*(0|false|no)\b'"'"' /etc/dnf/dnf.conf' 2>&1); printf '%s\n' "$o" | tr -s ' \t' ' ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'One of the following should be returned: install_weak_deps=0,' || { echo step1: missing 'One of the following should be returned: install_weak_deps=0'; return 1; }; printf '%s\n' "$o" | tr -s ' \t' ' ' | sed 's/^ //;s/ $//' | grep -Fxq -- 'install_weak_deps=false, or install_weak_deps=no.' || { echo step1: missing 'install_weak_deps=false, or install_weak_deps=no.'; return 1; }; o=$(bash -c 'grep -Pi -- '"'"'^\h*install_weak_deps\h*=\h*(1|true|yes)\b'"'"' /etc/dnf/dnf.conf' 2>/dev/null); [ -z "$o" ] || { echo "step2: $o" | head -c 300; return 1; }; }; if alt0; then echo compliant; fi- 预期输出
compliant
修复方式
修复方法: 操作指南或基础设施补丁
Edit /etc/dnf/dnf.conf and set install_weak_deps=0 in the [main] section. [main] install_weak_deps=0 Example script: #!/usr/bin/env bash { if grep -Pq '^install_weak_deps' /etc/dnf/dnf.conf; then sed -i 's/^install_weak_deps\s*=\s*.*/install_weak_deps=0/' /etc/dnf/dnf.conf else printf '%s\n' "" "install_weak_deps=0" >> /etc/dnf/dnf.conf fi }
属性
- 操作系统
- rocky-9
- 标签
- cis-convertedlinux
- 参考
- CIS Rocky Linux 9 Benchmark v3.0.0 - 1.2.1.5
检查本机
请在您有权审计的机器上运行此命令。扫描为只读操作。
tmaegis scan --target linux --level 2