rDNS directories
Some of the options described below search directory structures for rDNS names. A directory structure is used because repeatedly searching a file full of domain names incurs a serious performance penalty. Querying the filesystem for the existance of a single file is very fast. Rule of thumb: if there are more than 100-200 entries in a file, consider switching to a directory structure instead.
To construct the directory path it uses, spamdyke takes the remote server's rDNS name, breaks it apart at the dots and reverses it using the following patterns:
e-five.d-four.c-three.b-two.a-one
becomesa-one/b/b-two/c-three/e-five.d-four.c-three.b-two.a-one
d-four.c-three.b-two.a-one
becomesa-one/b/b-two/c-three/d-four.c-three.b-two.a-one
c-three.b-two.a-one
becomesa-one/b/b-two/c-three.b-two.a-one
b-two.a-one
becomesa-one/b/b-two/b-two.a-one
a-one
becomesa-one/a/a-one
The final filename is treated as a wildcard and matches any host that ends with the given name. For example, if the following file existed in the directory structure:
com/e/example/example.com
example.com
mail.example.com
internal.mail.example.com
2ndfloor.internal.mail.example.com
These directory and filenames can be constructed with the domain2path tool,
included with spamdyke. domain2path takes one rDNS name as an argument and
returns the correct path to that name. domain2path also accepts a flag, -d
,
which makes it only return the directories in the path. This is useful in
scripts:
mkdir -p /PATH/TO/DIR/`domain2path -d FQDN`
touch /PATH/TO/DIR/`domain2path FQDN`
NOTE: The names of all the directories and files used in the directory structure must be lowercase or spamdyke will not match them. Unfortunately, searching a case sensitive filesystem in a case insensitive manner is not practical.