LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-14-2006, 09:02 AM   #1
phsythax
Member
 
Registered: Oct 2005
Location: Denmark
Distribution: Gentoo & XP pro for gaming
Posts: 152

Rep: Reputation: 30
iptables LOG consoles?


is it possible to configure Iptables to show (eks
A: all incomming connections
B: all ICMP traffic

.. in 2 different consoles? (aterms)
 
Old 06-14-2006, 10:43 AM   #2
phsythax
Member
 
Registered: Oct 2005
Location: Denmark
Distribution: Gentoo & XP pro for gaming
Posts: 152

Original Poster
Rep: Reputation: 30
...anyone?
 
Old 06-14-2006, 05:09 PM   #3
cachemonet
Member
 
Registered: Jan 2006
Distribution: Various versions of Red Hat Fedora Core and Ubuntu
Posts: 40

Rep: Reputation: 15
All incoming connections is shown with netstat. Try

netstat -n | grep -i established (pay attention to the 5th field or awk it with
netstat -n | grep -i established | awk '{print $5}'

use tethereal or tcpdump to watch for icmp traffic
 
Old 06-14-2006, 05:15 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Also, have you looked at iptstate from http://www.phildev.net/iptstate/. It provides a display similar to the top command for iptables connections.
 
Old 06-14-2006, 06:06 PM   #5
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 79
Quote:
Originally Posted by phsythax
is it possible to configure Iptables to show (eks
A: all incomming connections
B: all ICMP traffic

.. in 2 different consoles? (aterms)
I am not sure what you mean exactly. If what you want is a real-time picture of the connections currently held by your computer, suggestions have already been provided (netstat, among others).

If, however, you want to log all incoming connections (I assume you do not want to log all incoming traffic, as that would fill up your logs. You probably want only new connections initiated from outside (for services such as httpd)). For this, all you need is to modify your iptables rules. You might want to do this:

Code:
# filter table

iptables --new-chain ICMP
iptables --append ICMP --jump LOG --log-prefix "ICMP traffic traversing chains. "


#The beginning of your INPUT chain goes here

iptables --append INPUT --match state --state NEW --jump LOG --log-prefix "New incomming connection. "
iptables --append INPUT --protocol icmp --jump ICMP

#The ending of your INPUT chain goes here (includes all ACCEPTS)


#The beginning of your OUTPUT chain goes here

iptables --append OUTPUT --protocol icmp --jump ICMP

#The reest of your OUTPUT chain goes here (includes all ACCEPTS)
You can actually chose whether to put it before any ACCEPTs, DROPs, or REJECTs, in which case you log all attempted traffic. If you put it after the DROPs and REJECTs, only traffic that actually goes through will be logged. Remember NOT to put any accepts before the logging, otherwise it will never reach the LOG target.

The logging is done through the kernel, so your going to have to configure syslog.conf or equivalent if you want something special (HINT: the --log-level flag can narrow it down a little).


There is also a newer package released by the netfilter team called ULOG (userspace logging), which requires a daemon listening, using the netlink socket (which, btw is very fun to work with), and therefore much more flexible (you can log very specifically -- what files, what format, etc.).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleted /var/log/messages, can't log any files-iptables chingyenccy Linux - Newbie 7 02-27-2005 04:03 PM
iptables log don_wombat Linux - Software 1 01-25-2005 06:45 PM
IPtables log muru_enom Linux - Security 1 11-26-2003 09:31 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables, changing log file from /var/log/messages acid2000 Linux - Networking 3 03-11-2003 08:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration