Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 918963

Summary: sepolicy generate: Generated domain as permissive by default + man pages issues
Product: Red Hat Enterprise Linux 7 Reporter: Michal Trunecka <mtruneck>
Component: policycoreutilsAssignee: Daniel Walsh <dwalsh>
Status: CLOSED CURRENTRELEASE QA Contact: Michal Trunecka <mtruneck>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: ebenes, mmalik
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 13:19:41 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 917049    
Attachments:
Description Flags
FIxed manpage.py none

Description Michal Trunecka 2013-03-07 10:09:57 UTC
Description of problem:
The generated domain type for given application is permissive domain by default (i.e. defined in the generated module). From my point of view it is confusing because no documentation mentions it. In addition, following note is in the generated:

"Note: semanage permissive -a mojeapp_t can be used to make the process type mojeapp_t permissive. SELinux does not deny access to permissive process types, but the AVC (SELinux denials) messages are still generated."

Which would make more sense if the domain type wasn't permissive by default.


And second manpage thing, when I generate policy for "mydaemon", in generated manpage is correctly listed only the new domain:

       The following process types are defined for mydaemon:
       mydaemon_t

whereas when generated policy for "testd", there is listed also one unrelated testapp domain:

       The following process types are defined for testd:
       testd_t, testapp_t



Version-Release number of selected component (if applicable):
policycoreutils-python-2.1.14-16.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. sepolicy generate --init mydaemon
2a. cat mydaemon.te
....
permissive mydaemon_t;
....
2b. ./mydaemon.sh; man mydaemon_selinux.8


Actual results:
domain type is permissive by default
unrelated testapp_t is listed in testd_selinux generated man page

Expected results:
Better, domains aren't permissive by default. If it has a reason, it should be described better in documentation.

Comment 1 Daniel Walsh 2013-03-07 15:20:07 UTC
Added the following to the sepolicy-generate man page

       Note: Policy generated by sepolicy generate will automatically add a permissive DOMAIN to your te file.  When you are satisfied that your policy works, you need to remove  the  permissive line from the te file to run your domain in enforcing mode.

Also fixed sepolicy manpage to match on domain(d)_* rather then domain(d)*

Fixed in policycoreutils-2.1.14-20.el7

Comment 2 Michal Trunecka 2013-03-14 08:14:56 UTC
With the new version, I miss completely the line with the process types (one type respectively).

Moreover, the testapp is showed among the referred man pages:

SEE ALSO
       selinux(8), testd(8), ..... testapp_selinux(8)


# rpm -qa policycoreutils\*
policycoreutils-gui-2.1.14-20.el7.x86_64
policycoreutils-2.1.14-20.el7.x86_64
policycoreutils-devel-2.1.14-20.el7.x86_64
policycoreutils-sandbox-2.1.14-20.el7.x86_64
policycoreutils-restorecond-2.1.14-20.el7.x86_64
policycoreutils-python-2.1.14-20.el7.x86_64
policycoreutils-newrole-2.1.14-20.el7.x86_64

Comment 3 Daniel Walsh 2013-03-14 14:30:08 UTC
I have aproblem with this bugzilla since it is reporting two or more bugs.

First the original bug about permissive domains sh

I see 

man sepolicy-generate
...
       Note: Policy generated by sepolicy generate will  automatically  add  a
       permissive  DOMAIN  to  your te file.  When you are satisfied that your
       policy works, you need to remove the permissive line from the  te  file
       to run your domain in enforcing mode.


Do you agree this is fixed?

Comment 4 Michal Trunecka 2013-03-14 14:32:09 UTC
Sorry about that, yes, this Note is in sepolicy-generate man page.

Comment 5 Daniel Walsh 2013-03-14 18:30:08 UTC
Created attachment 710156 [details]
FIxed manpage.py

Can you save this python file to /usr/lib64/python2.7/site-packages/sepolicy/manpage.py and see if it fixes the problem.  If yes I will build a new update for RHEL.

Comment 6 Daniel Walsh 2013-03-14 22:18:12 UTC
Ok I have built another policycoreutils package

policycoreutils-2.1.14-22.el7

Comment 8 Ludek Smid 2014-06-13 13:19:41 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.