[rbldnsd] Slightly OT: script to add to rbldnsd zone

David Cary Hart rbldnsd at TQMcube.com
Fri Jan 28 20:56:44 MSK 2005


On Fri, 2005-01-28 at 09:32 -0800, Robin Lynn Frank wrote:
> I've been adapting a shell script we've been using to add such things as
> dictionary spam, unauthorized relay attempts, hits on spamtraps, etc to
> a postfix access map, so it can be used to add to a rbldnsd zone.
> 

What works for me is to create a header with the default and then to
create a data file. Here's an (inelegant) example:

        rbl="/var/lib/rbldns/dsbl"
        grep "Recipient address rejected" /var/log/maillog.1 >$rbl/temp
        grep -e "helo=<.*tqmcube\.com>" /var/log/maillog.1 >>$rbl/temp
        grep -oE "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
        $rbl/temp >$rbl/temp2
        sort $rbl/temp2 >$rbl/temp3
        uniq $rbl/temp3 $rbl/temp
        cat $rbl/temp |mail -s "Updated RBL Clients" root
        grep -oE "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*"
        $rbl/rblclients >$rbl/data
        cat $rbl/temp >>$rbl/data
        sort $rbl/data >$rbl/temp
        uniq $rbl/temp $rbl/data
        cat $rbl/header >$rbl/rblclientstemp
        cat $rbl/data >>$rbl/rblclientstemp
        mv -f $rbl/rblclientstemp $rbl/rblclients
        chown rbldns:rbldns $rbl/rblclients
        
> The script sorts the IP address, but unfortunately, also sorts the  line
> beginning: :127.0.0.4:DNSBL.  I am not a script wizard and haven't
> figured out how to keep that line at the top of the file.  If anyone
> knows how I can keep that line whereit belongs, I'd appreciate it.
> Alternately, if there already is such a script available, pointing me to
> it would avoid another reinvention of the wheel. ;-)
> 
> Code snippet follows.
> ######################################################
> #edit below for the address and verbiage you wish to use
> echo ":127.0.0.4:DNSBL. Policy restrictions (prior abuse from netblock):
> Mail from $ is NOT accepted on this server." > /var/tmp/rbldnsd_abuse.map
> 
> 
> cat /var/tmp/rbldnsd_abuse.map /var/tmp/rbldnsd_abuse.map
> /var/lib/rbldns/abuse |\
>     sort -f | uniq -i \
>     > /var/tmp/rbldnsd_abuse.map
> 
> #touch file so it doesn't need to be created the first time the
> #script is run.
> touch /var/lib/rbldns/abuse
> 
> cp /var/tmp/rbldnsd_abuse.map /var/lib/rbldns/abuse
> 
> exit 0
> --
> Robin Lynn Frank - Director of Operations - Paradigm-Omega, LLC
> Website:   http://www.paradigm-omega.com/
> RSS:       http://paradigm-omega.blogspot.com/atom.xml
> Spamtraps: http://www.paradigm-omega.net/cgi-bin/custmail.cgi
> =====================================================================
> Reality TV is an oxymoron.
> _______________________________________________
> rbldnsd mailing list
> rbldnsd at corpit.ru
> http://www.corpit.ru/mailman/listinfo/rbldnsd



More information about the rbldnsd mailing list