spamd0.1.0SpamD Settings/pkg.php?xml=spamd.xmlSpamD Whitelist/pkg.php?xml=spamd_whitelist.xmlhttp://www.pfsense.com/packages/config/spamd.tgz['installedpackages']['spamd']['config']Provider NameprovidernameDescriptionproviderdescriptionProvider NameprovidernameEnter the name of the source30inputProvider TypeprovidertypeSelect the Provider Typeselectblack1Provider DescriptionproviderdescriptionEnter the description for this iteminput30Reject messagerejectmessageEnter the message to display to emailing parties that are on this providers listinput30Provider MethodprovidermethodSelect the Provider Methodselecthttp1Provider URL or FilenameproviderurlEnter the URL to the provider.340textarea
function sync_package() {
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, ":white:\\ \n");
fwrite($fd, ":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, ":" . rtrim($spamd['providermethod']) . ":\\ \n");
fwrite($fd, ":msg=\"" . rtrim($spamd['rejectmessage']) . "\":\\ \n");
fwrite($fd, ":" . rtrim($spamd['providermethod']) . ":\\ \n");
fwrite($fd, ":file=" . rtrim($spamd['providerurl']) . ":\n\n");
}
fclose($fd);
$fd = fopen("/var/mail/whitelist.txt","w");
if($config['installedpackages']['spamd-whitelist']['config'] != "")
foreach($config['installedpackages']['spamd-whitelist']['config'] as $spamd) {
fwrite($fd, $spamd['ip'] . "\n");
}
fclose($fd);
conf_mount_ro();
config_unlock();
}
sync_package();
sync_package();
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($fd, "/usr/libexec/spamd-setup &\n");
fwrite($fd, "/usr/libexec/spamlogd &\n");
fclose($fd);
system("chmod a+x /usr/local/etc/rc.d/spamd 2>/dev/null");
system("/usr/local/etc/rc.d/spamd 2>/dev/null");