Bug 620576 - luci generates selinux avcs
luci generates selinux avcs
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy (Show other bugs)
6.0
All Linux
high Severity high
: rc
: ---
Assigned To: Miroslav Grepl
Cluster QE
:
Depends On: 619893
Blocks: 616643 619918
  Show dependency treegraph
 
Reported: 2010-08-02 17:45 EDT by Chris Feist
Modified: 2012-11-23 16:07 EST (History)
12 users (show)

See Also:
Fixed In Version: selinux-policy-3.7.19-36.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 619893
Environment:
Last Closed: 2010-11-15 09:48:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Comment 1 Chris Feist 2010-08-02 17:47:56 EDT
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 17:49:14 EDT
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 09:21:33 EDT
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 10:37:22 EDT
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 11:35:38 EDT
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 14:47:33 EDT
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 15:40:33 EDT
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 15:50:32 EDT
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 07:51:04 EDT
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 14:40:37 EDT
(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 14:22:22 EDT
(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 18:25:51 EDT
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 09:48:18 EST
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.