[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Default Policy = DROP. Help-me

--On Donnerstag, Oktober 25, 2007 14:10:43 +0200 Ansgar -59cobalt- Wiechers <lists@planetcobalt.net> wrote:
On 2007-10-24 Paolo wrote:
$iptables -t mangle -P OUTPUT ACCEPT &&\
$iptables -t mangle -P INPUT ACCEPT &&\
$iptables -t mangle -P POSTROUTING ACCEPT &&\
echo "Policing .......................................... [ OK ]" || {
  echo "Something broke in 'Policing'!"
  exit 1

You don't want to do that, because the term in curled braces is executed
when *any* of the previous commands fails (including the echo).

This is a Debian list. Debian uses bash as /bin/sh. Bash has echo as an builtin which always returns exit status 0, so it never fails.

Also, when a script is not even able to output its diagnostics, I would consider this as a failure too (guarding against failure of echo would be nice when enabling/disabling IP forwarding ...). On the other hand, echoing error messages when a previous echo failed is, ahemm, not very productive, at least writing the error messages to syslog via logger (at level "err" or higher) would IMHO be advisable.

Ralf Döblitz

Reply to: