Linux Netfilter discussions
 help / color / mirror / Atom feed
* log EVERYTHING
@ 2003-03-26  6:05 Dan Egli
  2003-03-26  8:10 ` Rob Sterenborg
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Egli @ 2003-03-26  6:05 UTC (permalink / raw)
  To: netfilter

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I was wondering if there was a way I could setup my rules to log
EVERYTHING, THEN process normally. I.e. if it's an allowed port, log the
connection, then pass it through, and if it is a disallowed port, log
the intrusion and then reject the packet.

Is this possible?

Thanks!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+gUNExQEzeXtVwzoRAgUqAJ9U48nvbRqC7++B4HlY2YhhAn0QygCfcK3E
7zS4cnq63yJTxgNfTRFMc+g=
=dntV
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: log EVERYTHING
  2003-03-26  6:05 log EVERYTHING Dan Egli
@ 2003-03-26  8:10 ` Rob Sterenborg
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Sterenborg @ 2003-03-26  8:10 UTC (permalink / raw)
  To: 'Dan Egli', netfilter

> I was wondering if there was a way I could setup my rules to 
> log EVERYTHING, THEN process normally. I.e. if it's an 
> allowed port, log the connection, then pass it through, and 
> if it is a disallowed port, log the intrusion and then reject 
> the packet.
> 
> Is this possible?

Sure.


iptables -P INPUT DROP
iptables -A INPUT -i <inet_if> -p tcp --dport 22 -j LOG --log-level info
--log-prefix "ipt:ssh "
iptables -A INPUT -i <inet_if> -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -i <inet_if> -p tcp --dport 80 -j LOG --log-level info
--log-prefix "ipt:http "
iptables -A INPUT -i <inet_if> -p tcp --dport 80 -j ACCEPT

<...More rules like these...>

iptables -A INPUT -i <inet_if> -j LOG --log-level info --log-prefix
"ipt:DROP! "


This will log all packets allowed and then accept them. If There's no
match for a packet it gets logged as "ipt:DROP!" and then will be
dropped (not rejected) by the default policy.

You can also reject the packet by using the following line as the last
rule :
iptables -A INPUT -i <inet_if> -j REJECT [--reject-with <some-type>]
In this case you don't really need the default policy, as no packet will
reach it.


Rob



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-26  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-26  6:05 log EVERYTHING Dan Egli
2003-03-26  8:10 ` Rob Sterenborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox