TMAegisBeta
Aturan lainnya untuk linux

Linux distributions

TMA-ROCKY9-1.2.1.5

Ensure weak dependencies are configured

RendahLevel 2Otomatislinux

Deskripsi

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.

Cara pemeriksaan

Metode audit: Perintah shell

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
Output yang diharapkan
compliant

Cara perbaikan

Metode perbaikan: Panduan atau patch infrastruktur

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 }

Properti

Sistem operasi
rocky-9
Tag
cis-convertedlinux
Referensi
CIS Rocky Linux 9 Benchmark v3.0.0 - 1.2.1.5

Periksa host ini

Jalankan ini pada mesin yang diizinkan untuk Anda audit. Pemindaian bersifat hanya baca.

shell
tmaegis scan --target linux --level 2