postfix with bitdefender-scanner
In this post i'll describe to you, how to scan emails using postfix and BitDefender-scanner.
This will help you scan and clean all incoming email traffic to your server for viruses.
Nevertheless, this sollution is not a fast one(and it will scan only the incoming mail), because for each and every mail, the procmail filter will send the eml to the bitdefender-scanner.
In order to increase speed, i recommand to use BitDefender for mail servers
, and integrate it with postfix or other favorite mta.
Bitdefender-scanner it is very easy to install.The package will cam as, rpm, deb and tar.
Just type in your console sh -x BitDefender-scanner.rpm/deb/tar.run and follow the install procedure.
After the install, I recommend to update your scanner.To do this, go to /opt/BitDefender-scanner/bin, and type ./bdscan --update
If you LDA in postfix is procmail, then you don't need to make any modifications to your main.cf file.If not just add this line in /etc/postfix/main.cf
mailbox_command = /usr/bin/procmail -a "$EXTENSION"
In order to delivery emails in ~/Maildir add this line in main.cf
home_mailbox = Maildir/
After this, restart postfix server.
In your home directory, edit .procmailrc file (if is not there, echo > .procmailrc).Offcourse you can enable procmailrc system wide (write this file in /etc)
Add the following lines in .procmailrc
$ cat .procmailrc
PATH=/usr/local/bin:/usr/bin:/bin
MAILDIR=$HOME/Maildir/
DEFAULT=$MAILDIR
LOGFILE=$MAILDIR/procmail.log
FILE=`mktemp`
:0 fw
|cat > $FILE; if bdscan $FILE &>/dev/null; then formail -a "X-BDScan:
clean" <$FILE; else formail -a "X-BDScan: infected" <$FILE; fi; rm -f $FILE
Offcourse, you must modify MAILDIR variable and bdscan must be in your path.
This will add in your email, a header that contain X-BDScan:infected/clean acording to the bdscan result.
If you want the infected mail to be deleted just add in .procmailrc the following line
:0
* ^X-BDScan: infected
/dev/null
Or else, if you want to move infected files to an local directory add in .procmailrc
:0
* ^X-BDScan: infected
Maildir/infected
If your postfix server is using another LDA, but it is using .forward files, a sollutins per user, not system wide is to add a .forward file in your home dir just like this
$ cat .forward
|/usr/bin/procmail
Well, this is it :)
Enjoy a free virus email.
Thanks to the BitDefender team for making this possible
This will help you scan and clean all incoming email traffic to your server for viruses.
Nevertheless, this sollution is not a fast one(and it will scan only the incoming mail), because for each and every mail, the procmail filter will send the eml to the bitdefender-scanner.
In order to increase speed, i recommand to use BitDefender for mail servers
, and integrate it with postfix or other favorite mta.
Bitdefender-scanner it is very easy to install.The package will cam as, rpm, deb and tar.
Just type in your console sh -x BitDefender-scanner.rpm/deb/tar.run and follow the install procedure.
After the install, I recommend to update your scanner.To do this, go to /opt/BitDefender-scanner/bin, and type ./bdscan --update
If you LDA in postfix is procmail, then you don't need to make any modifications to your main.cf file.If not just add this line in /etc/postfix/main.cf
mailbox_command = /usr/bin/procmail -a "$EXTENSION"
In order to delivery emails in ~/Maildir add this line in main.cf
home_mailbox = Maildir/
After this, restart postfix server.
In your home directory, edit .procmailrc file (if is not there, echo > .procmailrc).Offcourse you can enable procmailrc system wide (write this file in /etc)
Add the following lines in .procmailrc
PATH=/usr/local/bin:/usr/bin:/bin
MAILDIR=$HOME/Maildir/
DEFAULT=$MAILDIR
LOGFILE=$MAILDIR/procmail.log
FILE=`mktemp`
:0 fw
|cat > $FILE; if bdscan $FILE &>/dev/null; then formail -a "X-BDScan:
clean" <$FILE; else formail -a "X-BDScan: infected" <$FILE; fi; rm -f $FILE
Offcourse, you must modify MAILDIR variable and bdscan must be in your path.
This will add in your email, a header that contain X-BDScan:infected/clean acording to the bdscan result.
If you want the infected mail to be deleted just add in .procmailrc the following line
:0
* ^X-BDScan: infected
/dev/null
Or else, if you want to move infected files to an local directory add in .procmailrc
:0
* ^X-BDScan: infected
Maildir/infected
If your postfix server is using another LDA, but it is using .forward files, a sollutins per user, not system wide is to add a .forward file in your home dir just like this
|/usr/bin/procmail
Well, this is it :)
Enjoy a free virus email.
Thanks to the BitDefender team for making this possible
Comments