Bug 868866 - SELinux is preventing /usr/sbin/fping from 'create' accesses on the rawip_socket .
Summary: SELinux is preventing /usr/sbin/fping from 'create' accesses on the rawip_soc...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 17
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:8d44b81f68c6f855e8c6c60b04e...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-22 10:26 UTC by Ilkka Tengvall
Modified: 2012-12-20 15:28 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-12-20 15:28:23 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: type (9 bytes, text/plain)
2012-10-22 10:26 UTC, Ilkka Tengvall
no flags Details
File: hashmarkername (14 bytes, text/plain)
2012-10-22 10:26 UTC, Ilkka Tengvall
no flags Details

Description Ilkka Tengvall 2012-10-22 10:26:27 UTC
Description of problem:
I installed smokeping, and started httpd, and entered webpage http://localhost/smokeping/sm.cgi

Additional info:
libreport version: 2.0.14
kernel:         3.6.1-1.fc17.x86_64

description:
:SELinux is preventing /usr/sbin/fping from 'create' accesses on the rawip_socket .
:
:*****  Plugin catchall (100. confidence) suggests  ***************************
:
:If you believe that fping should be allowed create access on the  rawip_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 fping /var/log/audit/audit.log | audit2allow -M mypol
:# semodule -i mypol.pp
:
:Additional Information:
:Source Context                system_u:system_r:httpd_smokeping_cgi_script_t:s0
:Target Context                system_u:system_r:httpd_smokeping_cgi_script_t:s0
:Target Objects                 [ rawip_socket ]
:Source                        fping
:Source Path                   /usr/sbin/fping
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           fping-3.0-1.fc17.x86_64
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.10.0-153.fc17.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux (removed) 3.6.1-1.fc17.x86_64 #1 SMP Wed Oct
:                              10 12:13:05 UTC 2012 x86_64 x86_64
:Alert Count                   3
:First Seen                    2012-10-22 13:20:56 EEST
:Last Seen                     2012-10-22 13:20:56 EEST
:Local ID                      cef8cb11-e4b8-419d-8d52-b67ec17d831a
:
:Raw Audit Messages
:type=AVC msg=audit(1350901256.421:6049): avc:  denied  { create } for  pid=9349 comm="fping" scontext=system_u:system_r:httpd_smokeping_cgi_script_t:s0 tcontext=system_u:system_r:httpd_smokeping_cgi_script_t:s0 tclass=rawip_socket
:
:
:type=SYSCALL msg=audit(1350901256.421:6049): arch=x86_64 syscall=socket success=no exit=EACCES a0=2 a1=3 a2=1 a3=7fffae008880 items=0 ppid=9291 pid=9349 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm=fping exe=/usr/sbin/fping subj=system_u:system_r:httpd_smokeping_cgi_script_t:s0 key=(null)
:
:Hash: fping,httpd_smokeping_cgi_script_t,httpd_smokeping_cgi_script_t,rawip_socket,create
:
:audit2allow
:
:#============= httpd_smokeping_cgi_script_t ==============
:allow httpd_smokeping_cgi_script_t self:rawip_socket create;
:
:audit2allow -R
:
:#============= httpd_smokeping_cgi_script_t ==============
:allow httpd_smokeping_cgi_script_t self:rawip_socket create;
:

Comment 1 Ilkka Tengvall 2012-10-22 10:26:29 UTC
Created attachment 631387 [details]
File: type

Comment 2 Ilkka Tengvall 2012-10-22 10:26:31 UTC
Created attachment 631388 [details]
File: hashmarkername

Comment 3 Ilkka Tengvall 2012-10-22 10:29:46 UTC
and after allowing that, it continues to nag:


SELinux is preventing /usr/sbin/fping from using the net_raw capability.

Plugin: catchall 
you want to allow fping to have net_raw access on the capabilityIf you believe that fping should have the net_raw capability by default.
You should report this as a bug.
You can generate a local policy module to allow this access.
Allow this access for now by executing:
# grep fping /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Comment 4 Dominick Grift 2012-10-22 11:27:09 UTC
the cgi script needs to be able to run ping in the ping_t domain

Temporary fix:

mkdir mysmokep; cd mysmokep; echo "policy_module(mysmokep, 1.0.0) gen_require(\` type httpd_smokeping_cgi_script_t; ') netutils_domtrans_ping(httpd_smokeping_cgi_script_t)" > mysmokep.te

make -f /usr/share/selinux/devel/Makefile mysmokep.pp

semodule -i mysmokep.pp

Comment 5 Miroslav Grepl 2012-10-22 13:44:35 UTC
added.

commit 49bd3ad0a443459e3acd6ed451f49c724bd66eb0
Author: Miroslav Grepl <mgrepl>
Date:   Mon Oct 22 15:44:00 2012 +0200

    Allow smokeping to execute fping in the neutils domain

Comment 6 Ilkka Tengvall 2012-10-24 06:39:15 UTC
Just for the record, I had still this one to add after updgrading to selinux-policy-3.10.0-156.fc17.noarch. I hadn't applied your temporary fix, maybe it would've done the same effect.


module mypol.pp 1.0;

require {
	type bin_t;
	type httpd_smokeping_cgi_script_t;
	type smokeping_t;
	type httpd_t;
	class capability net_raw;
	class unix_stream_socket { shutdown ioctl getattr accept };
	class file { read execute open execute_no_trans };
	class rawip_socket create;
}

#============= httpd_smokeping_cgi_script_t ==============
allow httpd_smokeping_cgi_script_t httpd_t:unix_stream_socket { ioctl accept getattr shutdown };
#!!!! This avc is allowed in the current policy

allow httpd_smokeping_cgi_script_t self:capability net_raw;
#!!!! This avc is allowed in the current policy

allow httpd_smokeping_cgi_script_t self:rawip_socket create;

#============= smokeping_t ==============
#!!!! This avc is allowed in the current policy

Comment 7 Ilkka Tengvall 2012-10-24 06:48:29 UTC
Just for the record, there is another bug open about this #868893. SELinux doesn't produce any logs into audit.log any longer, but smokeping fcgi page works only if selinux is permissive. weird.

Comment 8 Miroslav Grepl 2012-10-24 09:22:27 UTC
Could you test it with

http://koji.fedoraproject.org/koji/buildinfo?buildID=361848

Comment 9 Ilkka Tengvall 2012-10-24 09:48:36 UTC
thanks, doesn't give errors anymore. But it didn't anymore even without it, I had applied manually the above rules. I can remove my additions if you tell me how :)

The weird thing is that the selinux makes smokeping web page fail, even though it doesn't log anything anymore into audit.log. If I set it to permissive, smokeping fcgi works fine.

Comment 10 Ilkka Tengvall 2012-10-24 09:49:43 UTC
I forgot to mention clearly: So I tried your package from Koji, that is.

Comment 11 Miroslav Grepl 2012-10-24 09:55:46 UTC
Please remove your local policy

# semodule -r mypol

Comment 12 Ilkka Tengvall 2012-10-24 10:05:56 UTC
thanks, I removed the policies using the file from my policy in comment #6.

SELinux won't nag any longer, but somehow it still prevents smokeping from working. setenforce 0 fixes smokeping fcgi.

Comment 13 Miroslav Grepl 2012-10-24 10:10:04 UTC
and are you getting AVC msgs?

# setenforce 1
# setneforce 0

re-test and execute

# ausearch -m avc,user_avc

Comment 14 Fedora Update System 2012-11-06 08:20:01 UTC
selinux-policy-3.10.0-159.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-159.fc17

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

Comment 16 Fedora Update System 2012-12-20 15:28:25 UTC
selinux-policy-3.10.0-159.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.


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