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 

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 christianity 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
  • 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

      • Sky creates first head of social media position 10 March, 2010
      • Social media leads drive to bring online ad spend in line with consumer use of internet 10 March, 2010
      • CEOP calls for Facebook and MySpace to adopt abuse reporting button 9 March, 2010
    • RSS Brand Republic

      • Price comparison site nets deal with Premier League grounds 10 March, 2010
      • Alpen snack bar to sponsor Grey's Anatomy 10 March, 2010
      • BBH floats Ila rape alarm on AIM 10 March, 2010
    • RSS iMedia Connection: Consumer Strategies

      • The underlying drivers of social media success
      • How to turn user-generated content into profits
      • Digital demographics: 11 brands that are doing it right
    • RSS Behavioural Targeting news

      • Go, and Target No More? - ClickZ News 10 March, 2010
      • Industry prepares for FTC scrutiny of behavioral ads - BtoB Magazine 8 March, 2010
      • AudienceScience appoints Amazon's Dahill as network sales director - New Media Age 8 March, 2010
      • 5 Digital Truisms for Marketers - Adweek 8 March, 2010
      • How Behavioral Targeting Impacts Cart Abandonment - Multichannel Merchant 5 March, 2010
    • RSS Adotas

      • Rubicon Partners With mOcean to Offer Mobile Platform 9 March, 2010
      • Fuze Box Launches Tweetshare for Twitter Fan Pages 9 March, 2010
      • EXCLUSIVE: ‘There Is No Ad’ — StumbleUpon Revamps Ad System 9 March, 2010
    • RSS MarketingVox

      • Marketers Scramble As Apple Changes App Rules - Again 9 March, 2010
      • 4 Tips for a Successful Multivariate Test 9 March, 2010
      • CitySearch, OrangeSoda JV to Offer Local SEO 9 March, 2010
    • RSS ExchangeWire.com

      • Digital Element Looking To Bring Its Hyper-Local Targeting Europe-Wide 10 March, 2010
      • Video Advertising Getting Popular Among UK Media Planners Says WebTV Report; Rubicon Enters The Mobile Market 9 March, 2010
      • Specific Media Talks DSPs, Ad Networks, And Possible Market Consolidation 9 March, 2010
    • RSS SimsCity blog

      • Attaching pixels to pages 2 January, 2009
      • Frequency capping 28 December, 2008
      • ITV player 27 December, 2008
    • RSS Donald Hamilton

      • Never a True Word said with an “F” 1 December, 2009
      • Whose audience is it anyway? 19 October, 2009
      • Online ad spending bucks trends 29 September, 2008
    • RSS Segmentacion por comportamiento

      • La “Santa Alianza” contra Google. 18 February, 2010
      • Torsten Ahlers, CEO de wunderloop, en el OMExpo2010 26 January, 2010
      • Lanzamiento de la Alianza de editores en Alemania, con la tecnología de wunderloop como motor. 26 January, 2010
    • RSS Sandlines

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

      • DMEXCO Premiere war erfolgreich / Topthema Targeting 6 October, 2009
      • Mit „Behavioral“ den optimalen Werbe-Weg finden 8 May, 2009
      • Mit ToDo und Toodledo das Chaos beherschen 6 May, 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

      51,308 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