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 924121

Summary: sepolicy generate --customize doesn't use the domain type I want
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.1CC: ebenes, mgrepl, 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 10:39:27 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: 924105    
Bug Blocks: 917049    

Description Michal Trunecka 2013-03-21 09:10:36 UTC
Description of problem:

Following command:
# sepolicy generate --customize -n mypolicy -d httpd_sys_script_t -w /home
generates policy, but it doesn't extend the given type httpd_sys_script_t, but
created new type mypolicy_t:


# cat mypolicy.te 
policy_module(mypolicy, 1.0.0)

gen_require(`
        type httpd_sys_script_t;
')

type mypolicy_rw_t;
files_type(mypolicy_rw_t)

########################################
#
# mypolicy customized policy
#

manage_dirs_pattern(mypolicy_t, mypolicy_rw_t, mypolicy_rw_t)
manage_files_pattern(mypolicy_t, mypolicy_rw_t, mypolicy_rw_t)
manage_lnk_files_pattern(mypolicy_t, mypolicy_rw_t, mypolicy_rw_t)


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

Comment 2 Daniel Walsh 2013-03-21 18:16:57 UTC
I have fixed this to do 

policy_module(mypolicy, 1.0.0)

gen_require(`
        type httpd_sys_script_t;
')

type mypolicy_rw_t;
files_type(mypolicy_rw_t)

########################################
#
# mypolicy customized policy
#

manage_dirs_pattern(httpd_sys_script_t, httpd_sys_script_rw_t, httpd_sys_script_rw_t)
manage_files_pattern(httpd_sys_script_t, httpd_sys_script_rw_t, httpd_sys_script_rw_t)
manage_lnk_files_pattern(httpd_sys_script_t, httpd_sys_script_rw_t, httpd_sys_script_rw_t)


But I am not sure this is what the user would expect,  In a perfect world, I would have added something like

userdom_manage_home_root()

For that command.

Comment 3 Miroslav Grepl 2013-03-26 20:06:27 UTC
Well, yes. 

At least it could just check labeling for the path and use this label in the local policy.

Also a user could define a new type for this writable location.

I am going to switch to modify because of

"I have fixed this to do  .."

and we could open a new bug with this feature request for "sepolicy generate -w whatever ...."

Comment 4 Michal Trunecka 2013-05-14 07:27:40 UTC
Yes, it is fixed -> VERIFIED

policycoreutils-2.1.14-37.el7.x86_64

.te file generated by current version:


policy_module(mypolicy, 1.0.0)

gen_require(`
        type httpd_sys_script_t;
')

type mypolicy_rw_t;
files_type(mypolicy_rw_t)

########################################
#
# mypolicy customized policy
#

manage_dirs_pattern(httpd_sys_script_t, mypolicy_rw_t, mypolicy_rw_t)
manage_files_pattern(httpd_sys_script_t, mypolicy_rw_t, mypolicy_rw_t)
manage_lnk_files_pattern(httpd_sys_script_t, mypolicy_rw_t, mypolicy_rw_t)

Comment 5 Ludek Smid 2014-06-13 10:39:27 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.