Bug 1392154 - semodule -l lost policy versioning listing
Summary: semodule -l lost policy versioning listing
Status: CLOSED DUPLICATE of bug 1392573
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: policycoreutils
Version: 7.3
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Petr Lautrbach
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 1391886
TreeView+ depends on / blocked
 
Reported: 2016-11-05 11:38 UTC by Andrea Veri
Modified: 2016-11-21 14:40 UTC (History)
9 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2016-11-11 09:39:35 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Bugzilla 1391886 None CLOSED Puppet's selmodule syncversion is called at each run even when the policy version has been loaded already 2018-08-15 12:13 UTC
Red Hat Knowledge Base (Solution) 2760071 None None None 2016-11-10 08:55 UTC

Description Andrea Veri 2016-11-05 11:38:28 UTC
Description of problem:

semodule -l is not showing up policy modules versions anymore as it was used to do since the time I recall about using the semodule command:

With RHEL 7.3 this fails:

semodule -l | head -n 5
abrt
accountsd
acct
afs
aiccu

With RHEL 6 or RHEL 7.2 it works as expected:

semodule -l | head -n 5
abrt	1.2.0	
accountsd	1.0.0	
ada	1.4.0	
afs	1.5.3	
aiccu	1.0.0

Version-Release number of selected component (if applicable):
policycoreutils-2.5-8.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Run semodule -l

Actual results:

semodule -l | head -n 5
abrt
accountsd
acct
afs
aiccu

Expected results:

semodule -l | head -n 5
abrt	1.2.0	
accountsd	1.0.0	
ada	1.4.0	
afs	1.5.3	
aiccu	1.0.0

Additional info:

Comment 2 Christian Kaenzig 2016-11-08 07:52:05 UTC
Hello, this bug also affects RHEL 7.2 when the policycoreutils package is upgraded to 2.5-8.

I opened as support case with Red Hat, here is the answer I got:

---
The new SELinux userspace uses SELinux Common Intermediate Language (CIL) in the module store. CIL treats files as modules and does not have a separate module statement, the module is named after the file name. 

Unfortunately CIL doesn't support policy_module() statement. It means that modules don't have versions anymore. Now we have namespaces for policy rules. So all the current rules are in the global namespace and we don't identify them using policy modules as before.
---

I don't currently understand what this means exactly as I lack knowledge about how selinux modules work exactly.

Comment 4 Petr Lautrbach 2016-11-10 22:41:12 UTC
SELinux userspace 2.4 and higher uses CIL and CIL doesn't have any component which would represent a module name or version. Therefore a module name is derived from a filename and a version completely dropped from semodule output.

However, original .pp files are stored together with cil files as hll files. It means that a version could be extracted from that file.

I prepared a patch and srpms [1] with libsemanage patched to look to try to extract a version from hll files if an original module was installed from .pp file. And semodule patched to accept another list option - legacy - which tries to provide same output as pre-2.4 releases, e.g.:

# semodule -l | tail -n 3    
zarafa
zebra
zoneminder

# semodule -lfull | tail -n 3
100 zebra             pp         
100 zoneminder        cil         
100 zosremote         pp disabled

# semodule -llegacy | tail -n 3
zebra   1.13.0
zoneminder      (null)
zosremote       1.2.0   Disabled



(null) at zoneminder means that the module was not installed from .pp file and there's no version available.


[1] https://plautrba.fedorapeople.org/copr/selinux-semodule-llegacy/

Comment 6 Petr Lautrbach 2016-11-11 09:39:35 UTC
Let's move the discussion to one place.

*** This bug has been marked as a duplicate of bug 1392573 ***


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