Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

audit2allow

Explain SELinux denials (audit2why) or build a policy module that allows them (audit2allow) — the last resort.

Niveau
Extra
Groep
SELinux en beveiliging
Root nodig
Ja
Pakket
policycoreutils-python-utils
Ook
audit2why

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

audit2why reads AVC messages and says why each one happened: missing rule, a boolean that is off, or a wrong label. audit2allow -M NAME writes a policy module that allows exactly the denied actions; semodule -i NAME.pp installs it.

Use modules only when labels, ports and booleans cannot solve the problem, and read the rules first: allowing a denial blindly may allow an attack.

Zo schrijf je het

audit2allow [OPTION]...
audit2why [OPTION]...

Opties 17

Meest gebruikt

-a, --all
Read audit.log and messages.
-b, --boot
Only messages since the last boot.
-i, --input FILE
Read from a file.
-d, --dmesg
Read from dmesg.
-l, --lastreload
Only since the last policy reload.
-M NAME
Create a module package NAME.pp (and NAME.te).
-m, --module NAME
Print a module named NAME.
-o, --output FILE
Write to a file.
-w, --why
Explain (same as audit2why).
-D, --dontaudit
Generate dontaudit rules.
-R, --reference
Use interface macros from the reference policy.
-N, --noreference
Do not use macros.
-r, --requires
Add requires lines.
-x, --xperms
Extended permission rules.
-p, --policy FILE
Use another policy file.
-v, --verbose
Verbose.
-h, --help
Show help.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Why was it denied?

    ausearch -m AVC -ts recent | audit2why
    Was caused by:
    	The boolean httpd_can_network_connect was set incorrectly.

    Then: setsebool -P httpd_can_network_connect on.

  2. 2Missing type enforcement rule

    ausearch -m AVC -c myapp -ts today | audit2why

    "Missing type enforcement (TE) allow rule" = no label or boolean fix; maybe a module.

  3. 3Show the rules that would be needed

    ausearch -m AVC -c myapp -ts today | audit2allow
    allow myapp_t var_log_t:file { append open };

    Read them carefully.

  4. 4Build and install a module

    ausearch -m AVC -c myapp -ts today | audit2allow -M myapp_local
    semodule -i myapp_local.pp

    Only after checking myapp_local.te.

  5. 5List and remove modules

    semodule -l | grep local
    semodule -r myapp_local

    Remove modules you no longer need.

  6. 6Explain from a saved log

    audit2why -i /root/avc.log

    Analyze offline.

  7. 7Since the last boot

    audit2allow -b -w

    Explanations for this boot.

  8. 8Do not allow everything (security)

    ausearch -m AVC -ts today | audit2allow | grep -E 'shadow_t|execmem|setenforce'

    Rules like these mean an attack or a broken app — do not allow them.

  9. 9Use reference macros

    ausearch -m AVC -c myapp | audit2allow -R

    Nicer rules with policy interfaces.

  10. 10Generate dontaudit rules for noisy denials

    ausearch -m AVC -c myapp | audit2allow -D -M myapp_quiet

    Hides harmless denials (they stay blocked).

Exitcodes

0Done.
1Error.

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man audit2allow