spamd
0.1.0
SpamD Settings
/pkg.php?xml=spamd.xml
SpamD Whitelist
/pkg.php?xml=spamd_whitelist.xml
/usr/local/www/
a+rx
- http://www.pfsense.com/packages/config/spamd_rules.php
/usr/local/pkg/
a+rx
- http://www.pfsense.com/packages/config/spamd_whitelist.xml
['installedpackages']['spamd']['config']
Provider Name
providername
Description
providerdescription
Provider Name
providername
Enter the name of the source
30
input
Provider Type
providertype
Select the Provider Type
select
black
1
Provider Description
providerdescription
Enter the description for this item
input
30
Reject message
rejectmessage
Enter the message to display to emailing parties that are on this providers list
input
30
Provider Method
providermethod
Select the Provider Method
select
http
1
Provider URL or Filename
providerurl
Enter the URL to the provider.
3
40
textarea
function sync_package_spamd() {
conf_mount_rw();
config_lock();
global $config;
$fd = fopen("/usr/local/etc/spamd.conf","w");
/* all header */
fwrite($fd, "# this file was automatically generated by the pfSense\n");
fwrite($fd, "# package management system\n\n");
fwrite($fd, "all:\\\n\t:whitelist");
foreach($config['installedpackages']['spamd']['config'] as $spamd) {
fwrite($fd, ":" . rtrim($spamd['providername']));
}
fwrite($fd, ":\n\n# begin of whitelist\n");
fwrite($fd, "whitelist:\\\n");
fwrite($fd, "\t:white:\\\n");
fwrite($fd, "\t:file=/var/mail/whitelist.txt\n");
/* loop through each item and write out its configuration */
fwrite($fd, "\n# begin of user created entries\n");
foreach($config['installedpackages']['spamd']['config'] as $spamd) {
fwrite($fd, rtrim($spamd['providername']) . ":\\\n");
fwrite($fd, "\t:" . rtrim($spamd['providertype']) . ":\\\n");
fwrite($fd, "\t:msg=\"" . rtrim($spamd['rejectmessage']) . "\":\\\n");
fwrite($fd, "\t:method=" . rtrim($spamd['providermethod']) . ":\\\n");
fwrite($fd, "\t:" . rtrim($spamd['providermethod']) . ":\\\n");
fwrite($fd, "\t:file=" . rtrim($spamd['providerurl']) . ":\n\n");
}
fclose($fd);
$fd = fopen("/var/mail/whitelist.txt","w");
if($config['installedpackages']['spamdwhitelist']['config'] != "")
foreach($config['installedpackages']['spamdwhitelist']['config'] as $spamd) {
fwrite($fd, $spamd['ip'] . "\n");
}
fclose($fd);
system("/usr/local/etc/rc.d/spamd 2>/dev/null");
conf_mount_ro();
config_unlock();
}
sync_package_spamd();
sync_package_spamd();
system("touch /var/mail/whitelist.txt 2>/dev/null");
system("/usr/libexec/spamd-setup 2>/dev/null &");
system("/usr/libexec/spamlogd 2>/dev/null &");
$fd = fopen("/usr/local/etc/rc.d/spamd","w");
fwrite($fd, "#!/bin/sh\n\n");
fwrite($fout, "# PACKAGE: STunnel\n");
fwrite($fout, "# EXECUTABLE: stunnel\n");
fwrite($fd, "/usr/bin/killall spamd-setup 2>/dev/null\n");
fwrite($fd, "/usr/local/sbin/spamd-setup &\n");
fwrite($fd, "/usr/local/libexec/spamlogd &\n");
fclose($fd);
chmod("/usr/local/etc/rc.d/spamd", 0755);
mwexec("/usr/local/etc/rc.d/spamd");
unlink_if_exists("/usr/local/pkg/spamd*");
unlink_if_exists("/usr/local/www/spam*");