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

getsebool

Show SELinux booleans (getsebool) or switch them on and off (setsebool; with -P permanently).

Niveau
RHCSA-examen
Groep
SELinux en beveiliging
Root nodig
Voor wijzigingen
Pakket
libselinux-utils / policycoreutils
Ook
setsebool

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

Wat het doet

Booleans turn parts of the policy on or off without writing rules: httpd_enable_homedirs, httpd_can_network_connect_db, samba_export_all_rw … setsebool NAME on changes it now; add -P to keep it after reboot. semanage boolean -l shows descriptions.

Zo schrijf je het

getsebool -a | BOOLEAN...
setsebool [-PNV] BOOLEAN on|off|1|0 | BOOL1=VAL1 …

Opties 4

Meest gebruikt

getsebool

-a
Show all booleans.

setsebool

-P
Permanent: also write it to the policy on disk.
-N
Do not reload the policy.
-V
Verbose errors.

Voorbeelden 10

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

  1. 1All web booleans

    getsebool -a | grep httpd

    on/off per boolean.

  2. 2One boolean

    getsebool httpd_enable_homedirs
    httpd_enable_homedirs --> off

    Off by default.

  3. 3Switch on permanently

    setsebool -P httpd_enable_homedirs on

    Survives a reboot.

  4. 4Only until reboot

    setsebool httpd_can_network_connect on

    For a quick test.

  5. 5Several at once

    setsebool -P httpd_can_network_connect_db=1 httpd_can_sendmail=1

    Name=value pairs.

  6. 6Descriptions

    semanage boolean -l | grep httpd_can_network_connect

    What the boolean allows.

  7. 7Only your changes

    semanage boolean -l -C

    Booleans that differ from the default.

  8. 8Find a boolean from the man page

    man httpd_selinux | grep -A2 httpd_use_nfs

    Needs selinux-policy-doc.

  9. 9NFS home folders

    setsebool -P use_nfs_home_dirs on

    Users with NFS homes can log in.

  10. 10Audit risky booleans (security)

    getsebool -a | grep -E 'httpd_execmem|httpd_unified|allow_execstack|selinuxuser_execstack' 

    Booleans that weaken protection should stay off unless needed.

Exitcodes

0Done.
1Error (unknown boolean, not allowed).