LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 10-27-2011, 08:16 AM   #1
piotr.pawlowski
LQ Newbie
 
Registered: Oct 2011
Posts: 5

Rep: Reputation: Disabled
Problems with logging outgoing SMTP connections


Dear all,

I would like to consult with you some iptables rule, which, in my opinion was sufficient for my needs, but it looks like I am making somewhere a mistake.

So I would like to log every outgoing SMTP connection from my server. What is more, I would like to log only those connections, which exceed 40 per minute limit. That is why I put following two lines into my iptables:

Code:
/sbin/iptables -I OUTPUT -p tcp --dport 25 -m state --state NEW -m recent --set
/sbin/iptables -I OUTPUT -p tcp --dport 25 -m state --state NEW -m recent --update --seconds 60 --hitcount 40 -j LOG --log-prefix "Out. SMTP con LIMIT: " --log-level 4
Unfortunately it doesn't work as I expected. I am testing it by performing following for loop from my server:

Code:
for i in {1..200} ; do echo "QUIT" | nc mailserver 25 ; done
Whole loop is finishing in around 30 seconds, so, in my opinion, there is more than 40 new outgoing SMTP connections from my server. Unfortunately, nothing is printed in log file.
BTW, I've changed syslog configuration file, so kern.warning logs are going to separate log file, so this is not an issue here.

Where I am making a mistake?
Thank you in advance for any constructive tip.

Regards
Piotr
 
Old 10-27-2011, 11:41 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
"--set" goes after "--update", see http://www.snowman.net/projects/ipt_recent/.
 
Old 10-27-2011, 01:42 PM   #3
piotr.pawlowski
LQ Newbie
 
Registered: Oct 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
Well, I've changed rules order and it still doesn't work. However, I've decreased hitcountvalue to 5 and it started to work correctly... I'm confused... hitcount=5 is not what I want to log...
 
  


Reply



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
iptables and outgoing connections Dutchy_ Linux - Security 8 10-30-2009 01:48 PM
Setting the source port for outgoing SMTP connections in exim4 heby Debian 7 11-04-2008 01:08 PM
SMTP Outgoing Routing kngspook Linux - Software 3 04-14-2008 10:10 PM
firewall outgoing connections hotrodowner Linux - Security 2 02-22-2004 12:51 PM
outgoing connections DonMiner Linux - Networking 2 05-02-2003 09:51 AM

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

All times are GMT -5. The time now is 06:23 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