Bug 1312261

Summary: semanage generates ROLE_REMOVE events with invalid new-range=s0-s0
Product: [Fedora] Fedora Reporter: Miroslav Vadkerti <mvadkert>
Component: policycoreutilsAssignee: Petr Lautrbach <plautrba>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 28CC: dwalsh, jjaburek, mgrepl, plautrba
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: policycoreutils-2.8-15.fc29 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1554365 (view as bug list) Environment:
Last Closed: 2019-01-23 02:28:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1281852, 1554365    

Description Miroslav Vadkerti 2016-02-26 09:19:58 UTC
Description of problem:
Semanage login generates ROLE_REMOVE event with "new-range=s0-s0" which seems invalid (in RHEL7 it generates s0)

# TS=$(date +%T); useradd -Z staff_u superman; semanage login -d superman; ausearch -ts $TS -m ROLE_REMOVE -m ROLE_ASSIGN; userdel -Z -r superman
----
time->Fri Feb 26 10:17:07 2016
type=ROLE_ASSIGN msg=audit(1456478227.986:22791): pid=28888 uid=0 auid=1000 ses=124 subj=staff_u:lspp_test_r:lspp_harness_t:s0-s15:c0.c1023 msg='op=login-sename,role,range acct="superman" old-seuser=? old-role=? old-range=? new-seuser=staff_u new-role=auditadm_r,secadm_r,staff_r,sysadm_r,system_r,lspp_test_r new-range=s0-s15:c0.c1023 exe="/usr/sbin/useradd" hostname=? addr=? terminal=pts/1 res=success' 
----
time->Fri Feb 26 10:17:18 2016
type=ROLE_REMOVE msg=audit(1456478238.532:22798): pid=28898 uid=0 auid=1000 ses=124 subj=staff_u:lspp_test_r:lspp_harness_t:s0-s15:c0.c1023 msg='op=login id=0 old-seuser=staff_u old-role=auditadm_r,secadm_r,staff_r,sysadm_r,system_r,lspp_test_r old-range=s0-s15:c0.c1023 new-seuser=? new-role=? new-range=? exe="/usr/bin/python3.4" hostname=? addr=? terminal=pts/1 res=success' 
----
time->Fri Feb 26 10:17:28 2016
type=ROLE_REMOVE msg=audit(1456478248.393:22800): pid=28898 uid=0 auid=1000 ses=124 subj=staff_u:lspp_test_r:lspp_harness_t:s0-s15:c0.c1023 msg='op=login acct="superman" old-seuser=staff_u old-role=auditadm_r,secadm_r,staff_r,sysadm_r,system_r,lspp_test_r old-range=s0-s15:c0.c1023 new-seuser=user_u new-role=user_r new-range=s0-s0 exe=/usr/sbin/semanage hostname=? addr=? terminal=pts/1 res=success' 

Version-Release number of selected component (if applicable):
policycoreutils-python-utils-2.4-18.fc23

How reproducible:
100%

Steps to Reproduce:
1. Install Fedora in MLS
2. TS=$(date +%T); useradd -Z staff_u superman; semanage login -d superman; ausearch -ts $TS -m ROLE_REMOVE; userdel -r superman

Actual results:
new-range=s0-s0

Expected results:
new-range=s0

Additional info:
In RHEL7 the new-range is s0.

Comment 1 Fedora End Of Life 2016-11-24 15:46:36 UTC
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 2 Fedora End Of Life 2016-12-20 19:02:44 UTC
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
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 3 Jiri Jaburek 2017-01-02 14:17:34 UTC
Still occurs on F25,

time->Mon Jan  2 15:00:12 2017
type=ROLE_REMOVE msg=audit(1483365612.289:294): pid=1691 uid=0 auid=0 ses=1 subj=root:sysadm_r:semanage_t:s0 msg='op=login acct="superman" old-seuser=staff_u old-role=auditadm_r,secadm_r,staff_r,sysadm_r,system_r old-range=s0-s15:c0.c1023 new-seuser=user_u new-role=user_r new-range=s0-s0 exe=/usr/sbin/semanage hostname=? addr=? terminal=pts/0 res=success'

Probably related to the fact that __default__ login entry has

__default__          user_u               s0-s0                *

Comment 4 Petr Lautrbach 2018-10-25 20:00:30 UTC
Fixed in Rawhide:

^_^ TS=$(date +%T); useradd -Z staff_u superman; semanage login -d superman; ausearch -ts $TS -m ROLE_REMOVE -m ROLE_ASSIGN; userdel -Z -r superman
----
time->Thu Oct 25 21:59:54 2018
type=ROLE_ASSIGN msg=audit(1540497594.700:1940): pid=16303 uid=0 auid=13558 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=login-sename,role,range acct="superman" old-seuser=? old-role=? old-range=? new-seuser=staff_u new-role=staff_r,sysadm_r,system_r,unconfined_r new-range=s0-s0:c0.c1023 exe="/usr/sbin/useradd" hostname=? addr=? terminal=pts/1 res=success'
----
time->Thu Oct 25 21:59:58 2018
type=ROLE_REMOVE msg=audit(1540497598.456:1944): pid=16316 uid=0 auid=13558 ses=2 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 msg='op=login id=0 old-seuser=staff_u old-role=staff_r,sysadm_r,system_r,unconfined_r old-range=s0-s0:c0.c1023 new-seuser=? new-role=? new-range=? exe="/usr/bin/python3.7" hostname=? addr=? terminal=pts/1 res=success'

Comment 5 Fedora Update System 2019-01-21 20:51:18 UTC
policycoreutils-2.8-15.fc29 libselinux-2.8-6.fc29 libsepol-2.8-3.fc29 libsemanage-2.8-8.fc29 checkpolicy-2.8-3.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-16fd3acb03

Comment 6 Fedora Update System 2019-01-22 03:04:05 UTC
checkpolicy-2.8-3.fc29, libselinux-2.8-6.fc29, libsemanage-2.8-8.fc29, libsepol-2.8-3.fc29, policycoreutils-2.8-15.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-16fd3acb03

Comment 7 Fedora Update System 2019-01-23 02:28:10 UTC
checkpolicy-2.8-3.fc29, libselinux-2.8-6.fc29, libsemanage-2.8-8.fc29, libsepol-2.8-3.fc29, policycoreutils-2.8-15.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.