SpamD: Add DNSWL's legitimate SMTP servers to whitelist
-
Hello all.
I've written a small PHP script to fetch DNSWL's legitimate SMTP servers to SpamD's whitelist.
There are few steps to make in order for this to work, so here we go:-
This has been tested on 1.2.1-RC3 (yes, it has been compiled tonight.)
-
Connect to pfSense using SSH shell as we need to add a new package.
-
Base pfSense don't include rsync command, so add it using: pkg_add -r rsync
-
Make a new directory (/usr/local/dnswl) and make it current directory (chdir).
-
Edit a new file (vi retrieve.php) and add the following code to it:
#!/usr/local/bin/php -f $script_dir = dirname(__FILE__); $tmp_dir = md5(time()); mkdir($script_dir.'/'.$tmp_dir); exec('/usr/local/bin/rsync --times "rsync1.dnswl.org::dnswl/generic-dnswl" "'.$script_dir.'/'.$tmp_dir.'/"'); if(file_exists($dnswl_path = $script_dir.'/'.$tmp_dir.'/generic-dnswl')) { $rptr = fopen($dnswl_path, 'r'); $optr = fopen($script_dir.'/generic-dnswl', 'wb'); if($rptr & $optr) { while($line = fgets($rptr)) { $line = trim($line); if(!$line) { continue; } if('#' == $line{0}) { continue; } $semicolor_pos = strpos($line, ';'); $line = substr($line, 0, $semicolor_pos); fputs($optr, $line."\n"); } } } @exec('/bin/rm -rf "'.$script_dir.'/'.$tmp_dir.'"'); @readfile($script_dir.'/generic-dnswl'); ?>
-
Go to (SpamD's External Sources) page, and click the [ + ] button to add a new entry.
-
Fill in the following settings in the input values:
-
Provider Name: dnswl.org
-
Provider Type: whitelist
-
Provider Description: DNSWL.org provides a whitelist of known legitimate email servers to reduce the chances of false positives while spam filtering.
-
Reject message: Your own message goes here
-
Provider Method: Execute command
-
Provider URL or Filename: /usr/local/dnswl/retrieve.php
Now, click the [ Save ] button to add the entry.
SpamD is able now to retrieve the list of legitimate SMTP servers, and add it automatically.
Enjoy!
-
-
Comrax: doing excellent work here!! I'm updating to RC3 just so i can use this and the other patch you released to SPAMD!!
Are you running greylisting or just white/black?