SkyHorse.Org

Configuring E-mail (Exim) related areas

1) Since verification is now done on the RCPT stage, make the default catch-all to :fail: , not :blackhole: . For new accounts, change the settings in the “tweak settings” from WHM. For existing accounts, see script below.

The reasons are:

1. :blackhole: accepts the email and receives it, then sends it to /dev/null. This wastes your bandwidth and actually breaks the SMTP RFC because you’re not notifying the sender that the email is undelivered.

2. :fail: stops the email from being received, because verify = recipient occurs at the RCPT phase of the SMTP exchange before any data has been received. No bounce is sent, the exchange simply termintates with an SMTP error code. This means much less processing resources on your SMTP server, much less bandwidth (you don’t actually receive the email) and you maintain RFC compliance by notifying the senders SMTP server that the delivery failed (which spammers ignore and real people appreciate if they’ve made an addressing mistake).
(Jonathan Michaelson)

ACTION
Script to change all existing catch-all emails from :blackhole: to :fail:
Run this in a different directory than valiases, I recomend your home directory because it will create a backup of the current aliases (just in case)
This also keeps permissions and owners settings.

tar -cf valiases_backup.tar /etc/valiases/*
gzip valiases_backup.tar

files=`find /etc/valiases -type f`

for file in $files
do
cp -p $file $file.tmp
cat /dev/null > $file.tmp
cat $file | sed ’s/\:blackhole\:/\:fail\:/g’ > $file.tmp
mv $file.tmp $file -f
done

2) Let exim read userdomains!
It happens that eximstats cannot read /etc/userdomains as this fille is owned by root.mail, and smtp records in /var/log/exim_mainlog dont contain the system user so a lookup must be used.
This affects bandwidth measures will improve the accurracy, by including transfers in the users which were previously being counted towards the mailnull or cpanel user.

ACTION
open /etc/passwd with your favourite editor and change this line:
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
to
mailnull:x:47:12::/var/spool/mqueue:/sbin/nologin

3) Fix BFD to properly check the Exim logs
You should already be running APF and BFD.
BFD 0.9 script does not work for me , and it doesnt parse exim logs properly, so I had to hack it.
I would advise you to do the same, if you want to block IP addresses that consistently try to flood your email server and they belong to a spam list

ACTION

In the BFD itself, I changed one line. Here’s the diff:

root@host [/usr/local/bfd]# diff bfd bfd.backup
126c126
< for ihost in `echo $ARG_VAL | tr ' ' '\n' | tr ':' ' ' | awk '{print$1}' | grep -E '[.0-9]+' | sort -u`; do
—
> for ihost in `echo $ARG_VAL | tr ‘ ‘ ‘\n’ | tr ‘:’ ‘ ‘ | awk ‘{print$1}’ | grep -E ‘[.0-9]+’ | uniq`; do

In the rules directory , I changed my exim file and it looks like this now:

REQ=”/usr/sbin/exim”
if [ -f "$REQ" ]; then
LP=”/var/log/exim_mainlog”
TLOG_TF=”exim”
TRIG=”10″

# Max log entries to process at once for this rule
MLOG=2500

## EXIM
ARG_VAL=`$TLOGP $LP $TLOG_TF | grep -iw “rejected RCPT” | awk ‘{print$4}’ | tr -d ‘[]‘ | tr ‘:’ ‘ ‘ | awk ‘{print$1}’ | grep -E ‘^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$’ | tail -n $MLOG`
fi

I have also setup BFD to run once a minute, with minimal performance impact.

DISCUSSION

I found that uniq doesnt really uniq the list down, but simply uniques lines that are consecutively repeated. So it will change this:

192.168.0.1
192.168.0.1
192.168.0.2
192.168.0.3
192.168.0.1

into this:

192.168.0.1
192.168.0.2
192.168.0.3
192.168.0.1

when in reality, what we want is this:

192.168.0.1
192.168.0.2
192.168.0.3

which is what sort -u does.

The original exim rules don’t parse my exim log properly, so my exim file placed in the directory rules does the job. I found that the original rule does not take the ip address properly, because it tries to make a match at 192.168.0.1:1312, where in reality we need first to remove the port number (:1312) and then look for an ip address, I also found it lets things like (domain.com) pass, which shouldn’t.

Dealing with SPAM:

More (a lot more) to come, but some links for now:

http://www.benzedrine.cx/relaydb.html 

  • Google Buzz
  • Delicious
  • Facebook
  • Twitter
  • LinkedIn
  • Share/Bookmark

Related posts:

  • The Definite Guide of Obscure Tweaks to Install and Maintain cPanel / WHM (version 10)
  • DirectAdmin to cPanel : a partial BASH solution
  • The future of E-mail
  • Tags

    AI apple behavioural-targeting business Computing cPanel deep packet inspection design Downloads Games GNU/Linux google hacking hacking Hardware headphones hosting Ideas Instant Messaging iphone marketing mod-security online-advertising online media Personal Philosophy phorm poker Programming satire scripts Security sociology startups technology Travel ubuntu v-moda Visionarism web-2.0 web-marketing Web Design WHM wunderloop yahoo
  • Pages

    • About
    • Web Server Administration
      • Auto update modsecurity rules – modsec.sh
      • DirectAdmin to cPanel : a partial BASH solution
      • The Definite Guide of Obscure Tweaks to Install and Maintain cPanel / WHM (version 10)
        • Configuring E-mail (Exim) related areas
        • Fixing open DNS servers
        • Monitoring your server
        • Scripts and misc information
        • Security by Obscurity
        • Tweaking apache web server
  • Twitter Updates

    • Ads

    • RSS NMA

      • MySpace allows users to sync with Facebook 31 August, 2010
      • YouTube in first full-length movie deal with Blinkbox 27 August, 2010
      • nma Social Media Social takes place next Thursday 26 August, 2010
    • RSS Brand Republic

      • STV appoints Peter Reilly as commercial director 1 September, 2010
      • Binatone beats Samsung and BlackBerry with budget tablet launch 1 September, 2010
      • Alterian expands social media offer with Intrepid acquisition 1 September, 2010
    • RSS iMedia Connection: Consumer Strategies

      • Social media: What lies ahead
      • The truth about consumers' targeting fears
      • 3 reasons your brand doesn't have more Facebook fans
    • RSS Behavioural Targeting news

      • Moving Targets: Somebody Follow Me, Please? - MediaPost Publications 1 September, 2010
      • Moving Beyond Behavioral Ads - ClickZ News 1 September, 2010
      • Cybercrime Still a Major Concern - eMarketer 1 September, 2010
      • DigiRant: Retargeting Needs Some 411 - digiday:DAILY 31 August, 2010
      • How to Make Google Matter in Social Media - GigaOm (blog) 30 August, 2010
    • RSS Adotas

      • Rose Abdicates Digg Throne as Revolt Continues 1 September, 2010
      • Irony Alert: Zuck Wants Privacy Too 1 September, 2010
      • Yahoo & Dex One Expand Partnership for the Locals 1 September, 2010
    • RSS MarketingVox

      • Top Industry News for 9-01-10: Target to sell Facebook Credits gift cards 1 September, 2010
    • RSS ExchangeWire.com

      • OpenX Partners CCI To Build Out Automated Ad Trading Platform In Japan 1 September, 2010
      • AdAudience Moving Its Audience-Buying Offering From Wunderloop to Nugg.ad 31 August, 2010
      • Aegis H1 Report Shows Sluggish Growth In Europe, But Global Revenues Up 3.1% 27 August, 2010
    • RSS Segmentacion por comportamiento

      • Nota de prensa sobre la compra de wunderloop por Audience Science. 5 July, 2010
      • El gigante americano Audience Science compra wunderloop 5 July, 2010
      • Orange lanza su propio AdExchange 31 March, 2010
    • RSS Sandlines

      • the iPad and Marketing 28 January, 2010
      • The anticipation of disappointment 7 December, 2009
      • Groundhog Day 27 November, 2009
    • Ads

    • Blogroll

      • 90kts
      • Acxiom Poker Nights
      • Amy’s blog
      • Bytter’s blog
      • morena flor no samba da saudade
      • Not Quite There Yet
      • Swedish Pirate Party
    • Cartoons

      • Geek & Poke
      • Order of the Stick
      • User Friendly
    • Gaming

      • Neverwinter Nights
    • online media

      • Knowledge for the Digital Economy
      • Mike on Ads
    • Personal

      • Atelier de Camisa
      • Banksy
      • Designarte
      • My Amazon Wishlist
      • SkyServers.Org
    • Science

      • New Scientist
      • Rex Research
      • ScienceBox
      • Wired
    • Security

      • GPG4Win
      • GPGol
      • GPGShell
      • Mod Security
      • Offline Windows NT(2k,XP) Password Recovery
    • Web Design

      • PageStrength
      • SiteScore
      • UrlTrends
    • Akismet

      55,513 spam comments blocked by
      Akismet
    • Meta

      • Log in
      • Entries RSS
      • Comments RSS
      • WordPress.org

    © 2003 - 2010 Paulo Cunha | SkyHorse.Org is proudly powered by WordPress | Theme based on Bob