Bug 948137

Summary: SELinux is preventing /usr/sbin/httpd from 'name_connect' accesses on the tcp_socket .
Product: [Fedora] Fedora Reporter: Gowrishankar Rajaiyan <grajaiya>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: dominick.grift, dwalsh, grajaiya, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:0617b4a453f5ecbf871809a2d2e9d298d1551ab6b5d80c5fa82e286ca28f9fec
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-19 05:56:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gowrishankar Rajaiyan 2013-04-04 06:03:04 UTC
Description of problem:
1. Executed openstack-demo-install
2. After successful completion of above command accessed http://localhost/dashboard
SELinux is preventing /usr/sbin/httpd from 'name_connect' accesses on the tcp_socket .

*****  Plugin connect_ports (85.9 confidence) suggests  **********************

If you want to allow /usr/sbin/httpd to connect to network port 8774
Then you need to modify the port type.
Do
# semanage port -a -t PORT_TYPE -p tcp 8774
    where PORT_TYPE is one of the following: dns_port_t, http_port_t, kerberos_port_t, ocsp_port_t.

*****  Plugin catchall_boolean (7.33 confidence) suggests  *******************

If you want to allow system to run with NIS
Then you must tell SELinux about this by enabling the 'nis_enabled' boolean.
You can read 'None' man page for more details.
Do
setsebool -P nis_enabled 1

*****  Plugin catchall_boolean (7.33 confidence) suggests  *******************

If you want to allow HTTPD scripts and modules to connect to the network using TCP.
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect' boolean.
You can read 'httpd_selinux' man page for more details.
Do
setsebool -P httpd_can_network_connect 1

*****  Plugin catchall (1.35 confidence) suggests  ***************************

If you believe that httpd should be allowed name_connect access on the  tcp_socket by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep httpd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:httpd_t:s0
Target Context                system_u:object_r:unreserved_port_t:s0
Target Objects                 [ tcp_socket ]
Source                        httpd
Source Path                   /usr/sbin/httpd
Port                          8774
Host                          (removed)
Source RPM Packages           httpd-2.4.4-2.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-24.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.9.0-0.rc5.git1.301.fc19.x86_64
                              #1 SMP Tue Apr 2 20:37:45 UTC 2013 x86_64 x86_64
Alert Count                   2
First Seen                    2013-04-04 11:27:04 IST
Last Seen                     2013-04-04 11:27:16 IST
Local ID                      8d022b39-138c-4803-94c3-60f2f2c02e0b

Raw Audit Messages
type=AVC msg=audit(1365055036.659:530): avc:  denied  { name_connect } for  pid=1336 comm="httpd" dest=8774 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket


type=SYSCALL msg=audit(1365055036.659:530): arch=x86_64 syscall=connect success=no exit=ECONNREFUSED a0=d a1=7f42cf1de2e0 a2=1c a3=0 items=0 ppid=1264 pid=1336 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 ses=4294967295 tty=(none) comm=httpd exe=/usr/sbin/httpd subj=system_u:system_r:httpd_t:s0 key=(null)

Hash: httpd,httpd_t,unreserved_port_t,tcp_socket,name_connect

audit2allow

#============= httpd_t ==============

#!!!! This avc can be allowed using one of the these booleans:
#     nis_enabled, httpd_can_network_connect
allow httpd_t unreserved_port_t:tcp_socket name_connect;

audit2allow -R
require {
	type httpd_t;
}

#============= httpd_t ==============
corenet_tcp_connect_unreserved_ports(httpd_t)


Additional info:
hashmarkername: setroubleshoot
kernel:         3.9.0-0.rc5.git1.301.fc19.x86_64
type:           libreport

Potential duplicate: bug 870514

Comment 1 Miroslav Grepl 2013-04-04 11:51:48 UTC
Why is apache trying to connect to 8774?

Comment 2 Gowrishankar Rajaiyan 2013-04-04 12:21:23 UTC
https://wiki.openstack.org/wiki/NovaConfigOptions
# osapi_compute_listen_port=8774

Comment 3 Daniel Walsh 2013-04-04 21:18:19 UTC
Looks like we need a new defition for this port.

Comment 4 Miroslav Grepl 2013-04-08 10:12:02 UTC
Added.

Comment 5 Fedora Update System 2013-04-08 11:44:06 UTC
selinux-policy-3.12.1-28.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/FEDORA-2013-5045/selinux-policy-3.12.1-28.fc19

Comment 6 Fedora Update System 2013-04-08 15:56:34 UTC
Package selinux-policy-3.12.1-28.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-28.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-5045/selinux-policy-3.12.1-28.fc19
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2013-04-19 05:56:22 UTC
selinux-policy-3.12.1-28.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.