kernel_module_disabled: Fedora remediation does not add the "blacklist" line that the OVAL check requires

Aperta Adatta ai principianti
#15,383 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
ansible, shell
Ambito
devops, security

Direzione di ricerca

Leggi shared/templates/kernel_module_disabled/oval.template, poi confronta la relativa condizione del prodotto con quelle di shared/templates/kernel_module_disabled/bash.template e shared/templates/kernel_module_disabled/ansible.template. Aggiungi Fedora e rhcos4 alla condizione di correzione che scrive la riga della blacklist, come proposto nell’issue. Verifica che le correzioni Bash e Ansible generate per Fedora includano quella riga e che la regola OVAL interessata passi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description of problem:

On Fedora, the OVAL check generated from the kernel_module_disabled template requires a blacklist <module> entry in addition to the install <module> /bin/false (or /bin/true) directive. The Bash and Ansible remediations from the same template only write the blacklist line for ol/rhel/sle/slmicro/ubuntu (Bash also debian), not for Fedora. As a result, the affected rules still fail on Fedora after their own remediation has been applied.

  • shared/templates/kernel_module_disabled/oval.template: the test_kernmod_<module>_blacklisted criterion is included when product in ["rhcos4", "fedora"] or 'ol' in families or 'rhel' in product or 'sle' in product or 'slmicro' in product or 'ubuntu' in product.
  • shared/templates/kernel_module_disabled/bash.template: the blacklist line is only written when 'ol' in families or 'rhel' in product or 'sle' in product or 'slmicro' in product or 'ubuntu' in product or 'debian' in product.
  • shared/templates/kernel_module_disabled/ansible.template: same condition as Bash, without debian.

I checked this at v0.1.82 and on current master. On master the OVAL patterns have been relaxed since v0.1.82 (for example /usr/bin/false is accepted), but the product conditions above are unchanged.

rhcos4 appears to be affected the same way, but I have not tested it.

SCAP Security Guide Version:

0.1.82 (Fedora package scap-security-guide-0.1.82-1.fc44), OpenSCAP 1.4.6

Operating System Version:

Fedora 44

Steps to Reproduce:
  1. Start from a system where no file in the scanned modprobe.d / modules-load.d paths contains blacklist atm.
  2. oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_cis_workstation_l1 --rule xccdf_org.ssgproject.content_rule_kernel_module_atm_disabled --results results.xml --report report.html /usr/share/xml/scap/ssg/content/ssg-fedora-ds.xml - the rule fails.
  3. Get the TestResult ID with oscap info results.xml, then oscap xccdf generate fix --fix-type bash --result-id RESULT_ID --output fix.sh results.xml and run fix.sh as root.
  4. Repeat step 2.
Actual Results:

/etc/modprobe.d/atm.conf now contains install atm /bin/false, but kernel_module_atm_disabled still fails. In the HTML report, the OVAL details show test_kernmod_atm_blacklisted as false ("No items have been found", pattern ^blacklist\s+atm$). On my system the same happens for kernel_module_can_disabled, kernel_module_dccp_disabled, kernel_module_tipc_disabled, kernel_module_cramfs_disabled, kernel_module_freevxfs_disabled, kernel_module_hfs_disabled, kernel_module_hfsplus_disabled and kernel_module_jffs2_disabled (remediated together with the CIS Workstation L1 profile).

Expected Results:

After the rule's own remediation, the rule passes on Fedora.

Additional Information/Debugging Steps:

A possible fix is to use the same product condition in bash.template and ansible.template as in oval.template, i.e. add product in ["rhcos4", "fedora"] to the condition that writes the blacklist line.

Lingua principale
Shell
Stelle
2.8k
Fork
851
Merge medio
2g 23h
PR unite (30g)
100

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ComplianceAsCode/content

Tutte le issue di ComplianceAsCode/content

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.