Bug 671891

Summary: SELinux is preventing /usr/sbin/httpd from 'name_connect' accesses on the tcp_socket port 5432.
Product: [Fedora] Fedora Reporter: Harish Pillay <h.pillay>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 14CC: dwalsh, l.wandrebeck, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:84abac1a6b863750ca105ef2c1cfde2cd40c70c61526af54eb4af91de047a632
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-24 14:11:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Harish Pillay 2011-01-22 16:02:42 UTC
SELinux is preventing /usr/sbin/httpd from 'name_connect' accesses on the tcp_socket port 5432.

*****  Plugin catchall_boolean (47.5 confidence) suggests  *******************

If you want to allow HTTPD scripts and modules to connect to the network using any TCP port.
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect' boolean.
Do
setsebool -P httpd_can_network_connect 1

*****  Plugin catchall_boolean (47.5 confidence) suggests  *******************

If you want to allow HTTPD scripts and modules to connect to databases over the network.
Then you must tell SELinux about this by enabling the 'httpd_can_network_connect_db' boolean.
Do
setsebool -P httpd_can_network_connect_db 1

*****  Plugin catchall (6.38 confidence) suggests  ***************************

If you believe that httpd should be allowed name_connect access on the port 5432 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                unconfined_u:system_r:httpd_t:s0
Target Context                system_u:object_r:postgresql_port_t:s0
Target Objects                port 5432 [ tcp_socket ]
Source                        httpd
Source Path                   /usr/sbin/httpd
Port                          5432
Host                          (removed)
Source RPM Packages           httpd-2.2.17-1.fc14
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.7-20.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed)
                              2.6.35.10-74.fc14.x86_64 #1 SMP Thu Dec 23
                              16:04:50 UTC 2010 x86_64 x86_64
Alert Count                   1
First Seen                    Sun 23 Jan 2011 12:01:01 AM SGT
Last Seen                     Sun 23 Jan 2011 12:01:01 AM SGT
Local ID                      cfa46e52-6dda-430a-bbfe-a68103dbaca2

Raw Audit Messages
type=AVC msg=audit(1295712061.341:27886): avc:  denied  { name_connect } for  pid=20877 comm="httpd" dest=5432 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:postgresql_port_t:s0 tclass=tcp_socket

httpd,httpd_t,postgresql_port_t,tcp_socket,name_connect
type=SYSCALL msg=audit(1295712061.341:27886): arch=x86_64 syscall=connect success=no exit=EACCES a0=10 a1=7f2977b428e0 a2=10 a3=7ffff6dd4ce4 items=0 ppid=20027 pid=20877 auid=500 uid=48 gid=488 euid=48 suid=48 fsuid=48 egid=488 sgid=488 fsgid=488 tty=(none) ses=10 comm=httpd exe=/usr/sbin/httpd subj=unconfined_u:system_r:httpd_t:s0 key=(null)
httpd,httpd_t,postgresql_port_t,tcp_socket,name_connect

#============= httpd_t ==============
#!!!! This avc can be allowed using one of the these booleans:
#     httpd_can_network_connect, httpd_can_network_connect_db

allow httpd_t postgresql_port_t:tcp_socket name_connect;

Comment 1 Daniel Walsh 2011-01-24 14:11:11 UTC
Turn on the boolean

# setsebool -P httpd_can_network_connect_db 1

Comment 2 Harish Pillay 2011-01-24 14:19:30 UTC
Ok, thanks.

Harish