All of lore.kernel.org
 help / color / mirror / Atom feed
* Logging Portscans
@ 2002-10-21  9:39 Tasha Smith
  2002-10-21  9:52 ` netfilter
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tasha Smith @ 2002-10-21  9:39 UTC (permalink / raw)
  To: netfilter

Hii,
I was wandering why iptables is NOT logging to my /var/log/messages/ NMAPS
stealth port scans or when i telnet any port?.  Here are what the first part of
my rules look like. How can u add some rules soo i can see (LOG) all ports scans
or connection attemps on my machine????
iptables 1.2.7
kernel 2.4.19

iptables --flush
iptables -t nat --flush
iptables -t mangle --flush

iptables -A INPUT -i lo -j ACEPT
iptables -A OUTPUT -o lo -j ACCEPT

# I tryed to put in a logging rule here and it didnt log the port scan!
iptables -A INPUT -i eth0 -p tcp \
         --dport 111 -j LOG-prefix "DROP sunrpc: "

iptables --policy INPUT DROP
iptables --policy FORWARD DROP
iptables --policy OUTPUT ACCEPT

# I tryed a LOG Policy here too like this!
iptables -i INPUT -p tcp -j LOG --log-prefix "log-tcp-test: "

iptables -A INPUT -m state --state ESTABLSIHED,RELATED -j ACCEPT
iptables -A FOWARD -m state --state ESTABLSIHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLSIHED,RELATED -j ACCEPT

And then after this i have all stuff that is allowed on my machine like DNS,
DHCP, and my forwarding rules! 
 

__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/


^ permalink raw reply	[flat|nested] 7+ messages in thread
* RE: Logging Portscans
@ 2002-10-21 10:15 Ferry van Steen
  0 siblings, 0 replies; 7+ messages in thread
From: Ferry van Steen @ 2002-10-21 10:15 UTC (permalink / raw)
  To: Tasha Smith; +Cc: netfilter

You supplied insufficient information :-)
/var/log/messages doesn't necessarily catch/log all messages send to
syslogd/klogd this depends on the configuration in your /etc/syslog.conf

Try this

add this line to /etc/syslog.conf
*.*			/var/log/allmessages

then
killall -1 syslogd
killall -1 klogd

Hmm that is for linux

maybe
killall -HUP syslogd
and
killall -HUP klogd
would be safer.

Anyways, make sure they're still running after that killall command it
should only make it reread the config.
ps -Af | grep log
to see

then you should get the lines in
/var/log/allmessages file
please note this file can grow quite quickly
do
man syslog.conf
for more info


> -----Oorspronkelijk bericht-----
> Van: Tasha Smith [mailto:natasha3641@yahoo.com] 
> Verzonden: maandag 21 oktober 2002 11:39
> Aan: netfilter@lists.netfilter.org
> Onderwerp: Logging Portscans
> 
> 
> Hii,
> I was wandering why iptables is NOT logging to my 
> /var/log/messages/ NMAPS stealth port scans or when i telnet 
> any port?.  Here are what the first part of my rules look 
> like. How can u add some rules soo i can see (LOG) all ports 
> scans or connection attemps on my machine???? iptables 1.2.7 
> kernel 2.4.19
> 
> iptables --flush
> iptables -t nat --flush
> iptables -t mangle --flush
> 
> iptables -A INPUT -i lo -j ACEPT
> iptables -A OUTPUT -o lo -j ACCEPT
> 
> # I tryed to put in a logging rule here and it didnt log the 
> port scan! iptables -A INPUT -i eth0 -p tcp \
>          --dport 111 -j LOG-prefix "DROP sunrpc: "
> 
> iptables --policy INPUT DROP
> iptables --policy FORWARD DROP
> iptables --policy OUTPUT ACCEPT
> 
> # I tryed a LOG Policy here too like this!
> iptables -i INPUT -p tcp -j LOG --log-prefix "log-tcp-test: "
> 
> iptables -A INPUT -m state --state ESTABLSIHED,RELATED -j 
> ACCEPT iptables -A FOWARD -m state --state 
> ESTABLSIHED,RELATED -j ACCEPT iptables -A OUTPUT -m state 
> --state ESTABLSIHED,RELATED -j ACCEPT
> 
> And then after this i have all stuff that is allowed on my 
> machine like DNS, DHCP, and my forwarding rules! 
>  
> 
> __________________________________________________
> Do you Yahoo!?
> Y! Web Hosting - Let the expert host your web site 
http://webhosting.yahoo.com/




^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Logging Portscans
@ 2002-10-21 23:33 Tasha Smith
  2002-10-22 10:14 ` Antony Stone
  0 siblings, 1 reply; 7+ messages in thread
From: Tasha Smith @ 2002-10-21 23:33 UTC (permalink / raw)
  To: netfilter

you mean you never get any logs at all, or you get log entries on the screen 
but not in a file, or you get logs sometimes, but not when you're doing a 
particular type of scan ?

--->I am scanning my firewall machine from a machine on a "different network".

--->And when the scan is finished i  check the log file of my firewall machine
and there are no reports of a scan to any port. My log file being
"/var/log/messages"

--->Here is what the nmap scan i used   "namp -sS -sT -P0 -v 152.22.xx.xx"
    

> I even added this to my syslog.conf file......
>
>  kern.warn                            /var/log/fwlog

Does this successfully log anything at all ?  I mean, if you insert a rule 
right at the start of your INPUT chain:
iptables -I INPUT -j LOG --log-prefix "fwlog: "

Does anything go into /var/log/fwlog ?
---> Yes, somehting does go into the "/var/log/fwlog" file. (All kernel messages
goes into this file like:
OCT 21 01:4443 HOSTNAME   kernel : Linux version 2.4.19
(root@hostname.bc.hisa.telus.net) gcc version 2.96)
OCT 21 01:4443 HOSTNAME   kernel Mount-cache has tables entyries: 1024 (order:
1, 8192 bytes
OCT 21 01:4443 HOSTNAME   kernel : Buffer-cache hash tables entries:4096
(order:2, 16384
And and someother kernel messages 

(I would expect you to have to add the option "--log-level=warn" to match the 
entry in your syslog.conf file.)

>  How can i get this machine to log STEALTH port scans and stuff???

Explain what you mean by a Stealth port scan ?   If yu;re using nmap, what 
options are you using ?

---> Here what options im using "namp -sS -sT -P0 -v 152.22.xx.xx"

> iptables           --flush
> iptables -t -nat   --flush
> iptables -t mangle --flush
>
> iptables -A INPUT  -i lo -j ACCEPT
> iptables -A OUTPUT -o lo -j ACCEPT
>
> iptables --policy INPUT DROP
> iptables --policy FORWARD DROP
> iptables --policy OUTPUT ACCEPT
--->#when this line is added to my script:
  iptables -I INPUT -j LOG --log-prefix "fwlog: "
># When this line is added to my script and i run the nmap scan from a computer
with an ip address of 152.22.xx.xxx  the only things that get log in the fwlog
file are:
OCT 21 01:4453 HOSTNAME   kernel : fwlog: IN eth1 OUT= MAC=
ff:ff:ff:ff:00:43:xx:xx:xx src=192.168.0.11 DST=192.168.0.255 LEN=78 TOS=0x00
PREC=0x00 TTL=128 ID 63894 PROTO=UDP SPT=137 DPT=137 LEN=58
---> But nothing from the computers ip addressd that i did the port scan with
only tarffic that is getting logged is my machine behind the firewall and the
firewall machines eth1.

 
  iptables -A INPUT      -p tcp --tcp-flags ALL NONE -j DROP
> iptables -A FORWARD    -p tcp --tcp-flags ALL NONE -j DROP

> iptables -A INPUT    -m state --state ESTABLISHED,RELATED -j ACCEPT
> iptables -A OUTPUT   -m state --state ESTABLISHED,RELATED -j ACCEPT
> iptables -A FOWWARD  -m state --state ESTABLISHED,RELATED -j ACCEPT
>
> iptables -A INPUT -i eth0 -p udp \
>          -s ISP.DHCP  --sport 67 \
>          --dport 68 -j ACCEPT
> iptables -A OUTPUT -o eth0 -p udp \
>          -s eth0 --sport 68 \
>          -d ISP.DHCP --dport 67 -j ACCEPT
>
> iptables -A FORWARD -i eth1 -o eth0 -s 192.168.0.0/24 -j ACCEPT
>
> iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
>
> iptables -A INPUT -i eth0 -p tcp \
>          --dport 22,25,111,1024,1025 -j LOG --log-prefix "Log-test: "

Okay, so this LOGging rule is last in your INPUT chain, just before the 
default DROP policy.

I assume you are scanning the Firewall address itself ?
--->Yes...im scanning the firewall computers ip addrsss,  152.22.xx.xx and im
not scanning  from a machine behind the firewall.Its a machine on a different
network!

By the way, what result do you get from the scan ?   Does it suggest you have 
closed ports, open ones, nothing accessible, what ?
---> The relsut i get is: All 1601 scanned ports on "firewall machine" are
filtered."

What happens if you simply ssh to the Firewall, or telnet to port 25 ?   Do 
you see a log entry then ?
--->No, i dont!
--->The script is exactly what it look like now when i did the scan!


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/


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

end of thread, other threads:[~2002-10-22 10:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-21  9:39 Logging Portscans Tasha Smith
2002-10-21  9:52 ` netfilter
2002-10-21 11:18 ` Nick Drage
2002-10-21 11:27 ` Antony Stone
  -- strict thread matches above, loose matches on Subject: below --
2002-10-21 10:15 Ferry van Steen
2002-10-21 23:33 Tasha Smith
2002-10-22 10:14 ` Antony Stone

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.