Current Issue


Table of contents

CD-ROM

Sys Admin and The Perl Journal CD-ROM version 12.0

Version 12.0 delivers every issue of Sys Admin from 1992 through 2006 and every
issue of The Perl Journal from 1996-2002 in one convenient CD-ROM!

Order now!

Sys Admin Magazine > Archives > 2001 > November 2001

Questions and Answers

Amy Rich

Back in the August issue of Sys Admin, someone asked a question about how to read a file backwards, and I provided a handy one-liner in Perl. Thanks to Tillman Hodgson for pointing out that there is also a GNU program called tac (cat spelled backwards) that does the same thing. Also thanks to Tom Payerle for pointing out the program rev, which prints lines from right to left.

Q: I have our Sendmail server configured with RBL and DUL, but these lists are not complete enough to catch all the spam that we receive. We get nothing but spam, for instance, from several top-level country domains, and I'm trying to block those with the access_db feature. I'm having some difficulty blocking a TLD and all of its subdomains, however. I can successfully block the addresses in the access.db when I have an exact match. For example, the following entry works:

host.sub.domain REJECT

I obviously don't want to go through and match every host, so I was trying to write a match for the entire TLD:

.domain REJECT

When I test my access rules with sendmail -bt -v it doesn't seem to work:

> /map access .domain

map_lookup: access (.domain) returns REJECT (0)

which is fine, but:

> /map access sub.domain

map_lookup: access (sub.domain) no match (0)

which fails. How do I correctly block an entire TLD?

A: Your access.db entry is syntactically incorrect and should look like the following:

domain REJECT

You don't want the leading '.' on the domain when you're trying to block the whole domain. When lookups are done against the access database, they're done in tokens, separated by dots. When the lookup for host.sub.domain is done, it then iterates through, taking off a token and a dot each time:

host.s




MarketPlace

Free Download Speeds Up PCs
Make Your PC Faster --New Diskeeper 2008 Speeds Up PCs --Download Free Trial Now!

Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.

Automate Software Builds with Visual Build Pro
Easily create an automated, repeatable process for building and deploying software.

Flowcharts from C/C++ code -- Free trial download
Understand C/C++ code in less time. A new team member ? Inherited legacy code ? Get up to speed faster with Crystal Flow for C/C++. Code-formatting improves readability. Flowcharts are integrated with code browser. Export flowcharts to Visio.

Wanna see your ad here?