Score:0

How to NOT enable SELinux

nl flag

On Ubuntu 20.10:

  • disabled apparmor
  • installed selinux*
  • selinux-activate
  • enforced in /etc/selinux/config
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    # enforcing - SELinux security policy is enforced.
    # permissive - SELinux prints warnings instead of enforcing.
    # disabled - No SELinux policy is loaded.
    SELINUX=enforcing
    # SELINUXTYPE= can take one of these two values:
    # default - equivalent to the old strict and targeted policies
    # mls     - Multi-Level Security (for military and educational use)
    # src     - Custom policy built from source
    SELINUXTYPE=default
    
    # SETLOCALDEFS= Check local definition changes
    SETLOCALDEFS=0

reboot

brad@zika:/home/brad# sudo seinfo
    Statistics for policy file: /etc/selinux/default/policy/policy.32
    Policy Version:             32 (MLS enabled)
    Target Policy:              selinux
    Handle unknown classes:     allow
      Classes:             131    Permissions:         423
      Sensitivities:         1    Categories:         1024
      Types:              3943    Attributes:          212
      Users:                 7    Roles:                15
      Booleans:            300    Cond. Expr.:         331
      Allow:            102134    Neverallow:            0
      Auditallow:           22    Dontaudit:         16881
      Type_trans:         8877    Type_change:         123
      Type_member:          16    Range_trans:          33
      Role allow:           32    Role_trans:          388
      Constraints:         133    Validatetrans:         0
      MLS Constrain:        57    MLS Val. Tran:         0
      Permissives:           0    Polcap:                5
      Defaults:              0    Typebounds:            0
      Allowxperm:            0    Neverallowxperm:       0
      Auditallowxperm:       0    Dontauditxperm:        0
      Ibendportcon:          0    Ibpkeycon:             0
      Initial SIDs:         27    Fs_use:               26
      Genfscon:             92    Portcon:             475
      Netifcon:              0    Nodecon:               0

but check-selinux-installation output reports 2 dirs missing:

    check-selinux-installation
    getfilecon:  getfilecon(/proc/1) failed
    SELinux is not enabled.
    Could not read the domain of PID 1.
    The directories /sys/fs/selinux and /selinux are missing.
    Postfix init script is syncing the chroots.
    Postfix has chrooted service in master.cf
/etc/default/grub
GRUB_CMDLINE_LINUX=" security=selinux"
and 
update-grub

no relabelling noticed at boot and getenforce reports disabled .. What I did wrong?

Update: suddenly SELinux activated and works fine in permissive mode.

Terrance avatar
id flag
You might want to read https://www.redhat.com/en/topics/linux/what-is-selinux as it states that you might not want to set SELINUX to enforcing right away as it can cause issues. It states to do permissive first.
Brad Thompson avatar
nl flag
the first step was permissive mode but getenforce still reported 'disabled'
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.