Bug 587684 - SELinux is preventing /usr/sbin/httpd "name_bind" access .
Summary: SELinux is preventing /usr/sbin/httpd "name_bind" access .
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 12
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Fedora Extras Quality Assurance
Whiteboard: setroubleshoot_trace_hash:33de85aadff...
Depends On:
TreeView+ depends on / blocked
Reported: 2010-04-30 15:04 UTC by marinalan
Modified: 2010-05-03 18:23 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-05-03 18:23:50 UTC
Type: ---

Attachments (Terms of Use)

Description marinalan 2010-04-30 15:04:37 UTC

SELinux is preventing /usr/sbin/httpd "name_bind" access .

Detailed Description:

[SELinux is in permissive mode. This access was not denied.]

SELinux denied access requested by httpd. It is not expected that this access is
required by httpd and this access may signal an intrusion attempt. It is also
possible that the specific version or configuration of the application is
causing it to require additional access.

Allowing Access:

You can generate a local policy module to allow this access - see FAQ
(http://docs.fedoraproject.org/selinux-faq-fc5/#id2961385) Please file a bug

Additional Information:

Source Context                unconfined_u:system_r:httpd_t:s0
Target Context                system_u:object_r:soundd_port_t:s0
Target Objects                None [ tcp_socket ]
Source                        httpd
Source Path                   /usr/sbin/httpd
Port                          8000
Host                          (removed)
Source RPM Packages           httpd-2.2.14-1.fc12
Target RPM Packages           
Policy RPM                    selinux-policy-3.6.32-110.fc12
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Plugin Name                   catchall
Host Name                     (removed)
Platform                      Linux (removed)
                     #1 SMP Mon Apr 5
                              16:15:03 EDT 2010 i686 i686
Alert Count                   8
First Seen                    Tue 27 Apr 2010 02:13:50 PM PDT
Last Seen                     Fri 30 Apr 2010 08:03:02 AM PDT
Local ID                      eb604883-a26b-4124-b2b8-37155b1b7acb
Line Numbers                  

Raw Audit Messages            

node=(removed) type=AVC msg=audit(1272639782.56:31): avc:  denied  { name_bind } for  pid=2436 comm="httpd" src=8000 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:soundd_port_t:s0 tclass=tcp_socket

node=(removed) type=SYSCALL msg=audit(1272639782.56:31): arch=40000003 syscall=102 success=yes exit=0 a0=2 a1=bfce4800 a2=4f91e4 a3=d6bc00 items=0 ppid=2435 pid=2436 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="httpd" exe="/usr/sbin/httpd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)

Hash String generated from  catchall,httpd,httpd_t,soundd_port_t,tcp_socket,name_bind
audit2allow suggests:

#============= httpd_t ==============
allow httpd_t soundd_port_t:tcp_socket name_bind;

Comment 1 Carl G. 2010-04-30 15:43:41 UTC
allow httpd_t soundd_port_t:tcp_socket name_bind;    ?!

Comment 2 Daniel Walsh 2010-04-30 20:35:40 UTC
Did you setup your httpd server to listen on port 8000?

Comment 3 marinalan 2010-04-30 20:54:40 UTC
yes, sometimes i need to test php app, that for some reason demand everything to be in document root, i have recently set virtualhost configured in apache to listen and respond to http://localhost:8000 for one such app.

But even before i established that virtual host and added "Listen 8000" directive in apache configuration files, I regularly have in /var/log/httpd/error_log lines like that ( when httpd starts)

[error] avahi_entry_group_add_service_strlst("marina-home") failed: Invalid host name

I am not sure if that has something to do with "name_bind"
in /etc/hosts I have:
--------------------------------------------------------------------------   localhost localhost.localdomain localhost4 localhost4.localdomain4 marina-home.localdomain
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 marina-home.localdomain

Comment 4 marinalan 2010-04-30 20:57:02 UTC
Listen 8000
<VirtualHost _default_:8000>
    ServerAdmin marinalan@shaw.ca
    DocumentRoot /home/marina/<some_directory_webroot_of_tested_php_app>
    ServerName marina-home
    Options FollowSymLinks

Comment 5 marinalan 2010-04-30 20:58:51 UTC
I needed to use some port, because i use ssh remote port forwarding to have public url

Comment 6 Daniel Walsh 2010-05-03 18:23:31 UTC
You can add this port by using audit2allow

# grep name_bind /var/log/audit/audit.log | audit2allow -M myhttp
# semodule -i myhttp.pp

If you want to have a document root in /home/marina you will need to setup this directory to have labeling of httpd_sys_content_t.

# semanage fcontext -a -t httpd_sys_content_t /home/marina ' /<some_directory_webroot_of_tested_php_app>(/.*)?'
# restorecon -R -v /home/marina /home/marina/<some_directory_webroot_of_tested_php_app>

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