LinuxQuestions.org
Visit Jeremy's Blog.
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 05-03-2006, 02:13 PM   #1
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Rep: Reputation: 30
Red face Ulogdrop


What module should i modprobe in an iptables'script for target LOGDROP and if there is , also an ULOGDROP cause i use ULOGD and relative options , thankssssssssss !!!!

Last edited by gabsik; 05-03-2006 at 02:15 PM.
 
Old 05-04-2006, 08:11 PM   #2
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
I don't believe there are modules specifically for LOGDROP or ULOGDROP targets. Rather, they are user-defined chains that simply combine the LOG and DROP or ULOG and DROP targets. Like this:

Code:
iptables -N LOGDROP
iptables -A LOGDROP -j LOG
iptables -A LOGDROP -j DROP
iptables <whatever> -j LOGDROP
To use the ULOG target you will need the ULOG module.
 
Old 05-05-2006, 07:06 PM   #3
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
I'm actually using ULOG and i use it in iptables , would have been handy an ulogdrop jump but a chain it's not going to work the same way ... !!!!
 
Old 05-05-2006, 07:58 PM   #4
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Sure it will. Create the user-defined chain named ULOGDROP and then add ULOG and DROP targets to it. Then just use ULOGDROP like it's a normal target. EG:

iptables -N ULOGDROP
iptables -A ULOGDROP -j ULOG
iptables -A ULOGDROP -j DROP
iptables -A INPUT <match some packets> -j ULOGDROP

If that doesn't work for you, maybe you should explain what you are trying to accomplish.
 
Old 05-05-2006, 10:45 PM   #5
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
Creating chains it's the only obscure point in creation of iptables rules i have sure because i don't know the potential of it.what you have just showed me opened landscapes to me ...............
 
Old 05-05-2006, 10:52 PM   #6
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
I need to log and drop all connections to ports not related to services i have allowed . If i put the above chain at the end of the input chain would i log and drop connections to not accepted ports from 1 to 65535 , i don't want to risk to drop allowed connections as www, mail ecc.
Do you see what i mean ?

Last edited by gabsik; 05-05-2006 at 10:55 PM.
 
Old 05-06-2006, 07:29 AM   #7
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
In that case it would log and drop anything that reaches the end of the INPUT chain. So make sure to allow the ports that you want, before reaching the end of the chain. For example:

iptables -N ULOGDROP
iptables -A ULOGDROP -j ULOG
iptables -A ULOGDROP -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -j LOGDROP

So in essence, it is similar to if you had your default INPUT policy set to "LOGDROP". You can also send certain packets to LOGDROP instead, like this (say we only wanted to log and drop packets that came to one port (1433 for example):

iptables -N ULOGDROP
iptables -A ULOGDROP -j ULOG
iptables -A ULOGDROP -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp --dport 1433 -j LOGDROP
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 25 -j ACCEPT

Hope that helps
 
  


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



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

All times are GMT -5. The time now is 05:44 AM.

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