Current time: 11-27-2024, 10:26 AM Hello There, Guest! (LoginRegister)


Post Reply 
script help please
Author Message
ChrisJones Offline
Newbie
*

Posts: 9
Joined: Nov 2009
Reputation: 0
Post: #3
RE: script help please
Thanks knut

below is the final script which i called postgreylog , added a cron job to run before syslog has been cleared. Not all systems have mail logging in syslog so customise as required.

Changed where the file is saved a little , might be interesting to get something like this into the users control panel so they can check to see if real mail is being blocked (my wife had 5 email addresses today).

had to change it just a little but overall it does it's job. Thanks for helping

to run script past into your most used editor
and save , then chmod +x it.
run to test.

sample output here
Code:
#!/bin/bash
#postgreylog v1
#This script outputs the blocked mail into a readable logfile for each domain
#Idea Chris Jones 2009
#script written by Knut on isp-control.net forums 2009
#script re-edited by Chris Jones 2009

# Folder gathers the list of domains
FOLDER="/var/mail/virtual/"

#log should be the file you want read by postgrey report
log="/var/log/syslog"

#output edit the output so non-readable on net or post into a protected folder
output="/var/www/virtual/"

#Main script
#I require the .:====== part to make it readable by me it also looks better
for domain in $(ls $FOLDER); do
  if test -d /var/www/virtual/$domain/htdocs; then
    echo "Report for Domain $domain"
    cat $log | grep $domain |postgreyreport --nosingle_line --check_sender=mx,a --show_tries --separate_by_subnet=.:===================================From====================​===============TO=======================:.MailServer-Sending-Mail\ > $output$domain/postgrey.log
  fi

done

Thanks
Chris Jones
(This post was last modified: 11-15-2009 02:57 PM by ChrisJones.)
11-15-2009 02:51 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
script help please - ChrisJones - 11-14-2009, 04:35 AM
RE: script help please - Knut - 11-14-2009, 03:53 PM
RE: script help please - ChrisJones - 11-15-2009 02:51 PM
RE: script help please - Knut - 11-15-2009, 03:27 PM
RE: script help please - ChrisJones - 11-16-2009, 09:59 PM
RE: script help please - Knut - 11-16-2009, 10:02 PM
RE: script help please - ChrisJones - 11-16-2009, 10:37 PM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)