Bug 665681 - SELinux is preventing /var/www/cgi-bin/cachemgr.cgi from 'name_connect' accesses on the tcp_socket port 3128.
Summary: SELinux is preventing /var/www/cgi-bin/cachemgr.cgi from 'name_connect' acces...
Keywords:
Status: CLOSED DUPLICATE of bug 666103
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 14
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:961e6316a82...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-12-26 00:28 UTC by Nivag
Modified: 2010-12-30 14:04 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-28 12:07:31 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Nivag 2010-12-26 00:28:59 UTC
# grep /var/www/cgi-bin/cachemgr.cgi /var/log/audit/audit.log | audit2allow -M mypol
compilation failed:
mypol.te:6:ERROR 'syntax error' at token '' on line 6:


/usr/bin/checkmodule:  error(s) encountered while parsing configuration
/usr/bin/checkmodule:  loading policy configuration from mypol.te

////////////////////////////

SELinux is preventing /var/www/cgi-bin/cachemgr.cgi from 'name_connect' accesses on the tcp_socket port 3128.

*****  Plugin catchall_boolean (89.3 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 (11.6 confidence) suggests  ***************************

If you believe that cachemgr.cgi should be allowed name_connect access on the port 3128 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 /var/www/cgi-bin/cachemgr.cgi /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:httpd_sys_script_t:s0
Target Context                system_u:object_r:squid_port_t:s0
Target Objects                port 3128 [ tcp_socket ]
Source                        cachemgr.cgi
Source Path                   /var/www/cgi-bin/cachemgr.cgi
Port                          3128
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.7-18.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 2.6.35.10-72.fc14.x86_64 #1 SMP Mon
                              Dec 20 21:14:22 UTC 2010 x86_64 x86_64
Alert Count                   27
First Seen                    Thu 23 Dec 2010 08:10:29 AM NZDT
Last Seen                     Sun 26 Dec 2010 01:00:53 PM NZDT
Local ID                      d77d0840-8316-4d43-a125-d222db58e1ce

Raw Audit Messages
type=AVC msg=audit(1293321653.191:49154): avc:  denied  { name_connect } for  pid=21542 comm="cachemgr.cgi" dest=3128 scontext=system_u:system_r:httpd_sys_script_t:s0 tcontext=system_u:object_r:squid_port_t:s0 tclass=tcp_socket

cachemgr.cgi,httpd_sys_script_t,squid_port_t,tcp_socket,name_connect
type=SYSCALL msg=audit(1293321653.191:49154): arch=x86_64 syscall=connect success=yes exit=0 a0=3 a1=7f448c1d0770 a2=10 a3=7fffe5be2dd0 items=0 ppid=9219 pid=21542 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm=cachemgr.cgi exe=/var/www/cgi-bin/cachemgr.cgi subj=system_u:system_r:httpd_sys_script_t:s0 key=(null)
cachemgr.cgi,httpd_sys_script_t,squid_port_t,tcp_socket,name_connect

#============= httpd_sys_script_t ==============
#!!!! This avc can be allowed using the boolean 'httpd_can_network_connect'

allow httpd_sys_script_t squid_port_t:tcp_socket name_connect;

Comment 1 Daniel Walsh 2010-12-28 12:07:31 UTC
The alert above tells you how you can fix this problem?  Why did you think this is a bug?

Comment 2 Nivag 2010-12-29 01:00:15 UTC
I started to apply the suggested fix...

grep /var/www/cgi-bin/cachemgr.cgi /var/log/audit/audit.log | audit2allow -M mypol

generated an error, which I reported in the bug report - see comment #1 above.

The contents of mypol:
$ cat /data/home/gavin/mypol.te

module mypol 1.0;



$ 

So I attempted to carry out the suggested remedy, and it appeared to fail.

So I still think there is a bug - or perhaps, I have misunderstood something that is 'obvious'.

Comment 3 Daniel Walsh 2010-12-30 14:04:43 UTC
After further looking at this bug and others you reported.  I realize this is a labeling issue.  I am looking into to fixing the alert message to fix that problem, also.

*** This bug has been marked as a duplicate of bug 666103 ***


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