Bug 1312283 - MLS: semanage adds staff_u with wrong range
MLS: semanage adds staff_u with wrong range
Product: Fedora
Classification: Fedora
Component: policycoreutils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Petr Lautrbach
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks: 1281852
  Show dependency treegraph
Reported: 2016-02-26 05:34 EST by Miroslav Vadkerti
Modified: 2017-01-02 10:05 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1349754 (view as bug list)
Last Closed: 2016-12-20 14:02:58 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Miroslav Vadkerti 2016-02-26 05:34:12 EST
Description of problem:
The command:
# { useradd stafftest; semanage user -l | grep staff_u; semanage login -a -s staff_u stafftest; semanage login -l | grep stafftest; userdel -Z stafftest; } 2>/dev/null

On Fedora adds stafftest with range SystemLow, instead of expected SystemLow-SystemHigh
staff_u         user       SystemLow  SystemLow-SystemHigh           auditadm_r secadm_r staff_r sysadm_r system_r lspp_test_r
stafftest            staff_u              SystemLow            *

On RHEL7 this works nicely:
staff_u         user       SystemLow  SystemLow-SystemHigh           auditadm_r staff_r lspp_test_r secadm_r sysadm_r system_r
stafftest            staff_u              SystemLow-SystemHigh *

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Install Fedora in MLS
2. { useradd stafftest; semanage user -l | grep staff_u; semanage login -a -s staff_u stafftest; semanage login -l | grep stafftest; userdel -Z stafftest; } 2>/dev/null

Actual results:
stafftest            staff_u              SystemLow            *

Expected results:
stafftest            staff_u              SystemLow-SystemHigh *
Comment 1 Petr Lautrbach 2016-02-26 07:15:14 EST
You need to use "-r RANGE" if you don't want to use a default value which is "s0", see man semanage-login:

       -r RANGE, --range RANGE
              MLS/MCS Security Range (MLS/MCS Systems only) SELinux Range for SELinux login mapping defaults to the SELinux user record range. SELinux  Range  for  SELinux user defaults to s0.

# semanage login -a -s staff_u -r s0-s0:c0.c1023 stafftest      

# semanage login -l | grep stafftest
stafftest            staff_u              s0-s0:c0.c1023       *
Comment 2 Petr Lautrbach 2016-02-26 07:54:14 EST
It looks like semanage is inconsistent with useradd tool now. While semanage login uses s0 as default, useradd uses seuser's mls range. semanage was change to use seuser's mls default in rhel-6 and rhel-7 but it seems to me that it has never been changed in Fedora/upstream.
Comment 3 Fedora End Of Life 2016-11-24 10:46:43 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 4 Fedora End Of Life 2016-12-20 14:02:58 EST
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 5 Jiri Jaburek 2017-01-02 10:05:20 EST
The "incosistency" between 'semanage login -a' and 'useradd -Z' still seems to be present on F25 at least.

First, the "MLS/MCS Level" of 'semanage user' is completely ignored when adding new 'semanage login' entries via semanage/useradd. Not sure what is the intended use case as the documentation in semanage-user(8) is rather brief.

Second, 'semanage login' seems to always add new entries with s0 and 'useradd -Z' always with the range copied from 'semanage user'.

Note You need to log in before you can comment on or make changes to this bug.