Bug 497936 - SELinux prevents changes to iptables
SELinux prevents changes to iptables
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
10
i386 Linux
low Severity medium
: ---
: ---
Assigned To: Miroslav Grepl
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-27 19:57 EDT by Jerry Purvis
Modified: 2009-04-28 05:56 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-04-28 05:56:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jerry Purvis 2009-04-27 19:57:26 EDT
Description of problem:


Summary:

SELinux is preventing iptables-save (iptables_t) "write" to
/etc/sysconfig/iptables (etc_t).

Detailed Description:

SELinux is preventing iptables-save (iptables_t) "write" to
/etc/sysconfig/iptables (etc_t). The SELinux type etc_t, is a generic type for
all files in the directory and very few processes (SELinux Domains) are allowed
to write to this SELinux type. This type of denial usual indicates a mislabeled
file. By default a file created in a directory has the gets the context of the
parent directory, but SELinux policy has rules about the creation of
directories, that say if a process running in one SELinux Domain (D1) creates a
file in a directory with a particular SELinux File Context (F1) the file gets a
different File Context (F2). The policy usually allows the SELinux Domain (D1)
the ability to write, unlink, and append on (F2). But if for some reason a file
(/etc/sysconfig/iptables) was created with the wrong context, this domain will
be denied. The usual solution to this problem is to reset the file context on
the target file, restorecon -v '/etc/sysconfig/iptables'. If the file context
does not change from etc_t, then this is probably a bug in policy. Please file a
bug report (http://bugzilla.redhat.com/bugzilla/enter_bug.cgi) against the
selinux-policy package. If it does change, you can try your application again to
see if it works. The file context could have been mislabeled by editing the file
or moving the file from a different directory, if the file keeps getting
mislabeled, check the init scripts to see if they are doing something to
mislabel the file.

Allowing Access:

You can attempt to fix file context by executing restorecon -v
'/etc/sysconfig/iptables'

Fix Command:

restorecon '/etc/sysconfig/iptables'

Additional Information:

Source Context                unconfined_u:unconfined_r:iptables_t:s0-s0:c0.c102
                              3
Target Context                system_u:object_r:etc_t:s0
Target Objects                /etc/sysconfig/iptables [ file ]
Source                        iptables-save
Source Path                   /sbin/iptables-save
Port                          <Unknown>
Host                          Yerushalayim.Yisrael
Source RPM Packages           iptables-1.4.1.1-2.fc10
Target RPM Packages           
Policy RPM                    selinux-policy-3.5.13-55.fc10
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   mislabeled_file
Host Name                     Yerushalayim.Yisrael
Platform                      Linux Yerushalayim.Yisrael
                              2.6.27.21-170.2.56.fc10.i686 #1 SMP Mon Mar 23
                              23:37:54 EDT 2009 i686 i686
Alert Count                   2
First Seen                    Mon 27 Apr 2009 07:20:32 PM EDT
Last Seen                     Mon 27 Apr 2009 07:46:14 PM EDT
Local ID                      70a1e04d-1b6f-4132-81c9-d60d1600d884
Line Numbers                  

Raw Audit Messages            

node=Yerushalayim.Yisrael type=AVC msg=audit(1240875974.453:35): avc:  denied  { write } for  pid=3289 comm="iptables-save" path="/etc/sysconfig/iptables" dev=dm-6 ino=26474 scontext=unconfined_u:unconfined_r:iptables_t:s0-s0:c0.c1023 tcontext=system_u:object_r:etc_t:s0 tclass=file

node=Yerushalayim.Yisrael type=SYSCALL msg=audit(1240875974.453:35): arch=40000003 syscall=11 success=yes exit=0 a0=2310c90 a1=bf9594e8 a2=230c250 a3=cbbb00 items=0 ppid=3201 pid=3289 auid=500 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="iptables-save" exe="/sbin/iptables-save" subj=unconfined_u:unconfined_r:iptables_t:s0-s0:c0.c1023 key=(null)





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


How reproducible: 
run command "iptables-save > /etc/sysconfig/iptables" from root

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results: ability to change settings from iptables

Additional info:
Comment 1 Miroslav Grepl 2009-04-28 05:56:29 EDT
Please update selinux-policy and selinux-policy-targeted packages.

It should work.

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