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 699063 - netlabelctl can't be run by init
Summary: netlabelctl can't be run by init
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy
Version: 6.1
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks: RHEL62CCC 846801 846802
TreeView+ depends on / blocked
 
Reported: 2011-04-22 21:50 UTC by Linda Knippers
Modified: 2016-11-28 08:31 UTC (History)
6 users (show)

Fixed In Version: selinux-policy-3.7.19-91.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-19 12:27:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Netlabel avcs from system boot (6.75 KB, text/plain)
2011-04-25 15:21 UTC, Linda Knippers
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0526 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2011-05-19 09:37:41 UTC

Description Linda Knippers 2011-04-22 21:50:13 UTC
Description of problem:
netlabel has a config file that allows netlabelctl commands to be run when 
starting the netlabel service through init.  However, running netlabelctl
at boot time or using run_init with the mls policy fails, generating some AVCs.

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

selinux-policy-3.7.19-82.el6.noarch
selinux-policy-mls-3.7.19-82.el6.noarch
selinux-policy-targeted-3.7.19-82.el6.noarch
netlabel_tools-0.19-7.el6.x86_64

Additional info:

I was able to fix the problem with this little policy module,
although there's probably a better way to fix it in the 
system/netlabel.te file.

policy_module(mynetlabel, 1.3)
gen_require(`
type initrc_t;
')

allow initrc_t self:netlink_socket { create bind getattr read setopt write};

Comment 2 RHEL Program Management 2011-04-23 06:00:44 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 3 Daniel Walsh 2011-04-25 13:51:44 UTC
Linda what were the AVC's you saw to generate this?

Comment 4 Linda Knippers 2011-04-25 14:10:23 UTC
I knew you were going to ask me that.  I don't think I still have them but I can recreate them if I unload my policy module, which was generated using those AVCs.  Will take me little while to get on the system.

Comment 5 Daniel Walsh 2011-04-25 14:46:44 UTC
I think we need to add

init_system_domain(netlabel_mgmt_t, netlabel_mgmt_exec_t)

Comment 6 Linda Knippers 2011-04-25 15:21:29 UTC
Created attachment 494689 [details]
Netlabel avcs from system boot

These are the AVCs from boot.  I don't recall why I had to add read and write.

Comment 7 Daniel Walsh 2011-04-25 15:29:38 UTC
Miroslav add the init_system_domain and this should fix the problem

Comment 9 Miroslav Grepl 2011-04-26 10:38:51 UTC
Fixed in selinux-policy-3.7.19-88.el6

Comment 12 Karel Srot 2011-04-27 09:27:52 UTC
Bug is not fixed in
selinux-policy-3.7.19-90.el6.noarch

there is a problem when executing netlabel service using run_init. 

# run_init service netlabel start

doesn't work but produce following DONTAUDITED AVCs:

type=AVC msg=audit(1303894153.272:147): avc:  denied  { read write } for  pid=2873 comm="netlabelctl" name="4" dev=devpts ino=7 scontext=system_u:system_r:netlabel_mgmt_t:s0-s15:c0.c1023 tcontext=system_u:object_r:initrc_devpts_t:s0 tclass=chr_file

In PERMISSIVE mode there is also { getattr } required:

# cat /var/log/audit/audit.log  | grep netlabel | egrep -v '(noatsecure|siginh|rlimitinh)'
type=AVC msg=audit(1303894398.896:168): avc:  denied  { read write } for  pid=3078 comm="netlabelctl" name="4" dev=devpts ino=7 scontext=system_u:system_r:netlabel_mgmt_t:s0-s15:c0.c1023 tcontext=system_u:object_r:initrc_devpts_t:s0 tclass=chr_file
type=SYSCALL msg=audit(1303894398.896:168): arch=c000003e syscall=59 success=yes exit=0 a0=bf1800 a1=bcae00 a2=c08270 a3=7fff488ba780 items=0 ppid=3077 pid=3078 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts4 ses=2 comm="netlabelctl" exe="/sbin/netlabelctl" subj=system_u:system_r:netlabel_mgmt_t:s0-s15:c0.c1023 key=(null)
type=AVC msg=audit(1303894403.923:171): avc:  denied  { getattr } for  pid=3227 comm="netlabelctl" path="/dev/pts/4" dev=devpts ino=7 scontext=system_u:system_r:netlabel_mgmt_t:s0-s15:c0.c1023 tcontext=system_u:object_r:initrc_devpts_t:s0 tclass=chr_file
type=SYSCALL msg=audit(1303894403.923:171): arch=c000003e syscall=5 success=yes exit=0 a0=1 a1=7fffa0192e80 a2=7fffa0192e80 a3=7fffa01934c0 items=0 ppid=3223 pid=3227 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts4 ses=2 comm="netlabelctl" exe="/sbin/netlabelctl" subj=system_u:system_r:netlabel_mgmt_t:s0-s15:c0.c1023 key=(null)


netlabel service seems to start properly during the boot although following AVC (this time it is not dontaudited) appears in the log:

# grep netlabel /var/log/audit/audit.log 
type=AVC msg=audit(1303895369.165:14): avc:  denied  { read write } for  pid=964 comm="netlabelctl" path="/dev/console" dev=devtmpfs ino=5058 scontext=system_u:system_r:netlabel_mgmt_t:s0-s15:c0.c1023 tcontext=system_u:object_r:console_device_t:s0 tclass=chr_file

my REPRODUCER:
# cat > /etc/netlabel.rules <<EOF
netlabelctl cipsov4 add pass doi:6000 tags:1
netlabelctl map add domain:"foo_t" protocol:cipsov4,6000
#netlabelctl map del domain:"foo_t"
#netlabelctl cipsov4 del doi:6000
EOF
# setenforce 1    # or setenforce 0 to see all required permissions
# semodule -DB   # this is required to see dontaudited rules witn -90 policy
# run_init service netlabel start
# run_init service netlabel status
# run_init service netlabel stop

Comment 13 Miroslav Grepl 2011-04-27 10:37:16 UTC
Karel,
could you test it with local policy which will contain

term_use_all_terms(netlabel_mgmt_t)

it should work.

Comment 14 Karel Srot 2011-04-27 11:37:06 UTC
With term_use_all_terms(netlabel_mgmt_t) it si working fine, no AVC.

Comment 15 Miroslav Grepl 2011-04-27 13:40:34 UTC
Fixed in selinux-policy-3.7.19-91.el6

Comment 17 errata-xmlrpc 2011-05-19 12:27:59 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0526.html


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