Bug 162202 - httpd can bind to any port in enforce mode
httpd can bind to any port in enforce mode
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: selinux-policy-targeted (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Daniel Walsh
Depends On:
  Show dependency treegraph
Reported: 2005-06-30 15:31 EDT by Dominic Duval
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version: 1.25.4-10.1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-09-15 11:59:07 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dominic Duval 2005-06-30 15:31:27 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041215 Firefox/1.0 Red Hat/1.0-12.EL4

Description of problem:
SELinux does not block the httpd server when we try to start on a non-http port, such as port 22. The web server binds to the port normally, which should not be the case.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Modify the /etc/httpd/conf/httpd.conf file to have the web server listen on port 22:
Listen 22

2. Stop the ssh server and restart apache:

service sshd stop
service httpd restart

3. httpd now listens to port 22, even though selinux should have blocked it. 


Actual Results:  The /var/log/messages file does not include any denial message for the bind operation.

Expected Results:  The httpd start operation should have failed with a selinux denial message in the log file.

Additional info:

setsebool allow_ypbind=false

solves the problem, so there might be something in the ypbind policy that opens up port access.
Comment 1 Daniel Walsh 2005-07-03 11:34:53 EDT
Yes this is allow_ypbind causing this, although port 22 should have been
prevented.  Basically ypbind causes all network daemons to need access to a port
returned by portmapper.  We can not predetermine this port so we need to allow
access to all non "reserved_ports"  In the case of SELinux we define this as all
ports with defined selinux policy less than 1024.  So the ssh_port should have
been covered.  I will fix this the next time we release policy for RHEL.  

Comment 2 Daniel Walsh 2005-07-03 11:37:25 EDT
Actually looking back at selinux policy for RHEL4, this port was not defined, so
I can't easily fix this problem, until the next release.  FC4 and RHEL5 will
have this fix.  

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