Posts Tagged ‘linux’

Pop Before SMTP & Postfix

March 6, 2009

Though POP Before SMTP is not a secured way, but it is an easiest way to configure mail server to allow roaming user to use the mailserver  as SMTP gateway. Before configuring POP Before SMTP make sure that your Mail Server & POP3/IMAP sever working properly. Following Perl Module are required for the POP Before SMTP :

Time:: HiRes
File:: Tail
Date:: Parse
Net:: Netmask
BerkeleyDB

Download the POP Before SMTP perl files from http://popbsmtp.sourceforge.net/. Untar the files & copy them to the following locaiton

% cp pop-before-smtp.init /etc/rc.d/init.d/pop-before-smtp
% cp pop-before-smtp /usr/sbin/
% cp pop-before-smtp-conf.pl /etc

Edit the pop-before-smtp-conf.pl file to customize it for your system.

$ logto = ‘/ var / log / pop-before-smtp’;
$ dbfile = ‘/ etc / postfix / pop-before-smtp’;
$ grace = 10 * 60; # the time to log 10 minutes and $ file_tail ( ‘name’) = ‘/ var / log / dovecot’;

Uncomment the following lines which you will get after “# For Dovecot POP3/IMAP when it does its own logging.”

$pat = ‘^dovecot: [LOGTIME] Info: (?:imap|pop3)-login: ‘ .
‘Login: .+? rip=[:f]*(\d+\.\d+\.\d+\.\d+),’;
$out_pat = ‘^dovecot: [LOGTIME] Info: (?:imap|pop3)-login: ‘ .
‘Disconnected.*? rip=[:f]*(\d+\.\d+\.\d+\.\d+),’;

Next comment the following two lines :

= cut #====================== Postfix BerkeleyDB ======================= START =
= cut #====================== Postfix BerkeleyDB ======================= == END =

Now edit /etc/dovecot.conf file :

protocols = imap imaps pop3 pop3s
imap_listen = *
pop3_listen = *
log_path = / var / log / dovecot
info_log_path = / var / log / dovecot
log_timestamp = “% b% d% H:% M:% S”

Finally make the following changes to the /etc/postfix/main.cf file

smtpd_recipient_restrictions = permit_mynetworks,reject_non_fqdn_recipient, check_client_access hash:/etc/postfix/pop-before-smtp, reject_unauth_destination

% touch /etc/postfix/pop-before-smtp
% postmap /etc/postfix/pop-before-smtp
% /etc/init.d/pop-before-smtp start
% /etc/init.d/postfix reload

Now configure you outlook/eudora. Do POP before sending any mail. You will get the logged IP in /var/log/pop-before-smtp file.

If you’re having trouble getting pop-before-smtp to work; you will get more in http://popbsmtp.sourceforge.net/debug.shtml

Empty Mail Trash Folder

February 23, 2009

User always forget to empty there trash folder. User delete mail from there inbox; but don’t delete those mail from Trash folder. At the end, it eats up a lot of your server disk space. Empty this Trash folder is big headache for the administrator. Shell script can easily rescue the administrator. First create a list for you user. You can create it easily from awk commad. Save it in a file named user. Now create a new bassh file named trash_empty.sh and chown it to 755. Add the following syntex to the trash_empty.sh file

#!/bin/sh
for i in `more user`
do
echo $i
cat /dev/null > $i/mail/Trash
done

[user Trash folder in /home/username/mail/Trash. It may varies depending on your mail server configuration. ]

Now run the file trash_empty.sh WOW all your users Trash folder will be empty :-)

Please take your own responsibility to empty users trash folder :-)

Monitor Antispam & Antivirus gateway

January 5, 2007

In my last post I have shown how to create an antispam & antivirus gateway. This give me spam and virus free emails. But how much this is efficient!! I have looked through the internet and find two very good software. These are Vispan and MailWatch. Both of them are web based.

Vispan show yearly, monthly, daily, hourly updates with fine graphs and detailed statistics. Using this mail gateway I was able to filter 90%-95% spam. It’s amaizing!!

MailWatch is also webbased and with lots of features. Vispan only give us the statistical output and reports. In MailWatch we can also change the configuration of MailScanner along with mailllog, quarantine maillist and lots of reports.

These tools don’t have any effect on spam filter. But it’s very nice to find out how efficient the Antispam & Antivirus gateway is.

This is a vispan report from my antispam & antivirus gateways server:

Vispan report

Antivirus and antispam free mail server using Postfix, Mailscanner, Clamav, Spamassassin and Greylisting

November 9, 2006

SPAM or Unsolicited Commercial Email (UCE) is alwasy hated by everybody. It is nightmare for all the system administrator. There are lot of talkings and solutions regarding SPAM. I have collect some of this useful inforamtion and implement. These work miracle in my case. I have wirte this tutorial (basically collect!) to help you out.

In this tutorial we will use Postfix as MTA. We will integrate MailScanner and Clamav for Antivirus solution and SpamAssassin and GreyListing for Antispam solution.
1. Postfix
2. Mailscanner
2. Clamav
4. SpamAssassin
5. GreyListing

For details click here.