Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Jason Opperisano <opie@817west.com>
To: netfilter@lists.netfilter.org
Subject: Re: why incoming packet's device not logging?
Date: Sat, 21 May 2005 17:32:58 -0400	[thread overview]
Message-ID: <20050521213258.GA2017@bender.817west.com> (raw)
In-Reply-To: <20050521070446.49238.qmail@web33015.mail.mud.yahoo.com>

On Sat, May 21, 2005 at 12:04:46AM -0700, cranium2003 wrote:
> hello,
>     I added 3 rules to iptables as
> iptables -A INPUT -j LOG

-A appends the rule to the end of the chain...let's see if that matters.

> iptables -A OUTPUT -j LOG
> iptables -A FORWARD -j LOG
>  But i am getting log of forward and output chain
> correctly but why when packet comes its incoming
> device is not logged. My IPTABLES is
> 
> # Generated by iptables-save v1.2.7a on Sat May 21
> 12:34:30 2005
> *nat
> :PREROUTING ACCEPT [123:21369]
> :POSTROUTING ACCEPT [6:360]
> :OUTPUT ACCEPT [6:360]
> -A POSTROUTING -o eth0 -p icmp -j SNAT --to-source
> 10.1.1.1
> COMMIT
> # Completed on Sat May 21 12:34:30 2005
> # Generated by iptables-save v1.2.7a on Sat May 21
> 12:34:30 2005
> *filter
> :INPUT ACCEPT [0:0]
> :FORWARD ACCEPT [0:0]
> :OUTPUT ACCEPT [54:8496]
> :RH-Lokkit-0-50-INPUT - [0:0]
> -A INPUT -j RH-Lokkit-0-50-INPUT 

so the first rule in INPUT, is to jump to the RH-Lokkit-0-50-INPUT
chain.

> -A INPUT -j LOG 

and the second rule is to LOG.  so let's skip down and see what
RH-Lokkit-0-50-INPUT does...

> -A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 25
> --tcp-flags SYN,RST,ACK SYN -j ACCEPT 
> -A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 80
> --tcp-flags SYN,RST,ACK SYN -j ACCEPT 
> -A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 21
> --tcp-flags SYN,RST,ACK SYN -j ACCEPT 
> -A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 22
> --tcp-flags SYN,RST,ACK SYN -j ACCEPT 
> -A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 23
> --tcp-flags SYN,RST,ACK SYN -j ACCEPT 
> -A RH-Lokkit-0-50-INPUT -i eth0 -p udp -m udp --sport
> 67:68 --dport 67:68 -j ACCEPT 
> -A RH-Lokkit-0-50-INPUT -i eth1 -p udp -m udp --sport
> 67:68 --dport 67:68 -j ACCEPT 

so we ACCEPT SMTP, HTTP, FTP, SSH, TELNET, and DHCP traffic--so none of
that will ever make it to your LOG rule.

> -A RH-Lokkit-0-50-INPUT -i lo -j ACCEPT 
> -A RH-Lokkit-0-50-INPUT -i eth0 -j ACCEPT 
> -A RH-Lokkit-0-50-INPUT -i eth1 -j ACCEPT 

and now we've unconditionally ACCEPTed all traffic arriving in on lo,
eth0, and eth1.  if those are all the interfaces you have, then there's
no traffic left that will traverse any further rules.

<--snip-->

if you're looking to create you own firewall script from scratch, do
just that--start from scratch:

  #!/bin/bash
  # delete all rules and user-defined chains
  for t in mangle nat filter; do
    iptables -t $t -F
    iptables -t $t -X
    iptables -t $t -Z
  done

  # set all policies to ACCEPT
  for c in PREROUTING POSTROUTING OUTPUT; do
    for t in mangle nat; do
      iptables -t $t -P $c ACCEPT
    done
  done

  for c in INPUT FORWARD OUTPUT; do
    for t in mangle filter; do
      iptables -t $t -P $c ACCEPT
    done
  done

alternatively, you could type "service iptables stop" which basically
does the above...but what's the fun in that?

after everything is cleared out--then you can start adding your own
rules.

-j

--
"Peter: This party couldn't be better if Jesus was here.
 Jesus: For my next miracle, I will turn water... into FUNK."
        --Family Guy


  parent reply	other threads:[~2005-05-21 21:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-21  7:04 why incoming packet's device not logging? cranium2003
2005-05-21 10:07 ` Jonas Berlin
2005-05-21 21:32 ` Jason Opperisano [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-05-21 13:22 cranium2003

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050521213258.GA2017@bender.817west.com \
    --to=opie@817west.com \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox