diff options
Diffstat (limited to 'packages/spamd.xml')
-rw-r--r-- | packages/spamd.xml | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/packages/spamd.xml b/packages/spamd.xml new file mode 100644 index 00000000..f029404f --- /dev/null +++ b/packages/spamd.xml @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8" ?> +<packagegui> + <name>spamd</name> + <version>0.1.0</version> + <title></title> + <!-- Menu is where this packages menu will appear --> + <menu> + <name>SpamD</name> + <tooltiptext></tooltiptext> + <section>Services</section> + <configfile>spamd.xml</configfile> + </menu> + <tabs> + <tab> + <text>SpamD Settings</text> + <url>/pkg_edit.php?xml=spamd.xml</url> + <active/> + </tab> + <tab> + <text>SpamD Whitelist</text> + <url>/pkg_edit.php?xml=spamd_whitelist.xml</url> + </tab> + </tabs> + <additional_files_needed> + <item>http://www.pfsense.com/packages/config/spamd.tgz</item> + </additional_files_needed> + <!-- configpath gets expanded out automatically and config items will be + stored in that location --> + <configpath>['installedpackages']['spamd']['config']</configpath> + <adddeleteeditpagefields> + <columnitem> + <fielddescr>Provider Name</fielddescr> + <fieldname>provider_name</fieldname> + </columnitem> + </adddeleteeditpagefields> + <!-- fields gets invoked when the user adds or edits a item. the following items + will be parsed and rendered for the user as a gui with input, and selectboxes. --> + <fields> + <field> + <fielddescr>Provider Name</fielddescr> + <fieldname>provider_name</fieldname> + <description>Enter the name of the source</description> + <type>input</type> + </field> + <field> + <fielddescr>Provider Type</fielddescr> + <fieldname>provider_type</fieldname> + <description>Select the Provider Type</description> + <type>select</type> + <value>black</value> + <options> + <option><value>black</value><name>Black List</name></option> + <option><value>white</value><name>White List</name></option> + </options> + </field> + <field> + <fielddescr>Reject message</fielddescr> + <fieldname>reject_message</fieldname> + <description>Enter the message to display to emailing parties that are on this providers list</description> + <type>input</type> + </field> + <field> + <fielddescr>Provider Method</fielddescr> + <fieldname>provider_method</fieldname> + <description>Select the Provider Metho</description> + <type>select</type> + <value>http</value> + <options> + <option><value>http</value><name>URL</name></option> + <option><value>exec</value><name>Execute command</name></option> + </options> + </field> + <field> + <fielddescr>Provider URL or Filename</fielddescr> + <fieldname>provider_url</fieldname> + <description>Enter the URL to the provider.</description> + <type>textarea</type> + </field> + </fields> + <custom_php_command_before_form> + function sync_package() { + global $config; + $fd = fopen("/usr/local/etc/spamd.conf","w"); + /* all header */ + fwrite($fd, "# this file was automatically generated by the pfSense"); + fwrite($fd, "# package management system"); + fwrite($fd, "all:whitelist:\\\n\t"); + foreach($config['installedpackages']['spamd']['config'] as $spamd) { + fwrite($fd, ":" . $spamd['provider_name']; + } + fwrite($fd, "whitelist:\\ \n"); + fwrite($fd, ":white:\\ \n"); + fwrite($fd, ":file=/var/mail/whitelist.txt\n\n"); + /* loop through each item and write out its configuration */ + foreach($config['installedpackages']['spamd']['config'] as $spamd) { + fwrite($fd, $spamd['provider_name'] . ":\\ \n"); + fwrite($fd, ":" . $spamd['provider_method'] . ":\\ \n"); + fwrite($fd, ":msg=\"" . $spamd['reject_message'] . "\":\\ \n": + fwrite($fd, ":" . $spamd['provider_method'] . ":\\ \n"); + fwrite($fd, ":file=" . $spamd['provider_url'] . ":\n\m"); + } + fwrite($fd, ":\n\n"); + fclose($fd); + $fd = fopen("/var/mail/whitelist.txt","w"); + foreach($config['installedpackages']['spamd-greylist']['config'] as $spamd) { + fwrite($fd, $spamd['ip'] . "\n"); + } + } + </custom_php_command_before_form> + <custom_php_resync_config_command> + sync_package(); + </custom_php_resync_config_command> + <custom_delete_php_command> + sync_package(); + </custom_delete_php_command> + <custom_php_install_command> + mwexc("touch /var/db/spammer-whitelist"); + mwexec("/usr/libexec/spamd-setup &"); + mwexec("/usr/libexec/spamlogd &"); + </custom_php_install_command> + <custom_php_deinstall_command> + </custom_php_deinstall_command> +</packagegui> |