Bug 20601 - /etc/init.d/ipchains save - results in zero byte config file
/etc/init.d/ipchains save - results in zero byte config file
Status: CLOSED WORKSFORME
Product: Red Hat Linux
Classification: Retired
Component: ipchains (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Nalin Dahyabhai
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-11-09 13:53 EST by Mark Zen
Modified: 2007-04-18 12:29 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-11-13 15:01:56 EST
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 Mark Zen 2000-11-09 13:53:07 EST
there is a small typo in the 7.0 distribution in
/etc/init.d/ipchains                 
the problem is in the save function:                         
                                                                                          
        /sbin/ipchains-save  > $IPCHAINS_CONFIG  2>/dev/null &&
\                         
                                                                                          
the "-v" was
missing:                                                                     
        /sbin/ipchains-save -v > $IPCHAINS_CONFIG  2>/dev/null &&
\                       
                                                                                          
resulting in a zero byte
file.                                                            
                                                                                          
thanks for your
time,                                                                     
                                                                                          
mark zen
Comment 1 Michael Schwendt 2000-11-12 13:55:45 EST
Erhm, could it be that you have no chains set up? Here, ipchains-save works
flawlessly. -v (print out every rule) prints out all rules to stderr besides
stdout.
Comment 2 Mark Zen 2000-11-13 08:22:05 EST
hopefully this documentation will help:

[root@mailcity chain]# ipchains -L              
Chain input (policy ACCEPT):
target     prot opt     source                destination           ports
ACCEPT     tcp  ------  charon.Sun.COM       mailcity.dotzen.org   any ->  
telnet
DENY       tcp  ----l-  anywhere             mailcity.dotzen.org   any ->  
tcpmux:1024
Chain forward (policy DENY):
target     prot opt     source                destination           ports
MASQ       all  ------  127.00.10.0/24       anywhere              n/a
Chain output (policy ACCEPT):
Chain acct (0 references):
[root@mailcity chain]# /etc/init.d/ipchains stop
Flushing all chains:                                       [  OK  ]
Removing user defined chains:                              [  OK  ]
Resetting built-in chains to the default ACCEPT policy:    [  OK  ]
[root@mailcity chain]# vi /etc/init.d/ipchains
[root@mailcity chain]# /etc/init.d/ipchains start
Flushing all current rules and user defined chains:        [  OK  ]
Clearing all current rules and user defined chains:        [  OK  ]
Applying ipchains firewall rules: Creating chain `acct'.
                                                           [  OK  ]
[root@mailcity chain]# ls -l /etc/sysconfig/ipchains
-rw-r--r--    1 root     root         1726 Nov  9 15:29 /etc/sysconfig/ipchains
[root@mailcity chain]# ipchains -L
Chain input (policy ACCEPT):
target     prot opt     source                destination           ports
ACCEPT     tcp  ------  charon.Sun.COM       mailcity.dotzen.org   any ->  
telnet
DENY       tcp  ----l-  anywhere             mailcity.dotzen.org   any ->  
tcpmux:1024
Chain forward (policy DENY):
target     prot opt     source                destination           ports
MASQ       all  ------  127.10.10.0/24       anywhere              n/a
Chain output (policy ACCEPT):
Chain acct (0 references):
[root@mailcity chain]# 
[root@mailcity chain]# ls -l /etc/sysconfig/ipchains
-rw-r--r--    1 root     root         1726 Nov  9 15:29 /etc/sysconfig/ipchains
[root@mailcity chain]# /etc/init.d/ipchains save 
Saving current rules to /etc/sysconfig/ipchains:           [  OK  ]
[root@mailcity chain]# ls -l /etc/sysconfig/ipchains
-rw-r--r--    1 root     root            0 Nov  9 15:37 /etc/sysconfig/ipchains
[root@mailcity chain]# ipchains -L
Chain input (policy ACCEPT):
target     prot opt     source                destination           ports
ACCEPT     tcp  ------  192.9.25.10          mailcity.dotzen.org   any ->  
telnet
^C

[root@mailcity chain]# /etc/init.d/ipchains stop 
Flushing all chains:                                       [  OK  ]
Removing user defined chains:                              [  OK  ]
Resetting built-in chains to the default ACCEPT policy:    [  OK  ]
[root@mailcity chain]# rm /etc/sysconfig/ipchains
rm: remove `/etc/sysconfig/ipchains'? y
[root@mailcity chain]# /etc/init.d/ipchains start
[root@mailcity chain]# ipchains -L
Chain input (policy ACCEPT):
Chain forward (policy ACCEPT):
Chain output (policy ACCEPT):
[root@mailcity chain]# ipchains -A forward -s 127.10.10.0/24 -j MASQ
[root@mailcity chain]# ipchains -L
Chain input (policy ACCEPT):
Chain forward (policy ACCEPT):
target     prot opt     source                destination           ports
MASQ       all  ------  127.10.10.0/24       anywhere              n/a
Chain output (policy ACCEPT):
[root@mailcity chain]# ls -l /etc/sysconfig/ipchains
ls: /etc/sysconfig/ipchains: No such file or directory
[root@mailcity chain]# /etc/init.d/ipchains save
Saving current rules to /etc/sysconfig/ipchains:           [  OK  ]
[root@mailcity chain]# ls -l /etc/sysconfig/ipchains
-rw-r--r--    1 root     root            0 Nov  9 15:43 /etc/sysconfig/ipchains
[root@mailcity chain]# rm !$
rm /etc/sysconfig/ipchains
rm: remove `/etc/sysconfig/ipchains'? y
[root@mailcity chain]# /etc/init.d/ipchains start
[root@mailcity chain]# ipchains -L
Chain input (policy ACCEPT):
Chain forward (policy ACCEPT):
Chain output (policy ACCEPT):
[root@mailcity chain]# ipchains -A forward -s 127.10.10.0/24 -j MASQ
[root@mailcity chain]# ipchains -L
Chain input (policy ACCEPT):
Chain forward (policy ACCEPT):
target     prot opt     source                destination           ports
MASQ       all  ------  127.10.10.0/24       anywhere              n/a
Chain output (policy ACCEPT):
[root@mailcity chain]# ls -l /etc/sysconfig/ipchains
ls: /etc/sysconfig/ipchains: No such file or directory
[root@mailcity chain]# /etc/init.d/ipchains save
Saving current rules to /etc/sysconfig/ipchains:           [  OK  ]
[root@mailcity chain]# ls -l /etc/sysconfig/ipchains
-rw-r--r--    1 root     root          112 Nov  9 15:45 /etc/sysconfig/ipchains

Comment 3 Michael Schwendt 2000-11-13 10:13:21 EST
> hopefully this documentation will help:

Well, '/etc/init.d/ipchains save' works fine at my end. I've even tested some of
your examples, but have never got an empty /etc/sysconfig/ipchains as result.
Raises the question whether you might be using a modified version of the
ipchains wrapper script.

# rpm -qf /etc/init.d/ipchains 
ipchains-1.3.9-17
# md5sum /etc/init.d/ipchains 
2b7f11ad7943ae8c606cc9e63ca7e226  /etc/init.d/ipchains

Just curious...
Comment 4 Mark Zen 2000-11-13 13:01:53 EST
[root@mailcity /root]# rpm -qf
/etc/init.d/ipchains                                                         
ipchains-1.3.9-17
Comment 5 Mark Zen 2000-11-13 13:03:48 EST
md5sum /etc/init.d/ipchains                           
85c16990ce34a91f857fc7deb3d4d29a  /etc/init.d/ipchains
Comment 6 Michael Schwendt 2000-11-13 15:01:54 EST
> # md5sum /etc/init.d/ipchains
> 85c16990ce34a91f857fc7deb3d4d29a  /etc/init.d/ipchains

Hmm, judging by the wrong fingerprint I take it this is your modified version of
the script? ;-)

$ rpm --verify ipchains

Btw, have you ever tried the "ipchains-save" command directly? I still don't see
why you think you need to add '-v'. But I think I leave this issue to the Red
Hat people now...
Comment 7 Bill Nottingham 2001-01-18 11:33:10 EST
This seems to work fine here.

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