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 620576 - luci generates selinux avcs
Summary: luci generates selinux avcs
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy
Version: 6.0
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: Cluster QE
URL:
Whiteboard:
Depends On: 619893
Blocks: 616643 619918
TreeView+ depends on / blocked
 
Reported: 2010-08-02 21:45 UTC by Chris Feist
Modified: 2012-11-23 21:07 UTC (History)
12 users (show)

Fixed In Version: selinux-policy-3.7.19-36.el6
Doc Type: Bug Fix
Doc Text:
Clone Of: 619893
Environment:
Last Closed: 2010-11-15 14:48:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Ricci policy that seems to fix the issue. (1.00 KB, application/octet-stream)
2010-08-02 21:47 UTC, Chris Feist
no flags Details

Comment 1 Chris Feist 2010-08-02 21:47:56 UTC
Created attachment 436138 [details]
Ricci policy that seems to fix the issue.

Ricci policy that seems to fix the issue.

Comment 2 Chris Feist 2010-08-02 21:49:14 UTC
We need to wait until 619893 is fixed to verify that this is a blocker that needs to be fixed by 6.0, but right now it appears that this will cause issues with luci/ricci in RHEL 6.0 when selinux is in targeted.

Comment 4 Daniel Walsh 2010-08-03 13:21:33 UTC
Chris the policy you attached is not very good.  

We can add

kernel_request_load_module(ricci_modclusterd_t)


type ricci_modclusterd_tmpfs_t;
files_tmpfs_file(ricci_modclusterd_tmpfs_t)

manage_dirs_pattern(ricci_modclusterd_t, ricci_modclusterd_tmpfs_t, ricci_modclusterd_tmpfs_t)
manage_files_pattern(ricci_modclusterd_t, ricci_modclusterd_tmpfs_t, ricci_modclusterd_tmpfs_t)
fs_tmpfs_filetrans(ricci_modclusterd_t, ricci_modclusterd_tmpfs_t, { dir file })


But we also need to know which tcp port modcluserd needs to connect to.

Comment 5 Chris Feist 2010-08-03 14:37:22 UTC
I just used the output from audit2allow to generate the old policy.  modclusterd is a server listening on port 16851, I believe it is only a server, I don't think it makes tcp connections elsewhere.  (I will check into this).

Comment 6 Daniel Walsh 2010-08-03 15:35:38 UTC
type=1400 audit(1280503340.368:54): avc:  denied  { name_connect } for 
pid=1876 comm="modclusterd" scontext=system_u:system_r:ricci_modclusterd_t:s0
tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket

This avc says that is it trying to connect somewhere.  The problem is you did not include the full AVC report to see which port it is tryint to connect to.

Comment 7 Chris Feist 2010-08-03 18:47:33 UTC
type=AVC msg=audit(1280782866.051:70): avc:  denied  { name_connect } for  pid=3507 comm="modclusterd" scontext=unconfined_u:system_r:ricci_modclusterd_t:s0 tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket
type=SYSCALL msg=audit(1280782866.051:70): arch=c000003e syscall=42 success=no exit=-111 a0=6 a1=7f2510003140 a2=10 a3=40 items=0 ppid=1 pid=3507 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=2 comm


Here are both lines that show up in the audit.log file form the name_connect denial.  Please let me know if I should be including any other information.

Comment 8 Daniel Walsh 2010-08-03 19:40:33 UTC
Miroslav just allow this for now.  

corenet_tcp_connect_generic_port(ricci_modclusterd_t)

I think we will need

########################################
## <summary>
##	Read and write to ricci_modcluserd temporary file system.
## </summary>
## <param name="domain">
##	<summary>
##	Domain allowed access.
##	</summary>
## </param>
#
interface(`ricci_rw_modclusterd_tmpfs_files',`
	gen_require(`
		type ricci_modcluserd_tmpfs_t;
	')

	allow $1 ricci_modcluserd_tmpfs_t:file rw_file_perms;
')


And we might need
ricci_rw_modclusterd_tmpfs_files(corosync_t)????


The tmpfs files are being created by clustat.

Comment 9 Daniel Walsh 2010-08-03 19:50:32 UTC
SELinux guys, any idea why we are getting a name_connect avs without a dst field?

We can not identify which tcp port the modclusterd is trying to connect to.

Comment 10 Miroslav Grepl 2010-08-04 11:51:04 UTC
I have created one-node cluster and I am finally seeing the same issues. 

Dan, 
we definitely need to add

type ricci_modclusterd_tmpfs_t;
files_tmpfs_file(ricci_modclusterd_tmpfs_t)

manage_dirs_pattern(ricci_modclusterd_t, ricci_modclusterd_tmpfs_t, ricci_modclusterd_tmpfs_t)
manage_files_pattern(ricci_modclusterd_t, ricci_modclusterd_tmpfs_t, ricci_modclusterd_tmpfs_t)
fs_tmpfs_filetrans(ricci_modclusterd_t, ricci_modclusterd_tmpfs_t, { dir file })

kernel_request_load_module(ricci_modclusterd_t)
corenet_tcp_connect_generic_port(ricci_modclusterd_t)

optional_policy(`
 ricci_rw_modclusterd_tmpfs_files(corosync_t)
')

and 

interface(`ricci_rw_modclusterd_tmpfs_files',`
        gen_require(`
                type ricci_modclusterd_tmpfs_t;
        ')

        allow $1 ricci_modclusterd_tmpfs_t:file rw_file_perms;
        allow $1 ricci_modclusterd_tmpfs_t:file unlink;
')

Comment 11 Stephen Smalley 2010-08-04 18:40:37 UTC
(In reply to comment #9)
> SELinux guys, any idea why we are getting a name_connect avs without a dst
> field?
> 
> We can not identify which tcp port the modclusterd is trying to connect to.    

Can you run it under strace and attach the output for the failing connect() call?
Lack of dest= information suggests that either:
- the program is passing port 0 (which implies disconnect rather than connect; I didn't realize that was supported on TCP sockets), or
- we have a bug in the kernel in extracting the destination port or auditing it.

Comment 12 Miroslav Grepl 2010-08-06 18:22:22 UTC
(In reply to comment #10)
> I have created one-node cluster and I am finally seeing the same issues. 
> 
> Dan, 
> we definitely need to add
> 
> type ricci_modclusterd_tmpfs_t;
> files_tmpfs_file(ricci_modclusterd_tmpfs_t)
> 
> manage_dirs_pattern(ricci_modclusterd_t, ricci_modclusterd_tmpfs_t,
> ricci_modclusterd_tmpfs_t)
> manage_files_pattern(ricci_modclusterd_t, ricci_modclusterd_tmpfs_t,
> ricci_modclusterd_tmpfs_t)
> fs_tmpfs_filetrans(ricci_modclusterd_t, ricci_modclusterd_tmpfs_t, { dir file
> })
> 
> kernel_request_load_module(ricci_modclusterd_t)
> corenet_tcp_connect_generic_port(ricci_modclusterd_t)
> 
> optional_policy(`
>  ricci_rw_modclusterd_tmpfs_files(corosync_t)
> ')
> 
> and 
> 
> interface(`ricci_rw_modclusterd_tmpfs_files',`
>         gen_require(`
>                 type ricci_modclusterd_tmpfs_t;
>         ')
> 
>         allow $1 ricci_modclusterd_tmpfs_t:file rw_file_perms;
>         allow $1 ricci_modclusterd_tmpfs_t:file unlink;
> ')    

Rules was added to selinux-policy-3.7.19-36.el6.noarch

Comment 13 Chris Feist 2010-08-09 22:25:51 UTC
2783  connect(6, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("10.15.85.4")}, 16) = -1 EINVAL (Invalid argument)
2783  connect(6, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("10.15.85.4")}, 16) = -1 ECONNREFUSED (Connection refused)


Output from strace, it looks like it's trying to open a connection on port 0, I'm looking through the code to see where this is happening.

Comment 16 releng-rhel@redhat.com 2010-11-15 14:48:18 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.


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