Bug 740669

Summary: "service iptables save" command fails returning exit value 1
Product: Red Hat Enterprise Linux 6 Reporter: Jan Pokorný [poki] <jpokorny>
Component: policycoreutilsAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.2CC: dwalsh, gozen, mcepl, mmalik, psklenar
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: policycoreutils-2.0.83-19.16.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 15:31:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 739953    

Description Jan Pokorný [poki] 2011-09-22 21:34:14 UTC
Version-Release number of selected component (if applicable):
iptables-1.4.7-4.el6.x86_64 @ RHEL 6.2 beta

Steps to Reproduce:
# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[FAILED]
# echo $?
1

Notes:
Enforcing SELinux (selinux-policy-3.7.19-113.el6.noarch).

Comment 2 RHEL Program Management 2011-09-22 22:08:05 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 3 Jan Pokorný [poki] 2011-09-23 13:08:08 UTC
I have found out that the failure is caused by restorecon command in the block

> if [ $ret -eq 0 ]; then
>     mv -f $TMP_FILE $IPTABLES_DATA \
>         && chmod 600 $IPTABLES_DATA \
>         && restorecon $IPTABLES_DATA \
>         || ret=1
> fi

of save function.

If I do hard exit at this place echoing the necessary variables, run
"service iptables save" and run these 3 commands checking exit codes,
restorecon one will exit with 1.  Subsequently repeated restorecon
will succeed returning 0.

Therefore this bug may belong rather to policycoreutils[*].
I could not find any similar bug for this package.

[*]
# rpm -qf $(which restorecon)
policycoreutils-2.0.83-19.15.el6.x86_64

Comment 4 Daniel Walsh 2011-09-23 15:33:34 UTC
This is a bug in restorecon.  restorecon should only exit with non zero is something failed.  Changing the label on a file is not a failure.

Comment 5 Daniel Walsh 2011-09-23 15:50:58 UTC
Fixed in policycoreutils-2.0.83-19.16.el6

Comment 6 Daniel Walsh 2011-09-26 18:02:20 UTC
*** Bug 741371 has been marked as a duplicate of this bug. ***

Comment 7 Petr Sklenar 2011-09-27 10:21:52 UTC
*** Bug 741555 has been marked as a duplicate of this bug. ***

Comment 12 errata-xmlrpc 2011-12-06 15:31:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1637.html