LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-27-2010, 08:21 AM   #1
chicken76
Member
 
Registered: Mar 2009
Distribution: Slackware
Posts: 121

Rep: Reputation: 2
How to dump the headers of SMTP connections going through a linux router


I have the following problem: I'm seeing some spam emails being passed through my qmail server. The connections come from an IP address of a linux router masquerading several computers running on a private address space.
I need to identify the private ip of the computer that is sending spam.
My qmail server only shows the public ip that is used for the connection, and blocking it is not possible, as there are legitimate users sending emails from behind that public ip. Using smtp authentication would also not solve the problem completely, as the offender may easily 'borrow' some colleague's password.

The only simple solution that comes to mind would be to dump the headers of every smtp connection on that linux router and analyze them to find the originating ip. Does anyone master iptables enough to help me with the necessary code?

Also, do you see any other method of doing this?
 
Old 07-27-2010, 04:17 PM   #2
lxf
LQ Newbie
 
Registered: Jul 2010
Posts: 22

Rep: Reputation: 2
iptables is a (stateful) packet filter and therefore not able to trace and decode L7 protocols. You should take a look on l7filter if you want to trace SMTP traffic in firewall.

A more simple solution would include the usage of a packet capturer on your incoming interface (e.g. with tcpdump, wireshark/tshark or similar). Capture your SMTP traffic to a file, say with tcpdump, and analyze it afterwards:

Code:
# tcpdump -i ethX -s 0 -w dump.pcap 'port smtp'
This may (or may not) solve your problem. It's up to the relaying SMTP server whether or not it is presenting you source IPs. It is very likely that your MTA is not displaying source IPs because they aren't there.

Last edited by lxf; 07-27-2010 at 04:25 PM.
 
  


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
Puppy Linux: problems with dial-up and router connections on XP PC Peter Rosier Puppy 8 07-22-2008 09:49 AM
linux router keeps dropping connections. exodist Linux - Networking 1 04-24-2008 11:29 PM
2 networks and 2 internet connections on linux router seer_tenedos Linux - Networking 6 03-27-2005 07:24 AM
SMTP headers overlord73 Linux - Security 4 03-22-2005 04:10 PM
Linux Router /w 2 DSL Connections adamantium Linux - Networking 1 01-14-2004 01:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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