Malware is used for a harmful purpose. It can be in your software or hardware. Email and free (don't confuse with OSS) or pirated software is the most famous way to spread malware. It is inserted in a system w/o user notification.
Wikipedia defines Malware as:
Malware is software designed to infiltrate or damage a computer system without the owner's informed consent. It is a portmanteau of the words "malicious" and "software". The expression is a general term used by computer professionals to mean a variety of forms of hostile, intrusive, or annoying software or program code.
It will be a nice idea to block malware spreading urls and website. Setting up a mlaware blacklist in Postix MTA is quite easy. The Malware Block List is a free, automated and user contributed system for checking URLs for the presence of Viruses, Trojans, Worms, or any other software considered Malware. The list is available in 25 formats.
Create a blacklist
First you need to create a blacklist, type the following command:
# wget -O - http://www.malware.com.br/cgi/submit?action=list_postfix > /etc/postfix/mbl-body-deny
Configure Postfix
Open postfix main.cf file:
# vi /etc/postfix/main.cf
Setup postfix body_check directive:
body_checks = regexp:/etc/postfix/mbl-body-deny
Restart Postfix
Now just restart postfix:
# postmap /etc/postfix/mbl-body-deny
# /etc/init.d/postfix restart
Automate procedure
You need to setup a cron job to automate entire procedure. Create a shell script as follows (Download link):
#!/bin/bash # Script to update malware urls /usr/bin/wget -O - http://www.malware.com.br/cgi/submit?action=list_postfix > /etc/postfix/mbl-body-deny /usr/sbin/postmap /etc/postfix/mbl-body-deny /etc/init.d/postfix reload
Add cronjob as follows:
40 23 * * * /etc/admin/scripts/fetch.postfixmalware.sh >/dev/null 2>&1
You may wan to combine this feature with mime attachments blocking and anti spam blacklist for the best result.
Further readings
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop



![Sending Email With Attachments From Unix / Linux Command [ Shell Prompt ]](http://s0.cyberciti.org/images/rp/1/25.jpg)









{ 10 comments… read them below or add one }
I’m giving it a try, even though the current list shows to have some duplicates.
Oh and AFAIK “postfix reload” will do fine too (instead of restarting)!
BOK,
Yes, reload is fine too, I’ve used reload in script. Just checked my log and there are 4 dupes. But it works like a charm on our anti spam email gateway :)
Nice – I’ll give it a try!
What will be the perl script to download this malware list please?
Regards
How do you unsuscribe Malware? I don’t want it, it is messing up my computer totally!! I want to delete now!!
Remove:
body_checks = regexp:/etc/postfix/mbl-body-deny
Restart postfix and you are done!
I want you to know that we are very pleased with the quality of Article you have provided. I sincerely appreciate your responsiveness and the way you conduct. I have recommended your to others because of our satisfaction. I look forward to doing with you further comment or suggestions. regards.electronic projects
Is it needed to ‘postmap’ the malware file? it complains about many duplicate entries, because i’m using it to block some domains (using ‘From:’ header). I think postmap is not helping in any way with this, because it’s a pcre table, that can’t be postmap’d
Not only is postmap unnecessary, the reload is as well.
This article is outdated (something has changed) or totally wrong.
You cannot postmap regexp.
Just wget the remote file and use
body_checks = regexp:/etc/postfix/mbl-body-deny