Link to home
Start Free TrialLog in
Avatar of psimation
psimationFlag for South Africa

asked on

Can I have ps -aux report the user that is sending e-mail?

HI
When I do a ps -aux from time to time, I notice that the sendmail processes lists the address or IP the mail is coming from/going to, but I would really like to see the user that is sending/receiving as well, and if possible a clear indication of whether it is outgoing or incoming mail.

Only reason for this is so I can have a nice quick way of seeing what is going on at a given time, and hopefully it should be fairly easy to spot a spam session going out.

I think this information is available in the sendmail logs right? But I was just hoping one could "tweak" the output of sendmail processes to the ps a bit...
Avatar of ahoffmann
ahoffmann
Flag of Germany image

ps cannot do this (except you modify sendmail to do it).
Sendmail usually writes a log file, /var/log/mail, wher all the information you want will be logged.
Avatar of psimation

ASKER

Hi ahoffmann
I had a look at the /var/log/maillog file, but it doesn't show the local user affected. It simply shows :

Nov 19 12:44:58 chaos sendmail[8415]: gAJAisK08415: from=<qna@experts-exchange.com>, size=1684, class=0, nrcpts=1, msgid=<27832.1037701927839.JavaMail.root@www1.experts-exchange.com>, proto=ESMTP, daemon=MTA, relay=[206.169.61.187]
Nov 19 12:44:58 chaos sendmail[8418]: gAJAisK08415: to=<internet@linuxhelp.co.za>, delay=00:00:04, xdelay=00:00:00, mailer=cyrus, pri=31684, relay=localhost, dsn=2.0.0, stat=Sent
Nov 19 12:45:00 chaos sendmail[8416]: gAJAitK08416: from=<php-general-return-125051-internet=vsa.co.za@lists.php.net>, size=2823, class=-60, nrcpts=1, msgid=<20021119103204.89850.qmail@pb1.pair.com>, proto=SMTP, daemon=MTA, relay=pb1.pair.com [216.92.131.4]

and I'm not sure what it all means...
> and I'm not sure what it all means...
may I just repeat the first entry (partially):

    (send)mail  gAJAisK08415 from=...

and the second one:

    (send)mail  gAJAisK08415 to=... stat=sent

hmm, somthing which cannot be understood by simply reading ;-)

As you see, sendmail spawns 2 processes [pid 8415 and 8418] to handle mail: one for receiving, one for delivering. In the log they glue together by a uniqe ID: gAJAisK08415.
That's the reason why you cannot get the information with ps: 2 (or more) processes.
It's very "cramped", the whole point I'm trying to make is reporting the mail usage in a very simple way so you can scan it visually and quickly pickup "paterns" to detect spam being sent from the server.
Would this only be possible by processing the log file?
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CleanupPing
CleanupPing

psimation:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept comments from ahoffman as answer
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheWeakestLink
EE Cleanup Volunteer
Sorry, havn't received any mail bar the last one about this question.

Will award to ahoffmann