Bug 839191

Summary: SELinux policy doesn't allow freshclam to update through http proxy
Product: [Fedora] Fedora Reporter: ZiN <metanoite>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Ben Levenson <benl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: dwalsh, metanoite, williama_lovaton
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 863407 (view as bug list) Environment:
Last Closed: 2012-11-20 02:59:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 863407    
Attachments:
Description Flags
Syslog messages
none
Sealert message
none
Freshclam configuration
none
SELinux module that allows freshclam proxy connection none

Description ZiN 2012-07-11 07:46:35 UTC
Created attachment 597483 [details]
Syslog messages

Description of problem:
SELinux policy does not allow freeshclam to update databases through HTTP proxy when run by cron. When it is run manual by an unconfined user, everything is all right. HTTP proxy is set via profile.d shell script.

Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.10.0-137.fc17.noarch
clamav-update-0.97.5-1700.fc17.i686

How reproducible:
Install clamav-update, turn on selinux targeted mode, set up proxy and cron clamav updates. Wait for syslog and selinux messages.

Steps to Reproduce:
1. Install clamav-update.
2. Turn on selinux targeted mode.
3. Set up proxy.
4. Set up cron clamav updates.

Actual results:
ClamAV databases update fails

Expected results:
ClamAV databases update completes

Additional info:

Comment 1 ZiN 2012-07-11 07:47:42 UTC
Created attachment 597484 [details]
Sealert message

Comment 2 ZiN 2012-07-11 07:48:32 UTC
Created attachment 597485 [details]
Freshclam configuration

Comment 3 ZiN 2012-07-11 07:50:25 UTC
Created attachment 597486 [details]
SELinux module that allows freshclam proxy connection

Comment 4 ZiN 2012-07-11 07:57:40 UTC
I'm sorry, the version of components are from another computer with Fedora 17.
The actual versions are:
selinux-policy-targeted-3.10.0-89.fc16.noarch
clamav-update-0.97.3-1600.fc16.i686

Comment 5 Miroslav Grepl 2012-07-11 12:38:48 UTC
Fixed.

Comment 6 William Lovaton 2012-10-03 14:53:15 UTC
Hello there,  I have the very same problem with clamav-0.97.5-1.el6.x86_64 in RHEL 6.3 but in my case I setted the proxy parameters in /etc/freshclam.conf using the HTTPProxy* directives.

I got the following entries in audit.log:
type=AVC msg=audit(1349251647.435:43404): avc:  denied  { name_connect } for  pid=6865 comm="freshclam" dest=8080 scontext=system_u:system_r:freshclam_t:s0-s0:c0.c1023 tcontext=system_u:object_r:http_cache_port_t:s0 tclass=tcp_socket
type=SYSCALL msg=audit(1349251647.435:43404): arch=c000003e syscall=42 success=no exit=-13 a0=5 a1=17253f0 a2=10 a3=0 items=0 ppid=6863 pid=6865 auid=0 uid=496 gid=492 euid=496 suid=496 fsuid=496 egid=492 sgid=492 fsgid=492 tty=(none) ses=2999 comm="freshclam" exe="/usr/bin/freshclam" subj=system_u:system_r:freshclam_t:s0-s0:c0.c1023 key=(null)

And using the audit2allow tool it generated the following policy:
module freshclam-mypol 1.0;

require {
	type freshclam_t;
	type http_cache_port_t;
	class tcp_socket name_connect;
}

#============= freshclam_t ==============
allow freshclam_t http_cache_port_t:tcp_socket name_connect;

I still have to wait until tomorrow to confirm if this actually solves the problem.

The affected packages are:
selinux-policy-3.7.19-154.el6.noarch
selinux-policy-targeted-3.7.19-154.el6.noarch
libselinux-2.0.94-5.3.el6.x86_64

I really hope this gets fixed in RHEL.

Thanks.

Comment 7 William Lovaton 2012-10-05 15:13:11 UTC
I now confirm that this changes worked perfectly, I can see successful updates for Oct 4 and 5.

Comment 8 Fedora Update System 2012-11-13 18:31:26 UTC
selinux-policy-3.10.0-96.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-96.fc16

Comment 9 Fedora Update System 2012-11-15 02:43:51 UTC
Package selinux-policy-3.10.0-96.fc16:
* should fix your issue,
* was pushed to the Fedora 16 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.10.0-96.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-18243/selinux-policy-3.10.0-96.fc16
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2012-11-20 02:59:15 UTC
selinux-policy-3.10.0-96.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.