diff options
author | Daniel Stefan Haischt <dsh@pfsense.org> | 2006-07-15 22:16:04 +0000 |
---|---|---|
committer | Daniel Stefan Haischt <dsh@pfsense.org> | 2006-07-15 22:16:04 +0000 |
commit | 3eab27426aa39497d87a9fb768fd860f924e10be (patch) | |
tree | 729d886e70f6cd07f138bd72cf6308a1908ec9db /packages/dspam | |
parent | 5ea99d5d96bb72340cdb7d24e1258cb07b5cdfa1 (diff) | |
download | pfsense-packages-3eab27426aa39497d87a9fb768fd860f924e10be.tar.gz pfsense-packages-3eab27426aa39497d87a9fb768fd860f924e10be.tar.bz2 pfsense-packages-3eab27426aa39497d87a9fb768fd860f924e10be.zip |
- initial version of the DSPAM package
Diffstat (limited to 'packages/dspam')
47 files changed, 15839 insertions, 0 deletions
diff --git a/packages/dspam/conf.default/config.xml b/packages/dspam/conf.default/config.xml new file mode 100644 index 00000000..b06f65a3 --- /dev/null +++ b/packages/dspam/conf.default/config.xml @@ -0,0 +1,981 @@ +<?xml version="1.0"?> +<!-- pfSense default system configuration --> +<pfsense> + <version>2.1</version> + <lastchange></lastchange> + <theme>nione</theme> + <system> + <disablenatreflection/> + <optimization>normal</optimization> + <hostname>nione</hostname> + <domain>local</domain> + <dnsserver></dnsserver> + <dnsallowoverride/> + <timezone>Etc/UTC</timezone> + <time-update-interval>300</time-update-interval> + <timeservers>pool.ntp.org</timeservers> + <group> + <name>admins</name> + <description>System Administrators</description> + <scope>system</scope> + <pages>ANY</pages> + <home>index.php</home> + </group> + <group> + <name>dspam_users</name> + <description>DSPAM Users</description> + <scope>user</scope> + <home>dspam.php</home> + <pages> + <page>dspam.php</page> + <page>wizard.php</page> + <page>system_usermanager.php</page> + <page>license.php</page> + <page>pkg.php</page> + <page>pkg_edit.php</page> + <page>index.php</page> + <page>dspam_alerts.xml</page> + <page>dspam.xml</page> + <page>dspam-perf.php</page> + <page>dspam-prefs.php</page> + <page>dspam-train.php</page> + <page>dspam-quarantine.php</page> + <page>dspam-viewmsg.php</page> + <page>dspam-hfragment.php</page> + <page>dspam-history.php</page> + <page>dspam-analysis-graph.php</page> + <page>dspam-analysis.php</page> + <page>ifstats.php</page> + <page>xmlrpc.php</page> + <page>preload.php</page> + <page>functions.inc.php</page> + <page>javascript.inc.php</page> + <page>sajax.class.php</page> + </pages> + </group> + <group> + <name>dspam_admins</name> + <description>DSPAM Administrators</description> + <scope>user</scope> + <home>dspam.php</home> + <pages> + <page>dspam.php</page> + <page>dspam_wizard.xml</page> + <page>wizard.php</page> + <page>system_usermanager.php</page> + <page>license.php</page> + <page>pkg.php</page> + <page>pkg_edit.php</page> + <page>index.php</page> + <page>status_services.php</page> + <page>dspam-admin-prefs.php</page> + <page>dspam_alerts.xml</page> + <page>dspam.xml</page> + <page>dspam-perf.php</page> + <page>dspam-prefs.php</page> + <page>dspam-train.php</page> + <page>dspam-admin-stats.php</page> + <page>dspam-admin-graph.php</page> + <page>dspam-admin.php</page> + <page>dspam-quarantine.php</page> + <page>dspam-viewmsg.php</page> + <page>dspam-hfragment.php</page> + <page>dspam-history.php</page> + <page>dspam-analysis-graph.php</page> + <page>dspam-analysis.php</page> + <page>dspam-settings-algo.php</page> + <page>dspam-settings-bmta.php</page> + <page>dspam-settings-feat.php</page> + <page>dspam-settings-prefs.php</page> + <page>dspam-settings-header.php</page> + <page>dspam-settings-overr.php</page> + <page>dspam-settings-spwd.php</page> + <page>dspam-settings-tuser.php</page> + <page>dspam-settings.php</page> + <page>p3scan-pf-emer.xml</page> + <page>p3scan-pf.xml</page> + <page>p3scan-pf-msg.xml</page> + <page>p3scan-pf-spam.xml</page> + <page>p3scan-pf-vir.xml</page> + <page>ifstats.php</page> + <page>xmlrpc.php</page> + <page>preload.php</page> + <page>functions.inc.php</page> + <page>javascript.inc.php</page> + <page>sajax.class.php</page> + </pages> + </group> + <user> + <name>admin</name> + <fullname>System Administrator</fullname> + <scope>system</scope> + <groupname>admins</groupname> + <password>$1$7.o6q5uM$T86K5z0xG.rOUPWUUnjzm/</password> + <priv> + <id>lockwc</id> + <name>Lock webConfigurator</name> + <descr>Indicates whether this user will lock access to the webConfigurator for other users.</descr> + </priv> + <priv> + <id>lock-ipages</id> + <name>Lock individual pages</name> + <descr>Indicates whether this user will lock individual HTML pages after having accessed a particular page(the lock will be freed if the user leaves or saves the page form).</descr> + </priv> + <priv> + <id>hasshell</id> + <name>Has shell access</name> + <descr>Indicates whether this user is able to login for example via SSH.</descr> + </priv> + <priv> + <id>isroot</id> + <name>Is root user</name> + <descr>This user is associated with the UNIX root user (you should associate this privilege only with one single user).</descr> + </priv> + </user> + <user> + <name>dspamadm</name> + <fullname>DSPAM Administrator</fullname> + <scope>user</scope> + <groupname>dspam_admins</groupname> + <password>$1$utl.fBcK$ZDnGqMSm2fJHi8vxQ6EfT1</password> + </user> + <webgui> + <protocol>http</protocol> + <!-- + <port></port> + <certificate></certificate> + <private-key></private-key> + <noassigninterfaces/> + <expanddiags/> + <noantilockout></noantilockout> + --> + </webgui> + <!-- <disableconsolemenu/> --> + <!-- <disablefirmwarecheck/> --> + <!-- <shellcmd></shellcmd> --> + <!-- <earlyshellcmd></earlyshellcmd> --> + <!-- <harddiskstandby></harddiskstandby> --> + </system> + <interfaces> + <lan> + <if>sis0</if> + <ipaddr>192.168.1.1</ipaddr> + <subnet>24</subnet> + <media></media> + <mediaopt></mediaopt> + <bandwidth>100</bandwidth> + <bandwidthtype>Mb</bandwidthtype> + <!-- + <wireless> + *see below (opt[n])* + </wireless> + --> + </lan> + <wan> + <if>sis1</if> + <mtu></mtu> + <ipaddr>dhcp</ipaddr> + <!-- *or* ipv4-address *or* 'pppoe' *or* 'pptp' *or* 'bigpond' --> + <subnet></subnet> + <gateway></gateway> + <blockpriv/> + <disableftpproxy/> + <dhcphostname></dhcphostname> + <media></media> + <mediaopt></mediaopt> + <bandwidth>100</bandwidth> + <bandwidthtype>Mb</bandwidthtype> + <!-- + <wireless> + *see below (opt[n])* + </wireless> + --> + </wan> + <!-- + <opt[n]> + <enable/> + <descr></descr> + <if></if> + <ipaddr></ipaddr> + <subnet></subnet> + <media></media> + <mediaopt></mediaopt> + <bridge>lan|wan|opt[n]</bridge> + <wireless> + <mode>hostap *or* bss *or* ibss</mode> + <ssid></ssid> + <channel></channel> + <wep> + <enable/> + <key> + <txkey/> + <value></value> + </key> + </wep> + </wireless> + </opt[n]> + --> + </interfaces> + <!-- + <vlans> + <vlan> + <tag></tag> + <if></if> + <descr></descr> + </vlan> + </vlans> + --> + <staticroutes> + <!-- + <route> + <interface>lan|opt[n]|pptp</interface> + <network>xxx.xxx.xxx.xxx/xx</network> + <gateway>xxx.xxx.xxx.xxx</gateway> + <descr></descr> + </route> + --> + </staticroutes> + <pppoe> + <username></username> + <password></password> + <provider></provider> + <!-- + <ondemand/> + <timeout></timeout> + --> + </pppoe> + <pptp> + <username></username> + <password></password> + <local></local> + <subnet></subnet> + <remote></remote> + <!-- + <ondemand/> + <timeout></timeout> + --> + </pptp> + <bigpond> + <username></username> + <password></password> + <authserver></authserver> + <authdomain></authdomain> + <minheartbeatinterval></minheartbeatinterval> + </bigpond> + <dyndns> + <!-- <enable/> --> + <type>dyndns</type> + <username></username> + <password></password> + <host></host> + <mx></mx> + <!-- <wildcard/> --> + </dyndns> + <dhcpd> + <lan> + <enable/> + <range> + <from>192.168.1.100</from> + <to>192.168.1.199</to> + </range> + <!-- + <winsserver>xxx.xxx.xxx.xxx</winsserver> + <defaultleasetime></defaultleasetime> + <maxleasetime></maxleasetime> + <gateway>xxx.xxx.xxx.xxx</gateway> + <domain></domain> + <dnsserver></dnsserver> + <next-server></next-server> + <filename></filename> + --> + </lan> + <!-- + <opt[n]> + ... + </opt[n]> + --> + <!-- + <staticmap> + <mac>xx:xx:xx:xx:xx:xx</mac> + <ipaddr>xxx.xxx.xxx.xxx</ipaddr> + <descr></descr> + </staticmap> + --> + </dhcpd> + <pptpd> + <mode><!-- off *or* server *or* redir --></mode> + <redir></redir> + <localip></localip> + <remoteip></remoteip> + <!-- <accounting/> --> + <!-- + <user> + <name></name> + <password></password> + </user> + --> + </pptpd> + <ovpn> + <!-- + <server> + <enable/> + <ca_cert></ca_cert> + <srv_cert></srv_cert> + <srv_key></srv_key> + <dh_param></dh_param> + <verb></verb> + <tun_iface></tun_iface> + <port></port> + <bind_iface></bind_iface> + <cli2cli/> + <maxcli></maxcli> + <prefix></prefix> + <ipblock></ipblock> + <crypto></crypto> + <dupcn/> + <psh_options> + <redir></redir> + <redir_loc></redir_loc> + <rte_delay></rte_delay> + <ping></ping> + <pingrst></pingrst> + <pingexit></pingexit> + <inact></inact> + </psh_options> + </server> + <client> + <tunnel></tunnel> + <ca_cert></ca_cert> + <cli_cert></cli_cert> + <cli_key></cli_key> + <type></type> + <tunnel> + <if></if> + <proto></proto> + <cport></cport> + <saddr></saddr> + <sport></sport> + <crypto></crypto> + </tunnel> + </client> + --> + </ovpn> + <dnsmasq> + <enable/> + <!-- + <hosts> + <host></host> + <domain></domain> + <ip></ip> + <descr></descr> + </hosts> + --> + </dnsmasq> + <snmpd> + <!-- <enable/> --> + <syslocation></syslocation> + <syscontact></syscontact> + <rocommunity>public</rocommunity> + </snmpd> + <diag> + <ipv6nat> + <!-- <enable/> --> + <ipaddr></ipaddr> + </ipv6nat> + </diag> + <bridge> + <!-- <filteringbridge/> --> + </bridge> + <syslog> + <!-- + <reverse/> + <enable/> + <remoteserver>xxx.xxx.xxx.xxx</remoteserver> + <filter/> + <dhcp/> + <system/> + <nologdefaultblock/> + --> + </syslog> + <!-- + <captiveportal> + <enable/> + <interface>lan|opt[n]</interface> + <idletimeout>minutes</idletimeout> + <timeout>minutes</timeout> + <page> + <htmltext></htmltext> + <errtext></errtext> + </page> + <httpslogin/> + <httpsname></httpsname> + <certificate></certificate> + <private-key></private-key> + <redirurl></redirurl> + <radiusip></radiusip> + <radiusport></radiusport> + <radiuskey></radiuskey> + <nomacfilter/> + </captiveportal> + --> + <nat> + <ipsecpassthru> + <enable/> + </ipsecpassthru> + <!-- + <rule> + <interface></interface> + <external-address></external-address> + <protocol></protocol> + <external-port></external-port> + <target></target> + <local-port></local-port> + <descr></descr> + </rule> + --> + <!-- + <onetoone> + <interface></interface> + <external>xxx.xxx.xxx.xxx</external> + <internal>xxx.xxx.xxx.xxx</internal> + <subnet></subnet> + <descr></descr> + </onetoone> + --> + <!-- + <advancedoutbound> + <enable/> + <rule> + <interface></interface> + <source> + <network>xxx.xxx.xxx.xxx/xx</network> + </source> + <destination> + <not/> + <any/> + *or* + <network>xxx.xxx.xxx.xxx/xx</network> + </destination> + <target>xxx.xxx.xxx.xxx</target> + <descr></descr> + </rule> + </advancedoutbound> + --> + <!-- + <servernat> + <ipaddr></ipaddr> + <descr></descr> + </servernat> + --> + </nat> + <filter> + <!-- <tcpidletimeout></tcpidletimeout> --> + <rule> + <type>pass</type> + <descr>Default LAN -> any</descr> + <interface>lan</interface> + <source> + <network>lan</network> + </source> + <destination> + <any/> + </destination> + </rule> + <!-- rule syntax: + <rule> + <disabled/> + <type>pass|block|reject</type> + <descr>...</descr> + <interface>lan|opt[n]|wan|pptp</interface> + <protocol>tcp|udp|tcp/udp|...</protocol> + <icmptype></icmptype> + <source> + <not/> + + <address>xxx.xxx.xxx.xxx(/xx) or alias</address> + *or* + <network>lan|opt[n]|pptp</network> + *or* + <any/> + + <port>a[-b]</port> + </source> + <destination> + *same as for source* + </destination> + <frags/> + <log/> + </rule> + --> + </filter> + <shaper> + <!-- <enable/> --> + <!-- <schedulertype>hfsc</schedulertype> --> + <!-- rule syntax: + <rule> + <disabled/> + <descr></descr> + + <targetpipe>number (zero based)</targetpipe> + *or* + <targetqueue>number (zero based)</targetqueue> + + <interface>lan|wan|opt[n]|pptp</interface> + <protocol>tcp|udp</protocol> + <direction>in|out</direction> + <source> + <not/> + + <address>xxx.xxx.xxx.xxx(/xx)</address> + *or* + <network>lan|opt[n]|pptp</network> + *or* + <any/> + + <port>a[-b]</port> + </source> + <destination> + *same as for source* + </destination> + + <iplen>from[-to]</iplen> + <iptos>(!)lowdelay,throughput,reliability,mincost,congestion</iptos> + <tcpflags>(!)fin,syn,rst,psh,ack,urg</tcpflags> + </rule> + <pipe> + <descr></descr> + <bandwidth></bandwidth> + <delay></delay> + <mask>source|destination</mask> + </pipe> + <queue> + <descr></descr> + <targetpipe>number (zero based)</targetpipe> + <weight></weight> + <mask>source|destination</mask> + </queue> + --> + </shaper> + <ipsec> + <preferredoldsa/> + <!-- <enable/> --> + <!-- syntax: + <tunnel> + <disabled/> + <auto/> + <descr></descr> + <interface>lan|wan|opt[n]</interface> + <local-subnet> + <address>xxx.xxx.xxx.xxx(/xx)</address> + *or* + <network>lan|opt[n]</network> + </local-subnet> + <remote-subnet>xxx.xxx.xxx.xxx/xx</remote-subnet> + <remote-gateway></remote-gateway> + <p1> + <mode></mode> + <myident> + <myaddress/> + *or* + <address>xxx.xxx.xxx.xxx</address> + *or* + <fqdn>the.fq.dn</fqdn> + </myident> + <encryption-algorithm></encryption-algorithm> + <hash-algorithm></hash-algorithm> + <dhgroup></dhgroup> + <lifetime></lifetime> + <pre-shared-key></pre-shared-key> + </p1> + <p2> + <protocol></protocol> + <encryption-algorithm-option></encryption-algorithm-option> + <hash-algorithm-option></hash-algorithm-option> + <pfsgroup></pfsgroup> + <lifetime></lifetime> + </p2> + </tunnel> + <mobileclients> + <enable/> + <p1> + <mode></mode> + <myident> + <myaddress/> + *or* + <address>xxx.xxx.xxx.xxx</address> + *or* + <fqdn>the.fq.dn</fqdn> + </myident> + <encryption-algorithm></encryption-algorithm> + <hash-algorithm></hash-algorithm> + <dhgroup></dhgroup> + <lifetime></lifetime> + </p1> + <p2> + <protocol></protocol> + <encryption-algorithm-option></encryption-algorithm-option> + <hash-algorithm-option></hash-algorithm-option> + <pfsgroup></pfsgroup> + <lifetime></lifetime> + </p2> + </mobileclients> + <mobilekey> + <ident></ident> + <pre-shared-key></pre-shared-key> + </mobilekey> + --> + </ipsec> + <aliases> + <!-- + <alias> + <name></name> + <address>xxx.xxx.xxx.xxx(/xx)</address> + <descr></descr> + </alias> + --> + </aliases> + <proxyarp> + <!-- + <proxyarpnet> + <network>xxx.xxx.xxx.xxx/xx</network> + *or* + <range> + <from>xxx.xxx.xxx.xxx</from> + <to>xxx.xxx.xxx.xxx</to> + </range> + </proxyarpnet> + --> + </proxyarp> + <wol> + <!-- + <wolentry> + <interface>lan|opt[n]</interface> + <mac>xx:xx:xx:xx:xx:xx</mac> + <descr></descr> + </wolentry> + --> + </wol> + <installedpackages> + <dspam> + <config> + <!-- ============================================ --> + <!-- == Database Settings == --> + <!-- ============================================ --> + <storage-driver>mysql</storage-driver> + <dbsettings> + <mysql-server>/tmp/mysql.sock</mysql-server> + <mysql-port /> + <mysql-user>dspam</mysql-user> + <mysql-password>dspam</mysql-password> + <mysql-database>dspam</mysql-database> + <mysql-ccache>10</mysql-ccache> + <mysql-compress>yes</mysql-compress> + <mysql-uid>yes</mysql-uid> + </dbsettings> + <!-- ============================================ --> + <!-- == Delivery Settings == --> + <!-- ============================================ --> + <tdelivery-agent>mail</tdelivery-agent> + <tcpip-delivery>yes</tcpip-delivery> + <tcpip-delivery-host>192.168.1.6</tcpip-delivery-host> + <tcpip-delivery-port>24</tcpip-delivery-port> + <tcpip-delivery-ident>localhost</tcpip-delivery-ident> + <tcpip-delivery-proto>smtp</tcpip-delivery-proto> + <delivery-onfail>error</delivery-onfail> + <!-- ============================================ --> + <!-- == DSPAM Privileges == --> + <!-- ============================================ --> + <tuser> + <name>root</name> + <descr>root desc</descr> + </tuser> + <tuser> + <name>mail</name> + <descr>mail desc</descr> + </tuser> + <tuser> + <name>mailnull</name> + <descr>mailnull desc</descr> + </tuser> + <tuser> + <name>smmsp</name> + <descr>smmsp desc</descr> + </tuser> + <tuser> + <name>daemon</name> + <descr>daemon desc</descr> + </tuser> + <!-- ============================================ --> + <!-- == DSPAM Engine Settings == --> + <!-- ============================================ --> + <training-mode>teft</training-mode> + <test-cond-training>yes</test-cond-training> + <feature> + <name>chained</name> + <descr>feat desc</descr> + </feature> + <feature> + <name>whitelist</name> + <descr>whitelist desc</descr> + </feature> + <algorithm> + <name>graham</name> + <descr>naive desc</descr> + </algorithm> + <algorithm> + <name>burton</name> + <descr>naive desc</descr> + </algorithm> + <pvalue>graham</pvalue> + <improbability-drive>yes</improbability-drive> + <preference> + <value>"spamAction=quarantine"</value> + <descr>desc</descr> + </preference> + <preference> + <value>"signatureLocation=message"</value> + <descr>'message' or 'headers'</descr> + </preference> + <preference> + <value>"showFactors=on"</value> + <descr>desc</descr> + </preference> + <override> + <value>trainingMode</value> + <descr>tmode desc</descr> + </override> + <override> + <value>spamAction spamSubject</value> + <descr>desc</descr> + </override> + <override> + <value>statisticalSedation</value> + <descr>desc</descr> + </override> + <override> + <value>enableBNR</value> + <descr>desc</descr> + </override> + <override> + <value>enableWhitelist</value> + <descr>desc</descr> + </override> + <override> + <value>signatureLocation</value> + <descr>desc</descr> + </override> + <override> + <value>showFactors</value> + <descr>desc</descr> + </override> + <override> + <value>optIn optOut</value> + <descr>desc</descr> + </override> + <override> + <value>whitelistThreshold</value> + <descr>desc</descr> + </override> + <!-- ============================================ --> + <!-- == Miscellaneous Settings == --> + <!-- ============================================ --> + <failover-attempts>1</failover-attempts> + <notification-email>yes</notification-email> + <!-- ============================================ --> + <!-- == Maintainance Settings == --> + <!-- ============================================ --> + <purge-signatures>14</purge-signatures> + <purge-neutral>90</purge-neutral> + <purge-unused>90</purge-unused> + <purge-hapaxes>30</purge-hapaxes> + <purge-hits-1s>15</purge-hits-1s> + <purge-hits-1i>15</purge-hits-1i> + <!-- ============================================ --> + <!-- == System Settings == --> + <!-- ============================================ --> + <local-mx>127.0.0.1</local-mx> + <system-log>yes</system-log> + <user-log>yes</user-log> + <filter-opt>out</filter-opt> + <parse-to-headers>yes</parse-to-headers> + <change-mode-on-parse>yes</change-mode-on-parse> + <max-message-size>307200</max-message-size> + <processor-bias>yes</processor-bias> + <!-- ============================================ --> + <!-- == ClamAV Engine Settings == --> + <!-- ============================================ --> + <clamav-enable>yes</clamav-enable> + <clamav-port>3310</clamav-port> + <clamav-host>127.0.0.1</clamav-host> + <clamav-response>accept</clamav-response> + <!-- ============================================ --> + <!-- == DSPAM Daemon Settings (Server) == --> + <!-- ============================================ --> + <dspam-server-port>24</dspam-server-port> + <dspam-server-queue-size>32</dspam-server-queue-size> + <dspam-server-pid>/var/run/dspam/dspam.pid</dspam-server-pid> + <dspam-server-mode>standard</dspam-server-mode> + <dspam-server-params>--deliver=innocent -d %u</dspam-server-params> + <dspam-server-id>abysseleven.abyssworld.de</dspam-server-id> + <dspam-server-socket>/var/run/dspam/dspam.sock</dspam-server-socket> + </config> + </dspam> + <package> + <name>dspam</name> + <website>http://dspam.nuclearelephant.com/</website> + <descr> + DSPAM is a scalable and open-source content-based spam filter designed for multi-user enterprise systems. + On a properly configured system, many users experience results between 99.5% - 99.95%, or one error for + every 200 to 2000 messages. DSPAM supports many different MTAs and can also be deployed as a stand-alone + SMTP appliance. + </descr> + <config_file>http://www.abyssworld.de/packages/config/dspam.xml</config_file> + <depends_on_package_base_url>http://www.abyssworld.de/packages/All/</depends_on_package_base_url> + <depends_on_package>dspam-devel-3.6.4.20060315.1518.tbz</depends_on_package> + <version>3.6.6</version> + <status>ALPHA</status> + <maintainer>me@daniel.stefan.haischt.name</maintainer> + <logging> + <facilityname>dspam</facilityname> + </logging> + </package> + <package> + <name>mysql</name> + <website>http://www.mysql.com/</website> + <descr> + MySQL RDBMS. + </descr> + <config_file>http://www.abyssworld.de/packages/config/mysql.xml</config_file> + <depends_on_package_base_url>http://www.abyssworld.de/packages/All/</depends_on_package_base_url> + <depends_on_package>mysql-server-5.0.21.tbz</depends_on_package> + <version>5.0.21</version> + <status>ALPHA</status> + <maintainer>me@daniel.stefan.haischt.name</maintainer> + <logging> + <facilityname>mysql</facilityname> + </logging> + </package> + <package> + <name>clamav</name> + <website>http://www.clamav.net/</website> + <descr> + Clam Antivirus. + </descr> + <config_file>http://www.abyssworld.de/packages/config/clamav.xml</config_file> + <depends_on_package_base_url>http://www.abyssworld.de/packages/All/</depends_on_package_base_url> + <depends_on_package>clamav-devel-20060503_1.tbz</depends_on_package> + <version>20060503_1</version> + <status>ALPHA</status> + <maintainer>me@daniel.stefan.haischt.name</maintainer> + <logging> + <facilityname>clamav</facilityname> + </logging> + </package> + <menu> + <name>POP3 Proxy</name> + <section>Services</section> + <configfile>p3scan.inc</configfile> + <url>/pkg_edit.php?xml=p3scan-pf.xml&id=0</url> + </menu> + <menu> + <name>DSPAM</name> + <section>Services</section> + <configfile>dspam.inc</configfile> + <url>/dspam.php</url> + </menu> + <menu> + <name>DSPAM Wizard</name> + <section>Services</section> + <configfile>dspam.inc</configfile> + <url>/wizard.php?xml=dspam_wizard.xml</url> + </menu> + <service> + <name>dspam</name> + <description>DSPAM content-based spam filter</description> + <rcfile>/usr/local/etc/rc.d/dspam.sh</rcfile> + <executable>dspam</executable> + </service> + <service> + <name>clamd</name> + <description>Clam AntiVirus Scanner</description> + <rcfile>/usr/local/etc/rc.d/010.clamav-clamd.sh</rcfile> + <executable>clamd</executable> + </service> + <service> + <description>Deamon that receives new AntiVirus signatures</description> + <name>freshclam</name> + <rcfile>/usr/local/etc/rc.d/020.clamav-freshclam.sh</rcfile> + <executable>freshclam</executable> + </service> + <service> + <name>mysql</name> + <description>MySQL RDBMS</description> + <rcfile>/usr/local/etc/rc.d/000.mysql.sh</rcfile> + <executable>mysqld_safe</executable> + </service> + <service> + <name>p3scan</name> + <description> + p3scan is a pop3 antivirus proxy that can be used completely transparently with any pop3 mail client. + </description> + <rcfile>/usr/local/etc/rc.d/030.p3scan.sh</rcfile> + <executable>p3scan</executable> + </service> + </installedpackages> + <cron> + <item> + <minute>0</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 newsyslog</command> + </item> + <item> + <minute>1,31</minute> + <hour>0-5</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 adjkerntz -a</command> + </item> + <item> + <minute>1</minute> + <hour>*</hour> + <mday>1</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /etc/rc.update_bogons.sh</command> + </item> + <item> + <minute>*/60</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /usr/local/sbin/expiretable -v -t 3600 sshlockout</command> + </item> + <item> + <minute>1</minute> + <hour>1</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /etc/rc.dyndns.update</command> + </item> + <item> + <minute>*/5</minute> + <hour>*</hour> + <mday>*</mday> + <month>*</month> + <wday>*</wday> + <who>root</who> + <command>/usr/bin/nice -n20 /etc/ping_hosts.sh</command> + </item> + </cron> +</pfsense> diff --git a/packages/dspam/pkg/000.mysql.sh b/packages/dspam/pkg/000.mysql.sh new file mode 100644 index 00000000..9c25c370 --- /dev/null +++ b/packages/dspam/pkg/000.mysql.sh @@ -0,0 +1,68 @@ +#!/bin/sh +# This file was automatically generated +# by the pfSense service handler + +rc_start() { +test_mysql_user=`cat /etc/passwd | grep mysql` +test_mysql_group=`cat /etc/group | grep mysql` +mysql_user="mysql" +mysql_limits_args="-e -U ${mysql_user}" +pidfile="/var/db/mysql/`/bin/hostname`.pid" +command="/usr/local/bin/mysqld_safe" +command_args="--user=${mysql_user} --datadir=/var/db/mysql --pid-file=${pidfile} --bind-address=127.0.0.1 --set-variable=max_connections=500" +procname="/usr/local/libexec/mysqld" +mysql_install_db="/usr/local/bin/mysql_install_db" +mysql_install_db_args="--ldata=/var/db/mysql" + +/sbin/mount_fdescfs fdescfs /dev/fd + +if [ -z "${test_mysql_group}" ]; then + pw groupadd mysql -g 88 +fi + +if [ -z "${test_mysql_user}" ]; then + pw useradd mysql -u 88 -g 88 -d /nonexistent -s /sbin/nologin -c 'MySQL Daemon' +fi + +if [ ! -d "/var/db/mysql" ]; then + mkdir /var/db/mysql && chown mysql:mysql /var/db/mysql +fi + +if [ ! -d "/var/db/mysql/mysql/." ]; then + eval $mysql_install_db $mysql_install_db_args >/dev/null + [ $? -eq 0 ] && chown -R ${mysql_user}:${mysql_user} /var/db/mysql +fi + +#if checkyesno mysql_limits; then +# eval `/usr/bin/limits ${mysql_limits_args}` 2>/dev/null +#else +# return 0 +#fi + +${command} ${command_args} > /dev/null & +} + +rc_stop() { +/usr/bin/killall mysqld +sleep 2 +} + +rc_restart() { + rc_stop + rc_start +} + +case $1 in + start) + rc_start + ;; + stop) + rc_stop + ;; + restart) + rc_restart + ;; + *) + echo "Usage: $0 <start|stop|restart>" + ;; +esac diff --git a/packages/dspam/pkg/010.clamav-clamd.sh b/packages/dspam/pkg/010.clamav-clamd.sh new file mode 100644 index 00000000..aeb23b04 --- /dev/null +++ b/packages/dspam/pkg/010.clamav-clamd.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# This file was automatically generated +# by the pfSense service handler + +rc_start() { +test_clamav_group=`cat /etc/group | grep clam` +test_clamav_user=`cat /etc/passwd | grep clam` + +if [ -z "${test_clamav_group}" ]; then + pw groupadd clamav -g 106 +fi + +if [ -z "${test_clamav_user}" ]; then + pw useradd clamav -u 106 -g 106 -d /nonexistent -s /sbin/nologin -c 'Clam Antivirus' +fi + +if [ ! -d "/usr/local/share/clamav" ]; then + mkdir /usr/local/share/clamav && chown clamav:clamav /usr/local/share/clamav +fi + +if [ ! -d "/var/log/clamav" ]; then + mkdir /var/log/clamav && chown clamav:clamav /var/log/clamav +fi + +if [ ! -d "/var/run/clamav" ]; then + mkdir /var/run/clamav && chown clamav:clamav /var/run/clamav +fi + + /sbin/mount_fdescfs fdescfs /dev/fd + /usr/local/sbin/clamd +} + +rc_stop() { + /usr/bin/killall clamd + sleep 2 +} + +rc_restart() { + rc_stop + rc_start +} + +case $1 in + start) + rc_start + ;; + stop) + rc_stop + ;; + restart) + rc_restart + ;; + *) + echo "Usage: $0 <start|stop|restart>" + ;; +esac diff --git a/packages/dspam/pkg/020.clamav-freshclam.sh b/packages/dspam/pkg/020.clamav-freshclam.sh new file mode 100644 index 00000000..4332d757 --- /dev/null +++ b/packages/dspam/pkg/020.clamav-freshclam.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# This file was automatically generated +# by the pfSense service handler + +rc_start() { + /sbin/mount_fdescfs fdescfs /dev/fd + /usr/local/bin/freshclam --daemon +} + +rc_stop() { + /usr/bin/killall freshclam + sleep 2 +} + +rc_restart() { + rc_stop + rc_start +} + +case $1 in + start) + rc_start + ;; + stop) + rc_stop + ;; + restart) + rc_restart + ;; + *) + echo "Usage: $0 <start|stop|restart>" + ;; +esac diff --git a/packages/dspam/pkg/030.p3scan.sh b/packages/dspam/pkg/030.p3scan.sh new file mode 100644 index 00000000..ffd08abf --- /dev/null +++ b/packages/dspam/pkg/030.p3scan.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# This file was automatically generated +# by the pfSense service handler + +rc_start() { +test_p3scan_user=`cat /etc/passwd | grep p3scan` +test_p3scan_group=`cat /etc/passwd | grep p3scan` + +if [ -z "${test_p3scan_group}" ]; then + pw groupadd p3scan -g 108 +fi + +if [ -z "${test_p3scan_user}" ]; then + pw useradd p3scan -u 108 -g p3scan -d /var/spool/p3scan -s /sbin/nologin -c 'P3Scan Daemon' +fi + +if [ ! -d "/var/spool/p3scan" ]; then + mkdir /var/spool/p3scan && chown p3scan:p3scan /var/spool/p3scan +fi + +if [ ! -d "/var/spool/p3scan/children" ]; then + mkdir /var/spool/p3scan/children && chown p3scan:p3scan /var/spool/p3scan/children +fi + +if [ ! -d "/var/spool/p3scannotify" ]; then + mkdir /var/spool/p3scannotify && chown p3scan:p3scan /var/spool/p3scannotify +fi + +if [ ! -d "/var/run/p3scan" ]; then + mkdir /var/run/p3scan && chown p3scan:p3scan /var/run/p3scan +fi + + /sbin/mount_fdescfs fdescfs /dev/fd + /usr/local/sbin/p3scan --configfile=/usr/local/etc/p3scan/p3scan.conf & +} + +rc_stop() { + /usr/bin/killall p3scan + sleep 2 +} + +rc_restart() { + rc_stop + rc_start +} + +case $1 in + start) + rc_start + ;; + stop) + rc_stop + ;; + restart) + rc_restart + ;; + *) + echo "Usage: $0 <start|stop|restart>" + ;; +esac diff --git a/packages/dspam/pkg/clamd.conf b/packages/dspam/pkg/clamd.conf new file mode 100644 index 00000000..3ce0402f --- /dev/null +++ b/packages/dspam/pkg/clamd.conf @@ -0,0 +1,299 @@ +## +## Example config file for the Clam AV daemon +## Please read the clamd.conf(5) manual before editing this file. +## + + +# Comment or remove the line below. +#Example + +# Uncomment this option to enable logging. +# LogFile must be writable for the user running daemon. +# A full path is required. +# Default: disabled +#LogFile /tmp/clamd.log +LogFile /var/log/clamav/clamd.log + +# By default the log file is locked for writing - the lock protects against +# running clamd multiple times (if want to run another clamd, please +# copy the configuration file, change the LogFile variable, and run +# the daemon with --config-file option). +# This option disables log file locking. +# Default: no +#LogFileUnlock yes + +# Maximal size of the log file. +# Value of 0 disables the limit. +# You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes) +# and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). To specify the size +# in bytes just don't use modifiers. +# Default: 1M +#LogFileMaxSize 2M + +# Log time with each message. +# Default: no +#LogTime yes + +# Also log clean files. Useful in debugging but drastically increases the +# log size. +# Default: no +#LogClean yes + +# Use system logger (can work together with LogFile). +# Default: no +#LogSyslog yes +LogSyslog yes + +# Specify the type of syslog messages - please refer to 'man syslog' +# for facility names. +# Default: LOG_LOCAL6 +#LogFacility LOG_MAIL + +# Enable verbose logging. +# Default: no +#LogVerbose yes + +# This option allows you to save a process identifier of the listening +# daemon (main thread). +# Default: disabled +#PidFile /var/run/clamd.pid +PidFile /var/run/clamav/clamd.pid + +# Optional path to the global temporary directory. +# Default: system specific (usually /tmp or /var/tmp). +#TemporaryDirectory /var/tmp + +# Path to the database directory. +# Default: hardcoded (depends on installation options) +#DatabaseDirectory /var/lib/clamav +DatabaseDirectory /usr/local/share/clamav + +# The daemon works in a local OR a network mode. Due to security reasons we +# recommend the local mode. + +# Path to a local socket file the daemon will listen on. +# Default: disabled (must be specified by a user) +#LocalSocket /tmp/clamd + +# Remove stale socket after unclean shutdown. +# Default: no +FixStaleSocket yes + +# TCP port address. +# Default: no +TCPSocket 3310 + +# TCP address. +# By default we bind to INADDR_ANY, probably not wise. +# Enable the following to provide some degree of protectiyes +# from the outside world. +# Default: no +TCPAddr 127.0.0.1 + +# Maximum length the queue of pending connections may grow to. +# Default: 15 +#MaxConnectionQueueLength 30 + +# Clamd uses FTP-like protocol to receive data from remote clients. +# If you are using clamav-milter to balance load between remote clamd daemons +# on firewall servers you may need to tune the options below. + +# Close the connection when the data size limit is exceeded. +# The value should match your MTA's limit for a maximal attachment size. +# Default: 10M +#StreamMaxLength 20M + +# Limit port range. +# Default: 1024 +#StreamMinPort 30000 +# Default: 2048 +#StreamMaxPort 32000 + +# Maximal number of threads running at the same time. +# Default: 10 +#MaxThreads 20 + +# Waiting for data from a client socket will timeout after this time (seconds). +# Value of 0 disables the timeout. +# Default: 120 +#ReadTimeout 300 + +# Waiting for a new job will timeout after this time (seconds). +# Default: 30 +#IdleTimeout 60 + +# Maximal depth directories are scanned at. +# Default: 15 +#MaxDirectoryRecursion 20 + +# Follow directory symlinks. +# Default: no +#FollowDirectorySymlinks yes + +# Follow regular file symlinks. +# Default: no +#FollowFileSymlinks yes + +# Perform internal sanity check (database integrity and freshness). +# Default: 1800 (30 min) +#SelfCheck 600 + +# Execute a command when virus is found. In the command string %v will +# be replaced by a virus name. +# Default: no +#VirusEvent /usr/local/bin/send_sms 123456789 "VIRUS ALERT: %v" + +# Run as a selected user (clamd must be started by root). +# Default: don't drop privileges +User clamav + +# Initialize supplementary group access (clamd must be started by root). +# Default: no +AllowSupplementaryGroups yes + +# Stop daemon when libclamav reports out of memory condition. +#ExitOnOOM yes + +# Don't fork into background. +# Default: no +#Foreground yes + +# Enable debug messages in libclamav. +# Default: no +#Debug yes + +# Do not remove temporary files (for debug purposes). +# Default: no +#LeaveTemporaryFiles yes + +## +## Executable files +## + +# PE stands for Portable Executable - it's an executable file format used +# in all 32-bit versions of Windows operating systems. This option allows +# ClamAV to perform a deeper analysis of executable files and it's also +# required for decompression of popular executable packers such as UPX, FSG, +# and Petite. +# Default: yes +#ScanPE yes + +# With this option clamav will try to detect broken executables and mark +# them as Broken.Executable +# Default: no +#DetectBrokenExecutables yes + + +## +## Documents +## + +# This option enables scanning of Microsoft Office document macros. +# Default: yes +#ScanOLE2 yes + +## +## Mail files +## + +# Enable internal e-mail scanner. +# Default: yes +#ScanMail yes + +# If an email contains URLs ClamAV can download and scan them. +# WARNING: This option may open your system to a DoS attack. +# Never use it on loaded servers. +# Default: no +#MailFollowURLs no + + +## +## HTML +## + +# Perform HTML normalisation and decryption of MS Script Encoder code. +# Default: yes +#ScanHTML yes + + +## +## Archives +## + +# ClamAV can scan within archives and compressed files. +# Default: yes +#ScanArchive yes + +# The options below protect your system against Denial of Service attacks +# using archive bombs. + +# Files in archives larger than this limit won't be scanned. +# Value of 0 disables the limit. +# Default: 10M +#ArchiveMaxFileSize 15M + +# Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR +# file, all files within it will also be scanned. This options specifies how +# deep the process should be continued. +# Value of 0 disables the limit. +# Default: 8 +#ArchiveMaxRecursion 10 + +# Number of files to be scanned within an archive. +# Value of 0 disables the limit. +# Default: 1000 +#ArchiveMaxFiles 1500 + +# If a file in an archive is compressed more than ArchiveMaxCompressionRatio +# times it will be marked as a virus (Oversized.ArchiveType, e.g. Oversized.Zip) +# Value of 0 disables the limit. +# Default: 250 +#ArchiveMaxCompressionRatio 300 + +# Use slower but memory efficient decompression algorithm. +# only affects the bzip2 decompressor. +# Default: no +#ArchiveLimitMemoryUsage yes + +# Mark encrypted archives as viruses (Encrypted.Zip, Encrypted.RAR). +# Default: no +#ArchiveBlockEncrypted no + +# Mark archives as viruses (e.g. RAR.ExceededFileSize, Zip.ExceededFilesLimit) +# if ArchiveMaxFiles, ArchiveMaxFileSize, or ArchiveMaxRecursion limit is +# reached. +# Default: no +#ArchiveBlockMax no + + +## +## Clamuko settings +## WARNING: This is experimental software. It is very likely it will hang +## up your system!!! +## + +# Enable Clamuko. Dazuko (/dev/dazuko) must be configured and running. +# Default: no +#ClamukoScanOnAccess yes + +# Set access mask for Clamuko. +# Default: no +#ClamukoScanOnOpen yes +#ClamukoScanOnClose yes +#ClamukoScanOnExec yes + +# Set the include paths (all files in them will be scanned). You can have +# multiple ClamukoIncludePath directives but each directory must be added +# in a seperate line. +# Default: disabled +#ClamukoIncludePath /home +#ClamukoIncludePath /students + +# Set the exclude paths. All subdirectories are also excluded. +# Default: disabled +#ClamukoExcludePath /home/bofh + +# Don't scan files larger than ClamukoMaxFileSize +# Value of 0 disables the limit. +# Default: 5M +#ClamukoMaxFileSize 10M diff --git a/packages/dspam/pkg/default.prefs.sample b/packages/dspam/pkg/default.prefs.sample new file mode 100644 index 00000000..d9be27ed --- /dev/null +++ b/packages/dspam/pkg/default.prefs.sample @@ -0,0 +1,43 @@ +# $Id$ +# default.prefs v3.2 +# Default preferences for DSPAM + +# This file serves two purposes. First, it sets the default preferences each +# user will see when using the preferences section of the DSPAM Control +# Center. Second, it may be symbolically linked (or copied) into DSPAM_HOME to +# set the system-wide default preferences, overriding any commandline or +# dspam.conf parameters. If symlinked, an administrator can edit these options +# in the DSPAM Administrative Suite. + +# Training Mode: TEFT, TOE, TUM, NOTRAIN +trainingMode=TEFT + +# Spam Action: quarantine, tag +spamAction=quarantine + +# Spam Subject: the text to be prepended onto the subject line of tagged spams +spamSubject=[SPAM] + +# Bayesian Noise Reduction: on/off +enableBNR=on + +# Automatic Whitelisting: on/off +enableWhitelist=on + +# Statistical Sedation: 0-10 +statisticalSedation=5 + +# Signature Location: message, headers, attachment +signatureLocation=message + +# Whitelist Threshold: the minimum number of innocent hits from a recipient to +# be automatically whitelisted. Do not set this value too low! +whitelistThreshold=10 + +# showFactors: when set to on, the determining factors for each message will +# be added to a X-DSPAM-Factors message header. +showFactors=off + +# optIn/optOut: Depending on the opt mode set, you can also use one of these. +#optIn=on +#optOut=off diff --git a/packages/dspam/pkg/dspam.inc b/packages/dspam/pkg/dspam.inc new file mode 100644 index 00000000..e2cdad40 --- /dev/null +++ b/packages/dspam/pkg/dspam.inc @@ -0,0 +1,3916 @@ +<?php +/* $Id$ */ +/* Copyright (C) 2006 Daniel S. Haischt */ + +/* include all configuration functions */ +require_once("functions.inc"); + +/* General TODO(s): + * + * - Use quotemeta where applicable + * - Issue a change message after a successful GET/POST + * - Issue an error message if something went wrong during a GET/POST + * - Revise user management (CURENT_USER, SESSION_USER etc.) + */ + +$DATA = array(); +$CONFIG = array('DSPAM_HOME' => '/var/db/dspam', + 'DSPAM_BIN' => '/usr/local/bin', + 'DSPAM' => '/usr/local/bin/dspam', + 'DSPAM_STATS' => '/usr/local/bin/dspam_stats', + 'DSPAM_WWW' => '/usr/local/pkg', + 'DSPAM_ARGS' => '--deliver=innocent --class=innocent ' . + '--source=error --user %CURRENT_USER% -d %u', + 'DSPAM_ADMIN_GROUP' => 'dspam_admins', + 'ALL_PROCS' => 'ps auxw', + 'MAIL_QUEUE' => 'mailq | grep \'^[0-9,A-F]\' | wc -l', + 'HISTORY_SIZE' => 799, + 'HISTORY_PER_PAGE' => 100, + 'QUARANTINE_PER_PAGE' => 100, + 'HISTORY_DUPLICATES' => 'yes', + 'MAX_COL_LEN' => 26, + 'QNAV_BUTTONS' => 20, + 'HNAV_BUTTONS' => 22, + 'SORT_DEFAULT' => 'Rating', + '3D_GRAPHS' => 1, + 'USE_MAILPARSE' => 1, + 'OPTMODE' => 'NONE', + 'LOCAL_DOMAIN' => 'localhost', + 'AUTODETECT' => 1, + 'OPENSOURCE' => 0, + /* 'DATE_FORMAT' => '%d.%m.%Y %H:%M' */ + 'DATE_FORMAT' => '%b %d %H:%M' + ); + +/* + * Determine which extensions are available + */ +if ($CONFIG['AUTODETECT'] == 1 || $CONFIG['AUTODETECT'] == "") { + $CONFIG['PREFERENCES_EXTENSION'] = 0; + $CONFIG['LARGE_SCALE'] = 0; + $CONFIG['DOMAIN_SCALE'] = 0; + + $buffer = ""; + $handle = popen ("/usr/local/bin/dspam --version", "r"); + + while (!feof($handle)) { + $buffer .= fgets($handle, 4096); + } + + pclose($handle); + + if (strpos($buffer, '--enable-preferences-extension') !== false) { + $CONFIG['PREFERENCES_EXTENSION'] = 1; + } + if (strpos($buffer, '--enable-large-scale') !== false) { + $CONFIG['LARGE_SCALE'] = 1; + } + if (strpos($buffer, '--enable-domain-scale') !== false) { + $CONFIG['DOMAIN_SCALE'] = 1; + } +} + +/* + * Determine admin status + */ + +$CONFIG['ADMIN'] = isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER']); + +/* + * Determine which user should be used to display DSPAm related data + */ +$CURRENT_USER = $HTTP_SERVER_VARS['AUTH_USER']; + +if (empty($CONFIG['ADMIN']) && + strpos($_SERVER['SCRIPT_NAME'], "wizard.php") !== false) { + + $group = $config['system']['user'][$userindex[$HTTP_SERVER_VARS['AUTH_USER']]]['groupname']; + $home = "/" . getGroupHomePage($group); + if ($home == "/") { $home = "/index.php"; } + + if (! headers_sent()) { + pfSenseHeader($home); + exit; + } else { + $htmlstr = <<< EOD +<html> + <head> + <title>Unauthorized Access</title> + <meta http-equiv="refresh" content="2; URL={$home}"> + </head> + <body> + <h3>Unauthorized Access - You will be redirected shortly!</h3> + </body> +</html> +EOD; + print $htmlstr; + exit; + } +} + +/* + * only DSPAM admins can change the current user without logging out + * and logging in as another user again. + */ +if ($_POST) { + if (! empty($_POST['username']) && $CONFIG['ADMIN'] == 1) { + $CURRENT_USER = $_POST['username']; + } +} +if ($_GET) { + if (! empty($_GET['user']) && $CONFIG['ADMIN'] == 1) { + $CURRENT_USER = $_GET['user']; + } +} + +if ($CURRENT_USER == "") { + $input_errors[] = "System Error. I was unable to determine your identity."; +} + +preg_replace('/%CURRENT_USER%/', $CURRENT_USER, $CONFIG['DSPAM_ARGS']); + +/* current store */ +$PREF =& GetPrefs($CURRENT_USER); +$CURRENT_STORE = $PREF['localStore']; +if ($CURRENT_STORE == "") {$CURRENT_STORE = $CURRENT_USER; } + +$USER = GetPath($CURRENT_STORE); +$MAILBOX = $USER . ".mbox"; +$TMPFILE = $USER . ".tmp"; + +/* + * Set up initial display variables + */ +CheckQuarantine(); +$DATA['REMOTE_USER'] = $CURRENT_USER; + +/* + * Check whether DSPAM is already configured. + */ +$install_errors =& check_dspam_installation(); +$input_errors = array_merge($input_errors, $install_errors); + +/* + * Check whether we should generate notification messages + */ +if (isset($config['installedpackages']['dspam']['config'][0]['notification-email'])) { + $tmpmsg = createNotificationMessages(); + if (! empty($tmpmsg)) + $tmpmsg .= "\n" . createUserNotificationMessages(); + else + $tmpmsg = createUserNotificationMessages(); + + $savemsg =& $tmpmsg; +} + +/* + * Process Commands + */ +if (isset($pgtitle) && is_array($pgtitle)) { + /* Performance */ + if (basename($_SERVER['SCRIPT_NAME']) == "dspam-perf.php") { + if ($_GET) { + if ($GET['command'] == "resetStats") { + ResetStats(); + } else if ($GET['command'] == "tweak") { + Tweak(); + } + } + + $display_errors =& DisplayIndex(); + $input_errors = array_merge($input_errors, $display_errors); + } + + /* Preferences */ + else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-prefs.php") { + $savemsg = ""; + $prefs_errors =& DisplayPreferences(NULL, $savemsg); + $input_errors = array_merge($input_errors, $prefs_errors); + } + + /* Quarantine */ + else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-quarantine.php") { + if ($_GET) { + if ($_GET['command'] == "viewMessage") { + $showpart = 0; + $ctype = 0; + $sortby = "Rating"; + $currentPage = 1; + $qPerPage = 0; + + if (isset($_GET['showpart'])) { $showpart = $_GET['showpart']; } + if (isset($_GET['ctype'])) { $ctype = intval($_GET['ctype']); } + if (isset($_GET['sortby'])) { $sortby = $_GET['sortby']; } + if (isset($_GET['page'])) { $currentPage = $_GET['page']; } + if (isset($_GET['qperpage'])) { $qPerPage = $_GET['qperpage']; } + + $quarantine_errors =& QuarantineViewMessage($_GET['signatureID'], + $showpart, + $ctype, + $sortby, + $currentPage, + $qPerPage); + $input_errors = array_merge($input_errors, $quarantine_errors); + } else if (isset($_GET['sortby'])) { + $qperpage = $CONFIG['QUARANTINE_PER_PAGE']; + if (isset($_GET['qperpage'])) { $qperpage = $_GET['qperpage']; } + $page = 1; + if (isset($_GET['page'])) { $page = $_GET['page']; } + + $quarantine_errors =& DisplayQuarantine($_GET['sortby'], + intval($page), + intval($qperpage)); + $input_errors = array_merge($input_errors, $quarantine_errors); + } else if (isset($_GET['qperpage'])) { + if (isset($_GET['page'])) { + $quarantine_errors =& DisplayQuarantine($CONFIG['SORT_DEFAULT'], + intval($_GET['page']), + intval($_GET['qperpage'])); + $input_errors = array_merge($input_errors, $quarantine_errors); + } else { + $quarantine_errors =& DisplayQuarantine($CONFIG['SORT_DEFAULT'], + 1, + intval($_GET['qperpage'])); + $input_errors = array_merge($input_errors, $quarantine_errors); + } + } else { + $displayq_errors =& DisplayQuarantine($CONFIG['SORT_DEFAULT'], 1); + $input_errors = array_merge($input_errors, $displayq_errors); + } + } else if ($_POST) { + if ($_POST['command'] == "processQuarantine") { + $signatures = array(); + + while (list($key, $val) = each($_POST)) { + if (strpos($key, "chkmsg") !== false) { + $signatures[$key] = $val; + } + } + if ($_POST['processAction']) { + $processq_errors =& ProcessQuarantine($signatures, + $_POST['processAction'], + $_POST['sortby'], + intval($_POST['qpage']), + intval($_POST['qperpage'])); + $input_errors = array_merge($input_errors, $processq_errors); + } else { + $processq_errors =& ProcessQuarantine($signatures, + "None", + $_POST['sortby'], + intval($_POST['qpage']), + intval($_POST['qperpage'])); + $input_errors = array_merge($input_errors, $processq_errors); + } + } else if ($_POST['command'] == "processFalsePositive") { + $processfp_errors =& ProcessFalsePositive($_POST['signatureID'], + $_POST['sortby'], + intval($_POST['qpage']), + intval($_POST['qperpage'])); + $input_errors = array_merge($input_errors, $processfp_errors); + $displayq_errors =& DisplayQuarantine($_POST['sortby'], + intval($_POST['qpage']), + intval($_POST['qperpage'])); + $input_errors = array_merge($input_errors, $displayq_errors); + } + } else { + /* usually this particular line of code should not be hit because + * the user always triggers a GET or POST action. Unfortunatly at + * the time, the alerts page is implemented in a way that neither + * triggers a GET nor a POST action if initially accessed via the + * tab. Hence this final catch all else. + */ + $displayq_errors =& DisplayQuarantine($CONFIG['SORT_DEFAULT'], 1); + $input_errors = array_merge($input_errors, $displayq_errors); + } + } + + /* Analysis */ + else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-analysis.php") { + $displaya_errors =& DisplayAnalysis(); + $input_errors = array_merge($input_errors, $displaya_errors); + } + + /* History */ + else if (in_array(gettext("History"), $pgtitle)) { + if ($_POST) { + /* Form fields that may be submited via POST: + * - command + * - username + * - msgid$retrain_checked_msg_no (checkbox, multible times) + */ + $checked = array(); + + while (list($key, $val) = each($_POST)) { + if (strpos($key, "msgid") !== false) { + $checked[] = $val; + } + } + + $displayh_errors =& DisplayHistory($_POST['command'], + "", + $checked, + $_POST['username'], + "", + $_POST['hpage'], + $_POST['hperpage']); + $input_errors = array_merge($input_errors, $displayh_errors); + } else if ($_GET) { + /* Form fields that may be submited via GET: + * - history_page + * - command + * - signatureID + * - retrain + * - user + */ + $displayh_errors =& DisplayHistory($_GET['command'], + $_GET['signatureID'], + NULL, + $_GET['user'], + $_GET['retrain'], + isset($_GET['page']) ? intval($_GET['page']) : 1, + isset($_GET['hperpage']) ? $_GET['hperpage'] : $CONFIG['QUARANTINE_PER_PAGE']); + $input_errors = array_merge($input_errors, $displayh_errors); + } else { + $displayh_errors =& DisplayHistory("", // command + "", // signature ID + NULL, // signatures to be retrained + $CURRENT_USER); + $input_errors = array_merge($input_errors, $displayh_errors); + } + } else if (in_array(gettext("Fragment"), $pgtitle)) { + if ($_GET) { + $displayf_errors =& DisplayFragment($_GET['signatureID'], + $_GET['from'], + $_GET['subject'], + $_GET['info'], + $_GET['time']); + $input_errors = array_merge($input_errors, $displayf_errors); + } + } + + /* Info Page */ + else if (basename($_SERVER['SCRIPT_NAME']) == "dspam.php") { + $info_errors =& DisplayInfos(); + $input_errors = array_merge($input_errors, $info_errors); + } + +/* ========================================================================== */ +/* = A D M I N R E L A T E D F U N C T I O N C A L L S = */ +/* ========================================================================== */ + + /* Status */ + else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-admin.php" && $CONFIG['ADMIN']) { + $displays_errors =& DisplayStatus(); + $input_errors = array_merge($input_errors, $displays_errors); + } + + /* User Statistics */ + else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-admin-stats.php" && $CONFIG['ADMIN']) { + $displayus_errors =& DisplayUserStatistics(); + $input_errors = array_merge($input_errors, $displayus_errors); + } + + /* Preferences */ + else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-admin-prefs.php" && $CONFIG['ADMIN']) { + $savemsg = ""; + $displayap_errors =& DisplayAdminPreferences($savemsg); + $input_errors = array_merge($input_errors, $displayap_errors); + } +} else { + $input_errors[] = "The page you did request can't be processed by <code>dspam.inc</code>."; +} + +/* ========================================================================== */ +/* = A D M I N S T A T U S F U N C T I O N S = */ +/* ========================================================================== */ + +function DisplayAdminPreferences(&$statusmsg) { + return DisplayPreferences("admin", $statusmsg); +} + +function DisplayUserStatistics() { + global $CONFIG, $DATA; + $b = "rowEven"; + + $sl_total = 0; + $il_total = 0; + $sm_total = 0; + $fp_total = 0; + $sc_total = 0; + $ic_total = 0; + $mailbox_total = 0; + + $pd = popen("{$CONFIG['DSPAM_STATS']} 2>&1", "r"); + + while (!feof($pd)) { + $line = chop( fgets($pd, 4096) ); + + if ($b == "qrowEven") { + $b = "qrowOdd"; + } else { + $b = "qrowEven"; + } + + $line = preg_replace('/:/', ' ', $line); + + list($username, , $sl, , $il, , $fp, , $sm, , $sc, , $ic) + = (preg_split('/\s+/', $line)); + if ($username == "" && $sl == "") { + /* we do not want to display data that + * does not bleong to any user + */ + continue; + } else if ($sl == "") { + $line = fgets($pd, 4096); + $line = preg_replace('/:/', ' ', $line); + list(, , $sl, , $il, , $fp, , $sm, , $sc, , $ic) + = (preg_split('/\s+/', $line)); + } + + $PREFS =& GetPrefs($username, GetPath($username).".prefs"); + if ($PREFS['enableBNR'] == "on") { $PREFS['enableBNR'] = "OFF"; } + if ($PREFS['enableWhitelist'] == "on") { $PREFS['enableWhitelist'] = "OFF"; } + $PREFS['spamAction'] = ucfirst($PREFS['spamAction']); + $PREFS['enableBNR'] = strtoupper($PREFS['enableBNR']); + $PREFS['enableWhitelist'] = strtoupper($PREFS['enableWhitelist']); + + $mailbox = GetPath($username).".mbox"; + if ( file_exists($mailbox) ) { + $mailbox_size = filesize($mailbox); + $mailbox_display = sprintf("%2.1f KB", ($mailbox_size / 1024)); + $mailbox_total += $mailbox_size; + } + else { + $mailbox_display = "--"; + } + + $sl_total += $sl; + $il_total += $il; + $sm_total += $sm; + $fp_total += $fp; + $sc_total += $sc; + $ic_total += $ic; + + $DATA['TABLE'] .= "<tr><td class=\"{$b}\"><a href=\"{$CONFIG['DSPAM_CGI']}?user={$username}\">{$username}</A></td>" . + " <td class=\"{$b} rowDivider\" align=\"right\" nowrap=\"nowrap\">{$mailbox_display}</td>" . + " <td class=\"{$b} rowDivider\">{$sl}</td>" . + " <td class=\"{$b}\">{$il}</td>" . + " <td class=\"{$b}\">{$fp}</td>" . + " <td class=\"{$b}\">{$sm}</td>" . + " <td class=\"{$b}\">{$sc}</td>" . + " <td class=\"{$b}\">{$ic}</td>" . + " <td class=\"{$b} rowDivider\">{$PREFS['trainingMode']}</td>" . + " <td class=\"{$b}\">{$PREFS['spamAction']}</td>" . + " <td class=\"{$b}\">{$PREFS['enableBNR']}</td>" . + " <td class=\"{$b}\">{$PREFS['enableWhitelist']}</td>" . + " <td class=\"{$b}\">{$PREFS['statisticalSedation']}</td>" . + " <td class=\"{$b}\">{$PREFS['signatureLocation']}</td>" . + "</tr>\n"; + } + pclose($pd); + + $mailbox_total_display = sprintf("%2.1f KB", ($mailbox_total / 1024)); + + $b = "listhdrr"; + $DATA['TABLE'] .= "<tr><td class=\"{$b}\">Total</td>". + " <td class=\"{$b} rowDivider\" align=\"right\" nowrap=\"nowrap\">{$mailbox_total_display}</td>". + " <td class=\"{$b} rowDivider\">{$sl_total}</td>". + " <td class=\"{$b}\">{$il_total}</td>". + " <td class=\"{$b}\">{$sm_total}</td>". + " <td class=\"{$b}\">{$fp_total}</td>". + " <td class=\"{$b}\">{$sc_total}</td>". + " <td class=\"{$b}\">{$ic_total}</td>". + " <td class=\"{$b} rowDivider\"> </td>". + " <td class=\"{$b}\"> </td>". + " <td class=\"{$b}\"> </td>". + " <td class=\"{$b}\"> </td>". + " <td class=\"{$b}\"> </td>". + " <td class=\"{$b}\"> </td>". + "</tr>\n"; +} + +function &DisplayStatus() { + global $CONFIG, $DATA; + + $LOG = "{$CONFIG['DSPAM_HOME']}/system.log"; + $spam_daily = array(); + $nonspam_daily = array(); + $period_daily = array(); + $fp_daily = array(); + $sm_daily = array(); + $inoc_daily = array(); + $whitelist_daily = array(); + $spam_weekly = array(); + $nonspam_weekly = array(); + $period_weekly = array(); + $fp_weekly = array(); + $sm_weekly = array(); + $inoc_weekly = array(); + $$whitelist_weekly = array(); + $msgpersecond = array(); + $classes = array(); + + list (, $min, $hour, $mday, $mon, $year, , ,) = (localtime(time())); + $hmstart = time() - 60; + $daystart = mktime(0, 0, 0, $mon, $mday, $year); + $periodstart = $daystart - (3600*24*24); /* 2 Weeks ago */ + $dailystart = time() - (3600*23); + $c_weekly = 0; /* Cursor to most recent time slot */ + $c_daily = 0; + + if (! file_exists($LOG)) { + return $input_errors[] = "No historical data is available (log file »{$LOG}« does not exist)."; + } + + /* Initialize each individual time period */ + + for ($i = 0; $i <= 23; $i++) { + $h = To12Hour($hour - (23-$i)); + $period_daily[$i] = $h; + $spam_daily[$i] = 0; + $nonspam_daily[$i] = 0; + $sm_daily[$i] = 0; + $fp_daily[$i] = 0; + $inoc_daily[$i] = 0; + } + + for ($i = 0; $i <= 23; $i++) { + $d = $daystart - (3600 * 24 * (24 - $i)); + list (, , , $lday, $lmon, $lyear, , ,) = (localtime($d)); + $lmon++; + $lyear += 1900; + $period_weekly[$i] = "{$lmon}/{$lday}/{$lyear}"; + $spam_weekly[$i] = 0; + $nonspam_weekly[$i] = 0; + $sm_weekly[$i] = 0; + $fp_weekly[$i] = 0; + $inoc_weekly[$i] = 0; + } + + if($fd = @fopen("{$LOG}", "r")) { + while (!feof($fd)) { + $line = fgets($fd, 4096); + list ($t_log, $c_log, , $signature, , $e_log) = preg_split('/\t/', $line); + if ($t_log > time()) { continue; } + + $last_message = $t_log; + + /* Only Parse Log Data in our Time Period */ + if ($t_log >= $periodstart) { + list (, $tmin, $thour, $tday, $tmon, $tyear) = (localtime($t_log)); + $tmon++; + $tyear += 1900; + + /* Weekly Graph */ + $c_weekly = 0; + while($period_weekly[$c_weekly] <> "{$tmon}/{$tday}/{$tyear}" && $c_weekly < 24) { + $c_weekly++; + } + + if ($c_log == "E") { + if ($classes[$signature] == "S") { + $spam_weekly[$c_weekly]--; + if ($spam_weekly[$c_weekly] < 0) { $spam_weekly[$c_weekly] = 0; } + } else if ($classes[$signature] == "I") { + $nonspam_weekly[$c_weekly]--; + if ($nonspam_weekly[$c_weekly] < 0) { $nonspam_weekly[$c_weekly] = 0; } + } else if ($classes[$signature] == "W") { + $whitelist_weekly[$c_weekly]--; + if ($whitelist_weekly[$c_weekly] < 0) { $whitelist_weekly[$c_weekly] = 0; } + } else if ($classes[$signature] == "F") { + $spam_weekly[$c_weekly]++; $fp_weekly[$c_weekly]--; + if ($fp_weekly[$c_weekly] < 0) { $fp_weekly[$c_weekly] = 0; } + } else if ($classes[$signature] == "M") { + $sm_weekly[$c_weekly]--; $nonspam_weekly[$c_weekly]++; + if ($sm_weekly[$c_weekly] < 0) { $sm_weekly[$c_weekly] = 0; } + } else if ($classes[$signature] == "N") { + $inoc_weekly[$c_weekly]--; + if ($inoc_weekly[$c_weekly] < 0) { $inoc_weekly[$c_weekly] = 0; } + } + } else { + $classes[$signature] = $c_log; + } + + if ($c_log == "S") { $spam_weekly[$c_weekly]++; } + if ($c_log == "I") { $nonspam_weekly[$c_weekly]++; } + if ($c_log == "W") { $whitelist_weekly[$c_weekly]++; } + if ($c_log == "F") + { $spam_weekly[$c_weekly]--; $fp_weekly[$c_weekly]++; + if ($spam_weekly[$c_weekly] < 0) { $spam_weekly[$c_weekly] = 0; } + } + if ($c_log == "M") + { $sm_weekly[$c_weekly]++; $nonspam_weekly[$c_weekly]--; + if ($nonspam_weekly[$c_weekly] < 0) { $nonspam_weekly[$c_weekly] = 0; } + } + if ($c_log == "N") { $inoc_weekly[$c_weekly]++; } + + + /* Daily Graph */ + if ($t_log >= $dailystart) { + while($period_daily[$c_daily] <> To12Hour($thour) && $c_daily < 24) { + $c_daily++; + } + + if ($c_log == "E") { + if ($classes[$signature] == "S") { + $spam_daily[$c_daily]--; + if ($spam_daily[$c_daily] < 0) { $spam_daily[$c_daily] = 0; } + } else if ($classes[$signature] == "I") { + $nonspam_daily[$c_daily]--; + if ($nonspam_daily[$c_daily] < 0) { $nonspam_daily[$c_daily] = 0; } + } else if ($classes[$signature] == "W") { + $whitelist_daily[$c_daily]--; + if ($whitelist_daily[$c_daily] < 0) { $whitelist_daily[$c_daily] = 0; } + } else if ($classes[$signature] == "F") { + $spam_daily[$c_daily]++; $fp_daily[$c_daily]--; + if ($fp_daily[$c_daily] < 0) { $fp_daily[$c_daily] = 0; } + } else if ($classes[$signature] == "M") { + $sm_daily[$c_daily]--; $nonspam_daily[$c_daily]++; + if ($sm_daily[$c_daily] < 0) { $sm_daily[$c_daily] = 0; } + } else if ($classes[$signature] == "N") { + $inoc_daily[$c_daily]--; + if ($inoc_daily[$c_daily] < 0) { $inoc_daily[$c_daily] = 0; } + } + } + + if ($c_log == "S") { $spam_daily[$c_daily]++; } + if ($c_log == "I") { $nonspam_daily[$c_daily]++; } + if ($c_log == "W") { $whitelist_daily[$c_daily]++; } + if ($c_log == "F") + { $spam_daily[$c_daily]--; $fp_daily[$c_daily]++; + if ($spam_daily[$c_daily] < 0) { $spam_daily[$c_daily] = 0; } + } + if ($c_log == "M") + { $sm_daily[$c_daily]++; $nonspam_daily[$c_daily]--; + if ($nonspam_daily[$c_daily] < 0) { $nonspam_daily[$c_daily] = 0; } + } + if ($c_log == "N") { $inoc_daily[$c_daily]++; } + } + + /* Last Half-Minute */ + if ($t_log >= $hmstart) { + $msgpersecond[$t_log]++; + $DATA['AVG_PROCESSING_TIME'] += $e_log; + $keycount_exectime++; + } + } + } // end while + + fclose($fd); + } else { + return $input_errors[] = "Unable to open logfile: {$LOG}."; + } // end if + + /* Calculate Avg. Messages Per Second */ + foreach(array_values($msgpersecond) as $el) { + $DATA['AVG_MSG_PER_SECOND'] += $el; + } + $DATA['AVG_MSG_PER_SECOND'] /= 60; + $DATA['AVG_MSG_PER_SECOND'] = sprintf("%2.2f", $DATA['AVG_MSG_PER_SECOND']); + + /* Calculate Avg. Processing Time */ + if ($keycount_exectime == 0) { + $DATA['AVG_PROCESSING_TIME'] = 0; + } else { + $DATA['AVG_PROCESSING_TIME'] /= $keycount_exectime; + } + $DATA['AVG_PROCESSING_TIME'] = sprintf("%01.6f", $DATA['AVG_PROCESSING_TIME']); + + /* Calculate Number of processes, Uptime and Mail Queue length */ + $pd = popen("{$CONFIG['ALL_PROCS']} | grep dspam | grep -v grep | grep -v cgi | grep -v sock | wc -l", "r"); + $DATA['DSPAM_PROCESSES'] = fgets($pd, 4096); + pclose($pd); + + $pd = popen("uptime", "r"); + $DATA['UPTIME'] = fgets($pd, 4096); + pclose($pd); + + $pd = popen("{$CONFIG['MAIL_QUEUE']}", "r"); + $DATA['MAIL_QUEUE'] = fgets($pd, 4096); + pclose($pd); + + /* Calculate Graphs */ + $DATA['SPAM_TODAY'] = $spam_weekly[24]; + $DATA['NONSPAM_TODAY'] = $nonspam_weekly[24]; + $DATA['SM_TODAY'] = $sm_weekly[24]; + $DATA['FP_TODAY'] = $fp_weekly[24]; + $DATA['INOC_TODAY'] = $inoc_weekly[24]; + $DATA['TOTAL_TODAY'] = $DATA['SPAM_TODAY'] + $DATA['NONSPAM_TODAY'] + $DATA['SM_TODAY'] + + $DATA['FP_TODAY'] + $DATA['INOC_TODAY']; + + $DATA['SPAM_THIS_HOUR'] = $spam_daily[23]; + $DATA['NONSPAM_THIS_HOUR'] = $nonspam_daily[23]; + $DATA['SM_THIS_HOUR'] = $sm_daily[23]; + $DATA['FP_THIS_HOUR'] = $fp_daily[23]; + $DATA['INOC_THIS_HOUR'] = $inoc_daily[23]; + $DATA['TOTAL_THIS_HOUR'] = $DATA['SPAM_THIS_HOUR'] + + + $DATA['NONSPAM_THIS_HOUR'] + + $DATA['SM_THIS_HOUR'] + + $DATA['FP_THIS_HOUR'] + + $DATA['INOC_THIS_HOUR']; + + if (is_array($spam_daily) && + is_array($nonspam_daily) && + is_array($sm_daily) && + is_array($fp_daily) && + is_array($inoc_daily) && + is_array($whitelist_daily) && + is_array($period_daily)) { + $DATA['DATA_DAILY'] = join(",", $spam_daily) + . "_" + . join(",", $nonspam_daily) + . "_" + . join(",", $sm_daily) + . "_" + . join(",", $fp_daily) + . "_" + . join(",", $inoc_daily) + . "_" + . join(",", $whitelist_daily) + . "_" + . join(",", $period_daily); + + foreach($spam_daily as $el){ $DATA['TS_DAILY'] += $el; }; + foreach($nonspam_daily as $el){ $DATA['TI_DAILY'] += $el; } + foreach($sm_daily as $el){ $DATA['SM_DAILY'] += $el; } + foreach($fp_daily as $el){ $DATA['FP_DAILY'] += $el; } + foreach($inoc_daily as $el){ $DATA['INOC_DAILY'] += $el; } + foreach($whitelist_daily as $el){ $DATA['TI_DAILY'] += $el; } + } + + if (is_array($spam_weekly) && + is_array($nonspam_weekly) && + is_array($sm_weekly) && + is_array($fp_weekly) && + is_array($inoc_weekly) && + is_array($whitelist_weekly) && + is_array($period_weekly)) { + $DATA['DATA_WEEKLY'] = join(",", $spam_weekly) + . "_" + . join(",", $nonspam_weekly) + . "_" + . join(",", $sm_weekly) + . "_" + . join(",", $fp_weekly) + . "_" + . join(",", $inoc_weekly) + . "_" + . join(",", $whitelist_weekly) + . "_" + . join(",", $period_weekly); + + foreach($spam_weekly as $el){ $DATA['TS_WEEKLY'] += $el; } + foreach($nonspam_weekly as $el){ $DATA['TI_WEEKLY'] += $el; } + foreach($sm_weekly as $el){ $DATA['SM_WEEKLY'] += $el; } + foreach($fp_weekly as $el){ $DATA['FP_WEEKLY'] += $el; } + foreach($inoc_weekly as $el){ $DATA['INOC_WEEKLY'] += $el; } + foreach($whitelist_weekly as $el){ $DATA['TI_WEEKLY'] += $el; } + } +} + +function &DisplayInfos() { + global $CONFIG, $DATA, $g; + $validity = "valide"; + + $pd = @popen("{$CONFIG['DSPAM']} --version", "r"); + fgets($pd, 4096); // ignore 1st line + $DATA['DSPAM_VERSION'] = fgets($pd, 4096); + fgets($pd, 4096); // ignore next line + $DATA['DSPAM_COPYRIGHT'] = fgets($pd, 4096); + $DATA['DSPAM_WEBSITE'] = fgets($pd, 4096); + fgets($pd, 4096); // ignore next line + $DATA['DSPAM_COPYRIGHT_TEXT'] = fgets($pd, 4096); + $DATA['DSPAM_COPYRIGHT_TEXT'] .= " " . fgets($pd, 4096); + fgets($pd, 4096); // ignore next line + $DATA['DSPAM_CONFIGURE_ARGS'] = str_replace("Configuration parameters: ", "", fgets($pd, 4096)); + + pclose($pd); + + if (file_exists("{$g['conf_path']}/nione.lic") && + file_exists("{$g['conf_path']}/nione.lic.sha1")) { + if ($fd = @fopen("{$g['conf_path']}/nione.lic", "r")) { + $owneru = str_replace("Licensed User: ", "", fgets($fd, 4096)); + if ($owneru == "") { $validity = "invalide (owner data not found)"; } + $ownerc = str_replace("Company: ", "", fgets($fd, 4096)); + if ($ownerc == "") { $validity = "invalide (company not found)"; } + $lkey = str_replace("License Key: ", "", fgets($fd, 4096)); + if ($lkey == "") { $validity = "invalide (license key not found)"; } + $pdate = strtotime( str_replace("Purchase Date: ", "", fgets($fd, 4096)) ); + if ($pdate == "") { $validity = "invalide (purchase date not found)"; } + + fclose($fd); + } else { + $validity = "invalide (license files not found)"; + } + + require_once ("knione"); + $gen_lkey = getNIONEKey(trim($owneru), trim($ownerc)); + if (trim($lkey) <> $gen_lkey) { $validity = "invalide (wrong license key)"; } + + $cdate = mktime(0, 0, 0, date("m"), + date("d"), + date("Y")); + + $edate = mktime(0, 0, 0, date("m", $pdate), + date("d", $pdate), + date("Y", $pdate)+1); + + if ($edate < $cdate || + $pdate > $cdate) { + $validity = "invalide (license expired)"; + } + + if ($fd = @fopen("{$g['conf_path']}/nione.lic.sha1", "r")) { + $chksum = str_replace("SHA1 (nione.lic) = ", "", fgets($fd, 4096)); + $chksum_new = sha1_file("{$g['conf_path']}/nione.lic"); + + if (trim($chksum) !== trim($chksum_new)) { + $validity = "invalide (wrong license file checksum)"; + } + + fclose($fd); + } else { + $validity = "invalide (license files not found)"; + } + } else { + $validity = "invalide (license files not found)"; + } + + $DATA['OWNER'] = $owneru; + $DATA['COMPANY'] = $ownerc; + $DATA['LICENSE_KEY'] = $lkey; + $DATA['LICENSE_VALIDITY'] = $validity; + $DATA['PURCHASE_DATE'] = date("F j, Y", $pdate); + $DATA['EXPIRY_DATE'] = date("F j, Y", $edate); +} + +/* ========================================================================== */ +/* = H I S T O R Y F U N C T I O N S = */ +/* ========================================================================== */ + +function &DisplayFragment($sigID = "", + $from = "", + $subject = "", + $info = "", + $time = "") { + global $DATA, $USER; + + $sigID = preg_replace('/\/', '///', $sigID); + + $DATA['FROM'] = $from; + $DATA['SUBJECT'] = $subject; + $DATA['INFO'] = $info; + $DATA['TIME'] = $time; + + if($fd = @fopen("{$USER}.frag/{$sigID}.frag", "r")) { + while (!feof($fd)) { + /* sanitize HTML markup */ + $line = preg_replace("/</e", "'<'", fgets($fd, 4096)); + $line = preg_replace("/>/e", "'>'", $line); + $DATA['MESSAGE'] .= $line; + } + fclose($fd); + } else { + return $input_errors[] = "Unable to open file {$USER}.frag/{$sigID}.frag."; + } +} + +function &DisplayHistory($command = "", + $sigID= "", + $retrainChecked = array(), + $username = "", + $retrainParam = "", + $currentPage = 1, + $hPerPage = 0) { + global $CONFIG, $USER, $CURRENT_USER, $DATA; + + $buffer = array(); + $history = array(); + $rec = array(); + $rowclass = "rowEven"; + + if ($command == "retrainChecked" && count ($retrainChecked) > 0) { + foreach($retrainChecked as $el) { + list ($retrain, $signature) = split(":", $el); + if ($retrain == "innocent") { + ProcessFalsePositive(quotemeta($signature)); + } else if ($retrain == "innocent" || $retrain == "spam") { + system("{$CONFIG['DSPAM']} --source=error --class=" . quotemeta($retrain) . + " --signature=" . quotemeta($signature) . + " --user " . quotemeta($CURRENT_USER)); + } + } + // TODO: Do we need the other params which were submited during the current + // POS/GET request? + pfSenseHeader("/dspam-history.php?user={$username}&page={$currentPage}&hperpage={$hPerPage}"); + } else { + if ($retrainParam <> "") { + if ($retrainParam == "innocent") { + ProcessFalsePositive(); + } else { + system("{$CONFIG['DSPAM']} --source=error --class=" . quotemeta($retrainParam) . + " --signature=" . quotemeta($sigID) . + " --user " . quotemeta($CURRENT_USER)); + } + // TODO: Do we need the other params which were submited during the current + // POS/GET request? + pfSenseHeader("/dspam-history.php?user={$username}&page={$currentPage}&hperpage={$hPerPage}"); + } + } + + $LOG = "{$USER}.log"; + if (! file_exists($LOG)) { + return $input_errors[] = "No historical data is available (log file »{$USER}.log« does not exist)."; + } + + /* Preseed retraining information and delivery errors */ + + $fd = fopen($LOG, "r"); + while (!feof($fd)) { + /* TODO: If the subject line contains a <TAB>, the below array would + * contain more then seven elements and thus would be invalide. + * + * The below code is some kind of a bug fix. + */ + $cline = fgets($fd, 4096); + $log_columns = preg_split("/\t/", $cline); + list($time, $class, $from, $signature, $subject, $info, $messageid) = $log_columns; + if (count ($log_columns) > 7) { + /* get values from the array beginning */ + $time = array_shift($log_columns); + $class = array_shift($log_columns); + $from = array_shift($log_columns); + $signature = array_shift($log_columns); + /* get msgid and info from the array end */ + $messageid = array_pop($log_columns); + $info = array_pop($log_columns); + /* the remaining parts are belonging to the subject */ + $subject = implode(" ", $log_columns); + } + + if ($signature == "") { continue; } + if ($class == "M" || $class == "F" || $class == "E") { + if ($class == "E") { + $rec[$signature]['info'] = $info; + } else if ($class == "F" || $class == "M") { + $rec[$signature]['class'] = $class; + $rec[$signature]['count']++; + if ($rec[$signature]['info'] == "") + { $rec[$signature]['info'] = $info; } + } + /* filter out resents if there are any. Since it's the same + * message we only allow retraining on the 1st occurence of it. + */ + } else if ($messageid == "" || + $rec[$signature]['messageid'] != $messageid || + $CONFIG['HISTORY_DUPLICATES'] <> "no") { + $rec[$signature]['time'] = $time; + $rec[$signature]['class'] = $class; + $rec[$signature]['from'] = $from; + $rec[$signature]['signature'] = $signature; + $rec[$signature]['subject'] = $subject; + $rec[$signature]['info'] = $info; + $rec[$signature]['messageid'] = $messageid; + + array_unshift($buffer, $rec[$signature]); + } + } // end while + fclose($fd); + + /* if the page size wasn't specified, set a default one */ + if ($CONFIG['HISTORY_PER_PAGE'] == 0) { + $CONFIG['HISTORY_PER_PAGE'] = 50; + } + + if (isset($hPerPage) && $hPerPage > 0) { + $CONFIG['HISTORY_PER_PAGE'] = $hPerPage; + } + + if (isset($currentPage) && isset($CONFIG['HISTORY_PER_PAGE'])) { + $pages = ceil( (count ($buffer) / $CONFIG['HISTORY_PER_PAGE']) ); + $begin = (($currentPage - 1) * $CONFIG['HISTORY_PER_PAGE']); + $ranges = ceil ($pages / $CONFIG['HNAV_BUTTONS']); + + /* Now lets just keep the information that we really need. */ + $buffer = array_splice($buffer, $begin, $CONFIG['HISTORY_PER_PAGE']); + } + + $retrain_checked_msg_no = 0; + while ($rec = array_pop($buffer)) { + $time = $rec['time']; + $class = $rec['class']; + $from = $rec['from']; + $signature = $rec['signature']; + $subject = $rec['subject']; + $info = $rec['info']; + $messageid = $rec['messageid']; + + if ($signature == "") { continue; } + if ($rec[$signature]['displayed'] <> "") { continue; } + if ($class == "E") { continue; } + $rec[$signature]['displayed'] = 1; + + /* Resends of retrained messages will need the original from/subject line */ + if ($messageid <> "") { + if ($from == "<None Specified>") { $from = $rec[$messageid]['from']; } + if ($subject == "<None Specified>") { $subject = $rec[$messageid]['subject']; } + + + if ($rec[$messageid]['from'] == "") { $rec[$messageid]['from'] = $from; } + if ($rec[$messageid]['subject'] == "") { $rec[$messageid]['subject'] = $subject; } + } + + if ($from == "") { $from = "<None Specified>"; } + if ($subject == "") { $subject = "<None Specified>"; } + + $ctime = ""; + if(isset($CONFIG["DATE_FORMAT"])) { + $ctime = strftime($CONFIG["DATE_FORMAT"], localtime($time)); + } else { + /* date format was taken from ctime.pl */ + $ctime = date ("D M d H:i:s TY",$time); + $ttmp = preg_split("/\s+/", $ctime); + $t = preg_split("/\:/", $ttmp[3]); + $xtmp = preg_split("/\s+/", $ctime); + $x = $xtmp[0]; + $m = "a"; + if ($t[0] > 12) { $t[0] -= 12; $m = "p"; } + if ($t[0] == 0) { $t[0] = 12; } + $ctime = "{$x} {$t[0]}:{$t[1]}{$m}"; + } + + /* Set the appropriate type and label for this message */ + + $cl = ""; + $cllabel = ""; + if ($rec[$signature]['class'] <> "") { $class = $rec[$signature]['class']; } + if ($class == "S") { $cl = "spam"; $cllabel="SPAM"; } + else if ($class == "I") { $cl = "innocent"; $cllabel="Good"; } + else if ($class == "F") { + if (fmod($rec[$signature]['count'], 2) != 0) { + $cl = "false"; $cllabel="Miss"; + } else { + $cl = "innocent"; $cllabel="Good"; + } + } + else if ($class == "M") { + if (fmod($rec[$signature]['count'], 2) != 0) { + $cl = "missed"; $cllabel="Miss"; + } else { + $cl = "spam"; $cllabel="SPAM"; + } + } + else if ($class == "N") { $cl = "inoculation"; $cllabel="Spam"; } + else if ($class == "C") { $cl = "blacklisted"; $cllabel="RBL"; } + else if ($class == "W") { $cl = "whitelisted"; $cllabel="Whitelist"; } + if ($messageid <> "") { + if ($rec[$messageid]['resend'] <> "") { + $cl = "relay"; + $cllabel = "Resend"; + } + $rec[$messageid]['resend'] = $signature; + } + + if ($rec[$signature]['info'] <> "") { $info = $rec[$signature]['info']; } + + /* sanitize HTML markup */ + $from = preg_replace("/</e", "'<'", $from); + $from = preg_replace("/>/e", "'>'", $from); + $subject = preg_replace('/</e', "'<'", $subject); + $subject = preg_replace('/>/e', "'>'", $subject); + + if (strlen($from) > $CONFIG['MAX_COL_LEN']) { $from = substr($from, 0, $CONFIG['MAX_COL_LEN']) . "..."; } + if (strlen($subject) > $CONFIG['MAX_COL_LEN']) { $subject = substr($subject, 0, $CONFIG['MAX_COL_LEN']) . "..."; } + + $rclass = ""; + if ($class == "I" || $class == "W" || $class == "F") { $rclass = "spam"; } + if ($class == "S" || $class == "M") { $rclass = "innocent"; } + + $retrain = ""; + if (preg_match('/^(M|F)$/', $rec[$signature]['class']) > 0 && + fmod($rec[$signature]['count'], 2) != 0) { + $retrain = "<b>Retrained</b>"; + } + + if ($retrain == "") { + $retrain = "<A HREF=\"/dspam-history.php?page={$currentPage}&hperpage={$hPerPage}&user={$username}&retrain={$rclass}&signatureID={$signature}\">As " . ucfirst($rclass) . "</A>"; + } else { + $retrain .= "(<A HREF=\"/dspam-history.php?page={$currentPage}&hperpage={$hPerPage}&user={$username}&retrain={$rclass}&signatureID={$signature}\">Undo</A>)"; + } + + $path = "{$USER}.frag/{$signature}.frag"; + if (file_exists($path)) { + $pairs = array(); + $pairs['template'] = "fragment"; + $pairs['signatureID'] = $signature; + $sub = $subject; + $sub = preg_replace('/#/e', '//', $sub); + $sub = preg_replace("/(['])/e", '/\\$1/', $sub); + $pairs['subject'] = $sub; + $pairs['from'] = $from; + $pairs['info'] = $info; + $pairs['time'] = $ctime; + $pairs['user'] = $username; + $pairs['page'] = $currentPage; + $pairs['hperpage'] = $hPerPage; + $url = SafeVars($pairs); + $from = "<a href=\"javascript:openwin(580,400,1,'/dspam-hfragment.php?{$url}')\">{$from}</a>"; + } + + $entry = <<<EOD + <tr> + <td align="left" valign="top" class="{$rowclass} {$cl}" nowrap="true"><small>{$cllabel}</small></td> + <td align="left" valign="top" class="{$rowclass}" nowrap="true"> + <small> + <input class="formfld" name="msgid{$retrain_checked_msg_no}" id="msgid{$retrain_checked_msg_no}" title="Check/Uncheck" type="checkbox" value="{$rclass}:{$signature}"> + <label for="msgid{$retrain_checked_msg_no}">{$retrain}</label> + </small> + </td> + <td align="left" valign="top" class="{$rowclass}" nowrap="true"><small>{$ctime}</small></td> + <td align="left" valign="top" class="{$rowclass}" nowrap="true"><small>{$from}</small></td> + <td align="left" valign="top" class="{$rowclass}" nowrap="true"><small>{$subject}</small></td> + <td align="left" valign="top" class="{$rowclass}" nowrap="true"><small>{$info}</small></td> + </tr> + +EOD; + + $retrain_checked_msg_no++; + array_push($history, $entry); + + if ($rowclass == "qrowEven") { + $rowclass = "qrowOdd"; + } else { + $rowclass = "qrowEven"; + } + $hurtz++; + } // end while + + $entry = <<<EOD + <input name="history_page" type="hidden" value="{$history_page}"> + +EOD; + array_push($history, $entry); + + while($line = array_pop($history)) { $DATA['HISTORY'] .= $line; } + + if ($CONFIG['HISTORY_PER_PAGE'] > 0) { + /* prepare quarantine navbar */ + if (($currentPage - 1) >= 1) { $previousPage = $currentPage - 1; } + else { $previousPage = 1; } + + if (($currentPage + 1) <= $pages) { $nextPage = $currentPage + 1; } + else { $nextPage = $pages; } + + $historyFooterBegin = <<<EOD + <tr> + <td align="right" valign="middle" class="listtopic" colspan="6"> + <span class="qnavbtn" onmouseover="this.style.backgroundColor='#A5B9E1;'" onmouseout="this.style.backgroundColor='#507DCD;'" title="First Page (1)"><a href="/dspam-history.php?page=1&qperpage={$CONFIG['HISTORY_PER_PAGE']}" title="First Page (1)">|<</a></span> + <span class="qnavbtn" onmouseover="this.style.backgroundColor='#A5B9E1;'" onmouseout="this.style.backgroundColor='#507DCD;'" title="Page {$previousPage}"><a href="/dspam-history.php?page={$previousPage}&qperpage={$CONFIG['HISTORY_PER_PAGE']}" title="Page {$previousPage}"><</a></span> + +EOD; + + $historyFooterEnd = <<<EOD + <span class="qnavbtn" onmouseover="this.style.backgroundColor='#A5B9E1;'" onmouseout="this.style.backgroundColor='#507DCD;'" title="Page {$nextPage}"><a href="/dspam-history.php?page={$nextPage}&qperpage={$CONFIG['HISTORY_PER_PAGE']}" title="Page {$nextPage}">></a></span> + <span class="qnavbtn" onmouseover="this.style.backgroundColor='#A5B9E1;'" onmouseout="this.style.backgroundColor='#507DCD;'" title="Last Page ({$pages})"><a href="/dspam-history.php?page={$pages}&qperpage={$CONFIG['HISTORY_PER_PAGE']}" title="Last Page ({$pages})">>|</a></span> + </td> + </tr> + +EOD; + + $ranges_array = array(); + $rpages = $pages; + for ($i = 0; $i < $ranges; $i++) { + $range = array(); + $range['start'] = (($i + 1)* $CONFIG['HNAV_BUTTONS']) - ($CONFIG['HNAV_BUTTONS'] - 1); + + if (($i + 1) == $ranges) { + $range['end'] = ($range['start'] + $rpages) - 1; + } else { + $range['end'] = (($i + 1)* $CONFIG['HNAV_BUTTONS']); + $rpages -= $CONFIG['HNAV_BUTTONS']; + } + + $ranges_array[$i] = $range; + } + + /* generate nav buttons */ + foreach($ranges_array as $range){ + if ($currentPage >= $range['start'] && $currentPage <= $range['end']) { + for ($i = $range['start']; ; $i++) { + if ($i > $range['end']) { + break; + } else { + if ($i == $currentPage) { + $historyFooter .= "<span class=\"qnavbtnhl\">{$i}</span> \n"; + } else { + $historyFooter .= "<span class=\"qnavbtn\" onmouseover=\"this.style.backgroundColor='#A5B9E1;'\" onmouseout=\"this.style.backgroundColor='#507DCD;'\" title=\"Page {$i}\"><a href=\"/dspam-history.php?page={$i}&hperpage={$CONFIG['HISTORY_PER_PAGE']}\" title=\"Page {$i}\">{$i}</a></span> \n"; + } + } + } + } + } + + $DATA['HISTORY_FOOTER'] = $historyFooterBegin . $historyFooter .$historyFooterEnd; + $DATA['HPAGES'] = $pages; + $DATA['HPAGE'] = $currentPage; + +/* + $DATA['HISTORY'] .= "<tr><td align=\"left\" valign=\"top\" colspan=\"6\"><center>["; + if (($history_pages > 1) && ($history_page > 1)) { + $i = $history_page - 1; + $DATA['HISTORY'] .= "<a href=\"/dspam-history.php?user={$username}&history_page={$i}\"> < </a>"; + } + for($i = 1; $i <= $history_pages; $i++) { + if ($i == $history_page) { + $DATA['HISTORY'] .= "<a href=\"/dspam-history.php?user={$username}&history_page={$i}\"><big><strong> $i </strong></big></a>"; + } else { + $DATA['HISTORY'] .= "<a href=\"/dspam-history.php?user={$username}&history_page={$i}\"> {$i} </a>"; + } + } + if (($history_pages > 1) && ($history_page < $history_pages)) { + $i = $history_page + 1; + $DATA['HISTORY'] .= "<a href=\"/dspam-history.php?user={$username}&history_page={$i}\"> > </a>"; + } + $DATA['HISTORY'] .= "]</center></td></tr>"; +*/ + } // end if +} + +/* ========================================================================== */ +/* = A N A L Y S I S F U N C T I O N S = */ +/* ========================================================================== */ + +function &DisplayAnalysis() { + global $USER, $CURRENT_USER, $CONFIG, $DATA; + $LOG = "{$USER}.log"; + + $Stats = array( + "daily" => array(), + "weekly" => array() + ); + + list(, $min, $hour, $mday, $mon, $year, , ,) = (localtime(time())); + $daystart = mktime(0, 0, 0, $mon, $mday, $year); + $periodstart = $daystart - (3600 * 24 * 13); /* 2 Weeks ago */ + $dailystart = time() - (3600 * 23); + + /* TODO: There's an issue that the Perl timelocal returns + * different values compared to PHP's mktime. There's a + * difference of 2678400, which will be added manually below. + */ + $daystart += 2678400; + $periodstart += 2678400; + + if (file_exists($LOG)) { + if ($fd = @fopen($LOG, "r")) { + $scount = 0; + $icount = 0; + $wcount = 0; + $fcount = 0; + $mcount = 0; + + while(!feof($fd)) { + $buffer = fgets($fd, 4096); + /* drop blank lines */ + if (strlen($buffer) == 0) { continue; } + list($t_log, $c_log) = preg_split("/\t/", $buffer); + + /* Only Parse Log Data in our Time Period */ + /* TODO: The below if should evaluate to true at least for some data */ + if ($t_log >= $periodstart) { + list(, $tmin, $thour, $tday, $tmon, , , ,) = (localtime($t_log)); + $tmon++; + + foreach (array('weekly', 'daily') as $period) { + $idx = 0; + if ($period == "weekly") { + $idx= "{$tmon}/{$tday}"; + } else { + if ($t_log <= $dailystart) { continue; } + $idx = To12Hour($thour); + } + if (is_array($Stats[$period]) && ! array_key_exists ($idx, $Stats[$period])) { + $Stats[$period][$idx] = array( + 'nonspam' => 0, + 'spam' => 0, + 'title' => $idx, + 'idx' => $t_log); + } + /* TODO: Is passing by reference here correct? */ + $hr =& $Stats[$period][$idx]; + /* S => spam */ + if ($c_log== "S") { + $hr['spam']++; + $scount++; + } + /* I => innocent W => whitelisted */ + if ($c_log == "I" || $c_log == "W") { + $hr['nonspam']++; + if ($c_log == "I") { $icount++; } + else { $wcount++; } + } + /* F => false positive */ + if ($c_log == "F") { + $hr['spam']--; + if ($hr['spam'] < 0) { $hr['spam'] = 0; } + $hr['nonspam']++; + $fcount++; + } + /* M => spam miss */ + if ($c_log == "M") { + $hr['nonspam']--; + if ($hr['nonspam'] < 0) { $hr['nonspam'] = 0; } + $hr['spam']++; + $mcount++; + } + } + } + } + + fclose($fd); + } else { + return $input_errors[] = "Unable to open log file: {$LOG}."; + } + + usort ((array_values ($Stats[$period])), "cmpArrayValues"); + + foreach (array('weekly', 'daily') as $period) { + $uc_period = strtoupper($period); + $hk = "DATA_{$uc_period}"; + $lst = array(); + + foreach (array_values($Stats[$period]) as $hr) { + foreach (array('spam', 'nonspam', 'title') as $type ) { + + if (empty($lst[$type])) { + $lst[$type] = array(); + } + + /* populate (newly) created array */ + $lst[$type][] = $hr[$type]; + + $totk=""; + + if ($type == "spam") { $totk="S"; } + else if ($type == "nonspam") { $totk="I"; } + + if ($totk == "") { continue; } + + $sk="T{$totk}_{$uc_period}"; + if (empty($DATA[$sk])) { $DATA[$sk] = 0; } + + $DATA[$sk] += $hr[$type]; + } + } // end foreach + $DATA[$hk] = + @join(",",$lst['spam']) . "_" . + @join(",",$lst['nonspam']) . "_" . + @join(",",$lst['title']); + } // end foreach + } else { + return $input_errors[] = "No historical data is available (log file »{$LOG}« does not exist)."; + } // end if +} + +function cmpArrayValues($a, $b) { + if ($a['idx'] == $b['idx']) + return 0; + + return ($a['idx'] < $b['idx']) ? -1 : 1; +} + +/* ========================================================================== */ +/* = P E R E F E R E N C E S F U N C T I O N S = */ +/* ========================================================================== */ + +function &DisplayPreferences($mode = "", &$statusmsg){ + global $USER, $CURRENT_USER, $CONFIG, $DATA; + $FILE = "{$USER}.prefs"; + $username = $CURRENT_USER; + + if ($_POST) { + $pconfig = $_POST; + + if ($pconfig['chk_feature_nr'] <> "on") { + $pconfig['chk_feature_nr'] = "off"; + } + + if ($pconfig['chk_feature_optin'] <> "on") { + $pconfig['chk_feature_optin'] = "off"; + } + + if ($pconfig['chk_feature_optout'] <> "on") { + $pconfig['chk_feature_optout'] = "off"; + } + + if ($pconfig['chk_feature_at'] <> "on") { + $pconfig['chk_feature_at'] = "off"; + } + + if ($pconfig['chk_feature_aw'] <> "on") { + $pconfig['chk_feature_aw'] = "off"; + } + + if ($CONFIG['PREFERENCES_EXTENSION'] == 1) { + if ($pconfig['msgtag'] == "") { + $pconfig['msgtag'] = "''"; + } else { + $pconfig['msgtag'] = quotemeta($pconfig['msgtag']); + } + + exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . + " trainingMode " . quotemeta($pconfig['rad_train']) . " > /dev/null"); + exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . + " spamAction " . quotemeta($pconfig['rad_train_action']) . " > /dev/null"); + exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . + " signatureLocation " . quotemeta($pconfig['signatureLocation']) . " > /dev/null"); + exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . + " spamSubject " . quotemeta($pconfig['msgtag']) . " > /dev/null"); + exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . + " statisticalSedation " . quotemeta($pconfig['rad_filter_sens']) . " > /dev/null"); + exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . + " enableBNR " . quotemeta($pconfig['chk_feature_nr']) . " > /dev/null"); + exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . + " optOut " . quotemeta($pconfig['chk_feature_optout']) . " >/dev/null"); + exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . + " optIn " . quotemeta($pconfig['chk_feature_optin']) . " >/dev/null"); + exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . + " showFactors " . quotemeta($pconfig['chk_feature_at']) . " > /dev/null"); + exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . + " enableWhitelist " . quotemeta($pconfig['chk_feature_aw']) . " > /dev/null"); + } else { + $prefsstr = <<<EOD +trainingMode={$pconfig['rad_train']} +spamAction={$pconfig['rad_ident_action']} +spamSubject={$pconfig['msgtag']} +statisticalSedation={$pconfig['rad_filter_sens']} +enableBNR={$pconfig['chk_feature_nr']} +optIn={$pconfig['chk_feature_optin']} +optOut={$pconfig['chk_feature_optout']} +showFactors={$pconfig['chk_feature_at']} +enableWhitelist={$pconfig['chk_feature_aw']} +signatureLocation={$pconfig['rad_train_action']} + +EOD; + + if ($fd = @fopen("{$FILE}","w")) { + fwrite($fd, $prefsstr); + fclose($fd); + } else { + return $input_errors[] = "Unable to write preferences to file: {$FILE}"; + } + } + + $statusmsg = "DSPAM preferences have been written to: {$FILE}."; + } + + $PREFS =& GetPrefs($username); + + $DATA["SEDATION_{$PREFS['statisticalSedation']}"] = 'checked="checked"'; + $DATA["S_{$PREFS['trainingMode']}"] = 'checked="checked"'; + $DATA["S_ACTION_" . strtoupper($PREFS['spamAction'])] = 'checked="checked"'; + $DATA["S_LOC_" . strtoupper($PREFS['signatureLocation'])] = 'checked="checked"'; + $DATA["SPAM_SUBJECT"] = $PREFS['spamSubject']; + if ($PREFS['optIn'] == "on") { + $DATA['C_OPTIN'] = 'checked="checked"'; + } + if ($PREFS['optOut'] == "on") { + $DATA['C_OPTOUT'] = 'checked="checked"'; + } + if ($PREFS['enableBNR'] == "on") { + $DATA['C_BNR'] = 'checked="checked"'; + } + if ($PREFS['showFactors'] == "on") { + $DATA['C_FACTORS'] = 'checked="checked"'; + } + if ($PREFS['enableWhitelist'] == "on") { + $DATA['C_WHITELIST'] = 'checked="checked"'; + } +} + +function sortByRating($a, $b){ + if ($a['rating'] == $b['rating']) { + return 0; + } + + return ($a['rating'] < $b['rating']) ? -1 : 1; +} + +/* ========================================================================== */ +/* = Q U A R A N T I N E F U N C T I O N S = */ +/* ========================================================================== */ + +function &ProcessQuarantine($signatures = array(), + $action = "None", + $sortBy = "Rating", + $currentPage = 1, + $qPerPage = 0){ + switch($action){ + case "None": + $input_errors =& DisplayQuarantine($sortBy, $currentPage, $qPerPage); + break; + case "manyNotSpam": + $input_errors =& QuarantineManyNotSpam($signatures, $sortBy, $currentPage, $qPerPage); + break; + case "deleteAll": + QuarantineDeleteSpam($action, $signatures, $sortBy, $currentPage, $qPerPage); + break; + default: + QuarantineDeleteSpam(); + } // switch + + CheckQuarantine(); + + return $input_errors; +} + +function &ProcessFalsePositive($sigID = "", + $sortBy = "Rating", + $currentPage = 1, + $qPerPage = 0) { + global $MAILBOX, $CONFIG, $TMPFILE, $CURRENT_USER; + $buffer = array(); + $head = array(); + $singatures = array(); + $found = 0; + $error = false; + + if ($sigID == "") { + return $input_errors[] = "No Message ID Specified."; + } + + /* read the user's mailbox line by line into a buffer */ + $fd = fopen("{$MAILBOX}", "r"); + while (!feof($fd)) { + $line = chop(fgets($fd, 4096)); + array_push($buffer, $line); + } + fclose ($fd); + + /* iterate over the mailbox buffer */ + reset($buffer); + $i = 0; + while ($i < count($buffer)) { + $temp = array(); + $head = array(); + $mode = 0; + $buff = ""; + + /* this while tries to iterate over one single mesage including + * the message header and the message body. + */ + while((preg_match('/^From /', $buff) == 0) && ($i < count($buffer))) { + $buff = $buffer[0]; + + /* switch mode if we are hitting DSPAMs + * pseudo From QUARANTINE line (without a + * colon after the From). + */ + if (preg_match('/^From /', $buff) > 0) { + if ($mode == 0) { $mode = 1; } + else { continue; } + } + + $buff = array_shift($buffer); + if (preg_match('/^From /', $buff) == 0) { + array_push($temp, $buff); + } + + continue; + } + + foreach($temp as $tempel) { + if ($tempel == "") { break; } + list($key, $val) = preg_split('/\: ?/', $tempel, 2); + $head[$key] = $val; + } + if ($head['X-DSPAM-Signature'] == $sigID) { + $found = 1; + $old_erep = error_reporting(E_ALL); + if ($pd = @popen("|{$CONFIG['DSPAM']} {$CONFIG['DSPAM_ARGS']} >{$TMPFILE} 2>&1", "w")) { + $pdresult = fread($handle, 2096); + + foreach($temp as $tempel) { + fwrite($pd, "{$tempel}\n"); + } + + pclose($pd); + error_reporting($old_erep); + } else { + $error = true; + $input_errors[] = "Unable to ope process pipe in function <code>ProcessFalsePositive</code>."; + } + } + } + + /* Couldn't find the message, so just retrain on signature */ + if (!$found) { + system("$CONFIG{'DSPAM'} --source=error --class=innocent --signature=" . quotemeta($sigID) . + " --user " . quotemeta($CURRENT_USER)); + } + + if ($error) { + $log = array(); + $fd = fopen("{$TMPFILE}", "r"); + while (!feof($handle)) { + $log .= fgets($fd, 4096); + } + fclose($fd); + unlink("{$TMPFILE}"); + return $input_errors[] = $log; + } + + unlink("{$TMPFILE}"); + $signatures[$sigID] = "on"; + return QuarantineDeleteSpam("", $signatures, $sortBy, $currentPage, $qPerPage); +} + +function &QuarantineManyNotSpam($signatures = array(), $sortBy = "Rating", $currentPage = 1, $qPerPage = 0){ + global $MAILBOX, $USER; + $buffer = array(); + $errors = array(); + + /* read the user's mailbox line by line into a buffer */ + $fd = fopen("{$MAILBOX}", "r"); + while (!feof($fd)) { + $line = chop(fgets($fd, 4096)); + array_push($buffer, $line); + } + fclose ($fd); + + if ($fd_FILE = @fopen("{$MAILBOX}", "w")) { + $fd_RETRAIN = fopen("{$USER}.retrain.log", "a"); + + /* iterate over the mailbox buffer */ + reset($buffer); + $i = 0; + while ($i < count($buffer)) { + $temp = array(); + $head = array(); + $mode = 0; + $buff = ""; + + /* this while tries to iterate over one single mesage including + * the message header and the message body. + */ + while((preg_match('/^From /', $buff) == 0) && ($i < count($buffer))) { + $buff = $buffer[0]; + + /* switch mode if we are hitting DSPAMs + * pseudo From QUARANTINE line (without a + * colon after the From). + */ + if (preg_match('/^From /', $buff) > 0) { + if ($mode == 0) { + $mode = 1; + $buff = array_shift($buffer); + array_push($temp, $buff); + $buff = ""; + continue; + } else { + continue; + } + } + + $buff = array_shift($buffer); + array_push($temp, $buff); + + continue; + } + + /* populate the header array with header fields */ + foreach($temp as $tempel) { + if ($tempel == "") { break; } + list($key, $val) = preg_split('/\: ?/', $tempel, 2); + $head[$key] = $val; + } + + $delivered = 0; + if ($signatures["chkmsg-{$head['X-DSPAM-Signature']}"] <> "") { + $err = Deliver($temp); + if ($err == "") { + $delivered = 1; + } else { + array_push($errors, $err); + } + } + if (!$delivered) { + foreach($temp as $tempel) { + fwrite($fd_FILE, "{$tempel}\n"); + } + } else { + fwrite($fd_RETRAIN, strval(time()) . "\t{$head['X-DSPAM-Signature']}\tinnocent\n"); + } + + $i++; + } // end while + + fclose($fd_FILE); + fclose($fd_RETRAIN); + } else { + return $input_errors[] = "Unable to open mailbox file: {$MAILBOX}."; + } + + if (count($errors) > 0) { + return $errors; + } + + return DisplayQuarantine($sortBy, $currentPage, $qPerPage); +} + +function Deliver($temp = array()) { + global $CONFIG; + + if (! file_exists("/tmp/dspam-error-output.txt")) { + touch("/tmp/dspam-error-output.txt"); + } + $descriptorspec = array( + 0 => array("pipe", "r"), // stdin is a pipe that the child will read from + 1 => array("pipe", "w"), // stdout is a pipe that the child will write to + 2 => array("file", "/tmp/dspam-error-output.txt", "a") // stderr is a file to write to + ); + + list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizeb, + $atime,$mtimeb,$ctime,$blksize,$blocks) + = stat("/tmp/dspam-error-output.txt"); + clearstatcache(); + + $cwd = '/tmp'; + $process = @proc_open("{$CONFIG['DSPAM']} {$CONFIG['DSPAM_ARGS']}", + $descriptorspec, + $pipes); + + if (is_resource($process)) { + foreach($temp as $tempel) { + if (! @fwrite($pipes[0], "{$tempel}\n")) { + return "error while writting to pipe."; + } + } + + fclose($pipes[0]); + fclose($pipes[1]); + $return_value = proc_close($process); + + /* this isn't an elegant solution to determine whether + * DSPAM did report some errors, but it works for now + */ + list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizea, + $atime,$mtimea,$ctime,$blksize,$blocks) + = stat("/tmp/dspam-error-output.txt"); + + if ($mtimeb <> $mtimea) { return "DSPAM did report some errors to /tmp/dspam-error-output.txt.\n" . + "Please check this particular file."; } + } else { + return "process is not a resource type."; + } + + return ""; +} + +function getLayoutedMessage($msgbuffer = "", $sigID = "", $showpart = 0, $ctype = 0){ + + if ($msgbuffer == "") { + return '<span class="errmsg">An error occured while parsing the message (no message).</span>'; + } + if ($sigID == "") { + return '<span class="errmsg">An error occured while parsing the message (no signature).</span>'; + } + + if( extension_loaded( 'mailparse' ) ) { + $msgdate = "N/A"; + $msgfrom = "N/A"; + $msgsub = "N/A"; + $msgto = "N/A"; + + $mime = mailparse_msg_create(); + mailparse_msg_parse($mime, $msgbuffer); + /* return an array of message parts - this contsists of the + * names of the parts only. + */ + $struct = mailparse_msg_get_structure($mime); + $htmlstr = <<<EOD + <tr> + <td align="left" valign="top" class="listtopic" colspan="3">Message Infos</td> + </tr> + <tr> + <td valign="baseline" class="vncell" colspan="1">Date:</td> + <td class="vtable" colspan="2">%MSGDATE%</td> + </tr> + <tr> + <td valign="baseline" class="vncell" colspan="1">From:</td> + <td class="vtable" colspan="2">%MSGFROM%</td> + </tr> + <tr> + <td valign="baseline" class="vncell" colspan="1">Subject:</td> + <td class="vtable" colspan="2">%MSGSUB%</td> + </tr> + <tr> + <td valign="baseline" class="vncell" colspan="1">To:</td> + <td class="vtable" colspan="2">%MSGTO%</td> + </tr> + <tr> + <td class="list" height="12" colspan="3"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic">Message Part</td> + <td align="left" valign="top" class="listtopic">Part Type</td> + <td align="left" valign="top" class="listtopic">Part Encoding</td> + </tr> + <tr> + +EOD; + + /* print a choice of sections */ + foreach($struct as $st) { + + /* get a handle on the message resource for a subsection */ + $section = mailparse_msg_get_part($mime, $st); + /* get content-type, encoding and header information for that section */ + $info = mailparse_msg_get_part_data($section); + + /* replace placeholder with real data */ + if ($info['headers']['date'] <> "") { + $htmlstr = str_replace("%MSGDATE%", $info['headers']['date'], $htmlstr); + } + if ($info['headers']['from'] <> "") { + $htmlstr = str_replace("%MSGFROM%", $info['headers']['from'], $htmlstr); + } + if ($info['headers']['subject'] <> "") { + $htmlstr = str_replace("%MSGSUB%", $info['headers']['subject'], $htmlstr); + } + if ($info['headers']['to'] <> "") { + $htmlstr = str_replace("%MSGTO%", $info['headers']['to'], $htmlstr); + } + + $fontStyle = ""; + if ($showpart && $showpart == $st) { $fontStyle = " style=\"font-weight: bolder;\""; } + + if ($info["content-type"] == "text/html") { + $htmlstr .= "<td align=\"left\" valign=\"top\" class=\"vncell\"{$fontStyle}>" . + "<a href=\"/dspam-viewmsg.php?ctype=1&showpart={$st}&signatureID={$sigID}&command=viewMessage\">{$st}</a>" . + "</td>\n"; + } else { + $htmlstr .= "<td align=\"left\" valign=\"top\" class=\"vncell\"{$fontStyle}>" . + "<a href=\"/dspam-viewmsg.php?showpart={$st}&signatureID={$sigID}&command=viewMessage\">{$st}</a>" . + "</td>\n"; + } + + $htmlstr .= <<<EOD + <td align="left" valign="top" class="vtable"{$fontStyle}>{$info["content-type"]}</td> + <td align="left" valign="top" class="vtable"{$fontStyle}>{$info["charset"]}</td> + </tr> + +EOD; + } // end foreach + + /* if we were called to display a part, do so now */ + if ($showpart) { + /* get a handle on the message resource for the desired part */ + $sec = mailparse_msg_get_part($mime, $showpart); + + $htmlstr .= <<<EOD + <tr> + <td class="list" height="12" colspan="3"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" colspan="3">Section {$showpart}</td> + </tr> + <tr> + <td align="top" valign="left" colspan="3" class="vncell"> +EOD; + + ob_start(); + mailparse_msg_extract_part($sec, $msgbuffer); + $contents = ob_get_contents(); + ob_end_clean(); + $contents = wordwrap( str_replace(">", ">\n", $contents), 100, "\n" ); + /* quote the message for safe display in a browser */ + if ($ctype = 1) { + /* a html email message */ + $htmlstr .= "<pre style=\"font-size: 1.4em;\">" . $contents . "</pre></td>\n</tr>\n"; + } else { + /* an ASCII (text) email message */ + $htmlstr .= htmlentities($contents) . "</td>\n</tr>\n"; + } + } + + return $htmlstr; + } else { + return '<span class="errmsg">Could not load mailparse extension.</span>'; + } +} + +function &QuarantineViewMessage($sigID = "", + $showpart = 0, + $ctype = 0, + $sortBy = "Rating", + $currentPage = 1, + $qPerPage = 0) { + global $MAILBOX, $DATA; + $buffer = array(); // mailbox buffer + + if ($sigID == "") { + return $input_errors[] = "No Message ID Specified."; + } + + /* save data to be displayed as HTML form data */ + $DATA['MESSAGE_ID'] = $sigID; + $DATA['SHOWPART'] = $showpart; + $DATA['CONTENT_TYPE'] = $ctype; + $DATA['QPAGE'] = $currentPage; + $DATA['SORTBY'] = $sortBy; + + if ($qPerPage > 0) { $CONFIG['QUARANTINE_PER_PAGE'] = $qPerPage; } + + /* read the user's mailbox line by line into a buffer */ + $fd = fopen("{$MAILBOX}", "r"); + while (!feof($fd)) { + $line = chop(fgets($fd, 4096)); + array_push($buffer, $line); + } + fclose ($fd); + + /* iterate over the mailbox buffer */ + reset($buffer); + $i = 0; + while ($i < count($buffer)) { + $temp = array(); + $head = array(); + $mode = 0; + $buff = ""; + + /* this while tries to iterate over one single mesage including + * the message header and the message body. + */ + while((preg_match('/^From /', $buff) == 0) && ($i < count($buffer))) { + $buff = $buffer[0]; + + /* switch mode if we are hitting DSPAMs + * pseudo From QUARANTINE line (without a + * colon after the From). + */ + if (preg_match('/^From /', $buff) > 0) { + if ($mode == 0) { $mode = 1; } + else { continue; } + } + + $buff = array_shift($buffer); + if (preg_match('/^From /', $buff) == 0) { + array_push($temp, $buff); + } + + continue; + } + + /* populate the header array with header fields */ + foreach($temp as $tempel) { + if ($tempel == "") { break; } + list($key, $val) = preg_split('/\: ?/', $tempel, 2); + $head[$key] = $val; + } + if ($head['X-DSPAM-Signature'] == $sigID) { + foreach($temp as $tempel) { + $tempel = preg_replace("/</e", "'<'", $tempel); + $tempel = preg_replace("/>/e", "'>'", $tempel); + $DATA['MESSAGE'] .= "{$tempel}\n"; + } + } + + $i ++; + } // end while +} + +function QuarantineDeleteSpam($deleteAll = "", $signatures = array(), $sortBy = "Rating", $currentPage = 1, $qPerPage = 0){ + global $USER, $MAILBOX; + $buffer = array(); + + /* this is the most easiest operation: If the user wants + * to completly delete any quarantined message, simply + * open his mailbox in write mode, which empties the + * user's mailbox file. + */ + if ($deleteAll <> "") { + + list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = stat("{$USER}.mbox"); + + $fd = fopen("{$USER}.mbox.size", "r"); + $sz = chop(fgets($fd, 4096)); + fclose($fd); + + if ($sz == $size) { + $fd = fopen("{$MAILBOX}", "w"); + fclose($fd); + unlink("{$USER}.mbox.size"); + unlink("{$USER}.mboxwarn"); + } else { + return DisplayQuarantine($sortBy, $currentPage, $qPerPage); + } + + //$FORM{'template'} = "performance"; + CheckQuarantine(); + return DisplayIndex(); + } + + /* iterate over the user's mailbox and store its contents in a buffer */ + $fd = fopen("{$MAILBOX}", "r"); + while (!feof($fd)) { + $line = chop(fgets($fd, 4096)); + array_push($buffer, $line); + } + fclose($fd); + + /* open the user's mailbox in write mode. This empties the mailbox! */ + fopen("{$MAILBOX}", "w"); + + /* iterate over the mailbox buffer */ + reset($buffer); + $i = 0; + while ($i < count($buffer)) { + $temp = array(); + $head = array(); + $mode = 0; + + /* this while tries to iterate over one single mesage including + * the message header and the message body. + */ + while((preg_match('/^From /', $buff) == 0) && ($i < count($buffer))) { + $buff = $buffer[0]; + + /* switch mode if we are hitting DSPAMs + * pseude From QUARANTINE line (without a + * colon after the From). + */ + if (preg_match('/^From /', $buff) > 0) { + if ($mode == 0) { + $mode = 1; + $buff = array_shift($buffer); + array_push($temp, $buff); + $buff = ""; + continue; + } else { + continue; + } + } + $buff = array_shift($buffer); + array_push($temp, $buff); + + continue; + } + + /* populate the header array with header fields */ + foreach($temp as $tempel) { + if ($tempel == "") { break; } + list($key, $val) = preg_split('/\: ?/', $tempel, 2); + $head[$key] = $val; + } + + /* if the current DSPAM signature wasn't selected by the + * user to be deleted, write it back to the user's mailbox. + */ + if ($signatures["chkmsg-{$head['X-DSPAM-Signature']}"] == "") { + foreach($temp as $tempel) { + fwrite($fd, "{$tempel}\n"); + } + } + + $i++; + } // end while + fclose($fd); + + return; +} + +function sortBySubject($a, $b){ + $lca = strtolower ($a['Subject']); + $lcb = strtolower ($b['Subject']); + + return strcmp($lca, $lcb); +} + +function sortByFrom($a, $b){ + $lca = strtolower ($a['From']); + $lcb = strtolower ($b['From']); + + return strcmp($lca, $lcb); +} + +function &DisplayQuarantine($sortBy = "Rating", $currentPage = 1, $qPerPage = 0) { + global $USER, $CURRENT_USER, $CONFIG, $DATA, $MAILBOX; + $alertcfg = &$config['installedpackages']['dspamalerts']['config']; + $alerts = array(); + + if (file_exists("{$USER}.mbox")) { + list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = stat("{$USER}.mbox"); + + $fd = fopen("{$USER}.mbox.size", "w"); + fwrite($fd, "{$size}"); + fclose($fd); + + $fd = fopen("{$MAILBOX}.stamp", "a+"); + fclose($fd); + chmod("{$MAILBOX}.stamp", 0660); + + /* process alert names */ + if (is_array($alertcfg)) { + $alert_counter = 0; + + foreach ($alertcfg as $alert) { + $alerts[$alert_counter] = $alert['alertname']; + $alert_counter++; + } + } + + $mode = ""; + $buffer = array(); + $headings = array(); + $rowclass = "qrowEven"; + $fd = fopen("{$MAILBOX}", "r"); + + while (!feof($fd)) { + $mbxline = chop(fgets($fd, 4096)); + + if ($mbxline <> "") { + if (($mode == "")) { + if (preg_match('/^From /', $mbxline) > 0) { + $mode = 1; + } else { + continue; + } + } + + array_push($buffer, $mbxline); + continue; + } + + if ($mode == "") { continue; } + + $alert = 0; + $new = array(); + + foreach($buffer as $buf_element){ + foreach($alerts as $al){ + if (preg_match("/{$al}/i", $buf_element) > 0) { + $alert = 1; + } + } + + if (preg_match('/^From /', $buf_element) > 0) { + $a = split(' ', $buf_element); + $x = 2; + + for ($i = 0; $i < count ($a); $i++) { + if ((preg_match('/\@|>/', $a[$i]) > 0) && $i > $x) { + $x = $i + 1; + } + } + + for ($i = 1; $i < $x; $i++) { array_shift($a); } + $start = join(" ", $a); + } else { + list($key, $val) = preg_split('/\: ?/', $buf_element, 2); + $new[$key] = $val; + } + } + + if ($rowclass == "qrowEven") { + $rowclass = "qrowOdd"; + } else { + $rowclass = "qrowEven"; + } + + $new['alert'] = $alert; + + if ($alert) { $rowclass="qrowAlert"; } + + $new['Sub2'] = $new['X-DSPAM-Signature']; + if (strlen($new['Subject']) > $CONFIG['MAX_COL_LEN']) { + $new['Subject'] = substr($new['Subject'], 0, $CONFIG['MAX_COL_LEN']) . "..."; + } + + if (strlen($new['From']) > $CONFIG['MAX_COL_LEN']) { + $new['From'] = substr($new['From'], 0, $CONFIG['MAX_COL_LEN']) . "..."; + } + + if ($new['Subject'] == "") { + $new['Subject'] = "<None Specified>"; + } + + //$new->{'rating'} = $new->{'X-DSPAM-Probability'} * $new->{'X-DSPAM-Confidence'}; + $new['rating'] = $new['X-DSPAM-Confidence']; + + foreach(array_keys($new) as $key) { + if ($key == "X-DSPAM-Signature") { continue; } + preg_replace('/</', '/\<\;/', $new[$key]); + preg_replace('/>/', '/\>\;/', $new[$key]); + } + + array_push($headings, $new); + + $buffer = array(); + $mode = ""; + continue; + } // end while (!feof($fd)) + + if (! isset($sortBy) || $sortBy == "") { + $sortBy = $CONFIG['SORT_DEFAULT']; + } + if ($sortBy == "Rating") { + usort($headings, "sortByRating"); + } + if ($sortBy == "Subject") { + usort($headings, "sortBySubject"); + } + if ($sortBy == "From") { + usort($headings, "sortByFrom"); + } + if ($sortBy == "Date") { + array_reverse ($headings); + } + + /* + + <tr> + <td align="left" valign="top" class="listtopic" width="8%"> </td> + <td align="left" valign="top" class="listtopic" width="5%" onclick="sortmsg('Rating');" style="cursor: pointer;">Rating</td> + <td align="left" valign="top" class="listtopic" width="20%" onclick="sortmsg('Date');" style="cursor: pointer;">Date</td> + <td align="left" valign="top" class="listtopic" width="25%" onclick="sortmsg('From');" style="cursor: pointer;">From</td> + <td align="left" valign="top" class="listtopic" width="42%" onclick="sortmsg('Subject');" style="cursor: pointer;">Subject</td> + </tr> + + */ + + $DATA['SORTBY'] = $sortBy; + $DATA['SORT_SELECTOR'] .= <<<EOD + <tr> + <td align="left" valign="top" class="listtopic" width="10%"> </td> + +EOD; + + if ($sortBy == "Rating") { + $DATA{'SORT_SELECTOR'} .= "<td align=\"left\" valign=\"top\" class=\"listtopic\" width=\"5%\" onclick=\"sortmsg('Rating');\" style=\"cursor: pointer;\">Rating ◊</td>"; + } else { + $DATA{'SORT_SELECTOR'} .= "<td align=\"left\" valign=\"top\" class=\"listtopic\" width=\"5%\" onclick=\"sortmsg('Rating');\" style=\"cursor: pointer;\">Rating</td>"; + } + if ($sortBy == "Date") { + $DATA{'SORT_SELECTOR'} .= "<td align=\"left\" valign=\"top\" class=\"listtopic\" width=\"20%\" onclick=\"sortmsg('Date');\" style=\"cursor: pointer;\">Date ◊</td>"; + } else { + $DATA{'SORT_SELECTOR'} .= "<td align=\"left\" valign=\"top\" class=\"listtopic\" width=\"20%\" onclick=\"sortmsg('Date');\" style=\"cursor: pointer;\">Date</td>"; + } + if ($sortBy == "Subject") { + $DATA{'SORT_SELECTOR'} .= "<td align=\"left\" valign=\"top\" class=\"listtopic\" width=\"40%\" onclick=\"sortmsg('Subject');\" style=\"cursor: pointer;\">Subject ◊</td>"; + } else { + $DATA{'SORT_SELECTOR'} .= "<td align=\"left\" valign=\"top\" class=\"listtopic\" width=\"40%\" onclick=\"sortmsg('Subject');\" style=\"cursor: pointer;\">Subject</td>"; + } + if ($sortBy == "From") { + $DATA{'SORT_SELECTOR'} .= "<td align=\"left\" valign=\"top\" class=\"listtopic\" width=\"25%\" onclick=\"sortmsg('From');\" style=\"cursor: pointer;\">From ◊</td>"; + } else { + $DATA{'SORT_SELECTOR'} .= "<td align=\"left\" valign=\"top\" class=\"listtopic\" width=\"25%\" onclick=\"sortmsg('From');\" style=\"cursor: pointer;\">From</td>"; + } + + $DATA{'SORT_SELECTOR'} .= "\n </tr>"; + + if (isset($qPerPage) && $qPerPage > 0) { + $CONFIG['QUARANTINE_PER_PAGE'] = $qPerPage; + } + + if (isset($currentPage) && isset($CONFIG['QUARANTINE_PER_PAGE'])) { + $pages = ceil( (count ($headings) / $CONFIG['QUARANTINE_PER_PAGE']) ); + $begin = (($currentPage - 1) * $CONFIG['QUARANTINE_PER_PAGE']); + $ranges = ceil ($pages / $CONFIG['QNAV_BUTTONS']); + + /* Now lets just keep the information that we really need. */ + $headings = array_splice ($headings, $begin, $CONFIG['QUARANTINE_PER_PAGE']); + } + + $rowclass = "qrowEven"; + foreach ($headings as $row) { + $rating = sprintf("%3.0f%%", $row['rating'] * 100.0); + if ($row['rating'] > 0.8) { + $markclass = "high"; + } else { + if ($row['rating'] < 0.7) { + $markclass = "low"; + } else { + $markclass = "medium"; + } + } + + $PAIRS = array(); + + $PAIRS['signatureID'] = $row['X-DSPAM-Signature']; + $PAIRS['command'] = "viewMessage"; + $PAIRS['user'] = $CURRENT_USER; + $PAIRS['page'] = $currentPage; + $PAIRS['sortby'] = $sortBy; + $PAIRS['qperpage'] = $CONFIG['QUARANTINE_PER_PAGE']; + // $PAIRS['template'] = "quarantine"; + + $url = SafeVars($PAIRS); + $sender = htmlentities ($row['From']); + $rsubject = htmlentities ($row['Subject']); + + if ($row['alert']) { + $outclass = "qrowAlert"; + } else { + $outclass = $rowclass; + } + + $ptfields = preg_split('/\s+/', $row['X-DSPAM-Processed']); + $times = preg_split('/\:/', $ptfields[3]); + $ptime = ""; + if($CONFIG["DATE_FORMAT"]) { + $month = array(); + $month['Jan'] = 0; + $month['Feb'] = 1; + $month['Mar'] = 2; + $month['Apr'] = 3; + $month['May'] = 4; + $month['Jun'] = 5; + $month['Jul'] = 6; + $month['Aug'] = 7; + $month['Sep'] = 8; + $month['Oct'] = 9; + $month['Nov'] = 10; + $month['Dec'] = 11; + $ptime = strftime($CONFIG["DATE_FORMAT"], + mktime($times[2], + $times[1], + $times[0], + $ptfields[2], + $month[$ptfields[1]], + $ptfields[4] - 1900)); + } else { + $mer = "a"; + if ($times[0] > 12) { $times[0] -= 12; $mer = "p"; } + if ($times[0] == 0) { $times[0] = "12"; } + $ptime = "{$ptfields[1]} {$ptfields[2]} {$times[0]}:{$times[1]}{$mer}"; + } + + /* + + <tr> + <td align="left" valign="top" class="vncell"> + <input type="checkbox" class="formfld" title="check" alt="check" name="chkmsg" id="" /> + </td> + <td align="left" valign="top" class="vncell"> + <span style="color: darkblue; font-weight: bold;">50%</span> + </td> + <td align="left" valign="top" class="vncell">Apr 1 05:59a</td> + <td align="left" valign="top" class="vncell">Mar 30 11:08a</td> + <td align="left" valign="top" class="vncell"> + <u>Last chance to register for Frankfurt, 4 April BEA...</u> + </td> + </tr> + + <tr> + <td align="left" valign="top" class="{$outclass}" nowrap="true"> + <input type="checkbox" class="formfld" title="check" alt="check" name="{$row['X-DSPAM-Signature']}" id="{$row['X-DSPAM-Signature']}" /> + </td> + <td align="left" valign="top" class="{$outclass} {$markclass}" nowrap="true"> + {$rating} + </td> + <td align="left" valign="top" class="{$outclass}" nowrap="true">{$ptime}</td> + <td align="left" valign="top" class="{$outclass}" nowrap="true">{$row['From']}</td> + <td align="left" valign="top" class="{$outclass}" nowrap="true"> + <a href="{$CONFIG['ME']}?{$url}">{$row['Subject']}</a> + </td> + </tr> + */ + + $DATA['QUARANTINE'] .= <<<EOD + <tr> + <td align="left" valign="top" class="{$outclass}" nowrap="true"> + <input type="checkbox" class="formfld" title="check" alt="check" name="chkmsg-{$row['X-DSPAM-Signature']}" id="{$row['X-DSPAM-Signature']}" /> + </td> + <td align="left" valign="top" class="{$outclass} {$markclass}" nowrap="true"> + {$rating} + </td> + <td align="left" valign="top" class="{$outclass}" nowrap="true">{$ptime}</td> + <td align="left" valign="top" class="{$outclass}" nowrap="true">{$sender}</td> + <td align="left" valign="top" class="{$outclass}" nowrap="true"> + <a href="/dspam-viewmsg.php?{$url}">{$rsubject}</a> + </td> + </tr> + +EOD; + + if ($rowclass == "qrowEven") { + $rowclass = "qrowOdd"; + } else { + $rowclass = "qrowEven"; + } + } // end foreach ($headings as $row) + + /* prepare quarantine navbar */ + if (($currentPage - 1) >= 1) { $previousPage = $currentPage - 1; } + else { $previousPage = 1; } + + if (($currentPage + 1) <= $pages) { $nextPage = $currentPage + 1; } + else { $nextPage = $pages; } + + $quarantineFooterBegin = <<<EOD + <tr> + <td align="left" valign="top" class="listtopic"> + <input type="checkbox" class="formfld" title="check all" alt="check all" name="checkall" id="checkall" onClick="checkallmsgs();" /> + <label for="checkall">All</label> + </td> + <td align="right" valign="middle" class="listtopic" colspan="4"> + <span class="qnavbtn" onmouseover="this.style.backgroundColor='#A5B9E1;'" onmouseout="this.style.backgroundColor='#507DCD;'" title="First Page (1)"><a href="/dspam-quarantine.php?page=1&qperpage={$CONFIG['QUARANTINE_PER_PAGE']}" title="First Page (1)">|<</a></span> + <span class="qnavbtn" onmouseover="this.style.backgroundColor='#A5B9E1;'" onmouseout="this.style.backgroundColor='#507DCD;'" title="Page {$previousPage}"><a href="/dspam-quarantine.php?page={$previousPage}&qperpage={$CONFIG['QUARANTINE_PER_PAGE']}" title="Page {$previousPage}"><</a></span> + +EOD; + + $quarantineFooterEnd = <<<EOD + <span class="qnavbtn" onmouseover="this.style.backgroundColor='#A5B9E1;'" onmouseout="this.style.backgroundColor='#507DCD;'" title="Page {$nextPage}"><a href="/dspam-quarantine.php?page={$nextPage}&qperpage={$CONFIG['QUARANTINE_PER_PAGE']}" title="Page {$nextPage}">></a></span> + <span class="qnavbtn" onmouseover="this.style.backgroundColor='#A5B9E1;'" onmouseout="this.style.backgroundColor='#507DCD;'" title="Last Page ({$pages})"><a href="/dspam-quarantine.php?page={$pages}&qperpage={$CONFIG['QUARANTINE_PER_PAGE']}" title="Last Page ({$pages})">>|</a></span> + </td> + </tr> + +EOD; + + $ranges_array = array(); + $rpages = $pages; + for ($i = 0; $i < $ranges; $i++) { + $range = array(); + $range['start'] = (($i + 1)* $CONFIG['QNAV_BUTTONS']) - ($CONFIG['QNAV_BUTTONS'] - 1); + + if (($i + 1) == $ranges) { + $range['end'] = ($range['start'] + $rpages) - 1; + } else { + $range['end'] = (($i + 1)* $CONFIG['QNAV_BUTTONS']); + $rpages -= $CONFIG['QNAV_BUTTONS']; + } + + $ranges_array[$i] = $range; + } + + /* generate nav buttons */ + foreach($ranges_array as $range){ + if ($currentPage >= $range['start'] && $currentPage <= $range['end']) { + for ($i = $range['start']; ; $i++) { + if ($i > $range['end']) { + break; + } else { + if ($i == $currentPage) { + $quarantineFooter .= "<span class=\"qnavbtnhl\">{$i}</span> \n"; + } else { + $quarantineFooter .= "<span class=\"qnavbtn\" onmouseover=\"this.style.backgroundColor='#A5B9E1;'\" onmouseout=\"this.style.backgroundColor='#507DCD;'\" title=\"Page {$i}\"><a href=\"/dspam-quarantine.php?page={$i}&qperpage={$CONFIG['QUARANTINE_PER_PAGE']}\" title=\"Page {$i}\">{$i}</a></span> \n"; + } + } + } + } + } + + $DATA['QUARANTINE_FOOTER'] = $quarantineFooterBegin . $quarantineFooter .$quarantineFooterEnd; + $DATA['QPAGES'] = $pages; + $DATA['QPAGE'] = $currentPage; + } else { + $input_errors[] = "Unable to open DSPAM quarantine mailbox at »{$USER}.mbox«. " . + "If you are a DSPAM admin user you can savely " . + "ignore this error because such users usually do not " . + "have a DSPAM mailbox/quarantine."; + } + + return $input_errors; +} + +/* ========================================================================== */ +/* = P E R F O R M A N C E F U N C T I O N S = */ +/* ========================================================================== */ + +function ResetStats() { + global $USER; + + $fd = fopen("{$USER}.stats", "r"); + $ts = chop(fgets($fd, 4096)); + $group = chop(fgets($fd, 4096)); + fclose($fd); + list($ts, $ti, $tm, $fp, $sc, $ic) = split(",", $ts); + + if ($group <> "") { + $GROUP = GetPath($group) . ".stats"; + $fd = fopen("{$GROUP}", "r"); + $gts = chop(fgets($fd, 4096)); + fclose($fd); + list ($gts, $gti, $gtm, $gfp, $gsc, $gic) = split(",", $gts); + $ts -= $gts; + $ti -= $gti; + $tm -= $gtm; + $fp -= $gfp; + $sc -= $gsc; + $ic -= $gic; + } + + $fd = fopen("{$USER}.rstats", "w"); + fputs($fd, "{$ts}" . "," . "{$ti}" . "," . "{$tm}" . "," . + "{$fp}" . "," . "{$sc}" . "," . "{$ic}\n"); + fclose($fd); +} + +function Tweak() { + global $USER; + + $fd = fopen("{$USER}.rstats", "r"); + $ts = chop(fgets($fd, 4096)); + $group = chop($fgets($fd, 4096)); + fclose($fd); + list($ts, $ti, $tm, $fp, $sc, $ic) = split(",", $ts); + $tm++; + + $fd = fopen("{$USER}.rstats", "w"); + fputs($fd, "{$ts},{$ti},{$tm},{$fp},{$sc},{$ic}\n"); + fclose($fd); +} + +function &DisplayIndex() { + global $USER, $CONFIG, $DATA, $CURRENT_STORE, $CURRENT_USER; + + if (strpos ($CURRENT_USER, "@") === false) { + if (GetDomain($CURRENT_STORE) <> "") + $domain = GetDomain($CURRENT_STORE); + else + $domain = $config['system']['domain']; + + $spamalias = "spam-{$CURRENT_USER}@{$domain}"; + } else { + $spamalias = "spam-{$CURRENT_USER}"; + } + + if ($handle = @fopen ("{$USER}.stats", "r")) { + $spam .= chop(fgets($handle, 4096)); + $group .= chop(fgets($handle, 4096)); + fclose($handle); + list($spam, $innocent, $misses, $fp, $sc, $ic) = split(",", $spam); + + if ($group <> "") { + $GROUP = GetPath($group) . ".stats"; + $fd = fopen("{$GROUP}", "r"); + $gspam = chop(fgets($fd, 4096)); + fclose($fd); + + list($gspam, $ginnocent, $gfp, $gmisses, $gsc, $gic) = preg_split('/\,/', $gspam); + $spam -= $gspam; + $innocent -= $ginnocent; + $misses -= $gmisses; + $fp -= $gfp; + $sc -= $gsc; + $ic -= $gic; + } + + if ($spam + $innocent > 0) { + $ratio = sprintf("%2.3f", + (($spam+$misses)/($spam+$misses+$fp+$innocent)*100)); + } else { + $ratio = 0; + } + + if (file_exists("{$USER}.rstats")) { + $handle = fopen ("{$USER}.rstats", "r"); + $buffer = chop(fgets($handle, 4096)); + + fclose ($handle); + + list($rts, $rti, $rtm, $rfp) = split(",", $buffer); + + $real_missed = $misses - $rtm; + $real_caught = $spam - $rts; + $real_fp = $fp - $rfp; + + if ($real_fp < 0) { $real_fp = 0; } + + $real_innocent = $innocent - $rti; + + if (($spam - $rts > 0) && ($spam - $rts + $misses - $rtm != 0) && + ($real_caught + $real_missed > 0) && ($real_fp + $real_innocent > 0)) { + $monthly = sprintf("%2.3f", + (100.0-(($real_missed)/($real_caught+$real_missed))*100.0)); + $overall = sprintf("%2.3f", + (100-((($real_missed+$real_fp) / + ($real_fp+$real_innocent+$real_caught+$real_missed))*100))); + } else { + if ($real_caught == 0 && $real_missed > 0) { + $monthly = 0; + $overall = 0; + } else { + $monthly = 100; + $overall = 100; + } + } + + if ($real_fp + $real_innocent > 0) { + $fpratio = sprintf("%2.3f", ($real_fp/($real_fp+$real_innocent)*100)); + } else { + $fpratio = 0; + } + + } else { + $rts = $spam + $misses; + $rti = $innocent; + $rtm = $misses; + $rfp = $fp; + + $handle = fopen ("{$USER}.rstats", "w"); + fwrite("{$rts},{$rti},{$rtm},{$rfp}\n"); + fclose($handle); + + $monthly = "N/A"; + $fpratio = "N/A"; + $overall = "N/A"; + } + + $DATA['TIME'] = $time; + $DATA['TOTAL_SPAM_SCANNED'] = $spam; + $DATA['TOTAL_SPAM_LEARNED'] = $misses; + $DATA['TOTAL_NONSPAM_SCANNED'] = $innocent; + $DATA['TOTAL_NONSPAM_LEARNED'] = $fp; + $DATA['SPAM_RATIO'] = $ratio; + $DATA['SPAM_ACCURACY'] = $monthly; + $DATA['NONSPAM_ERROR_RATE'] = $fpratio; + $DATA['OVERALL_ACCURACY'] = $overall; + $DATA['TOTAL_SPAM_CORPUSFED'] = $sc; + $DATA['TOTAL_NONSPAM_CORPUSFED'] = $ic; + $DATA['TOTAL_SPAM_MISSED'] = $real_missed; + $DATA['TOTAL_SPAM_CAUGHT'] = $real_caught; + $DATA['TOTAL_NONSPAM_MISSED'] = $real_fp; + $DATA['TOTAL_NONSPAM_CAUGHT'] = $real_innocent; + $DATA['SPAM_ALIAS'] = $spamalias; + + $DATA['LOCAL_DOMAIN'] = $CONFIG['LOCAL_DOMAIN']; + } else { + $DATA['SPAM_ACCURACY'] = "N/A"; + $DATA['NONSPAM_ERROR_RATE'] = "N/A"; + $DATA['OVERALL_ACCURACY'] = "N/A"; + $DATA['SPAM_RATIO'] = "N/A"; + $DATA['TOTAL_SPAM_MISSED'] = 0; + $DATA['TOTAL_SPAM_CAUGHT'] = 0; + $DATA['SPAM_RATIO'] = "N/A"; + $DATA['TOTAL_NONSPAM_MISSED'] = 0; + $DATA['TOTAL_NONSPAM_CAUGHT'] = 0; + $DATA['NONSPAM_ERROR_RATE'] = "N/A"; + $DATA['TOTAL_SPAM_LEARNED'] = 0; + $DATA['TOTAL_SPAM_SCANNED'] = 0; + $DATA['TOTAL_NONSPAM_LEARNED'] = 0; + $DATA['TOTAL_NONSPAM_SCANNED'] = 0; + $DATA['TOTAL_SPAM_CORPUSFED'] = 0; + $DATA['TOTAL_NONSPAM_CORPUSFED'] = 0; + $DATA['SPAM_ALIAS'] = $spamalias; + + $input_errors[] = "Unable to open DSPAM stats at »{$USER}.stats«. " . + "If you are a DSPAM admin user you can savely " . + "ignore this error because such users usually do not " . + "have a DSPAM mailbox/quarantine."; + } + + return $input_errors; +} + +/* ========================================================================== */ +/* = G L O B A L F U N C T I O N S = */ +/* ========================================================================== */ + +function &GetPrefs($user) { + global $CONFIG, $USER; + $prefs = array(); + $FILE = "{$USER}.prefs"; + + if ($CONFIG['PREFERENCES_EXTENSION'] == 1) { + $handle = popen ("{$CONFIG['DSPAM_BIN']}/dspam_admin agg pref " . quotemeta($user)); + + while (!feof($handle)) { + $buffer = chop(fgets($handle, 4096)); + list($key, $value) = split("=", $buffer); + $prefs[$key] = $value; + } + + pclose($handle); + + } + + if (count(array_keys($prefs)) == 0 || $CONFIG['PREFERENCES_EXTENSION'] != 1) { + + /* This step is only required if the user + * wants to use the legacy DSPAm CGI app. + */ + if (! file_exists("{$CONFIG['DSPAM_WWW']}/default.prefs")) { + /* try to copy the sample file */ + if (file_exists("{$CONFIG['DSPAM_WWW']}/default.prefs.sample")) { + copy("{$CONFIG['DSPAM_WWW']}/default.prefs.sample", + "{$CONFIG['DSPAM_WWW']}/default.prefs"); + } + } + $handle = fopen ("{$CONFIG['DSPAM_WWW']}/default.prefs", "r"); + + while (!feof($handle)) { + $buffer = chop(fgets($handle, 4096)); + list($key, $value) = split("=", $buffer); + $prefs[$key] = $value; + } + + fclose($handle); + + if(file_exists($FILE)) { + $handle = fopen ($FILE, "r"); + + while (!feof($handle)) { + $buffer = chop(fgets($handle, 4096)); + list($key, $value) = split("=", $buffer); + $prefs[$key] = $value; + } + } + } + return $prefs; +} + +function CheckQuarantine() { + global $MAILBOX, $DATA; + $f = 0; + + if (file_exists($MAILBOX)) { + $handle = fopen($MAILBOX, "r"); + + while (!feof($handle)) { + $buffer = fgets($handle, 4096); + if (preg_match('/^From /', $buffer) <= 0) {continue;} + $f++; + } + + fclose ($handle); + } + + if ($f == 0) { + $f = "Empty"; + } + + $DATA['TOTAL_QUARANTINED_MESSAGES'] = $f; +} + +function http_parse_query( $array = NULL, $convention = '%s' ) { + if( count( $array ) == 0 ) { + return ''; + } else { + if( function_exists( 'http_build_query' ) ){ + $query = http_build_query( $array ); + } else { + $query = ''; + + foreach( $array as $key => $value ) { + if( is_array( $value ) ){ + $new_convention = sprintf( $convention, $key ) . '[%s]'; + $query .= http_parse_query( $value, $new_convention ); + } else { + $key = urlencode( $key ); + $value = urlencode( $value ); + $query .= sprintf( $convention, $key ) . "=$value&"; + } + } + } + + return $query; + } +} + +/* just a wrapper function */ +function SafeVars($PAIRS) { + $url = http_parse_query($PAIRS); + return $url; +} + +function To12Hour($h) { + if ($h < 0) { $h += 24; } + if ($h > 11) { if ($h > 12) { $h -= 12; } $h .= "p"; } + else { if ($h == 0) { $h = "12"; } $h .= "a"; } + return $h; +} + +function GetPath($store) { + global $CONFIG, $USER; + $PATH = ""; + + /* Domain-scalen */ + if ($CONFIG['DOMAIN_SCALE'] == 1) { + $splittmp = (split('@', $store)); + $VPOPUSERNAME = $splittmp[0]; + $VPOPDOMAIN = $splittmp[1]; + if ($VPOPDOMAIN == "") {$VPOPDOMAIN = "local";} + + $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$VPOPDOMAIN}/{$VPOPUSERNAME}/" . + "{$VPOPUSERNAME}"; + return $PATH; + + /* Normal scale */ + } else if ($CONFIG['LARGE_SCALE'] == 0) { + $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$USER}/{$USER}"; + return $PATH; + + /* Large-scale */ + } else { + if (strlen($USER) > 1) { + $PATH = "{$CONFIG['DSPAM_HOME']}/data/" . substr($USER, 0, 1) . + "/". substr($USER, 1, 1) . "/{$USER}/{$USER}"; + } else { + $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$USER}/{$USER}"; + } + return $PATH; + } +} + +function GetUserDir($store) { + global $CONFIG, $USER; + $PATH = ""; + + /* Domain-scalen */ + if ($CONFIG['DOMAIN_SCALE'] == 1) { + $splittmp = (split('@', $store)); + $VPOPUSERNAME = $splittmp[0]; + $VPOPDOMAIN = $splittmp[1]; + if ($VPOPDOMAIN == "") {$VPOPDOMAIN = "local";} + + $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$VPOPDOMAIN}/{$VPOPUSERNAME}"; + return $PATH; + + /* Normal scale */ + } else if ($CONFIG['LARGE_SCALE'] == 0) { + $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$USER}/"; + return $PATH; + + /* Large-scale */ + } else { + if (strlen($USER) > 1) { + $PATH = "{$CONFIG['DSPAM_HOME']}/data/" . substr($USER, 0, 1) . + "/". substr($USER, 1, 1) . "/{$USER}/{$USER}"; + } else { + $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$USER}"; + } + return $PATH; + } +} + +function GetDomain($store) { + global $CONFIG, $USER; + $PATH = ""; + + /* Domain-scalen */ + if ($CONFIG['DOMAIN_SCALE'] == 1) { + $splittmp = (split('@', $store)); + $VPOPUSERNAME = $splittmp[0]; + $VPOPDOMAIN = $splittmp[1]; + if ($VPOPDOMAIN == "") {$VPOPDOMAIN = "local";} + + return $VPOPDOMAIN; + } +} + +function isDSPAMAdmin($username = "") { + global $config, $CONFIG; + + $groupindex = index_groups(); + $userindex = index_users(); + + if ($username == "") { return 0; } + + $gname = $config['system']['group'][$groupindex[$config['system']['user'][$userindex[$username]]['groupname']]]['name']; + + if (isset($gname)) { + return ($gname === $CONFIG['DSPAM_ADMIN_GROUP']); + } + + return 0; +} + +function createUserNotificationMessages() { + global $config, $CONFIG, $USER, $CURRENT_USER, $CURRENT_STORE; + + $firstrun = "{$USER}.firstrun"; + $firstspam = "{$USER}.firstspam"; + $quarantinefull = "{$USER}.quarantinefull"; + $savemsg = ""; + + if (isset($config['installedpackages']['dspam']['config'][0]['dspam-domain'])) + $domain = $config['installedpackages']['dspam']['config'][0]['dspam-domain']; + else + $domain = $config['system']['domain']; + + if (GetDomain($CURRENT_STORE) <> "") + $user_domain = GetDomain($CURRENT_STORE); + else + $user_domain = $config['system']['domain']; + + $userdir = GetUserDir($CURRENT_STORE); + $hostname = $config['system']['hostname']; + $support_user = $config['installedpackages']['dspam']['config'][0]['dspam-contact']; + + /* return if there are no sample files */ + if (! file_exists("{$CONFIG['DSPAM_HOME']}/firstrun.txt.sample") || + ! file_exists("{$CONFIG['DSPAM_HOME']}/firstspam.txt.sample") || + ! file_exists("{$CONFIG['DSPAM_HOME']}/quarantinefull.txt.sample") || + ! file_exists($userdir)) { + return; + } + + /* create firstrun.txt */ + if (! file_exists("{$firstrun}")) { + $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/firstrun.txt.sample"); + + $sample_msg = str_replace("support", $support_user, $sample_msg); + $sample_msg = str_replace("configureme.com", $user_domain, $sample_msg); + $sample_msg = str_replace("http://www.yourdomain.com/dspam/", + "http://{$hostname}.{$domain}/dspam.php", + $sample_msg); + + @file_put_contents("{$firstrun}", $sample_msg); + $savemsg .= " »{$firstrun}«, "; + } + + /* create firstspam.txt */ + if (! file_exists("{$firstspam}")) { + $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/firstspam.txt.sample"); + + $sample_msg = str_replace("support", $support_user, $sample_msg); + $sample_msg = str_replace("configureme.com", $user_domain, $sample_msg); + $sample_msg = str_replace("http://www.yourdomain.com/dspam/", + "http://{$hostname}.{$domain}/dspam.php", + $sample_msg); + + @file_put_contents("{$firstspam}", $sample_msg); + $savemsg .= " »{$firstspam}«, "; + } + + /* create quarantinefull.txt */ + if (! file_exists("{$quarantinefull}")) { + $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/quarantinefull.txt.sample"); + + $sample_msg = str_replace("support", $support_user, $sample_msg); + $sample_msg = str_replace("configureme.com", $user_domain, $sample_msg); + $sample_msg = str_replace("http://www.yourdomain.com/dspam/", + "http://{$hostname}.{$domain}/dspam.php", + $sample_msg); + + @file_put_contents("{$quarantinefull}", $sample_msg); + $savemsg .= " »{$quarantinefull}«."; + } + + if ($savemsg <> "") { + $savemsg = gettext("The following files were created: ") . $savemsg; + return $savemsg; + } + + return; +} + +function createNotificationMessages() { + global $config, $CONFIG, $USER, $CURRENT_USER; + + $firstrun = "{$CONFIG['DSPAM_HOME']}/firstrun.txt"; + $firstspam = "{$CONFIG['DSPAM_HOME']}/firstspam.txt"; + $quarantinefull = "{$CONFIG['DSPAM_HOME']}/quarantinefull.txt"; + $savemsg = ""; + + if (isset($config['installedpackages']['dspam']['config'][0]['dspam-domain'])) + $domain = $config['installedpackages']['dspam']['config'][0]['dspam-domain']; + else + $domain = $config['system']['domain']; + + $hostname = $config['system']['hostname']; + $support_user = $config['installedpackages']['dspam']['config'][0]['dspam-contact']; + + /* return if there are no sample files */ + if (! file_exists("{$CONFIG['DSPAM_HOME']}/firstrun.txt.sample") || + ! file_exists("{$CONFIG['DSPAM_HOME']}/firstspam.txt.sample") || + ! file_exists("{$CONFIG['DSPAM_HOME']}/quarantinefull.txt.sample")) { + return; + } + + /* create firstrun.txt */ + if (! file_exists("{$CONFIG['DSPAM_HOME']}/firstrun.txt")) { + $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/firstrun.txt.sample"); + + $sample_msg = str_replace("support", $support_user, $sample_msg); + $sample_msg = str_replace("configureme.com", $domain, $sample_msg); + $sample_msg = str_replace("http://www.yourdomain.com/dspam/", + "http://{$hostname}.{$domain}/dspam.php", + $sample_msg); + + @file_put_contents("{$firstrun}", $sample_msg); + $savemsg .= " »{$firstrun}«, "; + } + + /* create firstspam.txt */ + if (! file_exists("{$CONFIG['DSPAM_HOME']}/firstspam.txt")) { + $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/firstspam.txt.sample"); + + $sample_msg = str_replace("support", $support_user, $sample_msg); + $sample_msg = str_replace("configureme.com", $domain, $sample_msg); + $sample_msg = str_replace("http://www.yourdomain.com/dspam/", + "http://{$hostname}.{$domain}/dspam.php", + $sample_msg); + + @file_put_contents("{$firstspam}", $sample_msg); + $savemsg .= " »{$firstspam}«, "; + } + + /* create quarantinefull.txt */ + if (! file_exists("{$CONFIG['DSPAM_HOME']}/quarantinefull.txt")) { + $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/quarantinefull.txt.sample"); + + $sample_msg = str_replace("support", $support_user, $sample_msg); + $sample_msg = str_replace("configureme.com", $domain, $sample_msg); + $sample_msg = str_replace("http://www.yourdomain.com/dspam/", + "http://{$hostname}.{$domain}/dspam.php", + $sample_msg); + + @file_put_contents("{$quarantinefull}", $sample_msg); + $savemsg .= " »{$quarantinefull}«."; + } + + if ($savemsg <> "") { + $savemsg = gettext("The following files were created: ") . $savemsg; + return $savemsg; + } + + return; +} + +function &check_dspam_installation() { + global $config; + + /* create RC files if necessary */ + if (! file_exists("/usr/local/etc/rc.d")) { + @mkdir("/usr/local/etc/rc.d"); + } + if (! file_exists("/usr/local/etc/rc.d/000.mysql.sh")) { + @copy("/usr/local/pkg/000.mysql.sh", "/usr/local/etc/rc.d/000.mysql.sh"); + @chmod("/usr/local/etc/rc.d/000.mysql.sh", 0755); + } + if (! file_exists("/usr/local/etc/rc.d/010.clamav-clamd.sh")) { + @copy("/usr/local/pkg/010.clamav-clamd.sh", + "/usr/local/etc/rc.d/010.clamav-clamd.sh"); + @chmod("/usr/local/etc/rc.d/010.clamav-clamd.sh", 0755); + } + if (! file_exists("/usr/local/etc/rc.d/020.clamav-freshclam.sh")) { + @copy("/usr/local/pkg/020.clamav-freshclam.sh", + "/usr/local/etc/rc.d/020.clamav-freshclam.sh"); + @chmod("/usr/local/etc/rc.d/020.clamav-freshclam.sh", 0755); + } + if (! file_exists("/usr/local/etc/rc.d/030.p3scan.sh")) { + @copy("/usr/local/pkg/030.p3scan.sh", + "/usr/local/etc/rc.d/030.p3scan.sh"); + @chmod("/usr/local/etc/rc.d/030.p3scan.sh", 0755); + } + + /* create conf files for those packages DSPAM depends on */ + if (! file_exists("/usr/local/etc/clamd.conf")) { + @copy("/usr/local/pkg/clamd.conf", + "/usr/local/etc/clamd.conf"); + } + if (! file_exists("/usr/local/etc/freshclam.conf")) { + @copy("/usr/local/pkg/freshclam.conf", + "/usr/local/etc/freshclam.conf"); + } + + if (! is_service_running("dspam")) { + $input_errors[] = "The DSPAM daemon process is not running. " . + "If you are certain that you did configure DSPAM " . + "appropriatly, you can start the corresponding process " . + "using the service control panel which is part of the " . + "»Status« menu item."; + } + if (! is_service_running("p3scan")) { + $input_errors[] = "The POP3 proxy process is not running. " . + "If you are certain that you did configure the POP3 proxy " . + "appropriatly, you can start the corresponding process " . + "using the service control panel which is part of the " . + "»Status« menu item."; + } + if (! is_service_running("clamd")) { + $input_errors[] = "The ClamAV daemon process is not running. " . + "If you are certain that you did configure DSPAM " . + "appropriatly, you can start the corresponding process " . + "using the service control panel which is part of the " . + "»Status« menu item (ClamAV does not need any configuration)."; + } + if (! is_service_running("freshclam")) { + $input_errors[] = "The freshclam daemon process is not running. " . + "If you are certain that you did configure DSPAM " . + "appropriatly, you can start the corresponding process " . + "using the service control panel which is part of the " . + "»Status« menu item (freshclam does not need any configuration)."; + } + if (! is_service_running("mysql")) { + $input_errors[] = "The MySQL daemon process is not running. " . + "If you are certain that you did configure DSPAM " . + "appropriatly, you can start the corresponding process " . + "using the service control panel which is part of the " . + "»Status« menu item (MySQL does not need any configuration)."; + } + + if (empty($config['installedpackages']['dspam']['config']) || + empty($config['installedpackages']['dspam']['config'][0]['storage-driver']) || + (file_exists('/usr/local/etc/dspam.conf') == false)) { + /* create default config files etc. */ + sync_package_dspam(); + + $input_errors[] = "It seems that you are using DSPAM for the very first time. " . + "Please run the DSPAM wizard from the »Services« menu " . + "if you would like to configure DSPAM right now. " . + "If you are not eligible to administer DSPAM you may contact " . + "your local DSPAM admin personal to solve this issue."; + } + + return $input_errors; +} + +function getJScriptFunction($whichOne = 0) { + $changeuser_msg = gettext("Do you realy want to change the current user?") . "\\n" . + gettext("This requires a logout followed by a login."); + + switch ($whichOne) { + case 0: + $scriptstr = ' + + /* applicable for almost any dspam related page */ + function changeuser() { + check = confirm("' . $changeuser_msg . '"); + + if (check == true) + window.location.href = "/index.php?logout=true"; + } + '; + + break; + case 1: + $scriptstr = ' + + /* applicable for dspam-quarantine.php */ + function checkallmsgs(enable) { + var endis = (document.iform.checkall.checked || enable); + var elem = document.iform.elements.length; + + for (i = 0; i < elem; i++) { + if (document.iform.elements[i].name.indexOf("chkmsg") >= 0) { + document.iform.elements[i].checked = endis; + } + } + } + '; + + break; + case 2: + $scriptstr = ' + + /* applicable for dspam-quarantine.php */ + function sortmsg(criterion) { + var baseURL = "/dspam-quarantine.php?page=" + document.iform.qpage.value; + var qperpage = document.getElementsByName("qperpage")[0].value; + + window.location.href = baseURL + "&qperpage=" + qperpage + "&sortby=" + criterion; + } + '; + + break; + case 3: + $scriptstr = ' + + /* applicable for dspam-quarantine.php */ + function processmsg(what) { + var elem = document.iform.elements.length; + var checked = false; + + switch (what) { + case 0: + for (i = 0; i < elem; i++) { + if (document.iform.elements[i].name.indexOf("chkmsg") >= 0 && + document.iform.elements[i].checked == true) { + checked = true; + break; + } + } + + if (checked) { + document.iform.processAction.value = "manyNotSpam"; + } else { + alert("You did not select any message that should be processed as not beeing Spam."); + return false; + } + break; + case 1: + for (i = 0; i < elem; i++) { + if (document.iform.elements[i].name.indexOf("chkmsg") >= 0 && + document.iform.elements[i].checked == true) { + checked = true; + break; + } + } + + if (checked) { + if (confirm("Are you sure you want to delete SELECTED messages in quarantine?") == false) { + return false; + } else { + document.iform.processAction.value = "manySpam"; + } + } else { + alert("You did not select any message that should be processed as beeing Spam."); + return false; + } + break; + case 2: + if (confirm("Are you sure you want to delete ALL messages in quarantine?") == false) { + return false; + } else { + document.iform.processAction.value = "deleteAll"; + } + break; + } + + document.iform.submit(); + } + '; + + break; + case 4: + $scriptstr = ' + + /* applicable for dspam-quarantine.php nad dspam-history.php */ + function changeQPerPage(originator) { + var elementName = ""; + var baseURL = ""; + + if (originator.name == "qperpage") { + baseURL = "/dspam-quarantine.php?page=" + document.iform.qpage.value; + elementName = "qperpage"; + } else { + baseURL = "/dspam-history.php?page=" + document.iform.hpage.value; + elementName = "hperpage"; + } + + for (var i = 0; i < 2; i++) { + document.getElementsByName(elementName)[i].value = originator.value; + } + + if (originator.name == "qperpage") + window.location.href = baseURL + "&qperpage=" + originator.value; + else + window.location.href = baseURL + "&hperpage=" + originator.value; + } + '; + + break; + case 5: + $scriptstr = ' + + /* applicable for dspam-settings.php */ + + function fadeTableRow(rowid, fadeType, opts){ + if(!opts){ + opts = {}; + } + + var row = $(rowid); + var cells= row.childNodes; + for(i=0;i<cells.length;i++){ + if(cells[i].tagName == "TD"){ + if (fadeType == 0) + new Effect.Fade(cells[i],opts); + else + new Effect.Appear(cells[i],opts); + } + } + if (fadeType == 0) + new Effect.Fade(row,opts); + else + new Effect.Appear(row,opts); + } + + function toggleDSPAMDomain(enable_over, originator) { + var endis = !(originator.checked || enable_over); + + if (endis) { + fadeTableRow("emailnotitb", 1); + } else { + fadeTableRow("emailnotitb", 0); + } + } + + function toggleDBSettings(idx) { + if (idx) + idx = idx; + else + idx = document.iform.sdriver.selectedIndex; + + switch (idx) { + case 0: + fadeTableRow("DBmysql", 1); + fadeTableRow("DBsqlite", 0); + fadeTableRow("DBbdb", 0); + fadeTableRow("DBpgsql", 0); + fadeTableRow("DBoracle", 0); + fadeTableRow("DBhash", 0); + break; + case 1: + fadeTableRow("DBmysql", 0); + fadeTableRow("DBsqlite", 1); + fadeTableRow("DBbdb", 0); + fadeTableRow("DBpgsql", 0); + fadeTableRow("DBoracle", 0); + fadeTableRow("DBhash", 0); + break; + case 2: + fadeTableRow("DBmysql", 0); + fadeTableRow("DBsqlite", 0); + fadeTableRow("DBbdb", 1); + fadeTableRow("DBpgsql", 0); + fadeTableRow("DBoracle", 0); + fadeTableRow("DBhash", 0); + break; + case 3: + fadeTableRow("DBmysql", 0); + fadeTableRow("DBsqlite", 0); + fadeTableRow("DBbdb", 0); + fadeTableRow("DBpgsql", 1); + fadeTableRow("DBoracle", 0); + fadeTableRow("DBhash", 0); + break; + case 4: + fadeTableRow("DBmysql", 0); + fadeTableRow("DBsqlite", 0); + fadeTableRow("DBbdb", 0); + fadeTableRow("DBpgsql", 0); + fadeTableRow("DBoracle", 1); + fadeTableRow("DBhash", 0); + break; + case 5: + fadeTableRow("DBmysql", 0); + fadeTableRow("DBsqlite", 0); + fadeTableRow("DBbdb", 0); + fadeTableRow("DBpgsql", 0); + fadeTableRow("DBoracle", 0); + fadeTableRow("DBhash", 1); + break; + } + } + + function enable_change(enable_over, originator) { + var endis; + + switch (originator) { + case 0: + endis = !(document.iform.enabledbg.checked || enable_over); + endis ? document.iform.debug.style.backgroundColor = "#D4D0C8" : document.iform.debug.style.backgroundColor = "#FFFFFF"; + document.iform.debug.disabled = endis; + endis ? document.iform.dopt.style.backgroundColor = "#D4D0C8" : document.iform.dopt.style.backgroundColor = "#FFFFFF"; + document.iform.dopt.disabled = endis; + case 1: + endis = !(document.iform.enableldap.checked || enable_over); + document.iform.ldapmode.disabled = endis; + endis ? document.iform.ldaphost.style.backgroundColor = "#D4D0C8" : document.iform.ldaphost.style.backgroundColor = "#FFFFFF"; + document.iform.ldaphost.disabled = endis; + endis ? document.iform.ldapfilter.style.backgroundColor = "#D4D0C8" : document.iform.ldapfilter.style.backgroundColor = "#FFFFFF"; + document.iform.ldapfilter.disabled = endis; + endis ? document.iform.ldapbase.style.backgroundColor = "#D4D0C8" : document.iform.ldapbase.style.backgroundColor = "#FFFFFF"; + document.iform.ldapbase.disabled = endis; + case 2: + endis = !(document.iform.enablesbl.checked || enable_over); + endis ? document.iform.sblhost.style.backgroundColor = "#D4D0C8" : document.iform.sblhost.style.backgroundColor = "#FFFFFF"; + document.iform.sblhost.disabled = endis; + case 3: + endis = !(document.iform.enableclam.checked || enable_over); + endis ? document.iform.clamport.style.backgroundColor = "#D4D0C8" : document.iform.clamport.style.backgroundColor = "#FFFFFF"; + document.iform.clamport.disabled = endis; + endis ? document.iform.clamhost.style.backgroundColor = "#D4D0C8" : document.iform.clamhost.style.backgroundColor = "#FFFFFF"; + document.iform.clamhost.disabled = endis; + document.iform.clamresp.disabled = endis; + case 4: + endis = !(document.iform.enabledsclient.checked || enable_over); + endis ? document.iform.dsclhost.style.backgroundColor = "#D4D0C8" : document.iform.dsclhost.style.backgroundColor = "#FFFFFF"; + document.iform.dsclhost.disabled = endis; + endis ? document.iform.dsclport.style.backgroundColor = "#D4D0C8" : document.iform.dsclport.style.backgroundColor = "#FFFFFF"; + document.iform.dsclport.disabled = endis; + endis ? document.iform.dsclident.style.backgroundColor = "#D4D0C8" : document.iform.dsclident.style.backgroundColor = "#FFFFFF"; + document.iform.dsclident.disabled = endis; + case 5: + endis = !(document.iform.tcpipdel.checked || enable_over); + endis ? document.iform.dhost.style.backgroundColor = "#D4D0C8" : document.iform.dhost.style.backgroundColor = "#FFFFFF"; + document.iform.dhost.disabled = endis; + endis ? document.iform.dport.style.backgroundColor = "#D4D0C8" : document.iform.dport.style.backgroundColor = "#FFFFFF"; + document.iform.dport.disabled = endis; + endis ? document.iform.dident.style.backgroundColor = "#D4D0C8" : document.iform.dident.style.backgroundColor = "#FFFFFF"; + document.iform.dident.disabled = endis; + document.iform.delproto.disabled = endis; + case 6: + endis = !(document.iform.enablenoti.checked || enable_over); + document.iform.whichdomain.disabled = endis; + endis ? document.iform.dspamdomain.style.backgroundColor = "#D4D0C8" : document.iform.dspamdomain.style.backgroundColor = "#FFFFFF"; + document.iform.dspamdomain.disabled = endis; + endis ? document.iform.dspamcontact.style.backgroundColor = "#D4D0C8" : document.iform.dspamcontact.style.backgroundColor = "#FFFFFF"; + document.iform.dspamcontact.disabled = endis; + } + } + '; + + break; + case 6: + $scriptstr = ' + + function checkDisabledState(form) { + for (i = 0; i < form.elements.length; i++) { + if (form.elements[i].disabled && form.elements[i].type == "text") + form.elements[i].style.backgroundColor = "#D4D0C8"; + else if (form.elements[i].type == "text") + form.elements[i].style.backgroundColor = "#FFFFFF"; + } + } + '; + + break; + } + + return $scriptstr; +} + +function sync_package_dspam() { + global $config, $g; + conf_mount_rw(); + config_lock(); + $fd = fopen("/etc/dspam.conf","w"); + + $dspamcfg = <<<EOD +## dspam.conf -- DSPAM configuration file +## Generated by pfSense +Home /var/db/dspam +## Database Settings +StorageDriver /usr/local/lib/libmysql_drv.so +MySQLServer /tmp/mysql.sock +MySQLPort +MySQLUser dspam +MySQLPass dspam +MySQLDb dspam +MySQLCompress true +MySQLSupressQuote off +MySQLConnectionCache 10 +MySQLUIDInSignature on +## Delivery Settings +TrustedDeliveryAgent "/usr/bin/mail" +DeliveryHost 192.168.1.6 +DeliveryPort 24 +DeliveryIdent localhost +DeliveryProto smtp +OnFail error +## DSPAM Privileges +Trust root +Trust mail +Trust mailnull +Trust smmsp +Trust daemon +## DSPAM Engine Settings +TrainingMode teft +TestConditionalTraining on +Feature chained +Feature whitelist +Algorithm graham burton +PValue graham +ImprobabilityDrive on +Preference "spamAction=quarantine" +Preference "signatureLocation=message" +Preference "showFactors=on" +AllowOverride trainingMode +AllowOverride spamAction spamSubject +AllowOverride statisticalSedation +AllowOverride enableBNR +AllowOverride enableWhitelist +AllowOverride signatureLocation +AllowOverride showFactors +AllowOverride optIn optOut +AllowOverride whitelistThreshold +## Miscellaneous Settings +FailoverAttempts 1 +IgnoreHeader X-Spam-Scanned +IgnoreHeader X-Spam-Status +IgnoreHeader X-Virus-Scanner-Result +RBLInoculate on +Notifications on +## Maintainance Settings +PurgeSignatures 14 +PurgeNeutral 90 +PurgeUnused 90 +PurgeHapaxes 30 +PurgeHits1S 15 +PurgeHits1I 15 +## System Settings +LocalMX 127.0.0.1 +SystemLog on +UserLog on +Opt out +ParseToHeaders on +ChangeModeOnParse on +ChangeUserOnParse on +Broken returnCodes +Broken case +Broken lineStripping +MaxMessageSize 307200 +ProcessorBias on +## ClamAV Engine Settings +ClamAVPort 3310 +ClamAVHost 127.0.0.1 +ClamAVResponse accept +## DSPAM Daemon Settings (Server) +ServerPort 24 +ServerQueueSize 32 +ServerPID /var/run/dspam/dspam.pid +ServerMode standard +ServerParameters "--deliver=innocent -d %u" +ServerIdent "abysseleven.abyssworld.de" +ServerDomainSocketPath "/var/run/dspam/dspam.sock" +## EOF + +EOD; + + /* flush the default config to the file */ + fwrite($fd, $dspamcfg); + fclose($fd); + + $fd = fopen("/usr/local/bin/dspam_spamfeed","w"); + + $spamfeed = <<<EOD +#!/bin/sh +# +# automatically generated by pfSense + +cat \${2} | dspam --mode=teft --source=corpus --class=spam --feature=chained,noise --user \${1} + +EOD; + + fwrite($fd, $spamfeed); + fclose($fd); + mwexec("chmod a+x /usr/local/bin/dspam_spamfeed"); + + $fd = fopen("/usr/local/bin/dspam_innocentfeed","w"); + + $innocentfeed = <<<EOD +#!/bin/sh +# +# automatically generated by pfSense + +cat \${2} | dspam --mode=teft --source=corpus --class=innocent --feature=chained,noise --user \${1} + +EOD; + + fwrite($fd, $innocentfeed); + fclose($fd); + mwexec("chmod a+x /usr/local/bin/dspam_innocentfeed"); + + $start = <<<EOD +test_dspam_user=`cat /etc/passwd | grep dspam` +test_dspam_db=`mysql information_schema -e "select schema_name from schemata" | grep dspam` +test_dspam_db_user=`mysql mysql -e "select User from user" | grep dspam` + +if [ -z "\${test_dspam_user}" ]; then + pw useradd dspam -u 107 -g mail -d /var/db/dspam -s /bin/csh -c 'DSPAM Daemon User' +fi + +if [ ! -d "/var/run/dspam" ]; then + mkdir /var/run/dspam && chown dspam:mail /var/run/dspam +fi + +if [ -z "\${test_dspam_db}" ]; then + mysql -D mysql -e "create database dspam" + if [ -z "\${test_dspam_db_user}" ]; then + mysql -D mysql -e "GRANT ALL PRIVILEGES ON dspam.* TO dspam@localhost IDENTIFIED BY 'dspam'" + fi + mysql -udspam -pdspam dspam < /usr/local/share/examples/dspam/mysql/mysql_objects-space.sql && \ + mysql -udspam -pdspam dspam < /usr/local/share/examples/dspam/mysql/virtual_users.sql +fi + +/sbin/mount_fdescfs fdescfs /dev/fd +/usr/local/bin/dspam --daemon & + +EOD; + + $stop = "/usr/bin/killall dspam\n" . + "sleep 2"; + write_rcfile(array( + "file" => "dspam.sh", + "start" => $start, + "stop" => $stop + ) + ); + conf_mount_ro(); + config_unlock(); + + if (! file_exists("/usr/local/etc/dspam.conf")) { + mwexec("ln -s /etc/dspam.conf /usr/local/etc/dspam.conf"); + } + + mwexec("/usr/local/etc/rc.d/dspam.sh stop"); + mwexec("/usr/local/etc/rc.d/dspam.sh start"); + + return 0; +} + +function dspam_configure() { + global $config, $g; + + $dspamcfg = $config['installedpackages']['dspam']['config'][0]; + + if ($g['booting']) + echo "Starting DSPAM service... "; + else + sleep(1); + + /* write dhcpd.conf */ + $fd = fopen("/usr/local/etc/dspam.conf", "w"); + if (!$fd) { + printf("Error: cannot open dhcpd.conf in services_dhcpd_configure().\n"); + return 1; + } + + $dspamconf = <<<EOD +## dspam.conf -- DSPAM configuration file +## Generated by pfSense +Home /var/db/dspam +## Database Settings + +EOD; + + if ($dspamcfg['storage-driver'] == "mysql") { + $dspamconf .= "StorageDriver\t\t/usr/local/lib/libmysql_drv.so\n"; + $dspamconf .= <<<EOD +MySQLServer {$dspamcfg['dbsettings'][0]['mysql-server']} +MySQLPort {$dspamcfg['dbsettings'][0]['mysql-port']} +MySQLUser {$dspamcfg['dbsettings'][0]['mysql-user']} +MySQLPass {$dspamcfg['dbsettings'][0]['mysql-password']} +MySQLDb {$dspamcfg['dbsettings'][0]['mysql-database']} + +EOD; + isset($dspamcfg['dbsettings'][0]['mysql-compress']) ? $dspamconf .= "MySQLCompress\t\ttrue\n" : $dspamconf .= "MySQLCompress\tfalse\n"; + isset($dspamcfg['dbsettings'][0]['mysql-squote']) ? $dspamconf .= "MySQLSupressQuote\ton\n" : $dspamconf .= "MySQLSupressQuote\toff\n"; + isset($dspamcfg['dbsettings'][0]['mysql-ccache']) ? $dspamconf .= "MySQLConnectionCache\t{$dspamcfg['dbsettings'][0]['mysql-ccache']}\n" : $dspamconf .= "MySQLConnectionCache\t10\n"; + isset($dspamcfg['dbsettings'][0]['mysql-uid']) ? $dspamconf .= "MySQLUIDInSignature\ton\n" : $dspamconf .= "MySQLUIDInSignature\toff\n"; + } else if ($dspamcfg['storage-driver'] == "sqlite") { + $dspamconf .= "StorageDriver\t\t/usr/local/lib/libsqlite3_drv.so\n"; + if (isset($dspamcfg['dbsettings'][0]['sqlite-pragma'])) $dspamconf .= "SQLitePragma\t\t{$dspamcfg['dbsettings'][0]['sqlite-pragma']}\n"; + } else if ($dspamcfg['storage-driver'] == "pgsql") { + $dspamconf .= "StorageDriver\t\t/usr/local/lib/libpgsql_drv.so\n"; + $dspamconf .= <<<EOD +PgSQLServer {$dspamcfg['dbsettings'][0]['pgsql-server']} +PgSQLPort {$dspamcfg['dbsettings'][0]['pgsql-port']} +PgSQLUser {$dspamcfg['dbsettings'][0]['pgsql-user']} +PgSQLPass {$dspamcfg['dbsettings'][0]['pgsql-password']} +PgSQLDb {$dspamcfg['dbsettings'][0]['pgsql-database']} + +EOD; + isset($dspamcfg['dbsettings'][0]['pgsql-ccache']) ? $dspamconf .= "PgSQLConnectionCache\t{$dspamcfg['dbsettings'][0]['pgsql-ccache']}\n" : $dspamconf .= "PgSQLConnectionCache\t3\n"; + isset($dspamcfg['dbsettings'][0]['pgsql-uid']) ? $dspamconf .= "PgSQLUIDInSignature\ton\n" : $dspamconf .= "PgSQLUIDInSignature\toff\n"; + } else if ($dspamcfg['storage-driver'] == "oracle") { + $dspamconf .= "StorageDriver\t/usr/local/lib/libora_drv.so\n"; + $dspamconf .= <<<EOD +OraServer {$dspamcfg['dbsettings'][0]['ora-server']} +OraUser {$dspamcfg['dbsettings'][0]['ora-user']} +OraPass {$dspamcfg['dbsettings'][0]['ora-password']} +OraSchema {$dspamcfg['dbsettings'][0]['ora-schema']} + +EOD; + } else if ($dspamcfg['storage-driver'] == "hash") { + $dspamconf .= "StorageDriver\t\t/usr/local/lib/libhash_drv.so\n"; + $dspamconf .= <<<EOD +HashRecMax {$dspamcfg['dbsettings'][0]['hash-rec-max']} +HashMaxExtents {$dspamcfg['dbsettings'][0]['hash-max-ext']} +HashExtentSize {$dspamcfg['dbsettings'][0]['hash-ext-size']} +HashMaxSeek {$dspamcfg['dbsettings'][0]['hash-max-seek']} +HashConnectionCache {$dspamcfg['dbsettings'][0]['hash-co-cache']} + +EOD; + isset($dspamcfg['dbsettings'][0]['hash-auto-ex']) ? $dspamconf .= "HashAutoExtend\t\ton\n" : $dspamconf .= "HashAutoExtend\toff\n"; + if (isset($dspamcfg['dbsettings'][0]['hash-co-user'])) $dspamconf .= "HashConcurrentUser\t{$dspamcfg['dbsettings'][0]['hash-co-user']}\n"; + } + + $dspamconf .= "## Delivery Settings\n"; + + if ($dspamcfg['tdelivery-agent'] == "procmail") { + $dspamconf .= "TrustedDeliveryAgent\t\"/usr/local/bin/procmail\"\n"; + } else if ($dspamcfg['tdelivery-agent'] == "mail") { + $dspamconf .= "TrustedDeliveryAgent\t\"/usr/bin/mail\"\n"; + } else if ($dspamcfg['tdelivery-agent'] == "mail.local") { + $dspamconf .= "TrustedDeliveryAgent\t\"/usr/libexec/mail.local\"\n"; + } else if ($dspamcfg['tdelivery-agent'] == "deliver") { + $dspamconf .= "TrustedDeliveryAgent\t\"/usr/local/cyrus/bin/deliver\"\n"; + } else if ($dspamcfg['tdelivery-agent'] == "maildrop") { + $dspamconf .= "TrustedDeliveryAgent\t\"/usr/local/bin/maildrop\"\n"; + } else if ($dspamcfg['tdelivery-agent'] == "exim") { + $dspamconf .= "TrustedDeliveryAgent\t\"/usr/local/sbin/exim -oMr spam-scanned\"\n"; + } + + if (isset($dspamcfg['tcpip-delivery'])) { + $dspamconf .= <<<EOD +DeliveryHost {$dspamcfg['tcpip-delivery-host']} +DeliveryPort {$dspamcfg['tcpip-delivery-port']} +DeliveryIdent {$dspamcfg['tcpip-delivery-ident']} +DeliveryProto {$dspamcfg['tcpip-delivery-proto']} + +EOD; + } + + /* TODO: If required add the following, currently + missing options: + + - QuarantineAgent + - EnablePlusedDetail + - QuarantineMailbox + */ + + $dspamconf .= "OnFail\t\t\t{$dspamcfg['delivery-onfail']}\n"; + $dspamconf .= "## DSPAM Privileges\n"; + + $t_users = &$dspamcfg['tuser']; + + foreach ($t_users as $user) { + $dspamconf .= "Trust\t\t\t{$user['name']}\n"; + } + + if (isset($dspamcfg['debug-enable'])) { + $dspamconf .= "## DSPAM Debugging Options\n"; + $dspamconf .= "Debug\t\t\t{$dspamcfg['debug-whom']}\n"; + $dspamconf .= "DebugOpt\t\t{$dspamcfg['debug-options']}\n"; + } + + $dspamconf .= "## DSPAM Engine Settings\n"; + $dspamconf .= "TrainingMode\t\t{$dspamcfg['training-mode']}\n"; + isset($dspamcfg['test-cond-training']) ? $dspamconf .= "TestConditionalTraining\ton\n" : $dspamconf .= "TestConditionalTraining\toff\n"; + + $t_features = &$dspamcfg['feature']; + + foreach ($t_features as $feature) { + $dspamconf .= "Feature\t\t\t{$feature['name']}\n"; + } + + $t_algos = &$dspamcfg['algorithm']; + + if (count($t_algos) > 0) { + $dspamconf .= "Algorithm\t\t"; + + foreach ($t_algos as $algo) { + $dspamconf .= "{$algo['name']} "; + } + + $dspamconf .= "\n"; + } + + $dspamconf .= "PValue\t\t\t{$dspamcfg['pvalue']}\n"; + isset($dspamcfg['improbability-drive']) ? $dspamconf .= "ImprobabilityDrive\ton\n" : $dspamconf .= "ImprobabilityDrive\toff\n"; + + $t_prefs = &$dspamcfg['preference']; + + foreach ($t_prefs as $pref) { + $dspamconf .= "Preference\t\t{$pref['value']}\n"; + } + + $t_overr = &$dspamcfg['override']; + + foreach ($t_overr as $over) { + $dspamconf .= "AllowOverride\t\t{$over['value']}\n"; + } + + if (isset($dspamcfg['ldap-enable'])) { + $dspamconf .= <<<EOD +## LDAP Settings +LDAPMode {$dspamcfg['ldap-mode']} +LDAPHost {$dspamcfg['ldap-host']} +LDAPFilter {$dspamcfg['ldap-filter']} +LDAPBase {$dspamcfg['ldap-base']} + +EOD; + } + + $dspamconf .= "## Miscellaneous Settings\n"; + if (isset($dspamcfg['failover-attempts'])) $dspamconf .= "FailoverAttempts\t{$dspamcfg['failover-attempts']}\n"; + + $t_headers = &$dspamcfg['header']; + + if (is_array($t_headers)) { + foreach ($t_headers as $header) { + $dspamconf .= "IgnoreHeader\t\t{$header['name']}\n"; + } + } + + if (isset($dspamcfg['sbl-enable'])) { + $dspamconf .= "Lookup\t\t\t\"{$dspamcfg['sbl-host']}\"\n"; + } + + isset($dspamcfg['rbl-inoculate']) ? $dspamconf .= "RBLInoculate\t\ton\n" : $dspamconf .= "RBLInoculate\toff\n"; + isset($dspamcfg['notification-email']) ? $dspamconf .= "Notifications\t\ton\n" : $dspamconf .= "Notifications\toff\n"; + + $dspamconf .= <<<EOD +## Maintainance Settings +PurgeSignatures {$dspamcfg['purge-signatures']} +PurgeNeutral {$dspamcfg['purge-neutral']} +PurgeUnused {$dspamcfg['purge-unused']} +PurgeHapaxes {$dspamcfg['purge-hapaxes']} +PurgeHits1S {$dspamcfg['purge-hits-1s']} +PurgeHits1I {$dspamcfg['purge-hits-1s']} + +EOD; + + $dspamconf .= "## System Settings\n"; + $dspamconf .= "LocalMX\t\t\t{$dspamcfg['local-mx']}\n"; + isset($dspamcfg['system-log']) ? $dspamconf .= "SystemLog\t\ton\n" : $dspamconf .= "SystemLog\toff\n"; + isset($dspamcfg['user-log']) ? $dspamconf .= "UserLog\t\t\ton\n" : $dspamconf .= "UserLog\toff\n"; + $dspamconf .= "Opt\t\t\t{$dspamcfg['filter-opt']}\n"; + isset($dspamcfg['parse-to-headers']) ? $dspamconf .= "ParseToHeaders\t\ton\n" : $dspamconf .= "ParseToHeaders\toff\n"; + isset($dspamcfg['change-mode-on-parse']) ? $dspamconf .= "ChangeModeOnParse\ton\n" : $dspamconf .= "ChangeModeOnParse\toff\n"; + isset($dspamcfg['change-user-on-parse']) ? $dspamconf .= "ChangeUserOnParse\ton\n" : $dspamconf .= "ChangeUserOnParse\toff\n"; + + if (isset($dspamcfg['broken-mta-settings'])) { + $t_bmtas = &$dspamcfg['bmta']; + + foreach ($t_bmtas as $bmta) { + $dspamconf .= "Broken\t\t\t{$bmta['name']}\n"; + } + } + + $dspamconf .= "MaxMessageSize\t\t{$dspamcfg['max-message-size']}\n"; + isset($dspamcfg['processor-bias']) ? $dspamconf .= "ProcessorBias\t\ton\n" : $dspamconf .= "ProcessorBias\toff\n"; + + if (isset($dspamcfg['clamav-enable'])) { + $dspamconf .= <<<EOD +## ClamAV Engine Settings +ClamAVPort {$dspamcfg['clamav-port']} +ClamAVHost {$dspamcfg['clamav-host']} +ClamAVResponse {$dspamcfg['clamav-response']} + +EOD; + } + + $dspamconf .= <<<EOD +## DSPAM Daemon Settings (Server) +ServerPort {$dspamcfg['dspam-server-port']} +ServerQueueSize {$dspamcfg['dspam-server-queue-size']} +ServerPID {$dspamcfg['dspam-server-pid']} +ServerMode {$dspamcfg['dspam-server-mode']} + +EOD; + + if ($dspamcfg['dspam-server-mode'] == "dspam") { + $t_spwds = &$dspamcfg['server-pwd']; + $i = 1; + + foreach ($t_spwds as $spwd) { + $dspamconf .= "ServerPass.Relay{$i}\t\"{$spwd['value']}\"\n"; + $i++; + } + } else if ($dspamcfg['dspam-server-mode'] == "standard") { + $dspamconf .= <<<EOD +ServerParameters "{$dspamcfg['dspam-server-params']}" +ServerIdent "{$dspamcfg['dspam-server-id']}" + +EOD; + } + + if (isset($dspamcfg['dspam-server-socket'])) { + $dspamconf .= "ServerDomainSocketPath\t\"{$dspamcfg['dspam-server-socket']}\"\n"; + } + + if (isset($dspamcfg['dspam-client-enable']) && $dspamcfg['dspam-client-enable'] <> "") { + $dspamconf .= <<<EOD +## DSPAM Daemon Settings (Client) +ClientHost {$dspamcfg['dspam-client-host']} +ClientIdent {$dspamcfg['dspam-client-id']} + +EOD; + + if (isset($dspamcfg['dspam-client-port']) && $dspamcfg['dspam-client-port'] <> "") { + $dspamconf .= "ClientPort\t\t{$dspamcfg['dspam-client-port']}\n"; + } + } + + $dspamconf .= "## EOF\n"; + + fwrite($fd, $dspamconf); + fclose($fd); + + /* fire up dspam --daemon */ + mwexec("/usr/local/etc/rc.d/dspam.sh stop"); + mwexec("/usr/local/etc/rc.d/dspam.sh start"); + + if ($g['booting']) { + print "done.\n"; + } + + return 0; +} + +function custom_php_install_command() { + global $config, $g; + /* create a default config */ + sync_package_dspam(); +} + +function custom_php_deinstall_command() { + global $config, $g; + conf_mount_rw(); + unlink_if_exists("/usr/local/etc/rc.d/dspam.sh"); + unlink_if_exists("/usr/local/etc/dspam.conf"); + unlink_if_exists("/usr/local/bin/dspam_spamfeed"); + unlink_if_exists("/usr/local/bin/dspam_innocentfeed"); + conf_mount_ro(); +} +?>
\ No newline at end of file diff --git a/packages/dspam/pkg/dspam.xml b/packages/dspam/pkg/dspam.xml new file mode 100644 index 00000000..14b8751e --- /dev/null +++ b/packages/dspam/pkg/dspam.xml @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="utf-8" ?> +<packagegui> + <name>dspam</name> + <version>1.0</version> + <title>Services: DSPAM: Main</title> + <include_file>/usr/local/pkg/dspam.inc</include_file> + <!-- Menu is where this packages menu will appear --> + <menu> + <name>dspam</name> + <section>Services</section> + <configfile>dspam.xml</configfile> + <url>/dspam-perf.php</url> + </menu> + <menu> + <name>DSPAM Legacy WebGUI</name> + <tooltiptext>Original Perl-based GUI</tooltiptext> + <section>Services</section> + <url>/vhosts/dspam/dspam.cgi</url> + </menu> + <service> + <name>dspam</name> + <rcfile>/usr/local/etc/rc.d/dspam.sh</rcfile> + </service> + <tabs> + <tab> + <text>Overview</text> + <url>/dspam.php</url> + <active/> + </tab> + <tab> + <text>Performance</text> + <url>/dspam-perf.php</url> + </tab> + <tab> + <text>Preferences</text> + <url>/dspam-prefs.php</url> + </tab> + <tab> + <text>Alerts</text> + <url>/pkg.php?xml=dspam_alerts.xml</url> + </tab> + <tab> + <text>Quarantine</text> + <url>/dspam-quarantine.php</url> + </tab> + <tab> + <text>Analysis</text> + <url>/dspam-analysis.php</url> + </tab> + <tab> + <text>History</text> + <url>/dspam-history.php</url> + </tab> + </tabs> + <!-- + configpath gets expanded out automatically and config items + will be stored in that location + --> + <configpath>['installedpackages']['dspam']['config']</configpath> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam-perf.php</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam-admin.php</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam-admin-prefs.php</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam-admin-stats.php</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam_settings.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam-settings.php</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/verdana.ttf</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam-prefs.php</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam_alerts.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam-quarantine.php</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam-analysis.php</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam-history.php</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/wizards/</prefix> + <chmod>0755</chmod> + <item>http://www.abyssworld.de/packages/config/dspam_wizard.xml</item> + </additional_files_needed> + <!-- + 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. + --> + <!-- + Arbitrary PHP Code, that gets executed if a certain event gets triggered. + --> + <custom_php_resync_config_command> + sync_package_dspam(); + </custom_php_resync_config_command> + <custom_php_install_command> + custom_php_install_command(); + </custom_php_install_command> + <custom_php_deinstall_command> + custom_php_deinstall_command(); + </custom_php_deinstall_command> +</packagegui> diff --git a/packages/dspam/pkg/dspam_alerts.xml b/packages/dspam/pkg/dspam_alerts.xml new file mode 100644 index 00000000..182780cf --- /dev/null +++ b/packages/dspam/pkg/dspam_alerts.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + Tags which can be used to exec arbitrary PHP code: + + <custom_php_global_functions /> + <custom_php_command_before_form /> + <custom_delete_php_command /> if $_POST && act == del + <custom_add_php_command /> if $_POST && act == add + <custom_php_resync_config_command /> + <custom_php_validation_command /> + <custom_add_php_command_late /> + <start_command /> shell exec + <restart_command /> shell exec + <custom_php_after_form_command /> +--> +<packagegui> + <name>dspamalerts</name> + <version>1.0</version> + <title>Services: DSPAM: Alerts</title> + <include_file>/usr/local/pkg/dspam.inc</include_file> + <!-- Menu is where this packages menu will appear --> + <tabs> + <tab> + <text>Performance</text> + <url>/dspam-perf.php</url> + </tab> + <tab> + <text>Preferences</text> + <url>/dspam-prefs.php</url> + </tab> + <tab> + <text>Alerts</text> + <url>/pkg.php?xml=dspam_alerts.xml</url> + <active /> + </tab> + <tab> + <text>Quarantine</text> + <url>/dspam-quarantine.php</url> + </tab> + <tab> + <text>Analysis</text> + <url>/dspam-analysis.php</url> + </tab> + <tab> + <text>History</text> + <url>/dspam-history.php</url> + </tab> + <tab> + <text>Train Filter</text> + <url>/dspam-train.php</url> + </tab> + <tab> + <text>Admin Suite</text> + <url>/dspam-admin.php</url> + </tab> + </tabs> + <!-- + configpath gets expanded out automatically and config items + will be stored in that location + --> + <configpath>['installedpackages']['dspam']['config']['alerts']</configpath> + <adddeleteeditpagefields> + <columnitem> + <fielddescr>Alert Name</fielddescr> + <fieldname>alertname</fieldname> + </columnitem> + <columnitem> + <fielddescr>Description</fielddescr> + <fieldname>description</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>Alert Name</fielddescr> + <fieldname>alertname</fieldname> + <description>Name of an alert that should be raised</description> + <type>input</type> + <size>30</size> + <required /> + </field> + <field> + <fielddescr>Description</fielddescr> + <fieldname>description</fieldname> + <description>You may enter a description here for your reference (not parsed).</description> + <type>input</type> + <size>30</size> + </field> + </fields> + <!-- + Arbitrary PHP Code, that gets executed if a certain event gets triggered. + --> + <custom_delete_php_command> + dspam_configure(); + </custom_delete_php_command> + <custom_php_resync_config_command> + dspam_configure(); + </custom_php_resync_config_command> +</packagegui>
\ No newline at end of file diff --git a/packages/dspam/pkg/freshclam.conf b/packages/dspam/pkg/freshclam.conf new file mode 100644 index 00000000..173d97bf --- /dev/null +++ b/packages/dspam/pkg/freshclam.conf @@ -0,0 +1,110 @@ +## +## Example config file for freshclam +## Please read the freshclam.conf(5) manual before editing this file. +## This file may be optionally merged with clamd.conf. +## + + +# Comment or remove the line below. +#Example + +# Path to the database directory. +# WARNING: It must match clamd.conf's directive! +# Default: hardcoded (depends on installation options) +#DatabaseDirectory /var/lib/clamav +DatabaseDirectory /var/db/clamav + +# Path to the log file (make sure it has proper permissions) +# Default: disabled +#UpdateLogFile /var/log/freshclam.log +UpdateLogFile /var/log/clamav/freshclam.log + +# Enable verbose logging. +# Default: no +#LogVerbose yes + +# Use system logger (can work together with UpdateLogFile). +# Default: no +#LogSyslog yes + +# Specify the type of syslog messages - please refer to 'man syslog' +# for facility names. +# Default: LOG_LOCAL6 +#LogFacility LOG_MAIL + +# This option allows you to save the process identifier of the daemyes +# Default: disabled +#PidFile /var/run/freshclam.pid +PidFile /var/run/clamav/freshclam.pid + +# By default when started freshclam drops privileges and switches to the +# "clamav" user. This directive allows you to change the database owner. +# Default: clamav (may depend on installation options) +DatabaseOwner clamav + +# Initialize supplementary group access (freshclam must be started by root). +# Default: no +AllowSupplementaryGroups yes + +# Use DNS to verify virus database version. Freshclam uses DNS TXT records +# to verify database and software versions. With this directive you can change +# the database verification domain. +# WARNING: Do not touch it unless you're configuring freshclam to use your +# own database verification domain. +# Default: current.cvd.clamav.net +#DNSDatabaseInfo current.cvd.clamav.net + +# Uncomment the following line and replace XY with your country +# code. See http://www.iana.org/cctld/cctld-whois.htm for the full list. +#DatabaseMirror db.XY.clamav.net + +# database.clamav.net is a round-robin record which points to our most +# reliable mirrors. It's used as a fall back in case db.XY.clamav.net is +# not working. DO NOT TOUCH the following line unless you know what you +# are doing. +DatabaseMirror database.clamav.net + +# How many attempts to make before giving up. +# Default: 3 (per mirror) +#MaxAttempts 5 + +# Number of database checks per day. +# Default: 12 (every two hours) +#Checks 24 + +# Proxy settings +# Default: disabled +#HTTPProxyServer myproxy.com +#HTTPProxyPort 1234 +#HTTPProxyUsername myusername +#HTTPProxyPassword mypass + +# Use aaa.bbb.ccc.ddd as client address for downloading databases. Useful for +# multi-homed systems. +# Default: Use OS'es default outgoing IP address. +#LocalIPAddress aaa.bbb.ccc.ddd + +# Send the RELOAD command to clamd. +# Default: no +NotifyClamd /usr/local/etc/clamd.conf + +# Run command after successful database update. +# Default: disabled +#OnUpdateExecute command + +# Run command when database update process fails. +# Default: disabled +#OnErrorExecute command + +# Run command when freshclam reports outdated version. +# In the command string %v will be replaced by the new version number. +# Default: disabled +#OnOutdatedExecute command + +# Don't fork into background. +# Default: no +#Foreground yes + +# Enable debug messages in libclamav. +# Default: no +#Debug yes diff --git a/packages/dspam/pkg/p3scan-pf-emer.xml b/packages/dspam/pkg/p3scan-pf-emer.xml new file mode 100644 index 00000000..1f367409 --- /dev/null +++ b/packages/dspam/pkg/p3scan-pf-emer.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="utf-8" ?> +<packagegui> + <!-- change this if configpath works --> + <name>p3scanpfemer</name> + <version>1.0</version> + <title>Services: POP3 Proxy: Emergency Contact</title> + <include_file>/usr/local/pkg/p3scan.inc</include_file> + <tabs> + <tab> + <text>Daemon Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf.xml&id=0</url> + </tab> + <tab> + <text>Message Processing</text> + <url>/pkg_edit.php?xml=p3scan-pf-msg.xml&id=0</url> + </tab> + <tab> + <text>Emergency Contact</text> + <url>/pkg.php?xml=p3scan-pf-emer.xml</url> + <active /> + </tab> + <tab> + <text>Virus Scanner Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf-vir.xml&id=0</url> + </tab> + <tab> + <text>SPAM Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf-spam.xml&id=0</url> + </tab> + </tabs> + <!-- + configpath gets expanded out automatically and config items + will be stored in that location + --> + <configpath>['installedpackages']['p3scanpf']['config']['contacts']</configpath> + <!-- + adddeleteeditpagefields items will appear on the first page where you can + add / delete or edit items. An example of this would be the nat page where + you add new nat redirects + --> + <adddeleteeditpagefields> + <columnitem> + <fielddescr>Email Address</fielddescr> + <fieldname>emailaddress</fieldname> + </columnitem> + <columnitem> + <fielddescr>Description</fielddescr> + <fieldname>description</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>Email Address</fielddescr> + <fieldname>emailaddress</fieldname> + <description> + In the event p3scan encounters a catastrophic problem and has to terminate, + it will send an email to these email addresses just before setting up to + close down on the next iteration of a child process. + </description> + <type>input</type> + </field> + <field> + <fielddescr>Description</fielddescr> + <fieldname>description</fieldname> + <description>Description.</description> + <type>input</type> + </field> + </fields> + <!-- + Arbitrary PHP Code, that gets executed if a certain event gets triggered. + --> + <custom_delete_php_command> + sync_package_p3scan(); + </custom_delete_php_command> + <custom_php_resync_config_command> + sync_package_p3scan(); + </custom_php_resync_config_command> +</packagegui> diff --git a/packages/dspam/pkg/p3scan-pf-msg.xml b/packages/dspam/pkg/p3scan-pf-msg.xml new file mode 100644 index 00000000..fe8af442 --- /dev/null +++ b/packages/dspam/pkg/p3scan-pf-msg.xml @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="utf-8" ?> +<packagegui> + <!-- change this if configpath works --> + <name>p3scanpfmsg</name> + <version>1.0</version> + <title>Services: POP3 Proxy: Message Processing</title> + <note> + This <acronym title="Hypertext Markup Language">HTML</acronym> page uses default values, hence even if each field is + set, you are still required to save this page if you are editing this page + for the very first time! + </note> + <include_file>/usr/local/pkg/p3scan.inc</include_file> + <aftersaveredirect>pkg_edit.php?xml=p3scan-pf-msg.xml&id=0</aftersaveredirect> + <tabs> + <tab> + <text>Daemon Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf.xml&id=0</url> + </tab> + <tab> + <text>Message Processing</text> + <url>/pkg_edit.php?xml=p3scan-pf-msg.xml&id=0</url> + <active /> + </tab> + <tab> + <text>Emergency Contact</text> + <url>/pkg.php?xml=p3scan-pf-emer.xml</url> + </tab> + <tab> + <text>Virus Scanner Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf-vir.xml&id=0</url> + </tab> + <tab> + <text>SPAM Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf-spam.xml&id=0</url> + </tab> + </tabs> + <!-- + configpath gets expanded out automatically and config items + will be stored in that location + --> + <configpath>['installedpackages']['p3scanpf']['config']['messaging']</configpath> + <!-- + 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>Just Delete</fielddescr> + <fieldname>justdelete</fieldname> + <description> + Instead of keeping an infected message in the Virus Directory, delete it + after reporting it to the user. + </description> + <type>checkbox</type> + <donotdisable>true</donotdisable> + </field> + <field> + <fielddescr>Bytes Free</fielddescr> + <fieldname>bytesfree</fieldname> + <description>The number of KB's there must be free before processing any mail.</description> + <type>input</type> + <default_value>10000</default_value> + <required /> + </field> + <field> + <fielddescr>Broken Email Clients</fielddescr> + <fieldname>brokenec</fieldname> + <description> + Some email clients may require special processing. + </description> + <type>checkbox</type> + <donotdisable>true</donotdisable> + </field> + <field> + <fielddescr>ISP Spam</fielddescr> + <fieldname>ispspam</fieldname> + <description> + This option allows you to set the string your <acronym title="Internet Service Provider">ISP</acronym> uses if it processes + your email for SPAM. Leave this field blank if you are not going to use + this option. + </description> + <type>input</type> + <default_value>-- Spam --</default_value> + </field> + <field> + <fielddescr>Subject</fielddescr> + <fieldname>subject</fieldname> + <description> + This option can be used to change the default subject line when + reporting a virus infected message. + </description> + <type>input</type> + <size>60</size> + <default_value>Subject: "[Virus] found in a mail to you:" <virus name></default_value> + <required /> + </field> + <field> + <fielddescr>Notify</fielddescr> + <fieldname>notify</fieldname> + <description> + This option can be used to change the default file deleted notification + that is displayed in the virus notification message when the + "justdelete" option is used. + </description> + <type>input</type> + <size>60</size> + <default_value>Per instruction, the message has been deleted.</default_value> + <required /> + </field> + <field> + <fielddescr>SMTP Reject</fielddescr> + <fieldname>smtpreject</fieldname> + <description> + This option can be used to change the default lt;acronym title="Simple Mail Transfer Protocol">SMTP</acronym> Reject message that + is sent to the client in the event a message is rejected due to a virus. + The error message will have a prefix of "554". + </description> + <type>input</type> + <size>60</size> + <default_value>Virus detected! P3scan rejected message!</default_value> + <required /> + </field> + <field> + <fielddescr>Check SMTP size</fielddescr> + <fieldname>checksize</fieldname> + <description> + This option can be used to set the maximum message size (in KBytes) + that p3scan will use to determine if it should scan an smtp submission. + Leave this field blank if you are not going to use this option. + </description> + <type>input</type> + <default_value>1024</default_value> + </field> + <field> + <fielddescr>Footer</fielddescr> + <fieldname>footer</fieldname> + <description> + This option is used to add the virus definition info from your scanner + to an SMTP message. Leave this field blank if you are not going to use + this option. + </description> + <type>input</type> + <size>40</size> + <default_value>/usr/local/bin/clamdscan -V</default_value> + </field> + </fields> + <!-- + Arbitrary PHP Code, that gets executed if a certain event gets triggered. + --> + <custom_php_resync_config_command> + sync_package_p3scan(); + </custom_php_resync_config_command> +</packagegui> diff --git a/packages/dspam/pkg/p3scan-pf-spam.xml b/packages/dspam/pkg/p3scan-pf-spam.xml new file mode 100644 index 00000000..f6d77256 --- /dev/null +++ b/packages/dspam/pkg/p3scan-pf-spam.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8" ?> +<packagegui> + <!-- change this if configpath works --> + <name>p3scanpfspam</name> + <version>1.0</version> + <title>Services: POP3 Proxy: SPAM Settings</title> + <note> + This <acronym title="Hypertext Markup Language">HTML</acronym> page uses default values, hence even if each field is + set, you are still required to save this page if you are editing this page + for the very first time! + </note> + <include_file>/usr/local/pkg/p3scan.inc</include_file> + <aftersaveredirect>pkg_edit.php?xml=p3scan-pf-spam.xml&id=0</aftersaveredirect> + <tabs> + <tab> + <text>Daemon Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf.xml&id=0</url> + </tab> + <tab> + <text>Message Processing</text> + <url>pkg_edit.php?xml=p3scan-pf-msg.xml&id=0</url> + </tab> + <tab> + <text>Emergency Contact</text> + <url>/pkg.php?xml=p3scan-pf-emer.xml</url> + </tab> + <tab> + <text>Virus Scanner Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf-vir.xml&id=0</url> + </tab> + <tab> + <text>SPAM Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf-spam.xml&id=0</url> + <active /> + </tab> + </tabs> + <!-- + configpath gets expanded out automatically and config items + will be stored in that location + --> + <configpath>['installedpackages']['p3scanpf']['config']['spam']</configpath> + <!-- + 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>Enable Spam Checking</fielddescr> + <fieldname>checkspam</fieldname> + <description> + If set, will scan for Spam before scanning for a virus. + </description> + <type>checkbox</type> + <donotdisable>true</donotdisable> + <enablefields>spamcheck</enablefields> + </field> + <field> + <fielddescr>SPAM Executable Command</fielddescr> + <fieldname>spamcheck</fieldname> + <description>The command (plus arguments) that should be invoked to check for SPAM messages.</description> + <type>input</type> + <size>70</size> + <default_value> + /usr/local/bin/dspam --user dspamuser --mode=teft --stdout --deliver=innocent,spam --feature=ch,no,wh + </default_value> + </field> + </fields> + <!-- + Arbitrary PHP Code, that gets executed if a certain event gets triggered. + --> + <custom_php_resync_config_command> + sync_package_p3scan(); + </custom_php_resync_config_command> +</packagegui> diff --git a/packages/dspam/pkg/p3scan-pf-vir.xml b/packages/dspam/pkg/p3scan-pf-vir.xml new file mode 100644 index 00000000..ecaae872 --- /dev/null +++ b/packages/dspam/pkg/p3scan-pf-vir.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8" ?> +<packagegui> + <!-- change this if configpath works --> + <name>p3scanpfvir</name> + <version>1.0</version> + <title>Services: POP3 Proxy: Virus Scanner Settings</title> + <note> + This <acronym title="Hypertext Markup Language">HTML</acronym> page uses default values, hence even if each field is + set, you are still required to save this page if you are editing this page + for the very first time! + </note> + <include_file>/usr/local/pkg/p3scan.inc</include_file> + <aftersaveredirect>pkg_edit.php?xml=p3scan-pf-vir.xml&id=0</aftersaveredirect> + <tabs> + <tab> + <text>Daemon Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf.xml&id=0</url> + </tab> + <tab> + <text>Message Processing</text> + <url>/pkg_edit.php?xml=p3scan-pf-msg.xml&id=0</url> + </tab> + <tab> + <text>Emergency Contact</text> + <url>/pkg.php?xml=p3scan-pf-emer.xml</url> + </tab> + <tab> + <text>Virus Scanner Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf-vir.xml&id=0</url> + <active /> + </tab> + <tab> + <text>SPAM Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf-spam.xml&id=0</url> + </tab> + </tabs> + <!-- + configpath gets expanded out automatically and config items + will be stored in that location + --> + <configpath>['installedpackages']['p3scanpf']['config']['virus']</configpath> + <!-- + 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>Scanner Type</fielddescr> + <fieldname>scannertype</fieldname> + <description>Select here which type of scanner you want to use.</description> + <type>select</type> + <default_value>clamd</default_value> + <size>1</size> + <options> + <option><value>avpd</value><name>Kaspersky Anti-Virus for Linux</name></option> + <option><value>avpd_new</value><name>Kaspersky Anti-Virus for Linux (New)</name></option> + <option><value>bash</value><name>Shell Script</name></option> + <option><value>basic</value><name>Default Scanner Type</name></option> + <option><value>clamd</value><name>Clam Anti-Virus</name></option> + <option><value>trophie</value><name>Trophie Daemon</name></option> + </options> + </field> + <field> + <fielddescr>Virusscanner</fielddescr> + <fieldname>scanner</fieldname> + <description>Depends on scannertype.</description> + <type>input</type> + <default_value>127.0.0.1:3310</default_value> + <required /> + </field> + <field> + <fielddescr>Scanner Returncode</fielddescr> + <fieldname>viruscode</fieldname> + <description> + Specify the returncode(s) which the scanner returns when + the mail is infected. + </description> + <type>input</type> + <default_value>1</default_value> + </field> + <field> + <fielddescr>Good Scanner return codes</fielddescr> + <fieldname>goodcode</fieldname> + <description> + Some scanners can report more than good or infected. Place valid return + codes here that will enable the message to be delivered without a warning. + </description> + <type>input</type> + </field> + <field> + <fielddescr>Regular Expression for Virusname</fielddescr> + <fieldname>virusregexp</fieldname> + <description> + Specify here a regular expression which describes where the name of + the virus can be found. + </description> + <type>input</type> + <default_value>.*: (.*) FOUND</default_value> + </field> + <field> + <fielddescr>deMIME Setting</fielddescr> + <fieldname>demime</fieldname> + <description> + Tick this if we should parse all lt;acronym title="Multipurpose Internet Mail Extensions">MIME</acronym>-sections instead of passing the + message as-is to the scanner. + </description> + <type>checkbox</type> + <donotdisable>true</donotdisable> + </field> + </fields> + <!-- + Arbitrary PHP Code, that gets executed if a certain event gets triggered. + --> + <custom_php_resync_config_command> + sync_package_p3scan(); + </custom_php_resync_config_command> +</packagegui> diff --git a/packages/dspam/pkg/p3scan-pf.xml b/packages/dspam/pkg/p3scan-pf.xml new file mode 100644 index 00000000..9b99668a --- /dev/null +++ b/packages/dspam/pkg/p3scan-pf.xml @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="utf-8" ?> +<packagegui> + <name>p3scanpf</name> + <version>1.0</version> + <title>Services: POP3 Proxy: Main</title> + <note> + This <acronym title="Hypertext Markup Language">HTML</acronym> page uses default values, hence even if each field is + set, you are still required to save this page if you are editing this page + for the very first time! + </note> + <include_file>/usr/local/pkg/p3scan.inc</include_file> + <aftersaveredirect>pkg_edit.php?xml=p3scan-pf.xml&id=0</aftersaveredirect> + <!-- Menu is where this packages menu will appear --> + <menu> + <name>p3scan</name> + <section>Services</section> + <configfile>p3scan.xml</configfile> + <tooltiptext>A transparent POP3-Proxy with virus-scanning capabilities</tooltiptext> + </menu> + <service> + <name>p3scan-pf</name> + <rcfile>/usr/local/etc/rc.d/030.p3scan.sh</rcfile> + </service> + <tabs> + <tab> + <text>Daemon Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf.xml&id=0</url> + <active /> + </tab> + <tab> + <text>Message Processing</text> + <url>/pkg_edit.php?xml=p3scan-pf-msg.xml&id=0</url> + </tab> + <tab> + <text>Emergency Contact</text> + <url>/pkg.php?xml=p3scan-pf-emer.xml</url> + </tab> + <tab> + <text>Virus Scanner Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf-vir.xml&id=0</url> + </tab> + <tab> + <text>SPAM Settings</text> + <url>/pkg_edit.php?xml=p3scan-pf-spam.xml&id=0</url> + </tab> + </tabs> + <!-- + configpath gets expanded out automatically and config items + will be stored in that location + --> + <configpath>['installedpackages']['p3scanpf']['config']</configpath> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/p3scan-pf-msg.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/p3scan-pf-emer.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/p3scan-pf-vir.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/p3scan-pf-spam.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/p3scan_rules.php</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/p3scan.inc</item> + </additional_files_needed> + <!-- + 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>Max Child's</fielddescr> + <fieldname>maxchilds</fieldname> + <description>The maximum number of connections we will handle at once.</description> + <type>input</type> + <default_value>10</default_value> + </field> + <field> + <fielddescr>IP Address</fielddescr> + <fieldname>ipaddr</fieldname> + <description>The <acronym title="Internet Protocol">IP</acronym> Address we listen on.</description> + <type>input</type> + <default_value>0.0.0.0</default_value> + <required /> + </field> + <field> + <fielddescr>Port</fielddescr> + <fieldname>port</fieldname> + <description>The <acronym title="Transmission Control Protocol">TCP</acronym> port on we should listen.</description> + <type>input</type> + <default_value>8110</default_value> + <required /> + </field> + <field> + <fielddescr>SSL Port</fielddescr> + <fieldname>sslport</fieldname> + <description>The TCP <acronym title="Secure Sockets Layer">SSL</acronym> port on we should listen.</description> + <type>input</type> + <default_value>995</default_value> + <required /> + </field> + <field> + <fielddescr>Target IP</fielddescr> + <fieldname>targetip</fieldname> + <description>Target IP is the IP to connect (0.0.0.0 enables transparent mode).</description> + <type>input</type> + <default_value>0.0.0.0</default_value> + <required /> + </field> + <field> + <fielddescr>Target Port</fielddescr> + <fieldname>targetport</fieldname> + <description>Target Port is the port to connect.</description> + <default_value>8110</default_value> + <type>input</type> + <required /> + </field> + <field> + <fielddescr>Email Port</fielddescr> + <fieldname>emailport</fieldname> + <description>The port we should listen on to scan outgoing email messages.</description> + <type>input</type> + <default_value>25</default_value> + <required /> + </field> + <field> + <fielddescr>Daemon User</fielddescr> + <fieldname>daemonuser</fieldname> + <description>The username the daemon should run as.</description> + <type>input</type> + <default_value>root</default_value> + <required /> + </field> + </fields> + <!-- + Arbitrary PHP Code, that gets executed if a certain event gets triggered. + --> + <custom_delete_php_command> + sync_package_p3scan(); + </custom_delete_php_command> + <custom_php_resync_config_command> + sync_package_p3scan(); + </custom_php_resync_config_command> + <custom_php_install_command> + custom_php_install_command(); + </custom_php_install_command> + <custom_php_deinstall_command> + custom_php_deinstall_command(); + </custom_php_deinstall_command> +</packagegui> diff --git a/packages/dspam/pkg/p3scan.inc b/packages/dspam/pkg/p3scan.inc new file mode 100644 index 00000000..7d675050 --- /dev/null +++ b/packages/dspam/pkg/p3scan.inc @@ -0,0 +1,277 @@ +<?php +/* $Id$ */ +/* Copyright (C) 2006 Daniel S. Haischt */ + +/* include all configuration functions */ +require_once("functions.inc"); + +function sync_package_p3scan() { + global $config, $g; + conf_mount_rw(); + config_lock(); + $fd = fopen("/etc/p3scan.conf","w"); + + /* shorten the config path */ + $cfg = $config['installedpackages']['p3scanpf']['config'][0]; + $cfgmsg = $config['installedpackages']['p3scanpfmsg']['config'][0]; + $cfgemer = $config['installedpackages']['p3scanpfemer']['config']; + $cfgvir = $config['installedpackages']['p3scanpfvir']['config'][0]; + $cfgspam = $config['installedpackages']['p3scanpfspam']['config'][0]; + + fwrite($fd, "## p3scan-pf config file - generated by pfSense.\n##\n"); + fwrite($fd, "## at: " . date("l dS of F Y h:i:s A") . "\n##\n"); + /* ================================================================ */ + /* == Tab: Daemon Settings == */ + /* ================================================================ */ + fwrite($fd, "## Daemon Settings.\n"); + fwrite($fd, "pidfile = /var/run/p3scan/p3scan.pid\n"); + if (isset($cfg['maxchilds']) && $cfg['maxchilds'] <> "") + fwrite($fd, "maxchilds = {$cfg['maxchilds']}\n"); + else + fwrite($fd, "maxchilds = 10\n"); + if (isset($cfg['ipaddr']) && $cfg['ipaddr'] <> "") + fwrite($fd, "ip = {$cfg['ipaddr']}\n"); + else + fwrite($fd, "ip = 0.0.0.0\n"); + /* TODO: Even if the port is configurable, it is + hardcoded in p3scan.c. This needs to be + changed for the sake of flexebility. + */ + if (isset($cfg['port']) && $cfg['port'] <> "") + fwrite($fd, "port = {$cfg['port']}\n"); + else + fwrite($fd, "port = 8110\n"); + if (isset($cfg['sslport']) && $cfg['sslport'] <> "") + fwrite($fd, "sslport = {$cfg['sslport']}\n"); + else + fwrite($fd, "sslport = 995\n"); + if (isset($cfg['targetip']) && $cfg['targetip'] <> "") + fwrite($fd, "targetip = {$cfg['targetip']}\n"); + else + fwrite($fd, "targetip = 0.0.0.0\n"); + if (isset($cfg['targetport']) && $cfg['targetport'] <> "") + fwrite($fd, "targetport = {$cfg['targetport']}\n"); + else + fwrite($fd, "targetport = 8110\n"); + if (isset($cfg['emailport']) && $cfg['emailport'] <> "") + fwrite($fd, "emailport = {$cfg['emailport']}\n"); + else + fwrite($fd, "emailport = 25\n"); + if (isset($cfg['daemonuser']) && $cfg['daemonuser'] <> "") + fwrite($fd, "user = {$cfg['daemonuser']}\n"); + else + fwrite($fd, "user = root\n"); + fwrite($fd, "notifydir = /var/spool/p3scan/notify\n"); + fwrite($fd, "virusdir = /var/spool/p3scan\n"); + fwrite($fd, "template = /usr/local/etc/p3scan/p3scan.mail\n"); + + /* ================================================================ */ + /* == Tab: Message Processing == */ + /* ================================================================ */ + fwrite($fd, "## Message Processing Settings.\n"); + if (isset($cfgmsg['justdelete']) && $cfgmsg['justdelete'] <> "") + fwrite($fd, "justdelete\n"); + if (isset($cfgmsg['bytesfree']) && $cfgmsg['bytesfree'] <> "") + fwrite($fd, "bytesfree = {$cfgmsg['bytesfree']}\n"); + else + fwrite($fd, "bytesfree = 10000\n"); + if (isset($cfgmsg['broken']) && $cfgmsg['broken'] <> "") + fwrite($fd, "broken\n"); + if (isset($cfgmsg['timeout']) && $cfgmsg['timeout'] <> "") + fwrite($fd, "timeout = {$cfgmsg['timeout']}\n"); + else + fwrite($fd, "timeout = 30\n"); + if (isset($cfgmsg['ispspam']) && $cfgmsg['ispspam'] <> "") + fwrite($fd, "ispspam = {$cfg['ispspam']}\n"); + if (file_exists("/usr/local/bin/renattach")) + fwrite($fd, "renattach = /usr/local/bin/renattach\n"); + if (isset($cfgmsg['subject']) && $cfgmsg['subject'] <> "") + fwrite($fd, "subject = {$cfgmsg['subject']}\n"); + else + fwrite($fd, "subject = Subject: \"[Virus] found in a mail to you:\" <virus name>\n"); + if (isset($cfgmsg['notify']) && $cfgmsg['notify'] <> "") + fwrite($fd, "notify = {$cfgmsg['notify']}\n"); + else + fwrite($fd, "notify = Per instruction, the message has been deleted.\n"); + if (isset($cfgmsg['smtpreject']) && $cfgmsg['smtpreject'] <> "") + fwrite($fd, "smtprset = {$cfgmsg['smtpreject']}\n"); + else + fwrite($fd, "smtprset = Virus detected! P3scan rejected message!\n"); + if (isset($cfgmsg['checksize']) && $cfgmsg['checksize'] <> "") + fwrite($fd, "checksize = {$cfgmsg['checksize']}\n"); + if (isset($cfgmsg['footer']) && $cfgmsg['footer'] <> "") + fwrite($fd, "footer = {$cfgmsg['footer']}\n"); + + /* ================================================================ */ + /* == Tab: Emergency Contact == */ + /* ================================================================ */ + fwrite($fd, "## Emergency Contacts.\n"); + if (is_array($cfgemer)) { + foreach ($cfgemer as $addr) { + $contact .= "{$addr['emailaddress']} "; + } + if (isset($contact) && $contact <> "") + fwrite($fd, "emergcon = {$contact}\n"); + } + + /* ================================================================ */ + /* == Tab: Virus Scanner Settings == */ + /* ================================================================ */ + fwrite($fd, "## Virus Scanner Settings.\n"); + if (isset($cfgvir['scannertype']) && $cfgvir['scannertype'] <> "") + fwrite($fd, "scannertype = {$cfgvir['scannertype']}\n"); + else + fwrite($fd, "scannertype = clamd\n"); + if (isset($cfgvir['scanner']) && $cfgvir['scanner'] <> "") + fwrite($fd, "scanner = {$cfgvir['scanner']}\n"); + else + fwrite($fd, "scanner = 127.0.0.1:3310\n"); + if (isset($cfgvir['viruscode']) && $cfgvir['viruscode'] <> "") + fwrite($fd, "viruscode = {$cfgvir['viruscode']}\n"); + else + fwrite($fd, "viruscode = 1\n"); + if (isset($cfgvir['goodcode']) && $cfgvir['goodcode'] <> "") + fwrite($fd, "goodcode = {$cfgvir['goodcode']}\n"); + if (isset($cfgvir['virusregexp']) && $cfgvir['virusregexp'] <> "") + fwrite($fd, "virusregexp = {$cfgvir['virusregexp']}\n"); + if (isset($cfgvir['demime']) && $cfgvir['demime'] <> "") + fwrite($fd, "demime\n"); + + /* ================================================================ */ + /* == Tab: SPAM Settings == */ + /* ================================================================ */ + if (isset($cfgspam['checkspam']) && $cfgpam['checkspam'] <> "") { + fwrite($fd, "## SPAM Settings.\n"); + fwrite($fd, "checkspam\n"); + if (isset($cfgvir['spamcheck']) && $cfgvir['spamcheck'] <> "") + fwrite($fd, "spamcheck = {$cfgspam['spamcheck']}\n"); + else + fwrite($fd, "spamcheck = /usr/local/bin/dspam --user dspamuser --mode=teft --stdout --deliver=innocent,spam --feature=ch,no,wh\n"); + } + + fclose($fd); + + /* NOTE: The following code requires the p3scan.inc file to be saved with + UNIX Linefeeds. LF that is and NOT CR LF. + */ + $start = <<<EOD +test_p3scan_user=`cat /etc/passwd | grep p3scan` +test_p3scan_group=`cat /etc/passwd | grep p3scan` + +if [ -z "\${test_p3scan_group}" ]; then + pw groupadd p3scan -g 108 +fi + +if [ -z "\${test_p3scan_user}" ]; then + pw useradd p3scan -u 108 -g p3scan -d /var/spool/p3scan -s /sbin/nologin -c 'P3Scan Daemon' +fi + +if [ ! -d "/var/spool/p3scan" ]; then + mkdir /var/spool/p3scan && chown p3scan:p3scan /var/spool/p3scan +fi + +if [ ! -d "/var/spool/p3scan/children" ]; then + mkdir /var/spool/p3scan/children && chown p3scan:p3scan /var/spool/p3scan/children +fi + +if [ ! -d "/var/spool/p3scannotify" ]; then + mkdir /var/spool/p3scannotify && chown p3scan:p3scan /var/spool/p3scannotify +fi + +if [ ! -d "/var/run/p3scan" ]; then + mkdir /var/run/p3scan && chown p3scan:p3scan /var/run/p3scan +fi + +/sbin/mount_fdescfs fdescfs /dev/fd +/usr/local/sbin/p3scan --configfile=/usr/local/etc/p3scan/p3scan.conf & + +EOD; + + $stop = "/usr/bin/killall p3scan\n" . + "sleep 2"; + + write_rcfile(array( + "file" => "030.p3scan.sh", + "start" => $start, + "stop" => $stop + ) + ); + + conf_mount_ro(); + config_unlock(); + + if (! file_exists("/usr/local/etc/p3scan")) { + mkdir("/usr/local/etc/p3scan"); + } + if (! file_exists("/usr/local/etc/p3scan/p3scan.conf")) { + mwexec("ln -s /etc/p3scan.conf /usr/local/etc/p3scan/p3scan.conf"); + } + if (! file_exists("/usr/local/etc/p3scan/p3scan.mail")) { + $fd = fopen("/usr/local/etc/p3scan/p3scan.mail","w"); + + $p3scanmail = <<<EOD +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; + charset="iso-8859-1" + +Hello %USERNAME%. +This message body was generated automatically from P3Scan, which runs on +%HOSTNAME%.%DOMAINNAME% for scanning all incoming email. + +It replaces the body of a message sent to you that contained a VIRUS! + +Instead of the infected email this message has been sent to you. + +You may look at the message header of this message for the complete +email header information of the infected message. + +Virus name: + %VIRUSNAME% +(Supposed) Sender of the email: + %MAILFROM% +Sent To: + %MAILTO% +On Date: + %MAILDATE% +Subject: + %SUBJECT% +Connection data: + %PROTOCOL% from %CLIENTIP%:%CLIENTPORT% to %SERVERIP%:%SERVERPORT% +Message File: + %P3SCANID% +Virus Definition Info: + %VDINFO% +-- +%PROGNAME% %VERSION% +by Jack S. Lai <laitcg@cox.net> + +EOD; + + fwrite($fd, $p3scanmail); + fclose($fd); + } + + mwexec("/usr/local/etc/rc.d/030.p3scan.sh stop"); + mwexec("/usr/local/etc/rc.d/030.p3scan.sh start"); + + return 0; +} + +function custom_php_install_command() { + global $config, $g; + sync_package_p3scan(); +} + +function custom_php_deinstall_command() { + global $config, $g; + conf_mount_rw(); + unlink_if_exists("/usr/local/pkg/pf/p3scan_rules.php"); + unlink_if_exists("/usr/local/www/p3scan_rules.php"); + unlink_if_exists("/usr/local/etc/p3scan/p3scan.conf"); + unlink_if_exists("/usr/local/etc/p3scan/p3scan.mail"); + unlink_if_exists("/usr/local/etc/rc.d/030.p3scan.sh"); + rmdir("/usr/local/etc/p3scan"); + conf_mount_ro(); +} +?>
\ No newline at end of file diff --git a/packages/dspam/pkg/verdana.ttf b/packages/dspam/pkg/verdana.ttf Binary files differnew file mode 100644 index 00000000..754a9b7b --- /dev/null +++ b/packages/dspam/pkg/verdana.ttf diff --git a/packages/dspam/www/dspam-admin-graph.php b/packages/dspam/www/dspam-admin-graph.php new file mode 100644 index 00000000..508824e2 --- /dev/null +++ b/packages/dspam/www/dspam-admin-graph.php @@ -0,0 +1,201 @@ +<?php +/* $Id$ */ +/* + dspam-admin-graph.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +/* required because of system_groupmanager.php */ +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("System Status"), + gettext("Graph")); + +require_once 'Image/Graph.php'; +require_once 'Image/Canvas.php'; +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (! $_GET || + strlen($_SERVER['QUERY_STRING']) == 0 || + ! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + return; +} + +$FORM =& ReadParse($_SERVER['QUERY_STRING']); + +list($spam, $nonspam, $sm, $fp, $inoc, $wh, $period) = split('_', $FORM['data']); +$spam = split(',', $spam); +$nonspam = split(',', $nonspam); +$sm = split(',', $sm); +$fp = split(',', $fp); +$inoc = split(',', $inoc); +$wh = split(',', $wh); +$period = split(',', $period); + +// create a PNG canvas and enable antialiasing (canvas implementation) +$Canvas =& Image_Canvas::factory('png', array('width' => 725, + 'height' => 450, + 'antialias' => 'native')); + +// create the graph +$Graph =& Image_Graph::factory('graph', $Canvas); +// add a TrueType font +$Font =& $Graph->addNew('font', 'Verdana'); +// set the font size to 8 pixels +$Font->setSize(8); + +$Graph->setFont($Font); + +// setup the plotarea, legend and their layout +$Graph->add( + Image_Graph::vertical( + Image_Graph::factory('title', array('', 12)), + Image_Graph::horizontal( + $Plotarea = Image_Graph::factory('plotarea'), + $Legend = Image_Graph::factory('legend'), + 80 + ), + 0 + ) +); + +// add grids +$Grid =& $Plotarea->addNew('line_grid', IMAGE_GRAPH_AXIS_Y); +$Grid->setLineColor('silver'); + +// link the legend with the plotares +$Legend->setPlotarea($Plotarea); + +// create the two datasets +$i = 0; +$spamds =& Image_Graph::factory('dataset'); +foreach($spam as $el){ + $spamds->addPoint(strval($period[$i]), intval($el)); + $i++; +} + +$i = 0; +$hamds =& Image_Graph::factory('dataset'); +foreach($nonspam as $el){ + $hamds->addPoint(strval($period[$i]), intval($el)); + $i++; +} + +$i = 0; +$smds =& Image_Graph::factory('dataset'); +foreach($sm as $el){ + $smds->addPoint(strval($period[$i]), intval($el)); + $i++; +} + +$i = 0; +$fpds =& Image_Graph::factory('dataset'); +foreach($fp as $el){ + $fpds->addPoint(strval($period[$i]), intval($el)); + $i++; +} + +$i = 0; +$inocds =& Image_Graph::factory('dataset'); +foreach($inoc as $el){ + $inocds->addPoint(strval($period[$i]), intval($el)); + $i++; +} + +$i = 0; +$whds =& Image_Graph::factory('dataset'); +foreach($wh as $el){ + $whds->addPoint(strval($period[$i]), intval($el)); + $i++; +} + +// set the name/title of each dataset +$spamds->setName('SPAM'); +$hamds->setName('Nonspam'); +$smds->setName('Spam Misses'); +$fpds->setName('False Positives'); +$inocds->setName('Inoculations'); +$whds->setName('Auto-Whitelisted'); + +// put each dataset in a singel ds array +$Datasets = array($inocds, $whds, $spamds, $hamds, $smds, $fpds); + +// create the plot as line chart using the dataset +$Plot =& $Plotarea->addNew('Image_Graph_Plot_Bar', array($Datasets,'stacked')); + +// set a fill color +$FillArray =& Image_Graph::factory('Image_Graph_Fill_Array'); +$FillArray->addColor('#000000'); +$FillArray->addColor('#BF00BF'); +$FillArray->addColor('#BF0000'); +$FillArray->addColor('#00BF00'); +$FillArray->addColor('#BFBF00'); +$FillArray->addColor('#FF7F00'); + +// set a standard fill style +$Plot->setFillStyle($FillArray); + +/* set axis labels */ +$XAxis =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X); +$XAxis->setTitle("{$FORM['x_label']}", array('size' => 8, 'angle' => 0)); +$XAxis->setFontAngle(60); +$XAxis->setLabelOptions(array('offset' => intval($FORM['offset']), + 'showtext' => true, + 'position' => 'outside'), 1); + + +$YAxis =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y); +$YAxis->setTitle('Number of Messages', array('size' => 8, 'angle' => 90)); + +// create a Y data value marker +$Marker =& $Plot->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_VALUE_Y); +$Marker->setFontSize(6); + +// and use the marker on the 1st plot +$Plot->setMarker($Marker); +$Plot->setDataSelector(Image_Graph::factory('Image_Graph_DataSelector_NoZeros')); + +// output the Graph +$Graph->done(); + +function &ReadParse($URI = "") { + if ($URI == "") { + return NULL; + } + + $pairs = preg_split('/&/', $URI); + $FORM = array(); + + foreach($pairs as $pair){ + list($name, $value) = preg_split('/\=/', $pair); + $pattern = '/%([a-fA-F0-9][a-fA-F0-9])/'; + + $name = preg_replace('/\+/', ' ', $name); + $name = preg_replace_callback( + $pattern, + create_function( + '$matches', + 'return pack("C", hexdec($matches[1]));' + ), + $name + ); + + $value = preg_replace('/\+/', ' ', $value); + $value = preg_replace_callback( + $pattern, + create_function( + '$matches', + 'return pack("C", hexdec($matches[1]));' + ), + $value + ); + + $FORM[$name] = $value; + } // end foreach + + return $FORM; +} +?> diff --git a/packages/dspam/www/dspam-admin-prefs.php b/packages/dspam/www/dspam-admin-prefs.php new file mode 100644 index 00000000..324d961f --- /dev/null +++ b/packages/dspam/www/dspam-admin-prefs.php @@ -0,0 +1,249 @@ +<?php +/* $Id$ */ +/* + dspam-train.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Admin Preferences")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + /* if ajax is calling, give them an update message */ + if(isAjax()) + print_info_box_np($savemsg); + + include("head.inc"); + /* put your custom HTML head content here */ + /* using some of the $pfSenseHead function calls */ + $jscriptstr = <<<EOD +<script type="text/javascript"> +<!-- + +EOD; + + $jscriptstr .= getJScriptFunction(0); + $jscriptstr .= <<<EOD +//--> +</script> +EOD; + + $pfSenseHead->addScript($jscriptstr); + echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam-admin-prefs.php" method="post" name="iform" id="iform"> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<p> + <span class="vexpl"> + This page lets you configure how the filter will handle your messages. + </span> +</p> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("System Status", false, "/dspam-admin.php?user={$CURRENT_USER}"); + $tab_array[] = array("User Statistics", false, "/dspam-admin-stats.php?user={$CURRENT_USER}"); + $tab_array[] = array("Administration", true, "/dspam-admin-prefs.php?user={$CURRENT_USER}"); + $tab_array[] = array("Settings", false, "/dspam-settings.php?user={$CURRENT_USER}"); + $tab_array[] = array("Control Center", false, "/dspam.php?user={$CURRENT_USER}"); + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="2">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Username</td> + <td width="78%" class="vtable"> + <?php if(isset($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <input type="text" name="username" id="username" value="<?= $CURRENT_USER ?>" class="formfld user"<?php if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { echo " readonly=\"readonly\""; } ?> /> + <?php else: ?> + <input type="text" name="username" id="username" value="Please provide a username" class="formfld user" onFocus="this.value='';" /> + <?php endif; ?> + + <?php + if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + $action = "onClick=\"changeuser();\""; + else + $action = "onClick=\"document.iform.submit();\""; + ?> + <input type="button" name="change_user" id="change_user" class="formbtn" value="Change" <?= $action ?> /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" colspan="2"> + <strong>Training</strong> – Configure how the filter learns as it processes messages + </td> + </tr> + <tr> + <td align="left" valign="top" class="vncell" width="40%"> + <p>DSPAM should train:</p> + <input <?= $DATA["S_TEFT"]; ?> value="TEFT" type="radio" class="formfld" title="On every new message scanned by the filter" alt="On every new message scanned by the filter" name="rad_train" id="rad_train_one" /> + <label for="rad_train_one"> On every new message scanned by the filter (TEFT)</label> + <br /> + <input <?= $DATA["S_TOE"]; ?> value="TOE" type="radio" class="formfld" title="Only when the filter makes a mistake" alt="Only when the filter makes a mistake" name="rad_train" id="rad_train_two" /> + <label for="rad_train_two"> Only when the filter makes a mistake (TOE)</label> + <br /> + <input <?= $DATA["S_TUM"]; ?> value="TUM" type="radio" class="formfld" title=";Only with new data or if the filter makes a mistake" alt=";Only with new data or if the filter makes a mistake" name="rad_train" id="rad_train_three" /> + <label for="rad_train_three"> Only with new data or if the filter makes a mistake (TUM)</label> + </td> + <td align="left" valign="top" class="vncell" width="60%"> + <p>When I train DSPAM, I prefer:</p> + <input value="message" <?= $DATA["S_LOC_MESSAGE"]; ?> value="message" type="radio" class="formfld" title="To forward my spams (signature appears in message body)" alt="To forward my spams (signature appears in message body)" name="rad_train_action" id="rad_train_action_one" /> + <label for="rad_train_action_one"> To <u>forward</u> my spams (signature appears in message body)</label> + <br /> + <input <?= $DATA["S_LOC_HEADERS"]; ?> value="headers" type="radio" class="formfld" title="To bounce my spams (signature appears in message headers)" alt="To bounce my spams (signature appears in message headers)" name="rad_train_action" id="rad_train_action_two" /> + <label value="headers" for="rad_train_action_two"> To <u>bounce</u> my spams (signature appears in message headers)</label> + </td> + </tr> + <tr> + <td align="left" valign="middle" class="vncell" colspan="2"> + <p> + Filter sensitivity <strong>during</strong> the training period: + </p> + <p align="center"> + <nobr> + <span> + Catch SPAM (More in Quarantine) + <input value="0" type="radio" class="formfld" title="-5" alt="-5" name="rad_filter_sens" <?= $DATA["SEDATION_0"]; ?> /> + <input value="1" type="radio" class="formfld" title="-4" alt="-4" name="rad_filter_sens" <?= $DATA["SEDATION_1"]; ?> /> + <input value="2" type="radio" class="formfld" title="-3" alt="-3" name="rad_filter_sens" <?= $DATA["SEDATION_2"]; ?> /> + <input value="3" type="radio" class="formfld" title="-2" alt="-2" name="rad_filter_sens" <?= $DATA["SEDATION_3"]; ?> /> + <input value="4" type="radio" class="formfld" title="-1" alt="-1" name="rad_filter_sens" <?= $DATA["SEDATION_4"]; ?> /> + <strong style="font-size: larger;">»</strong> + <input value="5" type="radio" class="formfld" title="0" alt="0" name="rad_filter_sens" <?= $DATA["SEDATION_5"]; ?> /> + <strong style="font-size: larger;">«</strong> + <input value="6" type="radio" class="formfld" title="1" alt="1" name="rad_filter_sens" <?= $DATA["SEDATION_6"]; ?> /> + <input value="7" type="radio" class="formfld" title="2" alt="2" name="rad_filter_sens" <?= $DATA["SEDATION_7"]; ?> /> + <input value="8" type="radio" class="formfld" title="3" alt="3" name="rad_filter_sens" <?= $DATA["SEDATION_8"]; ?> /> + <input value="9" type="radio" class="formfld" title="4" alt="4" name="rad_filter_sens" <?= $DATA["SEDATION_9"]; ?> /> + <input value="10" type="radio" class="formfld" title="5" alt="5" name="rad_filter_sens" <?= $DATA["SEDATION_10"]; ?> /> + Assume Good (Fewer in Quarantine) + </span> + </nobr> + </p> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" colspan="2"> + <strong>Message Handling</strong> – Configure how SPAM is handled + </td> + </tr> + <tr> + <td align="left" valign="top" class="vncell" colspan="2"> + <p>When a SPAM message is identified:</p> + <p> + <input value="quarantine" <?= $DATA["S_ACTION_QUARANTINE"]; ?> type="radio" class="formfld" title="Quarantine the message" alt="Quarantine the message" name="rad_ident_action" id="rad_ident_action_one" /> + <label for="rad_ident_action_one"> Quarantine the message</label> + <br /> + <input value="tag" <?= $DATA["S_ACTION_TAG"]; ?> type="radio" class="formfld" title="Tag the Subject header with" alt="Tag the Subject header with" name="rad_ident_action" id="rad_ident_action_two" /> + <label for="rad_ident_action_two">Tag the Subject header with </label> + <input size="35" type="text" class="formfld mail" title="message tag" alt="message tag" value="<?= $DATA["SPAM_SUBJECT"]; ?>" name="msgtag" /> + <br /> + <input value="deliver" <?= $DATA["S_ACTION_DELIVER"]; ?> type="radio" class="formfld" title="Deliver the message normally with a X-DSPAM-Result header" alt="Deliver the message normally with a X-DSPAM-Result header" name="rad_ident_action" id="rad_ident_action_three" /> + <label for="rad_ident_action_three"> Deliver the message normally with a X-DSPAM-Result header</label> + </p> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" colspan="2"> + <strong>Features</strong> – Tuning SPAM filtering + </td> + </tr> + <tr> + <td align="left" valign="top" class="vncell" colspan="2"> + <p> + <input <?= $DATA["C_BNR"]; ?> type="checkbox" class="formbtn" title="Enable noise reduction, which usually improves filtering accuracy" alt="Enable noise reduction, which usually improves filtering accuracy" name="chk_feature_nr" id="chk_feature_nr" /> + <label for="chk_feature_nr"> Enable noise reduction, which usually improves filtering accuracy</label> + <br /> + <input <?= $DATA["C_WHITELIST"]; ?> type="checkbox" class="formbtn" title="Enable automatic whitelisting to record frequent correspondence" alt="Enable automatic whitelisting to record frequent correspondence" name="chk_feature_aw" id="chk_feature_aw" /> + <label for="chk_feature_aw"> Enable automatic whitelisting to record frequent correspondence</label> + <br /> + <input <?= $DATA["C_FACTORS"]; ?> type="checkbox" class="formbtn" title="Add the factoring tokens in each email into the message's full headers" alt="Add the factoring tokens in each email into the message's full headers" name="chk_feature_at" id="chk_feature_at" /> + <label for="chk_feature_at"> Add the factoring tokens in each email into the message's full headers</label> + <!-- + <input type="checkbox" class="formbtn" title="Add the factoring tokens in each email into the message's full headers" alt="Add the factoring tokens in each email into the message's full headers" name="chk_feature_at" id="chk_feature_at" /> + <label for="chk_feature_at"> Add the factoring tokens in each email into the message's full headers</label> + <br /> + <input type="checkbox" class="formbtn" title="opt in of DSPAM filtering" alt="opt in of DSPAM filtering" name="chk_feature_optin" id="chk_feature_optin" /> + <label for="chk_feature_optin"> opt in of DSPAM filtering</label> + <br /> + <input type="checkbox" class="formbtn" title="opt out of DSPAM filtering" alt="opt out of DSPAM filtering" name="chk_feature_optout" id="chk_feature_optout" /> + <label for="chk_feature_optout"> opt out of DSPAM filtering</label> + --> + </p> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td class="list"> </td> + <td class="list"> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> +</form> +<? +} else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php +} // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-admin-stats.php b/packages/dspam/www/dspam-admin-stats.php new file mode 100644 index 00000000..82b91831 --- /dev/null +++ b/packages/dspam/www/dspam-admin-stats.php @@ -0,0 +1,123 @@ +<?php +/* $Id$ */ +/* + dspam-train.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("User Statistics")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + /* if ajax is calling, give them an update message */ + if(isAjax()) + print_info_box_np($savemsg); + + include("head.inc"); + /* put your custom HTML head content here */ + /* using some of the $pfSenseHead function calls */ + echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam-admin-stats.php" method="post" name="iform" id="iform"> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<p> + <span class="vexpl"> + The following table shows the number of messages processed for each user + along with their current preference settings. + </span> +</p> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("System Status", false, "/dspam-admin.php?user={$CURRENT_USER}"); + $tab_array[] = array("User Statistics", true, "/dspam-admin-stats.php?user={$CURRENT_USER}"); + $tab_array[] = array("Administration", false, "/dspam-admin-prefs.php?user={$CURRENT_USER}"); + $tab_array[] = array("Settings", false, "/dspam-settings.php?user={$CURRENT_USER}"); + $tab_array[] = array("Control Center", false, "/dspam.php?user={$CURRENT_USER}"); + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="14">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Username</td> + <td width="78%" class="vtable" colspan="13"> + <strong><?= $CURRENT_USER ?></strong> + </td> + </tr> + <tr> + <td colspan="14" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic">Name</td> + <td align="left" valign="top" class="listtopic">Q.Size</td> + <td align="left" valign="top" class="listtopic">TP</td> + <td align="left" valign="top" class="listtopic">TN</td> + <td align="left" valign="top" class="listtopic">FP</td> + <td align="left" valign="top" class="listtopic">FN</td> + <td align="left" valign="top" class="listtopic">SC</td> + <td align="left" valign="top" class="listtopic">IC</td> + <td align="left" valign="top" class="listtopic">Mode</td> + <td align="left" valign="top" class="listtopic">On Spam</td> + <td align="left" valign="top" class="listtopic">BNR</td> + <td align="left" valign="top" class="listtopic">Whitelist</td> + <td align="left" valign="top" class="listtopic">Sed</td> + <td align="left" valign="top" class="listtopic">Sig Loc</td> + </tr> + <?= $DATA['TABLE']; ?> + </table> + </div> + </td> + </tr> +</table> +</form> +<? +} else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php +} // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-admin.php b/packages/dspam/www/dspam-admin.php new file mode 100644 index 00000000..45b33b55 --- /dev/null +++ b/packages/dspam/www/dspam-admin.php @@ -0,0 +1,207 @@ +<?php +/* $Id$ */ +/* + dspam-train.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("System Status"), + gettext("Overview")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + /* if ajax is calling, give them an update message */ + if(isAjax()) + print_info_box_np($savemsg); + + include("head.inc"); + /* put your custom HTML head content here */ + /* using some of the $pfSenseHead function calls */ + echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam-admin.php" method="post" name="iform" id="iform"> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<p> + <span class="vexpl"> + The following graphs and tables summarize the processing done by the filter. + </span> +</p> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("System Status", true, "/dspam-admin.php?user={$CURRENT_USER}"); + $tab_array[] = array("User Statistics", false, "/dspam-admin-stats.php?user={$CURRENT_USER}"); + $tab_array[] = array("Administration", false, "/dspam-admin-prefs.php?user={$CURRENT_USER}"); + $tab_array[] = array("Settings", false, "/dspam-settings.php?user={$CURRENT_USER}"); + $tab_array[] = array("Control Center", false, "/dspam.php?user={$CURRENT_USER}"); + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="2">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="10%" valign="baseline" class="vncell">Username</td> + <td width="90%" class="vtable"> + <strong><?= $CURRENT_USER ?></strong> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" align="left" valign="top" class="listtopic"> + <strong>Overview</strong> + </td> + </tr> + <tr> + <td colspan="2" align="center" valign="top" class="vncell"> + <table align="center" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr">Messages</td> + <td align="left" valign="top" class="listhdrr">Today</td> + <td align="left" valign="top" class="listhdrr">This Hour</td> + <td align="left" valign="top" class="list"> </td> + <td align="left" valign="top" class="listhdrr">Status</td> + <td align="left" valign="top" class="listhdrr">Current Value</td> + </tr> + <tr> + <td align="left" valign="top" class="listr">Spam</td> + <td align="left" valign="top" class="listr"><?= $DATA['SPAM_TODAY']; ?></td> + <td align="left" valign="top" class="listr"><?= $DATA['SPAM_THIS_HOUR']; ?></td> + <td align="left" valign="top" class="list"> </td> + <td align="left" valign="top" class="listr">Average message processing time</td> + <td align="left" valign="top" class="listr"><?= $DATA['AVG_PROCESSING_TIME']; ?> sec.</td> + </tr> + <tr> + <td align="left" valign="top" class="listr">Good</td> + <td align="left" valign="top" class="listr"><?= $DATA['NONSPAM_TODAY']; ?></td> + <td align="left" valign="top" class="listr"><?= $DATA['NONSPAM_THIS_HOUR']; ?></td> + <td align="left" valign="top" class="list"> </td> + <td align="left" valign="top" class="listr">Average throughput</td> + <td align="left" valign="top" class="listr"><?= $DATA['AVG_MSG_PER_SECOND']; ?> messages/sec.</td> + </tr> + <tr> + <td align="left" valign="top" class="listr">Spam Misses</td> + <td align="left" valign="top" class="listr"><?= $DATA['SM_TODAY']; ?></td> + <td align="left" valign="top" class="listr"><?= $DATA['SM_THIS_HOUR']; ?></td> + <td align="left" valign="top" class="list"> </td> + <td align="left" valign="top" class="listr">DSPAM instances</td> + <td align="left" valign="top" class="listr"><?= $DATA['DSPAM_PROCESSES']; ?> process(es)</td> + </tr> + <tr> + <td align="left" valign="top" class="listr">False Positives</td> + <td align="left" valign="top" class="listr"><?= $DATA['FP_TODAY']; ?></td> + <td align="left" valign="top" class="listr"><?= $DATA['FP_THIS_HOUR']; ?></td> + <td align="left" valign="top" class="list"> </td> + <td align="left" valign="top" class="listr">System uptime</td> + <td align="left" valign="top" class="listr"><?= $DATA['UPTIME']; ?></td> + </tr> + <tr> + <td align="left" valign="top" class="listr">Inoculations</td> + <td align="left" valign="top" class="listr"><?= $DATA['INOC_TODAY']; ?></td> + <td align="left" valign="top" class="listr"><?= $DATA['INOC_THIS_HOUR']; ?></td> + <td align="left" valign="top" class="list"> </td> + <td align="left" valign="top" class="listr">Mail queue length</td> + <td align="left" valign="top" class="listr"><?= $DATA['MAIL_QUEUE']; ?> messages</td> + </tr> + <tr> + <td align="left" valign="top" class="listbgns"><strong>Total</strong></td> + <td align="left" valign="top" class="listbgns"><strong><?= $DATA['TOTAL_TODAY']; ?></strong></td> + <td align="left" valign="top" class="listbgns"><strong><?= $DATA['TOTAL_THIS_HOUR']; ?></strong></td> + <td align="left" valign="top" class="list"> </td> + <td align="left" valign="top" class="list"> </td> + <td align="left" valign="top" class="list"> </td> + </tr> + </table> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" align="left" valign="top" class="listtopic"> + <strong>24 Hour Activity</strong> – 125 SPAM, 601 Good, 2 Spam Misses, 0 False Positives, 2 Inoculations + </td> + </tr> + <tr> + <td colspan="2" align="center" valign="top" class="vncell"> + <?php if(isset($_GET['test'])): ?> + <img src="/dspam-admin-graph.php?data=1,2,5,6,2,6,3,1,3,9,5,2,4,8,9,6,9,2,6,8,3,3,5,2_4,22,12,9,11,10,10,8,2,9,9,27,18,26,20,20,11,14,27,69,51,108,86,43_0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0_0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0_0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0_2,8,3,9,7,4,3,2,2,,4,7,6,3,4,6,2,7,4,17,5,3,10,1_10:00pm,11:00pm,12:00am,1:00am,2:00am,3:00am,4:00am,5:00am,6:00am,7:00am,8:00am,9:00am,10:00am,11:00am,12:00pm,1:00pm,2:00pm,3:00pm,4:00pm,5:00pm,6:00pm,7:00pm,8:00pm,9:00pm&x_label=Hour+of+the+day&offset=35" alt="24 Hour Activity" border="0" /> + <?php else: ?> + <img src="/dspam-admin-graph.php?data=<?= $DATA['DATA_DAILY']; ?>&x_label=<?= urlencode("Hour of the day"); ?>&offset=20" alt="24 Hour Activity" border="0" /> + <?php endif; ?> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" align="left" valign="top" class="listtopic"> + <strong>Daily Activity</strong> – 2457 SPAM, 10772 Good, 35 Spam Misses, 0 False Positives, 33 Inoculations + </td> + </tr> + <tr> + <td colspan="2" align="center" valign="top" class="vncell"> + <?php if(isset($_GET['test'])): ?> + <img src="/dspam-admin-graph.php?data=105,98,54,104,85,94,93,103,115,122,109,94,77,103,116,105,112,103,97,83,87,99,97,126,107_368,339,326,395,367,166,176,325,376,382,458,305,149,134,335,396,388,368,403,220,142,534,312,595,600_0,2,0,2,1,3,0,1,4,1,0,0,0,1,2,1,2,1,2,3,4,1,1,2,0_0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0_1,1,2,1,4,1,0,3,1,0,2,0,2,1,2,1,1,5,0,1,0,0,0,2,4_129,142,76,184,139,55,51,94,107,139,168,130,70,63,123,140,118,96,108,88,46,110,133,143,109_5/29/2006,5/30/2006,5/31/2006,6/1/2006,6/2/2006,6/3/2006,6/4/2006,6/5/2006,6/6/2006,6/7/2006,6/8/2006,6/9/2006,6/10/2006,6/11/2006,6/12/2006,6/13/2006,6/14/2006,6/15/2006,6/16/2006,6/17/2006,6/18/2006,6/19/2006,6/20/2006,6/21/2006,6/22/2006&graph=period&x_label=Date&offset=45" border="0" /> + <?php else: ?> + <img src="/dspam-admin-graph.php?data=<?= $DATA['DATA_WEEKLY']; ?>&graph=period&x_label=Date&offset=45" border="0" /> + <?php endif; ?> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> +</form> +<? +} else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php +} // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-analysis-graph.php b/packages/dspam/www/dspam-analysis-graph.php new file mode 100644 index 00000000..67262564 --- /dev/null +++ b/packages/dspam/www/dspam-analysis-graph.php @@ -0,0 +1,137 @@ +<?php +/* $Id$ */ +/* + dspam-analysis-graph.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +/* required because of system_groupmanager.php */ +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Analysis"), + gettext("Graph")); + +require_once 'Image/Graph.php'; +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (! $_GET || + strlen($_SERVER['QUERY_STRING']) == 0) { + return; +} + +$FORM =& ReadParse($_SERVER['QUERY_STRING']); + +list($spam, $nonspam, $period) = split('_', $FORM['data']); +$spam_day = split(',', $spam); +$nonspam_day = split(',', $nonspam); +$period = split(',', $period); + +// create the graph +$Graph =& Image_Graph::factory('graph', array(725, 300)); + +// add a TrueType font +$Font =& $Graph->addNew('font', 'Verdana'); +// set the font size to 11 pixels +$Font->setSize(8); + +$Graph->setFont($Font); + +// setup the plotarea, legend and their layout +$Graph->add( + Image_Graph::vertical( + Image_Graph::factory('title', array('', 12)), + Image_Graph::vertical( + $Plotarea = Image_Graph::factory('plotarea'), + $Legend = Image_Graph::factory('legend'), + 88 + ), + 5 + ) +); + +// link the legend with the plotares +$Legend->setPlotarea($Plotarea); + +// create the two datasets +$i = 0; +$spamds =& Image_Graph::factory('dataset'); +foreach($spam_day as $el){ + $spamds->addPoint(strval($period[$i]), intval($el)); + $i++; +} + +$i = 0; +$hamds =& Image_Graph::factory('dataset'); +foreach($nonspam_day as $el){ + $hamds->addPoint(strval($period[$i]), intval($el)); + $i++; +} + +// set the name/title of each dataset +$spamds->setName('SPAM'); +$hamds->setName('Good'); + +// put each dataset in a singel ds array +$Datasets = array($spamds, $hamds); + +// create the plot as line chart using the dataset +$Plot =& $Plotarea->addNew('Image_Graph_Plot_Line', array($Datasets,'normal')); + +// set a line color +$LineArray =& Image_Graph::factory('Image_Graph_Line_Array'); +$LineArray->addColor('red'); +$LineArray->addColor('green'); + +// set a standard line style +$Plot->setLineStyle($LineArray); + +/* set axis labels */ +$XAxis =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X); +$XAxis->setTitle("{$FORM['x_label']}"); +$YAxis =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y); +$YAxis->setTitle('Number of Messages', 'vertical'); + +// output the Graph +$Graph->done(); + +function &ReadParse($URI = "") { + if ($URI == "") { + return NULL; + } + + $pairs = preg_split('/&/', $URI); + $FORM = array(); + + foreach($pairs as $pair){ + list($name, $value) = preg_split('/\=/', $pair); + $pattern = '/%([a-fA-F0-9][a-fA-F0-9])/'; + + $name = preg_replace('/\+/', ' ', $name); + $name = preg_replace_callback( + $pattern, + create_function( + '$matches', + 'return pack("C", hexdec($matches[1]));' + ), + $name + ); + + $value = preg_replace('/\+/', ' ', $value); + $value = preg_replace_callback( + $pattern, + create_function( + '$matches', + 'return pack("C", hexdec($matches[1]));' + ), + $value + ); + + $FORM[$name] = $value; + } // end foreach + + return $FORM; +} +?> diff --git a/packages/dspam/www/dspam-analysis.php b/packages/dspam/www/dspam-analysis.php new file mode 100644 index 00000000..89b48df2 --- /dev/null +++ b/packages/dspam/www/dspam-analysis.php @@ -0,0 +1,147 @@ +<?php +/* $Id$ */ +/* + dspam-analysis.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Analysis"), + gettext("Overview")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +/* if this is an AJAX caller then handle via JSON */ +if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ + + $jscriptstr = <<<EOD +<script type="text/javascript"> +<!-- + +EOD; + + $jscriptstr .= getJScriptFunction(0); + $jscriptstr .= <<<EOD +//--> +</script> +EOD; + + $pfSenseHead->addScript($jscriptstr); +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam-analysis.php" method="post" name="iform" id="iform"> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<p> + <span class="vexpl"> + Graphs showing the number of messages that have been processed are shown below. + </span> +</p> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("Info", false, "/dspam.php?{$CURRENT_USER}"); + $tab_array[] = array("Performance", false, "/dspam-perf.php?user={$CURRENT_USER}"); + $tab_array[] = array("Preferences", false, "/dspam-prefs.php?user={$CURRENT_USER}"); + $tab_array[] = array("Alerts", false, "/pkg.php?xml=dspam_alerts.xml&user={$CURRENT_USER}"); + $tab_array[] = array("Quarantine ({$DATA['TOTAL_QUARANTINED_MESSAGES']})", false, "/dspam-quarantine.php?user={$CURRENT_USER}"); + $tab_array[] = array("Analysis", true, "/dspam-analysis.php?user={$CURRENT_USER}"); + $tab_array[] = array("History", false, "/dspam-history.php?user={$CURRENT_USER}"); + $tab_array[] = array("Train Filter", false, "/dspam-train.php?user={$CURRENT_USER}"); + if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + $tab_array[] = array("Admin Suite", false, "/dspam-admin.php"); + } + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="2">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="10%" valign="baseline" class="vncell">Username</td> + <td width="90%" class="vtable"> + <?php if(isset($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <input type="text" name="username" id="username" value="<?= $CURRENT_USER ?>" class="formfld user"<?php if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { echo " readonly=\"readonly\""; } ?> /> + <?php else: ?> + <input type="text" name="username" id="username" value="Please provide a username" class="formfld user" onFocus="this.value='';" /> + <?php endif; ?> + + <?php + if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + $action = "onClick=\"changeuser();\""; + else + $action = "onClick=\"document.iform.submit();\""; + ?> + <input type="button" name="change_user" id="change_user" class="formbtn" value="Change" <?= $action ?> /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" colspan="2"> + <strong>24 Hour Activity</strong> – <?= $DATA['TS_DAILY']; ?> SPAM, <?= $DATA['TI_DAILY']; ?> Good + </td> + </tr> + <tr> + <td align="center" valign="top" class="vncell" colspan="2"> + <?php if(isset($_GET['test'])): ?> + <img src="/dspam-analysis-graph.php?data=0,0,1,0,1_1,4,0,1,0_4p,6p,7a,11a,2p&x_label=Hour+of+the+day" alt="24 Hour Activity" border="0" /> + <?php else: ?> + <img src="/dspam-analysis-graph.php?data=<?= $DATA['DATA_DAILY']; ?>&x_label=<?= urlencode("Hour of the day"); ?>" alt="24 Hour Activity" border="0" /> + <?php endif; ?> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" colspan="2"> + <strong>14 Day Activity</strong> – <?= $DATA['TS_WEEKLY']; ?> SPAM, <?= $DATA['TI_WEEKLY']; ?> Good + </td> + </tr> + <tr> + <td align="center" valign="top" class="vncell" colspan="2"> + <?php if(isset($_GET['test'])): ?> + <img src="/dspam-analysis-graph.php?data=1,2,0,2,1,2,2,1,4,0,0,2,0,2_5,2,3,5,12,20,7,9,9,8,7,12,6,1_6/9,6/10,6/11,6/12,6/13,6/14,6/15,6/16,6/17,6/18,6/19,6/20,6/21,6/22&graph=period&x_label=Date" alt="24 Hour Activity" border="0" /> + <?php else: ?> + <img src="/dspam-analysis-graph.php?data=<?= $DATA['DATA_WEEKLY']; ?>&graph=period&x_label=Date" alt="24 Hour Activity" border="0" /> + <?php endif; ?> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> +</form> + +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-hfragment.php b/packages/dspam/www/dspam-hfragment.php new file mode 100644 index 00000000..36152a00 --- /dev/null +++ b/packages/dspam/www/dspam-hfragment.php @@ -0,0 +1,90 @@ +<?php +/* $Id$ */ +/* + dspam-train.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("History"), + gettext("Fragement")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +/* if this is an AJAX caller then handle via JSON */ +if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("Info", false, "/dspam.php?{$CURRENT_USER}"); + $tab_array[] = array("Performance", false, "/dspam-perf.php?user={$CURRENT_USER}"); + $tab_array[] = array("Preferences", false, "/dspam-prefs.php?user={$CURRENT_USER}"); + $tab_array[] = array("Alerts", false, "/pkg.php?xml=dspam_alerts.xml&user={$CURRENT_USER}"); + $tab_array[] = array("Quarantine ({$DATA['TOTAL_QUARANTINED_MESSAGES']})", false, "/dspam-quarantine.php?user={$CURRENT_USER}"); + $tab_array[] = array("Analysis", false, "/dspam-analysis.php?user={$CURRENT_USER}"); + $tab_array[] = array("History", true, "/dspam-history.php?user={$CURRENT_USER}"); + $tab_array[] = array("Train Filter", false, "/dspam-train.php?user={$CURRENT_USER}"); + if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + $tab_array[] = array("Admin Suite", false, "/dspam-admin.php?user={$CURRENT_USER}"); + } + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="list" width="10%"> + <br /> + <font color=white><big><?= $DATA['SUBJECT']; ?></big><br /> + <?= $DATA['FROM']; ?><br /> + <small><?= $DATA['TIME']; ?> (<?= $DATA['INFO']; ?>)</small></font><br /> + <br /> + </td> + </tr> + <tr> + <td class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="middle" class="list"> + <pre> + <?= $DATA['MESSSAGE']; ?> + </pre> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> + +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-history.php b/packages/dspam/www/dspam-history.php new file mode 100644 index 00000000..e9b77cf2 --- /dev/null +++ b/packages/dspam/www/dspam-history.php @@ -0,0 +1,172 @@ +<?php +/* $Id$ */ +/* + dspam-train.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("History"), + gettext("Overview")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +/* if this is an AJAX caller then handle via JSON */ +if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ + + $jscriptstr = <<<EOD +<script type="text/javascript"> +<!-- + +EOD; + + $jscriptstr .= getJScriptFunction(0); + $jscriptstr .= getJScriptFunction(4); + $jscriptstr .= <<<EOD +//--> +</script> +EOD; + +$pfSenseHead->addScript($jscriptstr); +$pfSenseHead->addLink("<link rel=\"stylesheet\" type=\"text/css\" href=\"/themes/" . $g['theme'] . "/dspam.css\" media=\"all\" />\n"); +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam-history.php" method="post" name="iform" id="iform"> +<input type="hidden" name="command" value="retrainChecked" /> +<input type="hidden" name="hpage" value="<?= $DATA['HPAGE']; ?>" /> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<p> + <span class="vexpl"> + The messages that have been processed by the filter are shown below. The + most recent messages are shown first. Use the retrain options to correct + errors and deliver any false positives that are still in your quarantine. + </span> +</p> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("Info", false, "/dspam.php?{$CURRENT_USER}"); + $tab_array[] = array("Performance", false, "/dspam-perf.php?user={$CURRENT_USER}"); + $tab_array[] = array("Preferences", false, "/dspam-prefs.php?user={$CURRENT_USER}"); + $tab_array[] = array("Alerts", false, "/pkg.php?xml=dspam_alerts.xml&user={$CURRENT_USER}"); + $tab_array[] = array("Quarantine ({$DATA['TOTAL_QUARANTINED_MESSAGES']})", false, "/dspam-quarantine.php?user={$CURRENT_USER}"); + $tab_array[] = array("Analysis", false, "/dspam-analysis.php?user={$CURRENT_USER}"); + $tab_array[] = array("History", true, "/dspam-history.php?user={$CURRENT_USER}"); + $tab_array[] = array("Train Filter", false, "/dspam-train.php?user={$CURRENT_USER}"); + if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + $tab_array[] = array("Admin Suite", false, "/dspam-admin.php"); + } + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="6">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell" colspan="2">Username</td> + <td width="78%" class="vtable" colspan="4"> + <?php if(isset($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <input type="text" name="username" id="username" value="<?= $CURRENT_USER ?>" class="formfld user"<?php if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { echo " readonly=\"readonly\""; } ?> /> + <?php else: ?> + <input type="text" name="username" id="username" value="Please provide a username" class="formfld user" onFocus="this.value='';" /> + <?php endif; ?> + + <?php + if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + $action = "onClick=\"changeuser();\""; + else + $action = "onClick=\"document.iform.submit();\""; + ?> + <input type="button" name="change_user" id="change_user" class="formbtn" value="Change" <?= $action ?> /> + </td> + </tr> + <tr> + <td colspan="6" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="middle" class="qnavtdl" colspan="4"> + <input type="submit" class="formbtn" title="Retrain Checked" value="Retrain Checked" name="retrain_checked" id="retrain_checked_top" /> + <label for="retrain_checked_top"> because those messages have<strong>n't</strong> been correctly classified.</label> + </td> + <td align="right" valign="middle" class="qnavtdr" colspan="2"> + <label for="hperpage-top">Records per page: </label> + <select class="formselect" id="hperpage-top" name="hperpage" onchange="changeQPerPage(this);"> + <option value="25"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 25) echo ' selected="selected"'; ?>>25</option> + <option value="50"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 50) echo ' selected="selected"'; ?>>50</option> + <option value="75"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 75) echo ' selected="selected"'; ?>>75</option> + <option value="100"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 100) echo ' selected="selected"'; ?>>100</option> + <option value="125"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 125) echo ' selected="selected"'; ?>>125</option> + <option value="150"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 150) echo ' selected="selected"'; ?>>150</option> + </select> + </td> + </tr> + <tr> + <td class="list" height="12" colspan="6"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" width="10%">Type</td> + <td align="left" valign="top" class="listtopic" width="10%">Action</td> + <td align="left" valign="top" class="listtopic" width="10%">Day/Time</td> + <td align="left" valign="top" class="listtopic" width="25%">From</td> + <td align="left" valign="top" class="listtopic" width="25%">Subject</td> + <td align="left" valign="top" class="listtopic" width="20%">Additional Info</td> + </tr> + <?= $DATA['HISTORY']; ?> + <?= $DATA['HISTORY_FOOTER']; ?> + <tr> + <td colspan="6" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="middle" class="qnavtdl" colspan="4"> + <input type="submit" class="formbtn" title="Retrain Checked" value="Retrain Checked" name="retrain_checked" id="retrain_checked_bottom" /> + <label for="retrain_checked_bottom"> because those messages have<strong>n't</strong> correctly been classified.</label> + </td> + <td align="right" valign="middle" class="qnavtdr" colspan="2"> + <label for="hperpage-bottom">Records per page: </label> + <select class="formselect" id="hperpage-bottom" name="hperpage" onchange="changeQPerPage(this);"> + <option value="25"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 25) echo ' selected="selected"'; ?>>25</option> + <option value="50"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 50) echo ' selected="selected"'; ?>>50</option> + <option value="75"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 75) echo ' selected="selected"'; ?>>75</option> + <option value="100"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 100) echo ' selected="selected"'; ?>>100</option> + <option value="125"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 125) echo ' selected="selected"'; ?>>125</option> + <option value="150"<?php if ($CONFIG['HISTORY_PER_PAGE'] == 150) echo ' selected="selected"'; ?>>150</option> + </select> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> +</form> + +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-perf.php b/packages/dspam/www/dspam-perf.php new file mode 100644 index 00000000..bead8709 --- /dev/null +++ b/packages/dspam/www/dspam-perf.php @@ -0,0 +1,222 @@ +<?php +/* $Id$ */ +/* + dspam-train.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Performance")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +/* if this is an AJAX caller then handle via JSON */ +if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ + + $jscriptstr = <<<EOD +<script type="text/javascript"> +<!-- + +EOD; + + $jscriptstr .= getJScriptFunction(0); + $jscriptstr .= <<<EOD +//--> +</script> +EOD; + +$pfSenseHead->addScript($jscriptstr); +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam-perf.php" method="post" name="iform" id="iform"> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<p> + <span class="vexpl"> + If you receive a message in your e-mail application that was not caught by + the filter, please forward it to <strong><?= $DATA['SPAM_ALIAS']; ?></strong> + so that it can be analyzed and learned as <acronym title="">SPAM</acronym>. + This will improve the filter's accuracy in the future. + </span> +</p> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("Info", false, "/dspam.php?{$CURRENT_USER}"); + $tab_array[] = array("Performance", true, "/dspam-perf.php?user={$CURRENT_USER}"); + $tab_array[] = array("Preferences", false, "/dspam-prefs.php?user={$CURRENT_USER}"); + $tab_array[] = array("Alerts", false, "/pkg.php?xml=dspam_alerts.xml&user={$CURRENT_USER}"); + $tab_array[] = array("Quarantine ({$DATA['TOTAL_QUARANTINED_MESSAGES']})", false, "/dspam-quarantine.php?user={$CURRENT_USER}"); + $tab_array[] = array("Analysis", false, "/dspam-analysis.php?user={$CURRENT_USER}"); + $tab_array[] = array("History", false, "/dspam-history.php?user={$CURRENT_USER}"); + $tab_array[] = array("Train Filter", false, "/dspam-train.php?user={$CURRENT_USER}"); + if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + $tab_array[] = array("Admin Suite", false, "/dspam-admin.php"); + } + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="2">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Username</td> + <td width="78%" class="vtable"> + <?php if(isset($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <input type="text" name="username" id="username" value="<?= $CURRENT_USER ?>" class="formfld user"<?php if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { echo " readonly=\"readonly\""; } ?> /> + <?php else: ?> + <input type="text" name="username" id="username" value="Please provide a username" class="formfld user" onFocus="this.value='';" /> + <?php endif; ?> + + <?php + if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + $action = "onClick=\"changeuser();\""; + else + $action = "onClick=\"document.iform.submit();\""; + ?> + <input type="button" name="change_user" id="change_user" class="formbtn" value="Change" <?= $action ?> /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" colspan="2"> + <strong>Performance Statistics</strong> – <?= date("l dS of F Y h:i:s A"); ?> + </td> + </tr> + <tr> + <td align="left" valign="top" colspan="2" class="vncell"> + <table align="center" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <!- beginn left info pane --> + <td align="left" valign="top"> + <table border="0" cellpadding="0" cellspacing="0" summary="left info pane"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="2">Metric</td> + <td align="left" valign="top" class="listhdrr">Calculated as</td> + <td align="left" valign="top" class="list"></td> + </tr> + <tr> + <td align="left" valign="top" class="listr"> + <nobr>Overall accuracy (since last reset)</nobr> + </td> + <td align="left" valign="top" class="listr"> + <strong><?= $DATA['OVERALL_ACCURACY']; ?>%</strong> + </td> + <td align="left" valign="top" class="listr">(SPAM messages caught + Good messages delivered) / Total number of messages</td> + <td align="left" valign="top" class="none"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listr"> + <nobr>Spam identification (since last reset)</nobr> + </td> + <td align="left" valign="top" class="listr"> + <strong><?= $DATA['SPAM_ACCURACY']; ?>%</strong> + </td> + <td align="left" valign="top" class="listr">(Spam catch rate only)</td> + <td align="left" valign="top" class="none"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listr"> + <nobr>Spam ratio (of total processed)</nobr> + </td> + <td align="left" valign="top" class="listr"> + <strong><?= $DATA['SPAM_RATIO']; ?>%</strong> + </td> + <td align="left" valign="top" class="listr">Total SPAM messages (both caught & missed) / Total number of messages</td> + <td align="left" valign="top" class="none"> </td> + </tr> + </table> + </td> + <!-- spacer td --> + <td align="left" valign="top" class="none"> </td> + <!-- begin right info pane --> + <td align="left" valign="top"> + <table border="0" cellpadding="0" cellspacing="0" summary="right info pane"> + <tr id="frheader"> + <td class="list"> </td> + <td class="listhdrr">SPAM messages</td> + <td class="listhdrr">Good messages</td> + </tr> + <tr> + <td align="left" valign="top" class="listhdrr">Since last reset</td> + <td align="left" valign="top" class="listr"> + <nobr><?= $DATA['TOTAL_SPAM_MISSED']; ?> missed</nobr><br /> + <nobr><?= $DATA['TOTAL_SPAM_CAUGHT']; ?> caught</nobr><br /> + <nobr><?= $DATA['SPAM_ACCURACY']; ?>% caught</nobr><br /> + </td> + <td align="left" valign="top" class="listr"> + <nobr><?= $DATA['TOTAL_NONSPAM_MISSED']; ?> missed</nobr><br /> + <nobr><?= $DATA['TOTAL_NONSPAM_CAUGHT']; ?> delivered</nobr><br /> + <nobr><?= $DATA['NONSPAM_ERROR_RATE']; ?>% missed</nobr><br /> + </td> + </tr> + <tr> + <td align="left" valign="top" class="listhdrr">Total processed by filter</td> + <td align="left" valign="top" class="listr"> + <nobr><?= $DATA['TOTAL_SPAM_LEARNED']; ?> missed</nobr><br /> + <nobr><?= $DATA['TOTAL_SPAM_SCANNED']; ?> caught</nobr><br /> + </td> + <td align="left" valign="top" class="listr"> + <nobr><?= $DATA['TOTAL_NONSPAM_LEARNED']; ?> missed</nobr><br /> + <nobr><?= $DATA['TOTAL_NONSPAM_SCANNED']; ?> delivered</nobr><br /> + </td> + </tr> + <tr> + <td align="left" valign="top" class="listhdrr">From corpus</td> + <td align="left" valign="top" class="listr"> + <nobr><?= $DATA['TOTAL_SPAM_CORPUSFED']; ?> feed</nobr><br /> + </td> + <td align="left" valign="top" class="listr"> + <nobr><?= $DATA['TOTAL_NONSPAM_CORPUSFED']; ?> feed</nobr><br /> + </td> + </tr> + </table> + </td> + </table> + </td> + </tr> + <tr> + <td align="left" valign="top" colspan="2"> + <p> + <a href="/dspam-perf.php?user=<?= $CURRENT_USER ?>&command=resetStats">Reset</a> | <a href="/dspam-perf.php?user=<?= $CURRENT_USER ?>&command=tweak">Tweak -1</a> + </p> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> +</form> + +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-prefs.php b/packages/dspam/www/dspam-prefs.php new file mode 100644 index 00000000..668cface --- /dev/null +++ b/packages/dspam/www/dspam-prefs.php @@ -0,0 +1,234 @@ +<?php +/* $Id$ */ +/* + dspam-train.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Preferences")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +/* if this is an AJAX caller then handle via JSON */ +if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ + + $jscriptstr = <<<EOD +<script type="text/javascript"> +<!-- + +EOD; + + $jscriptstr .= getJScriptFunction(0); + $jscriptstr .= <<<EOD +//--> +</script> +EOD; + +$pfSenseHead->addScript($jscriptstr); +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam-prefs.php" method="post" name="iform" id="iform"> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<p> + <span class="vexpl"> + This page lets you configure how the filter will handle your messages. + </span> +</p> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("Info", false, "/dspam.php?{$CURRENT_USER}"); + $tab_array[] = array("Performance", false, "/dspam-perf.php?user={$CURRENT_USER}"); + $tab_array[] = array("Preferences", true, "/dspam-prefs.php?user={$CURRENT_USER}"); + $tab_array[] = array("Alerts", false, "/pkg.php?xml=dspam_alerts.xml"); + $tab_array[] = array("Quarantine ({$DATA['TOTAL_QUARANTINED_MESSAGES']})", false, "/dspam-quarantine.php?user={$CURRENT_USER}"); + $tab_array[] = array("Analysis", false, "/dspam-analysis.php?user={$CURRENT_USER}"); + $tab_array[] = array("History", false, "/dspam-history.php?user={$CURRENT_USER}"); + $tab_array[] = array("Train Filter", false, "/dspam-train.php?user={$CURRENT_USER}"); + if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + $tab_array[] = array("Admin Suite", false, "/dspam-admin.php"); + } + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="2">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Username</td> + <td width="78%" class="vtable"> + <?php if(isset($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <input type="text" name="username" id="username" value="<?= $CURRENT_USER; ?>" class="formfld user"<?php if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { echo " readonly=\"readonly\""; } ?> /> + <?php else: ?> + <input type="text" name="username" id="username" value="Please provide a username" class="formfld user" onFocus="this.value='';" /> + <?php endif; ?> + + <?php + if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + $action = "onClick=\"changeuser();\""; + else + $action = "onClick=\"document.iform.submit();\""; + ?> + <input type="button" name="change_user" id="change_user" class="formbtn" value="Change" <?= $action ?> /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" colspan="2"> + <strong>Training</strong> – Configure how the filter learns as it processes messages + </td> + </tr> + <tr> + <td align="left" valign="top" class="vncell" width="40%"> + <p>DSPAM should train:</p> + <input <?= $DATA["S_TEFT"]; ?> value="TEFT" type="radio" class="formfld" title="On every new message scanned by the filter" alt="On every new message scanned by the filter" name="rad_train" id="rad_train_one" /> + <label for="rad_train_one"> On every new message scanned by the filter (TEFT)</label> + <br /> + <input <?= $DATA["S_TOE"]; ?> value="TOE" type="radio" class="formfld" title="Only when the filter makes a mistake" alt="Only when the filter makes a mistake" name="rad_train" id="rad_train_two" /> + <label for="rad_train_two"> Only when the filter makes a mistake (TOE)</label> + <br /> + <input <?= $DATA["S_TUM"]; ?> value="TUM" type="radio" class="formfld" title=";Only with new data or if the filter makes a mistake" alt=";Only with new data or if the filter makes a mistake" name="rad_train" id="rad_train_three" /> + <label for="rad_train_three"> Only with new data or if the filter makes a mistake (TUM)</label> + </td> + <td align="left" valign="top" class="vncell" width="60%"> + <p>When I train DSPAM, I prefer:</p> + <input value="message" <?= $DATA["S_LOC_MESSAGE"]; ?> value="message" type="radio" class="formfld" title="To forward my spams (signature appears in message body)" alt="To forward my spams (signature appears in message body)" name="rad_train_action" id="rad_train_action_one" /> + <label for="rad_train_action_one"> To <u>forward</u> my spams (signature appears in message body)</label> + <br /> + <input <?= $DATA["S_LOC_HEADERS"]; ?> value="headers" type="radio" class="formfld" title="To bounce my spams (signature appears in message headers)" alt="To bounce my spams (signature appears in message headers)" name="rad_train_action" id="rad_train_action_two" /> + <label value="headers" for="rad_train_action_two"> To <u>bounce</u> my spams (signature appears in message headers)</label> + </td> + </tr> + <tr> + <td align="left" valign="middle" class="vncell" colspan="2"> + <p> + Filter sensitivity <strong>during</strong> the training period: + </p> + <p align="center"> + <nobr> + <span> + Catch SPAM (More in Quarantine) + <input value="0" type="radio" class="formfld" title="-5" alt="-5" name="rad_filter_sens" <?= $DATA["SEDATION_0"]; ?> /> + <input value="1" type="radio" class="formfld" title="-4" alt="-4" name="rad_filter_sens" <?= $DATA["SEDATION_1"]; ?> /> + <input value="2" type="radio" class="formfld" title="-3" alt="-3" name="rad_filter_sens" <?= $DATA["SEDATION_2"]; ?> /> + <input value="3" type="radio" class="formfld" title="-2" alt="-2" name="rad_filter_sens" <?= $DATA["SEDATION_3"]; ?> /> + <input value="4" type="radio" class="formfld" title="-1" alt="-1" name="rad_filter_sens" <?= $DATA["SEDATION_4"]; ?> /> + <strong style="font-size: larger;">»</strong> + <input value="5" type="radio" class="formfld" title="0" alt="0" name="rad_filter_sens" <?= $DATA["SEDATION_5"]; ?> /> + <strong style="font-size: larger;">«</strong> + <input value="6" type="radio" class="formfld" title="1" alt="1" name="rad_filter_sens" <?= $DATA["SEDATION_6"]; ?> /> + <input value="7" type="radio" class="formfld" title="2" alt="2" name="rad_filter_sens" <?= $DATA["SEDATION_7"]; ?> /> + <input value="8" type="radio" class="formfld" title="3" alt="3" name="rad_filter_sens" <?= $DATA["SEDATION_8"]; ?> /> + <input value="9" type="radio" class="formfld" title="4" alt="4" name="rad_filter_sens" <?= $DATA["SEDATION_9"]; ?> /> + <input value="10" type="radio" class="formfld" title="5" alt="5" name="rad_filter_sens" <?= $DATA["SEDATION_10"]; ?> /> + Assume Good (Fewer in Quarantine) + </span> + </nobr> + </p> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" colspan="2"> + <strong>Message Handling</strong> – Configure how SPAM is handled + </td> + </tr> + <tr> + <td align="left" valign="top" class="vncell" colspan="2"> + <p>When a SPAM message is identified:</p> + <p> + <input value="quarantine" <?= $DATA["S_ACTION_QUARANTINE"]; ?> type="radio" class="formfld" title="Quarantine the message" alt="Quarantine the message" name="rad_ident_action" id="rad_ident_action_one" /> + <label for="rad_ident_action_one"> Quarantine the message</label> + <br /> + <input value="tag" <?= $DATA["S_ACTION_TAG"]; ?> type="radio" class="formfld" title="Tag the Subject header with" alt="Tag the Subject header with" name="rad_ident_action" id="rad_ident_action_two" /> + <label for="rad_ident_action_two">Tag the Subject header with </label> + <input size="35" type="text" class="formfld mail" title="message tag" alt="message tag" value="<?= $DATA["SPAM_SUBJECT"]; ?>" name="msgtag" /> + <br /> + <input value="deliver" <?= $DATA["S_ACTION_DELIVER"]; ?> type="radio" class="formfld" title="Deliver the message normally with a X-DSPAM-Result header" alt="Deliver the message normally with a X-DSPAM-Result header" name="rad_ident_action" id="rad_ident_action_three" /> + <label for="rad_ident_action_three"> Deliver the message normally with a X-DSPAM-Result header</label> + </p> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="top" class="listtopic" colspan="2"> + <strong>Features</strong> – Tuning SPAM filtering + </td> + </tr> + <tr> + <td align="left" valign="top" class="vncell" colspan="2"> + <p> + <input <?= $DATA["C_BNR"]; ?> type="checkbox" class="formbtn" title="Enable noise reduction, which usually improves filtering accuracy" alt="Enable noise reduction, which usually improves filtering accuracy" name="chk_feature_nr" id="chk_feature_nr" /> + <label for="chk_feature_nr"> Enable noise reduction, which usually improves filtering accuracy</label> + <br /> + <input <?= $DATA["C_WHITELIST"]; ?> type="checkbox" class="formbtn" title="Enable automatic whitelisting to record frequent correspondence" alt="Enable automatic whitelisting to record frequent correspondence" name="chk_feature_aw" id="chk_feature_aw" /> + <label for="chk_feature_aw"> Enable automatic whitelisting to record frequent correspondence</label> + <br /> + <input <?= $DATA["C_FACTORS"]; ?> type="checkbox" class="formbtn" title="Add the factoring tokens in each email into the message's full headers" alt="Add the factoring tokens in each email into the message's full headers" name="chk_feature_at" id="chk_feature_at" /> + <label for="chk_feature_at"> Add the factoring tokens in each email into the message's full headers</label> + <!-- + <input type="checkbox" class="formbtn" title="Add the factoring tokens in each email into the message's full headers" alt="Add the factoring tokens in each email into the message's full headers" name="chk_feature_at" id="chk_feature_at" /> + <label for="chk_feature_at"> Add the factoring tokens in each email into the message's full headers</label> + <br /> + <input type="checkbox" class="formbtn" title="opt in of DSPAM filtering" alt="opt in of DSPAM filtering" name="chk_feature_optin" id="chk_feature_optin" /> + <label for="chk_feature_optin"> opt in of DSPAM filtering</label> + <br /> + <input type="checkbox" class="formbtn" title="opt out of DSPAM filtering" alt="opt out of DSPAM filtering" name="chk_feature_optout" id="chk_feature_optout" /> + <label for="chk_feature_optout"> opt out of DSPAM filtering</label> + --> + </p> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td class="list"> </td> + <td class="list"> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> +</form> + +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-quarantine.php b/packages/dspam/www/dspam-quarantine.php new file mode 100644 index 00000000..19d8b755 --- /dev/null +++ b/packages/dspam/www/dspam-quarantine.php @@ -0,0 +1,178 @@ +<?php +/* $Id$ */ +/* + dspam-train.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Quarantine"), + gettext("Overview")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +/* if this is an AJAX caller then handle via JSON */ +if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ + + $jscriptstr = <<<EOD +<script type="text/javascript"> +<!-- + +EOD; + + $jscriptstr .= getJScriptFunction(0); + $jscriptstr .= getJScriptFunction(1); + $jscriptstr .= getJScriptFunction(2); + $jscriptstr .= getJScriptFunction(3); + $jscriptstr .= getJScriptFunction(4); + $jscriptstr .= <<<EOD +//--> +</script> +EOD; + +$pfSenseHead->addScript($jscriptstr); +$pfSenseHead->addLink("<link rel=\"stylesheet\" type=\"text/css\" href=\"/themes/" . $g['theme'] . "/dspam.css\" media=\"all\" />\n"); +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam-quarantine.php" method="post" name="iform" id="iform"> +<input type="hidden" name="command" value="processQuarantine" /> +<input type="hidden" name="processAction" value="None" /> +<input type="hidden" name="qpage" value="<?= $DATA['QPAGE']; ?>" /> +<input type="hidden" name="sortby" value="<?= $DATA['SORTBY']; ?>" > +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<p> + <span class="vexpl"> + The messages below have not been delivered to your normal e-mail application + because they are believed to be spam. Click on the Subject line to view the + message or choose a sort option to change how messages are sorted. Use the + checkboxes and <strong>Deliver Checked</strong> to deliver messages you want + to read, or use <strong>Delete All</strong> to empty the quarantine. + </span> +</p> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("Info", false, "/dspam.php?{$CURRENT_USER}"); + $tab_array[] = array("Performance", false, "/dspam-perf.php?user={$CURRENT_USER}"); + $tab_array[] = array("Preferences", false, "/dspam-prefs.php?user={$CURRENT_USER}"); + $tab_array[] = array("Alerts", false, "/pkg.php?xml=dspam_alerts.xml&user={$CURRENT_USER}"); + $tab_array[] = array("Quarantine ({$DATA['TOTAL_QUARANTINED_MESSAGES']})", true, "/dspam-quarantine.php?user={$CURRENT_USER}"); + $tab_array[] = array("Analysis", false, "/dspam-analysis.php?user={$CURRENT_USER}"); + $tab_array[] = array("History", false, "/dspam-history.php?user={$CURRENT_USER}"); + $tab_array[] = array("Train Filter", false, "/dspam-train.php?user={$CURRENT_USER}"); + if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + $tab_array[] = array("Admin Suite", false, "/dspam-admin.php"); + } + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="5">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="10%" valign="baseline" class="vncell" colspan="2">Username</td> + <td width="90%" class="vtable" colspan="3"> + <?php if(isset($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <input type="text" name="username" id="username" value="<?= $CURRENT_USER ?>" class="formfld user"<?php if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { echo " readonly=\"readonly\""; } ?> /> + <?php else: ?> + <input type="text" name="username" id="username" value="Please provide a username" class="formfld user" onFocus="this.value='';" /> + <?php endif; ?> + + <?php + if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + $action = "onClick=\"changeuser();\""; + else + $action = "onClick=\"document.iform.submit();\""; + ?> + <input type="button" name="change_user" id="change_user" class="formbtn" value="Change" <?= $action ?> /> + </td> + </tr> + <tr> + <td colspan="5" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="middle" colspan="4" class="qnavtdl"> + <nobr> + <input type="button" class="formbtn" title="Deliver Checked" value="Deliver Checked" name="delichk" id="delichk" onclick="processmsg(0);" /> + <input type="button" class="formbtn" title="Delete Checked" value="Delete Checked" name="delchk" id="delchk" onclick="processmsg(1);" /> + <input type="button" class="formbtn" title="Delete All" value="Delete All" name="delall" id="delall" onclick="processmsg(2);" /> + </nobr> + </td> + <td align="right" valign="middle" class="qnavtdr"> + <label for="qperpage-top">Records per page: </label> + <select class="formselect" id="qperpage-top" name="qperpage" onchange="changeQPerPage(this);"> + <option value="25"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 25) echo ' selected="selected"'; ?>>25</option> + <option value="50"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 50) echo ' selected="selected"'; ?>>50</option> + <option value="75"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 75) echo ' selected="selected"'; ?>>75</option> + <option value="100"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 100) echo ' selected="selected"'; ?>>100</option> + <option value="125"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 125) echo ' selected="selected"'; ?>>125</option> + <option value="150"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 150) echo ' selected="selected"'; ?>>150</option> + </select> + </td> + </tr> + <tr> + <td colspan="5" class="list" height="12"> </td> + </tr> + <?= $DATA['SORT_SELECTOR']; ?> + <?= $DATA['QUARANTINE']; ?> + <?= $DATA['QUARANTINE_FOOTER']; ?> + <tr> + <td colspan="5" class="list" height="12"> </td> + </tr> + <tr> + <td align="left" valign="middle" colspan="4" class="qnavtdl"> + <nobr> + <input type="button" class="formbtn" title="Deliver Checked" value="Deliver Checked" name="delichk" id="delichk" onclick="processmsg(0);" /> + <input type="button" class="formbtn" title="Delete Checked" value="Delete Checked" name="delchk" id="delchk" onclick="processmsg(1);" /> + <input type="button" class="formbtn" title="Delete All" value="Delete All" name="delall" id="delall" onclick="processmsg(2);" /> + </nobr> + </td> + <td align="right" valign="middle" class="qnavtdr"> + <label for="qperpage-bottom">Records per page: </label> + <select class="formselect" id="qperpage-bottom" name="qperpage" onchange="changeQPerPage(this);"> + <option value="25"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 25) echo ' selected="selected"'; ?>>25</option> + <option value="50"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 50) echo ' selected="selected"'; ?>>50</option> + <option value="75"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 75) echo ' selected="selected"'; ?>>75</option> + <option value="100"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 100) echo ' selected="selected"'; ?>>100</option> + <option value="125"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 125) echo ' selected="selected"'; ?>>125</option> + <option value="150"<?php if ($CONFIG['QUARANTINE_PER_PAGE'] == 150) echo ' selected="selected"'; ?>>150</option> + </select> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> +</form> + +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-settings-algo.php b/packages/dspam/www/dspam-settings-algo.php new file mode 100644 index 00000000..58ffb247 --- /dev/null +++ b/packages/dspam/www/dspam-settings-algo.php @@ -0,0 +1,204 @@ +<?php +/* $Id$ */ +/* + dspam-settings-algo.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Advanced Settings"), + gettext("Edit Algorithm")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + +/* + The following code presumes, that the following XML structure exists or + if it does not exist, it will be created. + + <algorithm> + <name>foo</name> + <descr>foo desc</descr> + </algorithm> + <algorithm> + <name>bar</name> + <descr>bar desc</descr> + </algorithm> +*/ + +if (!is_array($config['installedpackages']['dspam']['config'][0]['algorithm'])) { + $config['installedpackages']['dspam']['config'][0]['algorithm'] = array(); +} + +$t_algos = &$config['installedpackages']['dspam']['config'][0]['algorithm']; + +/* ID is only set if the user wants to edit an existing entry */ +$id = $_GET['id']; +$sectionid = $_GET['sectionid']; +if (isset($_POST['id'])) + $id = $_POST['id']; +if (isset($_POST['sectionid'])) + $sectionid = $_POST['sectionid']; + +if (isset($id) && $t_algos[$id]) { + $pconfig['name'] = $t_algos[$id]['name']; + $pconfig['descr'] = $t_algos[$id]['descr']; +} else { + $pconfig['name'] = $_GET['aname']; + $pconfig['descr'] = $_GET['descr']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "aname"); + $reqdfieldsn = explode(",", "DSPAM Algorithm Name"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* check for overlaps */ + foreach ($t_algos as $algo) { + if (isset($id) && ($t_algos[$id]) && ($t_algos[$id] === $algo)) { + continue; + } + if ($algo['name'] == $_POST['aname']) { + $input_errors[] = gettext("This algorithm name already exists."); + break; + } + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + if (!$input_errors) { + $algo = array(); + $algo['name'] = $_POST['aname']; + $algo['descr'] = $_POST['descr']; + + if (isset($id) && $t_algos[$id]) + $t_algos[$id] = $algo; + else + $t_algos[] = $algo; + + write_config(); + + $retval = 0; + config_lock(); + $retval = dspam_configure(); + config_unlock(); + + $savemsg = get_std_save_message($retval); + + isset($sectionid) ? $header = "dspam-settings.php?sectionid={$sectionid}" : $header = "dspam-settings.php"; + pfSenseHeader($header); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> + <form action="dspam-settings-algo.php" method="post" name="iform" id="iform"> + <div name="inputerrors" id="inputerrors"></div> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("DSPAM Algorithm Name");?></td> + <td width="78%" class="vtable"> + <!-- <input name="aname" type="text" class="formfld" id="aname" size="30" value="<?=htmlspecialchars($pconfig['name']);?>"> --> + <select name="aname" id="aname" class="formselect"> + <option value="naive" <?php if($pconfig['name'] == "naive") echo('selected=\"selected\"');?>>naive</option> + <option value="graham" <?php if($pconfig['name'] == "graham") echo('selected=\"selected\"');?>>graham</option> + <option value="burton" <?php if($pconfig['name'] == "burton") echo('selected=\"selected\"');?>>burton</option> + <option value="robinson" <?php if($pconfig['name'] == "robinson") echo('selected=\"selected\"');?>>robinson</option> + <option value="chi-square" <?php if($pconfig['name'] == "chi-square") echo('selected=\"selected\"');?>>chi-square</option> + </select> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> + <td width="78%" class="vtable"> + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> + <br> <span class="vexpl"><?=gettext("You may enter a description here + for your reference (not parsed).");?></span></td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()"> + <?php if (isset($id) && $t_algos[$id]): ?> + <input name="id" type="hidden" value="<?=$id;?>"> + <?php endif; ?> + <?php if (isset($sectionid)): ?> + <input name="sectionid" type="hidden" value="<?=$sectionid;?>"> + <?php endif; ?> + </td> + </tr> + </table> + </form> +<? + } else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php + } // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/packages/dspam/www/dspam-settings-bmta.php b/packages/dspam/www/dspam-settings-bmta.php new file mode 100644 index 00000000..c670085d --- /dev/null +++ b/packages/dspam/www/dspam-settings-bmta.php @@ -0,0 +1,202 @@ +<?php +/* $Id$ */ +/* + dspam-settings-feat.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Advanced Settings"), + gettext("Edit Broken MTA Settings")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + +/* + The following code presumes, that the following XML structure exists or + if it does not exist, it will be created. + + <bmta> + <name>foo</name> + <descr>foo desc</descr> + </bmta> + <bmta> + <name>bar</name> + <descr>bar desc</descr> + </bmta> +*/ + +if (!is_array($config['installedpackages']['dspam']['config'][0]['bmta'])) { + $config['installedpackages']['dspam']['config'][0]['bmta'] = array(); +} + +$t_bmtas = &$config['installedpackages']['dspam']['config'][0]['bmta']; + +/* ID is only set if the user wants to edit an existing entry */ +$id = $_GET['id']; +$sectionid = $_GET['sectionid']; +if (isset($_POST['id'])) + $id = $_POST['id']; +if (isset($_POST['sectionid'])) + $sectionid = $_POST['sectionid']; + +if (isset($id) && $t_bmtas[$id]) { + $pconfig['name'] = $t_bmtas[$id]['name']; + $pconfig['descr'] = $t_bmtas[$id]['descr']; +} else { + $pconfig['name'] = $_GET['oname']; + $pconfig['descr'] = $_GET['descr']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "oname"); + $reqdfieldsn = explode(",", "Broken MTA Option Name"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* check for overlaps */ + foreach ($t_bmtas as $bmta) { + if (isset($id) && ($t_bmtas[$id]) && ($t_bmtas[$id] === $bmta)) { + continue; + } + if ($bmta['name'] == $_POST['oname']) { + $input_errors[] = gettext("This option name already exists."); + break; + } + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + if (!$input_errors) { + $bmta = array(); + $bmta['name'] = $_POST['oname']; + $bmta['descr'] = $_POST['descr']; + + if (isset($id) && $t_bmtas[$id]) + $t_bmtas[$id] = $bmta; + else + $t_bmtas[] = $bmta; + + write_config(); + + $retval = 0; + config_lock(); + $retval = dspam_configure(); + config_unlock(); + + $savemsg = get_std_save_message($retval); + + isset($sectionid) ? $header = "dspam-settings.php?sectionid={$sectionid}" : $header = "dspam-settings.php"; + pfSenseHeader($header); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> + <form action="dspam-settings-bmta.php" method="post" name="iform" id="iform"> + <div name="inputerrors" id="inputerrors"></div> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("DSPAM Feature Name");?></td> + <td width="78%" class="vtable"> + <!-- <input name="oname" type="text" class="formfld" id="oname" size="30" value="<?=htmlspecialchars($pconfig['name']);?>"> --> + <select name="oname" id="oname" class="formselect"> + <option value="returnCodes" <?php if($pconfig['name'] == "returnCodes") echo('selected=\"selected\"');?>>returnCodes</option> + <option value="case" <?php if($pconfig['name'] == "case") echo('selected=\"selected\"');?>>case</option> + <option value="lineStripping" <?php if($pconfig['name'] == "lineStripping") echo('selected=\"selected\"');?>>lineStripping</option> + </select> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> + <td width="78%" class="vtable"> + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> + <br> <span class="vexpl"><?=gettext("You may enter a description here + for your reference (not parsed).");?></span></td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()"> + <?php if (isset($id) && $t_bmtas[$id]): ?> + <input name="id" type="hidden" value="<?=$id;?>"> + <?php endif; ?> + <?php if (isset($sectionid)): ?> + <input name="sectionid" type="hidden" value="<?=$sectionid;?>"> + <?php endif; ?> + </td> + </tr> + </table> +</form> +<? + } else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php + } // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/packages/dspam/www/dspam-settings-feat.php b/packages/dspam/www/dspam-settings-feat.php new file mode 100644 index 00000000..7805fa43 --- /dev/null +++ b/packages/dspam/www/dspam-settings-feat.php @@ -0,0 +1,203 @@ +<?php +/* $Id$ */ +/* + dspam-settings-feat.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Advanced Settings"), + gettext("Edit DSPAM Feature")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + +/* + The following code presumes, that the following XML structure exists or + if it does not exist, it will be created. + + <feature> + <name>foo</name> + <descr>foo desc</descr> + </feature> + <feature> + <name>bar</name> + <descr>bar desc</descr> + </feature> +*/ + +if (!is_array($config['installedpackages']['dspam']['config'][0]['feature'])) { + $config['installedpackages']['dspam']['config'][0]['feature'] = array(); +} + +$t_features = &$config['installedpackages']['dspam']['config'][0]['feature']; + +/* ID is only set if the user wants to edit an existing entry */ +$id = $_GET['id']; +$sectionid = $_GET['sectionid']; +if (isset($_POST['id'])) + $id = $_POST['id']; +if (isset($_POST['sectionid'])) + $sectionid = $_POST['sectionid']; + +if (isset($id) && $t_features[$id]) { + $pconfig['name'] = $t_features[$id]['name']; + $pconfig['descr'] = $t_features[$id]['descr']; +} else { + $pconfig['name'] = $_GET['fname']; + $pconfig['descr'] = $_GET['descr']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "fname"); + $reqdfieldsn = explode(",", "DSPAM Feature Name"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* check for overlaps */ + foreach ($t_features as $feature) { + if (isset($id) && ($t_features[$id]) && ($t_features[$id] === $feature)) { + continue; + } + if ($feature['name'] == $_POST['fname']) { + $input_errors[] = gettext("This feature name already exists."); + break; + } + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + if (!$input_errors) { + $feature = array(); + $feature['name'] = $_POST['fname']; + $feature['descr'] = $_POST['descr']; + + if (isset($id) && $t_features[$id]) + $t_features[$id] = $feature; + else + $t_features[] = $feature; + + write_config(); + + $retval = 0; + config_lock(); + $retval = dspam_configure(); + config_unlock(); + + $savemsg = get_std_save_message($retval); + + isset($sectionid) ? $header = "dspam-settings.php?sectionid={$sectionid}" : $header = "dspam-settings.php"; + pfSenseHeader($header); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> + <form action="dspam-settings-feat.php" method="post" name="iform" id="iform"> + <div name="inputerrors" id="inputerrors"></div> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("DSPAM Feature Name");?></td> + <td width="78%" class="vtable"> + <!-- <input name="fname" type="text" class="formfld" id="fname" size="30" value="<?=htmlspecialchars($pconfig['name']);?>"> --> + <select name="fname" id="fname" class="formselect"> + <option value="sbph" <?php if($pconfig['name'] == "sbph") echo('selected=\"selected\"');?>>sbph</option> + <option value="noise" <?php if($pconfig['name'] == "noise") echo('selected=\"selected\"');?>>noise</option> + <option value="chained" <?php if($pconfig['name'] == "chained") echo('selected=\"selected\"');?>>chained</option> + <option value="whitelist" <?php if($pconfig['name'] == "whitelist") echo('selected=\"selected\"');?>>whitelist</option> + </select> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> + <td width="78%" class="vtable"> + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> + <br> <span class="vexpl"><?=gettext("You may enter a description here + for your reference (not parsed).");?></span></td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()"> + <?php if (isset($id) && $t_features[$id]): ?> + <input name="id" type="hidden" value="<?=$id;?>"> + <?php endif; ?> + <?php if (isset($sectionid)): ?> + <input name="sectionid" type="hidden" value="<?=$sectionid;?>"> + <?php endif; ?> + </td> + </tr> + </table> +</form> +<? + } else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php + } // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/packages/dspam/www/dspam-settings-header.php b/packages/dspam/www/dspam-settings-header.php new file mode 100644 index 00000000..d0a5dd9c --- /dev/null +++ b/packages/dspam/www/dspam-settings-header.php @@ -0,0 +1,197 @@ +<?php +/* $Id$ */ +/* + dspam-settings-tuser.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Advanced Settings"), + gettext("Edit Mail Header")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + +/* + The following code presumes, that the following XML structure exists or + if it does not exist, it will be created. + + <header> + <name>foo</name> + <descr>foo desc</descr> + </header> + <header> + <name>bar</name> + <descr>foo desc</descr> + </header> +*/ + +if (!is_array($config['installedpackages']['dspam']['config'][0]['header'])) { + $config['installedpackages']['dspam']['config'][0]['header'] = array(); +} + +$t_headers = &$config['installedpackages']['dspam']['config'][0]['header']; + +/* ID is only set if the user wants to edit an existing entry */ +$id = $_GET['id']; +$sectionid = $_GET['sectionid']; +if (isset($_POST['id'])) + $id = $_POST['id']; +if (isset($_POST['sectionid'])) + $sectionid = $_POST['sectionid']; + +if (isset($id) && $t_headers[$id]) { + $pconfig['name'] = $t_headers[$id]['name']; + $pconfig['descr'] = $t_headers[$id]['descr']; +} else { + $pconfig['name'] = $_GET['hname']; + $pconfig['descr'] = $_GET['descr']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "hname"); + $reqdfieldsn = explode(",", "Header Name"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* check for overlaps */ + foreach ($t_headers as $header) { + if (isset($id) && ($t_headers[$id]) && ($t_headers[$id] === $header)) { + continue; + } + if ($header['name'] == $_POST['hname']) { + $input_errors[] = gettext("This header name already exists."); + break; + } + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + if (!$input_errors) { + $header = array(); + $header['name'] = $_POST['hname']; + $header['descr'] = $_POST['descr']; + + if (isset($id) && $t_headers[$id]) + $t_headers[$id] = $header; + else + $t_headers[] = $header; + + write_config(); + + $retval = 0; + config_lock(); + $retval = dspam_configure(); + config_unlock(); + + $savemsg = get_std_save_message($retval); + + isset($sectionid) ? $header = "dspam-settings.php?sectionid={$sectionid}" : $header = "dspam-settings.php"; + pfSenseHeader($header); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> + <form action="dspam-settings-header.php" method="post" name="iform" id="iform"> + <div name="inputerrors" id="inputerrors"></div> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Header Name");?></td> + <td width="78%" class="vtable"> + <input name="hname" type="text" class="formfld unknown" id="hname" size="30" value="<?=htmlspecialchars($pconfig['name']);?>"> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> + <td width="78%" class="vtable"> + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> + <br> <span class="vexpl"><?=gettext("You may enter a description here + for your reference (not parsed).");?></span></td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()"> + <?php if (isset($id) && $t_headers[$id]): ?> + <input name="id" type="hidden" value="<?=$id;?>"> + <?php endif; ?> + <?php if (isset($sectionid)): ?> + <input name="sectionid" type="hidden" value="<?=$sectionid;?>"> + <?php endif; ?> + </td> + </tr> + </table> +</form> +<? + } else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php + } // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/packages/dspam/www/dspam-settings-overr.php b/packages/dspam/www/dspam-settings-overr.php new file mode 100644 index 00000000..d938b313 --- /dev/null +++ b/packages/dspam/www/dspam-settings-overr.php @@ -0,0 +1,197 @@ +<?php +/* $Id$ */ +/* + dspam-settings-overr.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Advanced Settings"), + gettext("Edit Override Value")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + +/* + The following code presumes, that the following XML structure exists or + if it does not exist, it will be created. + + <override> + <value>foo</value> + <descr>foo desc</descr> + </override> + <override> + <value>bar</value> + <descr>bar desc</descr> + </override> +*/ + +if (!is_array($config['installedpackages']['dspam']['config'][0]['override'])) { + $config['installedpackages']['dspam']['config'][0]['override'] = array(); +} + +$t_overr = &$config['installedpackages']['dspam']['config'][0]['override']; + +/* ID is only set if the user wants to edit an existing entry */ +$id = $_GET['id']; +$sectionid = $_GET['sectionid']; +if (isset($_POST['id'])) + $id = $_POST['id']; +if (isset($_POST['sectionid'])) + $sectionid = $_POST['sectionid']; + +if (isset($id) && $t_overr[$id]) { + $pconfig['value'] = $t_overr[$id]['value']; + $pconfig['descr'] = $t_overr[$id]['descr']; +} else { + $pconfig['value'] = $_GET['ovalue']; + $pconfig['descr'] = $_GET['descr']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "ovalue"); + $reqdfieldsn = explode(",", "DSPAM Override Value"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* check for overlaps */ + foreach ($t_overr as $over) { + if (isset($id) && ($t_overr[$id]) && ($t_overr[$id] === $over)) { + continue; + } + if ($over['value'] == $_POST['ovalue']) { + $input_errors[] = gettext("This override value exists."); + break; + } + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + if (!$input_errors) { + $over = array(); + $over['value'] = $_POST['ovalue']; + $over['descr'] = $_POST['descr']; + + if (isset($id) && $t_overr[$id]) + $t_overr[$id] = $over; + else + $t_overr[] = $over; + + write_config(); + + $retval = 0; + config_lock(); + $retval = dspam_configure(); + config_unlock(); + + $savemsg = get_std_save_message($retval); + + isset($sectionid) ? $header = "dspam-settings.php?sectionid={$sectionid}" : $header = "dspam-settings.php"; + pfSenseHeader($header); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> + <form action="dspam-settings-overr.php" method="post" name="iform" id="iform"> + <div name="inputerrors" id="inputerrors"></div> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("DSPAM Override Value");?></td> + <td width="78%" class="vtable"> + <input name="ovalue" type="text" class="formfld unknown" id="ovalue" size="30" value="<?=htmlspecialchars($pconfig['value']);?>"> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> + <td width="78%" class="vtable"> + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> + <br> <span class="vexpl"><?=gettext("You may enter a description here + for your reference (not parsed).");?></span></td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()"> + <?php if (isset($id) && $t_overr[$id]): ?> + <input name="id" type="hidden" value="<?=$id;?>"> + <?php endif; ?> + <?php if (isset($sectionid)): ?> + <input name="sectionid" type="hidden" value="<?=$sectionid;?>"> + <?php endif; ?> + </td> + </tr> + </table> +</form> +<? + } else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php + } // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/packages/dspam/www/dspam-settings-prefs.php b/packages/dspam/www/dspam-settings-prefs.php new file mode 100644 index 00000000..c30cb7bd --- /dev/null +++ b/packages/dspam/www/dspam-settings-prefs.php @@ -0,0 +1,197 @@ +<?php +/* $Id$ */ +/* + dspam-settings-prefs.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Advanced Settings"), + gettext("Edit DSPAM Preferences")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + +/* + The following code presumes, that the following XML structure exists or + if it does not exist, it will be created. + + <preference> + <name>foo</name> + <descr>foo desc</descr> + </preference> + <preference> + <name>bar</name> + <descr>bar desc</descr> + </preference> +*/ + +if (!is_array($config['installedpackages']['dspam']['config'][0]['preference'])) { + $config['installedpackages']['dspam']['config'][0]['preference'] = array(); +} + +$t_prefs = &$config['installedpackages']['dspam']['config'][0]['preference']; + +/* ID is only set if the user wants to edit an existing entry */ +$id = $_GET['id']; +$sectionid = $_GET['sectionid']; +if (isset($_POST['id'])) + $id = $_POST['id']; +if (isset($_POST['sectionid'])) + $sectionid = $_POST['sectionid']; + +if (isset($id) && $t_prefs[$id]) { + $pconfig['value'] = $t_prefs[$id]['value']; + $pconfig['descr'] = $t_prefs[$id]['descr']; +} else { + $pconfig['value'] = $_GET['pvalue']; + $pconfig['descr'] = $_GET['descr']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "pvalue"); + $reqdfieldsn = explode(",", "DSPAM Algorithm Name"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* check for overlaps */ + foreach ($t_prefs as $pref) { + if (isset($id) && ($t_prefs[$id]) && ($t_prefs[$id] === $pref)) { + continue; + } + if ($pref['value'] == $_POST['pvalue']) { + $input_errors[] = gettext("This preference value already exists."); + break; + } + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + if (!$input_errors) { + $pref = array(); + $pref['value'] = $_POST['pvalue']; + $pref['descr'] = $_POST['descr']; + + if (isset($id) && $t_prefs[$id]) + $t_prefs[$id] = $pref; + else + $t_prefs[] = $pref; + + write_config(); + + $retval = 0; + config_lock(); + $retval = dspam_configure(); + config_unlock(); + + $savemsg = get_std_save_message($retval); + + isset($sectionid) ? $header = "dspam-settings.php?sectionid={$sectionid}" : $header = "dspam-settings.php"; + pfSenseHeader($header); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> + <form action="dspam-settings-prefs.php" method="post" name="iform" id="iform"> + <div name="inputerrors" id="inputerrors"></div> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("DSPAM Algorithm Name");?></td> + <td width="78%" class="vtable"> + <input name="pvalue" type="text" class="formfld unknown" id="pvalue" size="30" value="<?=htmlspecialchars($pconfig['value']);?>"> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> + <td width="78%" class="vtable"> + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> + <br> <span class="vexpl"><?=gettext("You may enter a description here + for your reference (not parsed).");?></span></td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()"> + <?php if (isset($id) && $t_prefs[$id]): ?> + <input name="id" type="hidden" value="<?=$id;?>"> + <?php endif; ?> + <?php if (isset($sectionid)): ?> + <input name="sectionid" type="hidden" value="<?=$sectionid;?>"> + <?php endif; ?> + </td> + </tr> + </table> +</form> +<? + } else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php + } // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/packages/dspam/www/dspam-settings-spwd.php b/packages/dspam/www/dspam-settings-spwd.php new file mode 100644 index 00000000..7912b0f6 --- /dev/null +++ b/packages/dspam/www/dspam-settings-spwd.php @@ -0,0 +1,197 @@ +<?php +/* $Id$ */ +/* + dspam-settings-overr.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Advanced Settings"), + gettext("Edit Server Password")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + +/* + The following code presumes, that the following XML structure exists or + if it does not exist, it will be created. + + <server-pwd> + <value>foo</value> + <descr>foo desc</descr> + </server-pwd> + <server-pwd> + <value>bar</value> + <descr>bar desc</descr> + </server-pwd> +*/ + +if (!is_array($config['installedpackages']['dspam']['config'][0]['server-pwd'])) { + $config['installedpackages']['dspam']['config'][0]['server-pwd'] = array(); +} + +$t_spwds = &$config['installedpackages']['dspam']['config'][0]['server-pwd']; + +/* ID is only set if the user wants to edit an existing entry */ +$id = $_GET['id']; +$sectionid = $_GET['sectionid']; +if (isset($_POST['id'])) + $id = $_POST['id']; +if (isset($_POST['sectionid'])) + $sectionid = $_POST['sectionid']; + +if (isset($id) && $t_spwds[$id]) { + $pconfig['value'] = $t_spwds[$id]['value']; + $pconfig['descr'] = $t_spwds[$id]['descr']; +} else { + $pconfig['value'] = $_GET['pwdvalue']; + $pconfig['descr'] = $_GET['descr']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "pwdvalue"); + $reqdfieldsn = explode(",", "Server Password Value"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* check for overlaps */ + foreach ($t_spwds as $spwd) { + if (isset($id) && ($t_spwds[$id]) && ($t_spwds[$id] === $spwd)) { + continue; + } + if ($spwd['value'] == $_POST['pwdvalue']) { + $input_errors[] = gettext("This password value already exists."); + break; + } + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + if (!$input_errors) { + $pwd = array(); + $pwd['value'] = $_POST['pwdvalue']; + $pwd['descr'] = $_POST['descr']; + + if (isset($id) && $t_spwds[$id]) + $t_spwds[$id] = $pwd; + else + $t_spwds[] = $pwd; + + write_config(); + + $retval = 0; + config_lock(); + $retval = dspam_configure(); + config_unlock(); + + $savemsg = get_std_save_message($retval); + + isset($sectionid) ? $header = "dspam-settings.php?sectionid={$sectionid}" : $header = "dspam-settings.php"; + pfSenseHeader($header); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> + <form action="dspam-settings-spwd.php" method="post" name="iform" id="iform"> + <div name="inputerrors" id="inputerrors"></div> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("Server Password Value");?></td> + <td width="78%" class="vtable"> + <input name="pwdvalue" type="text" class="formfld unknown" id="pwdvalue" size="30" value="<?=htmlspecialchars($pconfig['value']);?>"> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> + <td width="78%" class="vtable"> + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> + <br> <span class="vexpl"><?=gettext("You may enter a description here + for your reference (not parsed).");?></span></td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()"> + <?php if (isset($id) && $t_spwds[$id]): ?> + <input name="id" type="hidden" value="<?=$id;?>"> + <?php endif; ?> + <?php if (isset($sectionid)): ?> + <input name="sectionid" type="hidden" value="<?=$sectionid;?>"> + <?php endif; ?> + </td> + </tr> + </table> +</form> +<? + } else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php + } // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/packages/dspam/www/dspam-settings-tuser.php b/packages/dspam/www/dspam-settings-tuser.php new file mode 100644 index 00000000..57e9ec71 --- /dev/null +++ b/packages/dspam/www/dspam-settings-tuser.php @@ -0,0 +1,195 @@ +<?php +/* $Id$ */ +/* + dspam-settings-tuser.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Advanced Settings"), + gettext("Edit UNIX user")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + +/* + The following code presumes, that the following XML structure exists or + if it does not exist, it will be created. + + <tuser> + <name>foo</name> + </tuser> + <tuser> + <name>bar</name> + </tuser> +*/ + +if (!is_array($config['installedpackages']['dspam']['config'][0]['tuser'])) { + $config['installedpackages']['dspam']['config'][0]['tuser'] = array(); +} + +$t_users = &$config['installedpackages']['dspam']['config'][0]['tuser']; + +/* ID is only set if the user wants to edit an existing entry */ +$id = $_GET['id']; +$sectionid = $_GET['sectionid']; +if (isset($_POST['id'])) + $id = $_POST['id']; +if (isset($_POST['sectionid'])) + $sectionid = $_POST['sectionid']; + +if (isset($id) && $t_users[$id]) { + $pconfig['name'] = $t_users[$id]['name']; + $pconfig['descr'] = $t_users[$id]['descr']; +} else { + $pconfig['name'] = $_GET['uuname']; + $pconfig['descr'] = $_GET['descr']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = explode(" ", "uuname"); + $reqdfieldsn = explode(",", "Unix username"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + /* check for overlaps */ + foreach ($t_users as $user) { + if (isset($id) && ($t_users[$id]) && ($t_users[$id] === $user)) { + continue; + } + if ($user['name'] == $_POST['uuname']) { + $input_errors[] = gettext("This username already exists."); + break; + } + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + if (!$input_errors) { + $user = array(); + $user['name'] = $_POST['uuname']; + $user['descr'] = $_POST['descr']; + + if (isset($id) && $t_users[$id]) + $t_users[$id] = $user; + else + $t_users[] = $user; + + write_config(); + + $retval = 0; + config_lock(); + $retval = dspam_configure(); + config_unlock(); + + $savemsg = get_std_save_message($retval); + + isset($sectionid) ? $header = "dspam-settings.php?sectionid={$sectionid}" : $header = "dspam-settings.php"; + pfSenseHeader($header); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<?php if ($input_errors) print_input_errors($input_errors); ?> + <form action="dspam-settings-tuser.php" method="post" name="iform" id="iform"> + <div name="inputerrors" id="inputerrors"></div> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq"><?=gettext("UNIX username");?></td> + <td width="78%" class="vtable"> + <input name="uuname" type="text" class="formfld unknown" id="uuname" size="30" value="<?=htmlspecialchars($pconfig['name']);?>"> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td> + <td width="78%" class="vtable"> + <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> + <br> <span class="vexpl"><?=gettext("You may enter a description here + for your reference (not parsed).");?></span></td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>"> <input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()"> + <?php if (isset($id) && $t_users[$id]): ?> + <input name="id" type="hidden" value="<?=$id;?>"> + <?php endif; ?> + <?php if (isset($sectionid)): ?> + <input name="sectionid" type="hidden" value="<?=$sectionid;?>"> + <?php endif; ?> + </td> + </tr> + </table> +</form> +<? + } else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php + } // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/packages/dspam/www/dspam-settings.php b/packages/dspam/www/dspam-settings.php new file mode 100644 index 00000000..db7a4914 --- /dev/null +++ b/packages/dspam/www/dspam-settings.php @@ -0,0 +1,2941 @@ +<?php +/* $Id$ */ +/* + dspam-settings.php + Copyright (C) 2006 Daniel S. Haischt + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + $pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Advanced Settings"), + gettext("Overview")); + + require("guiconfig.inc"); + include("/usr/local/pkg/dspam.inc"); + + if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + + $pconfig['sectionid'] = $_GET['sectionid']; + + $pconfig['sdriver'] = $config['installedpackages']['dspam']['config'][0]['storage-driver']; + /* ============================================================================================= */ + /* == MySQL == */ + /* ============================================================================================= */ + $pconfig['msqlserver'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-server']; + $pconfig['msqlport'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-port']; + $pconfig['msqluser'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-user']; + $pconfig['msqlpwd'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-password']; + $pconfig['msqldb'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-database']; + $pconfig['msqlcomp'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-compress']; + $pconfig['msqlsuqt'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-squote']; + $pconfig['msqlccache'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-ccache']; + $pconfig['msqluid'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-uid']; + /* ============================================================================================= */ + /* == SQLite == */ + /* ============================================================================================= */ + $pconfig['slitepr'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['sqlite-pragma']; + /* ============================================================================================= */ + /* == PostgreSQL == */ + /* ============================================================================================= */ + $pconfig['pgserver'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-server']; + $pconfig['pgport'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-port']; + $pconfig['pguser'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-user']; + $pconfig['pgpwd'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-password']; + $pconfig['pgdb'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-database']; + $pconfig['pgccache'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-ccache']; + $pconfig['pguid'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-uid']; + /* ============================================================================================= */ + /* == Oracle == */ + /* ============================================================================================= */ + $pconfig['oraserver'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-server']; + $pconfig['orauser'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-user']; + $pconfig['orapwd'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-password']; + $pconfig['orasch'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-schema']; + /* ============================================================================================= */ + /* == Hash == */ + /* ============================================================================================= */ + $pconfig['hsrmax'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-rec-max']; + $pconfig['hsatex'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-auto-ex']; + $pconfig['hsmxex'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-ext']; + $pconfig['hsexsz'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-ext-size']; + $pconfig['hsmxse'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-seek']; + $pconfig['hsccus'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-user']; + $pconfig['hscoca'] = $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-cache']; + /* ============================================================================================= */ + /* == Delivery Settings == */ + /* ============================================================================================= */ + $pconfig['dagent'] = $config['installedpackages']['dspam']['config'][0]['tdelivery-agent']; + $pconfig['dsthinc'] = $config['installedpackages']['dspam']['config'][0]['thin-client']; + $pconfig['tcpipdel'] = $config['installedpackages']['dspam']['config'][0]['tcpip-delivery']; + $pconfig['dhost'] = $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-host']; + $pconfig['dport'] = $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-port']; + $pconfig['dident'] = $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-ident']; + $pconfig['delproto'] = $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-proto']; + $pconfig['onfail'] = $config['installedpackages']['dspam']['config'][0]['delivery-onfail']; + /* ============================================================================================= */ + /* == DSPAM Debugging Options == */ + /* ============================================================================================= */ + $pconfig['enabledbg'] = $config['installedpackages']['dspam']['config'][0]['debug-enable']; + $pconfig['debug'] = $config['installedpackages']['dspam']['config'][0]['debug-whom']; + $pconfig['dopt'] = $config['installedpackages']['dspam']['config'][0]['debug-options']; + /* ============================================================================================= */ + /* == DSPAM Engine Settings == */ + /* ============================================================================================= */ + $pconfig['tmode'] = $config['installedpackages']['dspam']['config'][0]['training-mode']; + $pconfig['testct'] = $config['installedpackages']['dspam']['config'][0]['test-cond-training']; + $pconfig['pvalue'] = $config['installedpackages']['dspam']['config'][0]['pvalue']; + $pconfig['ipdrive'] = $config['installedpackages']['dspam']['config'][0]['improbability-drive']; + /* ============================================================================================= */ + /* == LDAP Settings == */ + /* ============================================================================================= */ + $pconfig['enableldap'] = $config['installedpackages']['dspam']['config'][0]['ldap-enable']; + $pconfig['ldapmode'] = $config['installedpackages']['dspam']['config'][0]['ldap-mode']; + $pconfig['ldaphost'] = $config['installedpackages']['dspam']['config'][0]['ldap-host']; + $pconfig['ldapfilter'] = $config['installedpackages']['dspam']['config'][0]['ldap-filter']; + $pconfig['ldapbase'] = $config['installedpackages']['dspam']['config'][0]['ldap-base']; + /* ============================================================================================= */ + /* == Miscellaneous Settings == */ + /* ============================================================================================= */ + $pconfig['foatt'] = $config['installedpackages']['dspam']['config'][0]['failover-attempts']; + $pconfig['enablesbl'] = $config['installedpackages']['dspam']['config'][0]['sbl-enable']; + $pconfig['sblhost'] = $config['installedpackages']['dspam']['config'][0]['sbl-host']; + $pconfig['enablerbl'] = $config['installedpackages']['dspam']['config'][0]['rbl-inoculate']; + $pconfig['enablenoti'] = $config['installedpackages']['dspam']['config'][0]['notification-email']; + $pconfig['dspamdomain'] = $config['installedpackages']['dspam']['config'][0]['dspam-domain']; + $pconfig['dspamcontact'] = $config['installedpackages']['dspam']['config'][0]['dspam-contact']; + /* ============================================================================================= */ + /* == Maintainance Settings == */ + /* ============================================================================================= */ + $pconfig['psig'] = $config['installedpackages']['dspam']['config'][0]['purge-signatures']; + $pconfig['pneut'] = $config['installedpackages']['dspam']['config'][0]['purge-neutral']; + $pconfig['punu'] = $config['installedpackages']['dspam']['config'][0]['purge-unused']; + $pconfig['phapa'] = $config['installedpackages']['dspam']['config'][0]['purge-hapaxes']; + $pconfig['pones'] = $config['installedpackages']['dspam']['config'][0]['purge-hits-1s']; + $pconfig['ponei'] = $config['installedpackages']['dspam']['config'][0]['purge-hits-1i']; + /* ============================================================================================= */ + /* == System Settings == */ + /* ============================================================================================= */ + $pconfig['locmx'] = $config['installedpackages']['dspam']['config'][0]['local-mx']; + $pconfig['enablesysl'] = $config['installedpackages']['dspam']['config'][0]['system-log']; + $pconfig['enableusel'] = $config['installedpackages']['dspam']['config'][0]['user-log']; + $pconfig['optinout'] = $config['installedpackages']['dspam']['config'][0]['filter-opt']; + $pconfig['enableptoh'] = $config['installedpackages']['dspam']['config'][0]['parse-to-headers']; + $pconfig['enablecmop'] = $config['installedpackages']['dspam']['config'][0]['change-mode-on-parse']; + $pconfig['enablecuop'] = $config['installedpackages']['dspam']['config'][0]['change-user-on-parse']; + $pconfig['enablebmta'] = $config['installedpackages']['dspam']['config'][0]['broken-mta-settings']; + $pconfig['maxmsgs'] = $config['installedpackages']['dspam']['config'][0]['max-message-size']; + $pconfig['procbias'] = $config['installedpackages']['dspam']['config'][0]['processor-bias']; + /* ============================================================================================= */ + /* == ClamAV Engine Settings == */ + /* ============================================================================================= */ + $pconfig['enableclam'] = $config['installedpackages']['dspam']['config'][0]['clamav-enable']; + $pconfig['clamport'] = $config['installedpackages']['dspam']['config'][0]['clamav-port']; + $pconfig['clamhost'] = $config['installedpackages']['dspam']['config'][0]['clamav-host']; + $pconfig['clamresp'] = $config['installedpackages']['dspam']['config'][0]['clamav-response']; + /* ============================================================================================= */ + /* == DSPAM Daemon Settings (Server) == */ + /* ============================================================================================= */ + $pconfig['dsport'] = $config['installedpackages']['dspam']['config'][0]['dspam-server-port']; + $pconfig['dsqsize'] = $config['installedpackages']['dspam']['config'][0]['dspam-server-queue-size']; + $pconfig['dspid'] = $config['installedpackages']['dspam']['config'][0]['dspam-server-pid']; + $pconfig['dssmode'] = $config['installedpackages']['dspam']['config'][0]['dspam-server-mode']; + $pconfig['serverparam'] = $config['installedpackages']['dspam']['config'][0]['dspam-server-params']; + $pconfig['serverid'] = $config['installedpackages']['dspam']['config'][0]['dspam-server-id']; + $pconfig['serversock'] = $config['installedpackages']['dspam']['config'][0]['dspam-server-socket']; + /* ============================================================================================= */ + /* == DSPAM Daemon Settings (Client) == */ + /* ============================================================================================= */ + $pconfig['enabledsclient'] = $config['installedpackages']['dspam']['config'][0]['dspam-client-enable']; + $pconfig['dsclhost'] = $config['installedpackages']['dspam']['config'][0]['dspam-client-host']; + $pconfig['dsclport'] = $config['installedpackages']['dspam']['config'][0]['dspam-client-port']; + $pconfig['dsclident'] = $config['installedpackages']['dspam']['config'][0]['dspam-client-id']; + + if (!is_array($config['installedpackages']['dspam']['config'][0]['tuser'])) { + $config['installedpackages']['dspam']['config'][0]['tuser'] = array(); + } + if (!is_array($config['installedpackages']['dspam']['config'][0]['algorithm'])) { + $config['installedpackages']['dspam']['config'][0]['algorithm'] = array(); + } + if (!is_array($config['installedpackages']['dspam']['config'][0]['feature'])) { + $config['installedpackages']['dspam']['config'][0]['feature'] = array(); + } + if (!is_array($config['installedpackages']['dspam']['config'][0]['preference'])) { + $config['installedpackages']['dspam']['config'][0]['preference'] = array(); + } + if (!is_array($config['installedpackages']['dspam']['config'][0]['override'])) { + $config['installedpackages']['dspam']['config'][0]['override'] = array(); + } + if (!is_array($config['installedpackages']['dspam']['config'][0]['header'])) { + $config['installedpackages']['dspam']['config'][0]['header'] = array(); + } + if (!is_array($config['installedpackages']['dspam']['config'][0]['bmta'])) { + $config['installedpackages']['dspam']['config'][0]['bmta'] = array(); + } + + $t_users = &$config['installedpackages']['dspam']['config'][0]['tuser']; + $t_features = &$config['installedpackages']['dspam']['config'][0]['feature']; + $t_algos = &$config['installedpackages']['dspam']['config'][0]['algorithm']; + $t_prefs = &$config['installedpackages']['dspam']['config'][0]['preference']; + $t_overr = &$config['installedpackages']['dspam']['config'][0]['override']; + $t_headers = &$config['installedpackages']['dspam']['config'][0]['header']; + $t_bmtas = &$config['installedpackages']['dspam']['config'][0]['bmta']; + $t_spwds = &$config['installedpackages']['dspam']['config'][0]['server-pwd']; + +if ($_POST) { + + /* hash */ + $error_bucket = array(); + /* simple error list */ + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + if($_POST['sdriver'] == "mysql") { + if (! $_POST['msqlserver'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid MySQL server name value.", + "field" => "msqlserver"); + } else { + if (strpos($_POST['msqlserver'], '/') === false) { + foreach (explode(' ', $_POST['msqlserver']) as $ts) { + if (!is_domain($ts)) { + $error_bucket[] = array("error" => "A MySQL server name may only contain the characters a-z, 0-9, '-' and '.'.", + "field" => "msqlserver"); + break; + } + } + } + } + /* if we are going to use a TCP/IP base MySQL connection, a port value is required */ + if (! is_port($_POST['msqlport']) && strpos($_POST['msqlserver'], '/') === false) { + $error_bucket[] = array("error" => "You must specify a valid MySQL port value.", + "field" => "msqlport"); + } + if (! $_POST['msqluser'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid MySQL username value.", + "field" => "msqluser"); + } + if (! $_POST['msqlpwd'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid MySQL password value.", + "field" => "msqlpwd"); + } + if (! $_POST['msqldb'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid MySQL database value.", + "field" => "msqldb"); + } + if ($_POST['msqlccache'] && !is_numericint($_POST['msqlccache'])) { + $error_bucket[] = array("error" => "You must specify a valid integer value as a connection cache value.", + "field" => "msqlccache"); + } + } else if($_POST['sdriver'] == "sqlite") { + /* NOP */ + } else if($_POST['sdriver'] == "bdb") { + /* NOP */ + } else if($_POST['sdriver'] == "pgsql") { + if (! $_POST['pgserver'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid PostgreSQL server name value.", + "field" => "pgserver"); + } else { + foreach (explode(' ', $_POST['pgserver']) as $ts) { + if (!is_domain($ts)) { + $error_bucket[] = array("error" => "A PostgreSQL server name may only contain the characters a-z, 0-9, '-' and '.'.", + "field" => "pgserver"); + break; + } + } + } + if (! is_port($_POST['pgport'])) { + $error_bucket[] = array("error" => "You must specify a valid PostgreSQL port value.", + "field" => "pgport"); + } + if (! $_POST['pguser'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid PostgreSQL username value.", + "field" => "pguser"); + } + if (! $_POST['pgpwd'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid PostgreSQL password value.", + "field" => "pgpwd"); + } + if (! $_POST['pgdb'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid PostgreSQL database value.", + "field" => "pgdb"); + } + if ($_POST['pgccache'] && !is_numericint($_POST['pgccache'])) { + $error_bucket[] = array("error" => "You must specify a valid integer value as a connection cache value.", + "field" => "pgccache"); + } + } else if($_POST['sdriver'] == "oracle") { + if (! $_POST['oraserver'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid Oracle server connection string.", + "field" => "oraserver"); + } + if (! $_POST['orauser'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid Oracle username value.", + "field" => "orauser"); + } + if (! $_POST['orapwd'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid Oracle password value.", + "field" => "orapwd"); + } + if (! $_POST['orasch'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid Oracle schema value.", + "field" => "orasch"); + } + } else if($_POST['sdriver'] == "hash") { + if ($_POST['hsrmax'] && !is_numericint($_POST['hsrmax'])) { + $error_bucket[] = array("error" => "You must specify a valid integer value as a number for the initial records to be created.", + "field" => "hsrmax"); + } + if ($_POST['hsmxex'] && !is_numericint($_POST['hsmxex'])) { + $error_bucket[] = array("error" => "You must specify a valid integer value as a number for the maximum extends.", + "field" => "hsmxex"); + } + if ($_POST['hsexsz'] && !is_numericint($_POST['hsexsz'])) { + $error_bucket[] = array("error" => "You must specify a valid integer value as a number for the record size.", + "field" => "hsexsz"); + } + if ($_POST['hsmxse'] && !is_numericint($_POST['hsmxse'])) { + $error_bucket[] = array("error" => "You must specify a valid integer value as a number for the maximum number of records to seek.", + "field" => "hsmxse"); + } + if ($_POST['hscoca'] && !is_numericint($_POST['hscoca'])) { + $error_bucket[] = array("error" => "You must specify a valid integer value as a number for hash connection cache.", + "field" => "hscoca"); + } + } + + if ($_POST['tcpipdel'] == "yes") { + if (! $_POST['dhost'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid server name value for the DSPAM deliver host.", + "field" => "dhost"); + } else { + foreach (explode(' ', $_POST['dhost']) as $ts) { + if (!is_domain($ts)) { + $error_bucket[] = array("error" => "A DSPAM delivery host name may only contain the characters a-z, 0-9, '-' and '.'.", + "field" => "dhost"); + break; + } + } + } + if (! is_port($_POST['dport'])) { + $error_bucket[] = array("error" => "You must specify a valid port value for the DSPAM delivery host.", + "field" => "dport"); + } + if (! $_POST['dident'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid identification string for the DSPAM delivery host.", + "field" => "dident"); + } + } + + if ($_POST['enabledbg'] == "yes") { + if (! $_POST['debug'] <> "") { + $error_bucket[] = array("error" => "You must specify a non-zero value for the debug parameter.", + "field" => "debug"); + } + if (! $_POST['dopt'] <> "") { + $error_bucket[] = array("error" => "You must specify a non-zero value for the debug options.", + "field" => "dopt"); + } + } + + if ($_POST['enableldap'] == "yes") { + if (! $_POST['ldaphost'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid server name value for the LDAP host.", + "field" => "ldaphost"); + } else { + foreach (explode(' ', $_POST['ldaphost']) as $ts) { + if (!is_domain($ts)) { + $error_bucket[] = array("error" => "A LDAP host name may only contain the characters a-z, 0-9, '-' and '.'.", + "field" => "ldaphost"); + break; + } + } + } + if (! $_POST['ldapfilter'] <> "") { + $error_bucket[] = array("error" => "You must specify a non-zero value for the LDAP filter option or you may not be able to get any query result.", + "field" => "ldapfilter"); + } + if (! $_POST['ldapbase'] <> "") { + $error_bucket[] = array("error" => "You must specify a non-zero value for the LDAP base option or you may not be able to get any query result.", + "field" => "ldapbase"); + } + } + + /* misc settings */ + if ($_POST['foatt'] && !is_numericint($_POST['foatt'])) { + $error_bucket[] = array("error" => "You must specify a integer based value for the number of failover attempts.", + "field" => "foatt"); + } + if ($_POST['enablesbl'] == "yes") { + if (! $_POST['sblhost'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid server name value for the SBL host.", + "field" => "sblhost"); + } else { + foreach (explode(' ', $_POST['sblhost']) as $ts) { + if (!is_domain($ts)) { + $error_bucket[] = array("error" => "A SBL host name may only contain the characters a-z, 0-9, '-' and '.'.", + "field" => "sblhost"); + break; + } + } + } + } + if(isset($_POST['enablenoti'])) { + if($_POST['dspamcontact'] == "") { + $error_bucket[] = array("error" => "It is necessary to provide a support contact, if you want DSPAM to send notification messages.", + "field" => "dspamcontact"); + } + if(empty($_POST['whichdomain'])) { + if ($_POST['dspamdomain'] == "") { + $error_bucket[] = array("error" => "You must specify a valid domain name that should be used while sending DSPAM related mail messages.", + "field" => "dspamdomain"); + } else { + if (!is_domain($_POST['dspamdomain'])) { + $error_bucket[] = array("error" => "You must specify a valid domain name that should be used while sending DSPAM related mail messages.", + "field" => "dspamdomain"); + } + } + } + } + + /* Maintanance Settings */ + if (! $_POST['psig'] || $_POST['psig'] == "") { + $error_bucket[] = array("error" => "You must specify a value for the number of signatures to be purged.", + "field" => "psig"); + } else if (! $_POST['psig'] == "off") { + if (!is_numericint($_POST['psig'])) { + $error_bucket[] = array("error" => "You must specify a valide integer value for the number of signatures to be purged.", + "field" => "psig"); + } + } + if (! $_POST['pneut'] || $_POST['pneut'] == "") { + $error_bucket[] = array("error" => "You must specify a value for the number of neutrals to be purged.", + "field" => "pneut"); + } else if (! $_POST['pneut'] == "off") { + if (!is_numericint($_POST['pneut'])) { + $error_bucket[] = array("error" => "You must specify a valide integer value for the number of neutrals to be purged.", + "field" => "pneut"); + } + } + if (! $_POST['punu'] || $_POST['punu'] == "") { + $error_bucket[] = array("error" => "You must specify a value for the number of unused tokens to be purged.", + "field" => "punu"); + } else if (! $_POST['punu'] == "off") { + if (!is_numericint($_POST['punu'])) { + $error_bucket[] = array("error" => "You must specify a valide integer value for the number of unused tokens to be purged.", + "field" => "punu"); + } + } + if (! $_POST['phapa'] || $_POST['phapa'] == "") { + $input_errors[] = "You must specify a value for the number of hapaxes to be purged."; + $input_error_fields[] = "phapa"; + } else if (! $_POST['phapa'] == "off") { + if (!is_numericint($_POST['phapa'])) { + $error_bucket[] = array("error" => "You must specify a valide integer value for the number of hapaxes to be purged.", + "field" => "phapa"); + } + } + if (! $_POST['pones'] || $_POST['pones'] == "") { + $error_bucket[] = array("error" => "You must specify a value for the number of tokens with only 1 spam hit to be purged.", + "field" => "pones"); + } else if (! $_POST['pones'] == "off") { + if (!is_numericint($_POST['pones'])) { + $error_bucket[] = array("error" => "You must specify a valide integer value for the number of tokens with only 1 spam hit to be purged.", + "field" => "pones"); + } + } + if (! $_POST['ponei'] || $_POST['ponei'] == "") { + $error_bucket[] = array("error" => "You must specify a value for the number of tokens with only 1 innocent hit to be purged.", + "field" => "ponei"); + } else if (! $_POST['ponei'] == "off") { + if (!is_numericint($_POST['ponei'])) { + $error_bucket[] = array("error" => "You must specify a valide integer value for the number of tokens with only 1 innocent hit to be purged.", + "field" => "ponei"); + } + } + + /* System Settings */ + if (! is_ipaddr($_POST['locmx'])) { + $error_bucket[] = array("error" => "You must specify a valid IP address for the local MX parameter.", + "field" => "locmx"); + } + if ($_POST['maxmsgs'] && !is_numericint($_POST['maxmsgs'])) { + $error_bucket[] = array("error" => "You must specify a integer based value for the maximum message size.", + "field" => "maxmsgs"); + } + + /* ClamAV Settings */ + if ($_POST['enableclam'] == "yes") { + if (! is_port($_POST['clamport'])) { + $error_bucket[] = array("error" => "You must specify a valid port value for the ClamAV host.", + "field" => "clamport"); + } + if (! $_POST['clamhost'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid server name value for the ClamAV host.", + "field" => "clamhost"); + } else { + foreach (explode(' ', $_POST['clamhost']) as $ts) { + if (!is_domain($ts)) { + $error_bucket[] = array("error" => "A ClamAV host name may only contain the characters a-z, 0-9, '-' and '.'.", + "field" => "clamhost"); + break; + } + } + } + } + + /* */ + /* DSPAM Daemon Settings (Server) */ + /* */ + + /* at least the DSPAM thin client (dspamc) + * should force the user to configure the + * DSPAM daemon. + */ + if (isset($_POST['dsthinc'])) { + if (! is_port($_POST['dsport'])) { + $error_bucket[] = array("error" => "You must specify a valid port value for the DSPAM host.", + "field" => "dsport"); + } + if ($_POST['dsqsize'] && !is_numericint($_POST['dsqsize'])) { + $error_bucket[] = array("error" => "You must specify a valid integer value as a number for the server queue size.", + "field" => "dsqsize"); + } + if (! $_POST['dspid'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid value as PID file for the DSPAM server.", + "field" => "dspid"); + } + if ($_POST['dssmode'] == "standard") { + if (! $_POST['serverparam'] <> "") { + $error_bucket[] = array("error" => "You must specify some valid parameters to be passed to the LMTP server.", + "field" => "serverparam"); + } + if (! $_POST['serverid'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid identification string to be passed to the LMTP server.", + "field" => "serverid"); + } + if ($_POST['serversock'] && $_POST['serversock'] <> "") { + if (strpos($_POST['serversock'], '/') === false) { + $error_bucket[] = array("error" => "You must specify a valid value for the location of a Unix domain socket.", + "field" => "serversock"); + } + } + } + } + + /* DSPAM Daemon Settings (Client) */ + if ($_POST['enabledsclient'] == "yes") { + if (! $_POST['dsclhost'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid server name value for the DSPAM client host.", + "field" => "dsclhost"); + } else { + foreach (explode(' ', $_POST['dsclhost']) as $ts) { + if (!is_domain($ts)) { + $error_bucket[] = array("error" => "A DSPAM client host name may only contain the characters a-z, 0-9, '-' and '.'.", + "field" => "dsclhost"); + break; + } + } + } + if (! is_port($_POST['dsclport'])) { + $error_bucket[] = array("error" => "You must specify a valid port value for the DSPAM client host.", + "field" => "dsclport"); + } + if (! $_POST['dsclident'] <> "") { + $error_bucket[] = array("error" => "You must specify a valid value as identification string for the DSPAM client.", + "field" => "dsclident"); + } + } + + if (is_array($error_bucket)) + foreach($error_bucket as $elem) + $input_errors[] =& $elem["error"]; + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } + + if (!$input_errors) { + $config['installedpackages']['dspam']['config'][0]['storage-driver'] = $_POST['sdriver']; + unset($config['installedpackages']['dspam']['config'][0]['dbsettings']); + + if($_POST['sdriver'] == "mysql") { + /* ====================================================================== */ + /* == String and integer values == */ + /* ====================================================================== */ + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-server'] = $_POST['msqlserver']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-port'] = $_POST['msqlport']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-user'] = $_POST['msqluser']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-password'] = $_POST['msqlpwd']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-database'] = $_POST['msqldb']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-ccache'] = $_POST['msqlccache']; + /* ====================================================================== */ + /* == Boolean values == */ + /* ====================================================================== */ + if($_POST['msqlcomp'] == "yes") + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-compress'] = $_POST['msqlcomp']; + else + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-compress']); + if($_POST['msqlsuqt'] == "yes") + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-squote'] = $_POST['msqlsuqt']; + else + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-squote']); + if($_POST['msqluid'] == "yes") + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-uid'] = $_POST['msqluid']; + else + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-uid']); + } else if($_POST['sdriver'] == "sqlite") { + /* ====================================================================== */ + /* == String and integer values == */ + /* ====================================================================== */ + if ($_POST['slitepr']) + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['sqlite-pragma'] = $_POST['slitepr']; + } else if($_POST['sdriver'] == "bdb") { + /* NOP */ + } else if($_POST['sdriver'] == "pgsql") { + /* ====================================================================== */ + /* == String and integer values == */ + /* ====================================================================== */ + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-server'] = $_POST['pgserver']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-port'] = $_POST['pgport']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-user'] = $_POST['pguser']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-password'] = $_POST['pgpwd']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-database'] = $_POST['pgdb']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-ccache'] = $_POST['pgccache']; + /* ====================================================================== */ + /* == Boolean values == */ + /* ====================================================================== */ + if($_POST['pguid'] == "yes") + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-uid'] = $_POST['pguid']; + else + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-uid']); + } else if($_POST['sdriver'] == "oracle") { + /* ====================================================================== */ + /* == String and integer values == */ + /* ====================================================================== */ + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-server'] = $_POST['oraserver']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-user'] = $_POST['orauser']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-password'] = $_POST['orapwd']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-schema'] = $_POST['orasch']; + } else if($_POST['sdriver'] == "hash") { + /* ====================================================================== */ + /* == String and integer values == */ + /* ====================================================================== */ + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-rec-max'] = $_POST['hsrmax']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-ext'] = $_POST['hsmxex']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-ext-size'] = $_POST['hsexsz']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-seek'] = $_POST['hsmxse']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-user'] = $_POST['hsccus']; + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-cache'] = $_POST['hscoca']; + /* ====================================================================== */ + /* == Boolean values == */ + /* ====================================================================== */ + if($_POST['hsatex'] == "yes") + $config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-auto-ex'] = $_POST['hsatex']; + else + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-auto-ex']); + } + + $config['installedpackages']['dspam']['config'][0]['tdelivery-agent'] = $_POST['dagent']; + $config['installedpackages']['dspam']['config'][0]['thin-client'] = $_POST['dsthinc']; + + if($_POST['tcpipdel'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['tcpip-delivery'] = $_POST['tcpipdel']; + $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-host'] = $_POST['dhost']; + $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-port'] = $_POST['dport']; + $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-ident'] = $_POST['dident']; + $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-proto'] = $_POST['delproto']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['tcpip-delivery']); + unset($config['installedpackages']['dspam']['config'][0]['tcpip-delivery-host']); + unset($config['installedpackages']['dspam']['config'][0]['tcpip-delivery-port']); + unset($config['installedpackages']['dspam']['config'][0]['tcpip-delivery-ident']); + unset($config['installedpackages']['dspam']['config'][0]['tcpip-delivery-proto']); + } + + $config['installedpackages']['dspam']['config'][0]['delivery-onfail'] = $_POST['onfail']; + + if($_POST['enabledbg'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['debug-enable'] = $_POST['enabledbg']; + $config['installedpackages']['dspam']['config'][0]['debug-whom'] = $_POST['debug']; + $config['installedpackages']['dspam']['config'][0]['debug-options'] = $_POST['dopt']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['debug-enable']); + unset($config['installedpackages']['dspam']['config'][0]['debug-whom']); + unset($config['installedpackages']['dspam']['config'][0]['debug-options']); + } + + /* DSPAM engine settings */ + $config['installedpackages']['dspam']['config'][0]['training-mode'] = $_POST['tmode']; + if($_POST['testct'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['test-cond-training'] = $_POST['testct']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['test-cond-training']); + } + $config['installedpackages']['dspam']['config'][0]['pvalue'] = $_POST['pvalue']; + if($_POST['ipdrive'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['improbability-drive'] = $_POST['ipdrive']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['improbability-drive']); + } + + /* LDAP related settings */ + if($_POST['enableldap'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['ldap-enable'] = $_POST['enableldap']; + $config['installedpackages']['dspam']['config'][0]['ldap-mode'] = $_POST['ldapmode']; + $config['installedpackages']['dspam']['config'][0]['ldap-host'] = $_POST['ldaphost']; + $config['installedpackages']['dspam']['config'][0]['ldap-filter'] = $_POST['ldapfilter']; + $config['installedpackages']['dspam']['config'][0]['ldap-base'] = $_POST['ldapbase']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['ldap-enable']); + unset($config['installedpackages']['dspam']['config'][0]['ldap-mode']); + unset($config['installedpackages']['dspam']['config'][0]['ldap-host']); + unset($config['installedpackages']['dspam']['config'][0]['ldap-filter']); + unset($config['installedpackages']['dspam']['config'][0]['ldap-base']); + } + + /* misc settings */ + $config['installedpackages']['dspam']['config'][0]['failover-attempts'] = $_POST['foatt']; + if($_POST['enablesbl'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['sbl-enable'] = $_POST['enablesbl']; + $config['installedpackages']['dspam']['config'][0]['sbl-host'] = $_POST['sblhost']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['sbl-enable']); + unset($config['installedpackages']['dspam']['config'][0]['sbl-host']); + } + if($_POST['enablerbl'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['rbl-inoculate'] = $_POST['enablerbl']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['rbl-inoculate']); + } + if($_POST['enablenoti'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['notification-email'] = $_POST['enablenoti']; + $config['installedpackages']['dspam']['config'][0]['dspam-contact'] = $_POST['dspamcontact']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['notification-email']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-domain']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-contact']); + } + if($_POST['whichdomain'] == "yes") { + unset($config['installedpackages']['dspam']['config'][0]['dspam-domain']); + } else { + $config['installedpackages']['dspam']['config'][0]['dspam-domain'] = $_POST['dspamdomain']; + } + + /* Maintainance Settings */ + $config['installedpackages']['dspam']['config'][0]['purge-signatures'] = $_POST['psig']; + $config['installedpackages']['dspam']['config'][0]['purge-neutral'] = $_POST['pneut']; + $config['installedpackages']['dspam']['config'][0]['purge-unused'] = $_POST['punu']; + $config['installedpackages']['dspam']['config'][0]['purge-hapaxes'] = $_POST['phapa']; + $config['installedpackages']['dspam']['config'][0]['purge-hits-1s'] = $_POST['pones']; + $config['installedpackages']['dspam']['config'][0]['purge-hits-1i'] = $_POST['ponei']; + + /* System Settings */ + $config['installedpackages']['dspam']['config'][0]['local-mx'] = $_POST['locmx']; + $config['installedpackages']['dspam']['config'][0]['local-mx'] = $_POST['locmx']; + if($_POST['enablesysl'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['system-log'] = $_POST['enablesysl']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['system-log']); + } + if($_POST['enableusel'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['user-log'] = $_POST['enableusel']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['user-log']); + } + $config['installedpackages']['dspam']['config'][0]['filter-opt'] = $_POST['optinout']; + if($_POST['enableptoh'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['parse-to-headers'] = $_POST['enableptoh']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['parse-to-headers']); + } + if($_POST['enablecmop'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['change-mode-on-parse'] = $_POST['enablecmop']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['change-mode-on-parse']); + } + if($_POST['enablecuop'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['change-user-on-parse'] = $_POST['enablecuop']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['change-user-on-parse']); + } + if($_POST['enablecuop'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['change-user-on-parse'] = $_POST['enablecuop']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['change-user-on-parse']); + } + if($_POST['enablebmta'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['broken-mta-settings'] = $_POST['enablebmta']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['broken-mta-settings']); + } + $config['installedpackages']['dspam']['config'][0]['max-message-size'] = $_POST['maxmsgs']; + if($_POST['procbias'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['processor-bias'] = $_POST['procbias']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['processor-bias']); + } + + /* ClamAV related settings */ + if($_POST['enableclam'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['clamav-enable'] = $_POST['enableclam']; + $config['installedpackages']['dspam']['config'][0]['clamav-port'] = $_POST['clamport']; + $config['installedpackages']['dspam']['config'][0]['clamav-host'] = $_POST['clamhost']; + $config['installedpackages']['dspam']['config'][0]['clamav-response'] = $_POST['clamresp']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['clamav-enable']); + unset($config['installedpackages']['dspam']['config'][0]['clamav-port']); + unset($config['installedpackages']['dspam']['config'][0]['clamav-host']); + unset($config['installedpackages']['dspam']['config'][0]['clamav-response']); + } + + /* DSPAM daemon settings */ + $config['installedpackages']['dspam']['config'][0]['dspam-server-port'] = $_POST['dsport']; + $config['installedpackages']['dspam']['config'][0]['dspam-server-queue-size'] = $_POST['dsqsize']; + $config['installedpackages']['dspam']['config'][0]['dspam-server-pid'] = $_POST['dspid']; + $config['installedpackages']['dspam']['config'][0]['dspam-server-mode'] = $_POST['dssmode']; + $config['installedpackages']['dspam']['config'][0]['dspam-server-params'] = $_POST['serverparam']; + $config['installedpackages']['dspam']['config'][0]['dspam-server-id'] = $_POST['serverid']; + $config['installedpackages']['dspam']['config'][0]['dspam-server-socket'] = $_POST['serversock']; + + /* DSPAM client settings */ + if($_POST['enabledsclient'] == "yes") { + $config['installedpackages']['dspam']['config'][0]['dspam-client-enable'] = $_POST['enabledsclient']; + $config['installedpackages']['dspam']['config'][0]['dspam-client-host'] = $_POST['dsclhost']; + $config['installedpackages']['dspam']['config'][0]['dspam-client-port'] = $_POST['dsclport']; + $config['installedpackages']['dspam']['config'][0]['dspam-client-id'] = $_POST['dsclident']; + } else { + unset($config['installedpackages']['dspam']['config'][0]['dspam-client-enable']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-client-host']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-client-port']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-client-id']); + } + + write_config(); + + $retval = 0; + conf_mount_rw(); + config_lock(); + $retval = dspam_configure(); + config_unlock(); + $savemsg = get_std_save_message($retval); + conf_mount_ro(); + } +} + +/* did the user send a request to delete an item? */ +if ($_GET['act'] == "del") { + if ($_GET['what'] == "tuser" && $t_users[$_GET['id']]) { + unset($t_users[$_GET['id']]); + write_config(); + pfSenseHeader("dspam-settings.php"); + exit; + } else if ($_GET['what'] == "feat" && $t_features[$_GET['id']]) { + unset($t_features[$_GET['id']]); + write_config(); + pfSenseHeader("dspam-settings.php"); + exit; + } else if ($_GET['what'] == "algo" && $t_algos[$_GET['id']]) { + unset($t_algos[$_GET['id']]); + write_config(); + pfSenseHeader("dspam-settings.php"); + exit; + } else if ($_GET['what'] == "pref" && $t_prefs[$_GET['id']]) { + unset($t_prefs[$_GET['id']]); + write_config(); + pfSenseHeader("dspam-settings.php"); + exit; + } else if ($_GET['what'] == "overr" && $t_overr[$_GET['id']]) { + unset($t_overr[$_GET['id']]); + write_config(); + pfSenseHeader("dspam-settings.php"); + exit; + } else if ($_GET['what'] == "header" && $t_headers[$_GET['id']]) { + unset($t_headers[$_GET['id']]); + write_config(); + pfSenseHeader("dspam-settings.php"); + exit; + } else if ($_GET['what'] == "bmta" && $t_bmtas[$_GET['id']]) { + unset($t_bmtas[$_GET['id']]); + write_config(); + pfSenseHeader("dspam-settings.php"); + exit; + } else if ($_GET['what'] == "spwd" && $t_spwds[$_GET['id']]) { + unset($t_spwds[$_GET['id']]); + write_config(); + pfSenseHeader("dspam-settings.php"); + exit; + } +} + + /* if ajax is calling, give them an update message */ + if(isAjax()) + print_info_box_np($savemsg); + + include("head.inc"); + /* put your custom HTML head content here */ + /* using some of the $pfSenseHead function calls */ + $jscriptstr = <<<EOD +<script type="text/javascript"> +<!-- + +EOD; + + $jscriptstr .= getJScriptFunction(5); + if (empty($_POST)) + $jscriptstr .= getJScriptFunction(6); + $jscriptstr .= <<<EOD +//--> +</script> +EOD; + + $pfSenseHead->addScript($jscriptstr); + echo $pfSenseHead->getHTML();?> + +<body link="#000000" vlink="#000000" alink="#000000" <?php if (empty($_POST)) { echo "onLoad='checkDisabledState(document.iform);'"; } ?>> + <?php include("fbegin.inc"); ?> + <form action="dspam-settings.php" method="post" name="iform" id="iform"> + <input type="hidden" name="sectionid" id="sectionid" value="<?=$pconfig['sectionid'];?>" /> + <?php if ($input_errors) print_input_errors($input_errors); ?> + <?php if ($savemsg) print_info_box($savemsg); ?> + <p> + <span class="vexpl"> + <span class="red"> + <strong>Note: </strong> + </span> + the options on this page are intended for use by advanced users only. + Any setting found on this page is directly going into <code>dspam.conf</code>. + Make sure you do not mess with settings, you do not understand. + </span> + </p> + <p> + <span class="vexpl">If you submit this page, the DSPAM daemon process will be restarted.</span> + </p> + <br /> + <table width="99%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <?php + $tab_array = array(); + $tab_array[] = array("System Status", false, "/dspam-admin.php"); + $tab_array[] = array("User Statistics", false, "/dspam-admin-stats.php"); + $tab_array[] = array("Administration", false, "/dspam-admin-prefs.php"); + $tab_array[] = array("Settings", true, "/dspam-settings.php"); + $tab_array[] = array("Control Center", false, "/dspam-perf.php"); + display_top_tabs($tab_array); + ?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table id="maintable" name="maintable" class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <p><strong>Settings</strong></p> + <ul style="font-size:0.95em; font-family:Verdana,Arial,sans-serif"> + <li><a href="#db" class="redlnk">Database Settings<?php if ($pconfig['sectionid'] == "db") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#del" class="redlnk">Delivery Settings<?php if ($pconfig['sectionid'] == "del") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#priv" class="redlnk">DSPAM Privileges<?php if ($pconfig['sectionid'] == "priv") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#dbg" class="redlnk">DSPAM Debugging Options<?php if ($pconfig['sectionid'] == "dbg") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#eng" class="redlnk">DSPAM Engine Settings<?php if ($pconfig['sectionid'] == "eng") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#ldap" class="redlnk">LDAP Settings<?php if ($pconfig['sectionid'] == "ldap") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#misc" class="redlnk">Miscellaneous Settings<?php if ($pconfig['sectionid'] == "misc") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#main" class="redlnk">Maintainance Settings<?php if ($pconfig['sectionid'] == "main") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#sys" class="redlnk">System Settings<?php if ($pconfig['sectionid'] == "sys") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#clam" class="redlnk">ClamAV Engine Settings<?php if ($pconfig['sectionid'] == "clam") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#srv" class="redlnk">DSPAM Daemon Settings (Server)<?php if ($pconfig['sectionid'] == "srv") echo '<span class="red"> »last modified«</span>'; ?></a></li> + <li><a href="#cli" class="redlnk">DSPAM Daemon Settings (Client)<?php if ($pconfig['sectionid'] == "cli") echo '<span class="red"> »last modified«</span>'; ?></a></li> + </ul> + <br /> + </td> + </tr> + <tr> + <td> + <table id="sortabletable0" name="sortabletable0" width="100%" border="0" cellpadding="10" cellspacing="0"> + <tr> + <td colspan="2" valign="top" class="listtopic"><a name="db" style="visibility: hidden;"> </a>Database Settings</td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Storage Driver</td> + <td width="78%" class="vtable"> + <select name="sdriver" onChange="toggleDBSettings();" class="formselect"> + <option value="mysql" <?php if($pconfig['sdriver'] == "mysql") echo('selected="selected"');?>>mysql</option> + <option value="sqlite" <?php if($pconfig['sdriver'] == "sqlite") echo('selected="selected"');?>>sqlite</option> + <option value="bdb" <?php if($pconfig['sdriver'] == "bdb") echo('selected="selected"');?>>bdb</option> + <option value="pgsql" <?php if($pconfig['sdriver'] == "pgsql") echo('selected="selected"');?>>pgsql</option> + <option value="oracle" <?php if($pconfig['sdriver'] == "oracle") echo('selected="selected"');?>>oracle</option> + <option value="hash" <?php if($pconfig['sdriver'] == "hash") echo('selected="selected"');?>>hash</option> + </select> + <strong>Specifies the storage driver backend (library) to use.</strong> + <p> + <span class="vexpl"> + IMPORTANT: Switching storage drivers requires more than merely changing this option. + If you do not wish to lose all of your data, you will need to migrate it to the new + backend before making this change. + </span> + </p> + </td> + </tr> + <?php if ($pconfig['sdriver'] == "mysql"): ?> + <tbody id="DBmysql" style="display: table-row-group;"> + <?php else: ?> + <tbody id="DBmysql" style="display: none;"> + <?php endif; ?> + <tr> + <td width="22%" valign="top" class="vncell">MySQL Server</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("msqlserver", "formfld host"); ?> name="msqlserver" id="msqlserver" value="<?=htmlspecialchars($pconfig['msqlserver']);?>" /> + <strong> + Either a reference to a Unix domain socket or a reference to a specific host. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">MySQL Port</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("msqlport", "formfld unknown"); ?> name="msqlport" id="msqlport" value="<?=htmlspecialchars($pconfig['msqlport']);?>" /> + <strong> + Use this variable if you are going to a MySQL server instance using TCP/IP instead of a socket connection. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">MySQL User</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("msqluser", "formfld user"); ?> name="msqluser" id="msqluser" value="<?=htmlspecialchars($pconfig['msqluser']);?>" <?php if ($_POST && $input_error_fields && in_array("msqluser", $input_error_fields)) echo 'style="background-color: red;" onFocus="this.style.backgroundColor = \'white\';" onBlur="this.style.backgroundColor = \'red\';"'; ?>/> + <strong> + Username, that will be used to connect to a MySQL server instance. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">MySQL Password</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("msqlpwd", "formfld pwd"); ?> name="msqlpwd" id="msqlpwd" value="<?=htmlspecialchars($pconfig['msqlpwd']);?>" <?php if ($_POST && $input_error_fields && in_array("msqlpwd", $input_error_fields)) echo 'style="background-color: red;" onFocus="this.style.backgroundColor = \'white\';" onBlur="this.style.backgroundColor = \'red\';"'; ?>/> + <strong> + Password, that will be used to connect to a MySQL server instance. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">MySQL Database</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("msqldb", "formfld unknown"); ?> name="msqldb" id="msqldb" value="<?=htmlspecialchars($pconfig['msqldb']);?>" <?php if ($_POST && $input_error_fields && in_array("msqldb", $input_error_fields)) echo 'style="background-color: red;" onFocus="this.style.backgroundColor = \'white\';" onBlur="this.style.backgroundColor = \'red\';"'; ?>/> + <strong> + Database name, that contains DSPAM data. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">MySQL Compress</td> + <td width="78%" class="vtable"> + <input type="checkbox" class="formfld" name="msqlcomp" id="msqlcomp" value="yes" <?php if (isset($pconfig['msqlcomp'])) echo 'checked="checked"'; ?> /> + <strong> + Indicates whether communication data between DSPAM and MySQL should be compressed. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">MySQL Supress Quote</td> + <td width="78%" class="vtable"> + <input type="checkbox" class="formfld" name="msqlsuqt" id="msqlsuqt" value="yes" <?php if (isset($pconfig['msqlsuqt'])) echo 'checked="checked"'; ?> /> + <strong> + Use this if you have the 4.1 quote bug (see doc/mysql.txt). + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <p> + <span class="vexpl"> + If you're running DSPAM in client/server (daemon) mode, uncomment the + setting below to override the default connection cache size (the number + of connections the server pools between all clients). The connection cache + represents the maximum number of database connections *available* and should + be set based on the maximum number of concurrent connections you're likely + to have. Each connection may be used by only one thread at a time, so all + other threads _will block_ until another connection becomes available. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">MySQL Connection Cache</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("msqlccache", "formfld unknown"); ?> name="msqlccache" id="msqlccache" value="<?=htmlspecialchars($pconfig['msqlccache']);?>" <?php if ($_POST && $input_error_fields && in_array("msqlccache", $input_error_fields)) echo 'style="background-color: red;" onFocus="this.style.backgroundColor = \'white\';" onBlur="this.style.backgroundColor = \'red\';"'; ?>/> + <strong> + Conection cache default set to 10. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <p> + <span class="vexpl"> + MySQL supports the insertion of the user id into the DSPAM + signature. This allows you to create one single spam or fp alias + (pointing to some arbitrary user), and the uid in the signature will + switch to the correct user. Result: you need only one spam alias + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">MySQL UID In Signature</td> + <td width="78%" class="vtable"> + <input type="checkbox" class="formfld" name="msqluid" id="msqluid" value="yes" <?php if (isset($pconfig['msqluid'])) echo 'checked="checked"'; ?> /> + <strong> + Insert user id into the DSPAM signature. + </strong> + </td> + </tr> + </tbody> + <?php if ($pconfig['sdriver'] == "sqlite"): ?> + <tbody id="DBsqlite" style="display: table-row-group;"> + <?php else: ?> + <tbody id="DBsqlite" style="display: none;"> + <?php endif; ?> + <tr> + <td width="22%" valign="top" class="vncell">SQLite Pragma</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("slitepr", "formfld unknown"); ?> name="slitepr" id="slitepr" value="<?=htmlspecialchars($pconfig['slitepr']);?>" /> + <strong> + A particular SQLite pragma command to be used. + </strong> + <p> + <span class="vexpl"> + See: <a href="http://sqlite.org/pragma.html" target="_blank">http://sqlite.org/pragma.html</a> + </span> + </p> + </td> + </tr> + </tbody> + <?php if ($pconfig['sdriver'] == "bdb"): ?> + <tbody id="DBbdb" style="display: table-row-group;"> + <?php else: ?> + <tbody id="DBbdb" style="display: none;"> + <?php endif; ?> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <strong> + Nothing to be configured here ! + </strong> + </td> + </tr> + </tbody> + <?php if ($pconfig['sdriver'] == "pgsql"): ?> + <tbody id="DBpgsql" style="display: table-row-group;"> + <?php else: ?> + <tbody id="DBpgsql" style="display: none;"> + <?php endif; ?> + <tr> + <td width="22%" valign="top" class="vncell">PostgreSQL Server</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("pgserver", "formfld host"); ?> name="pgserver" id="pgserver" value="<?=htmlspecialchars($pconfig['pgserver']);?>" /> + <strong> + A reference to a specific host that is running a PostgreSQL instance. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">PostgreSQL Port</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("pgport", "formfld unknown"); ?> name="pgport" id="pgport" value="<?=htmlspecialchars($pconfig['pgport']);?>" /> + <strong> + A number that represents the port a specific PostgreSQL instance is listening to. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">PostgreSQL User</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("pguser", "formfld user"); ?> name="pguser" id="pguser" value="<?=htmlspecialchars($pconfig['pguser']);?>" /> + <strong> + Username, that will be used to connect to a PostgreSQL server instance. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">PostgreSQL Password</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("pgpwd", "formfld pwd"); ?> name="pgpwd" id="pgpwd" value="<?=htmlspecialchars($pconfig['pgpwd']);?>"/> + <strong> + Password, that will be used to connect to a PostgreSQL server instance. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">PostgreSQL Database</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("pgdb", "formfld unknown"); ?> name="pgdb" id="pgdb" value="<?=htmlspecialchars($pconfig['pgdb']);?>" /> + <strong> + Database name, that contains DSPAM data. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <p> + <span class="vexpl"> + If you're running DSPAM in client/server (daemon) mode, uncomment the + setting below to override the default connection cache size (the number + of connections the server pools between all clients). The connection cache + represents the maximum number of database connections *available* and should + be set based on the maximum number of concurrent connections you're likely + to have. Each connection may be used by only one thread at a time, so all + other threads _will block_ until another connection becomes available. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">PostgreSQL Connection Cache</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("pgccache", "formfld unknown"); ?> name="pgccache" id="pgccache" value="<?=htmlspecialchars($pconfig['pgccache']);?>" /> + <strong> + Conection cache default set to 3. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <p> + <span class="vexpl"> + PostgreSQL supports the insertion of the user id into the DSPAM + signature. This allows you to create one single spam or fp alias + (pointing to some arbitrary user), and the uid in the signature will + switch to the correct user. Result: you need only one spam alias + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">PostgreSQL UID In Signature</td> + <td width="78%" class="vtable"> + <input type="checkbox" class="formfld" name="pguid" id="pguid" value="yes" <?php if (isset($pconfig['pguid'])) echo 'checked="checked"'; ?> /> + <strong> + Insert user id into the DSPAM signature. + </strong> + </td> + </tr> + </tbody> + <?php if ($pconfig['sdriver'] == "oracle"): ?> + <tbody id="DBoracle" style="display: table-row-group;"> + <?php else: ?> + <tbody id="DBoracle" style="display: none;"> + <?php endif; ?> + <tr> + <td width="22%" valign="top" class="vncell">Attention !</td> + <td width="78%" class="vtable"> + <strong style="color: red;"> + This feature is currently unsupported ! + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Oracle Server</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("oraserver", "formfld host"); ?> name="oraserver" id="oraserver" value="<?=htmlspecialchars($pconfig['oraserver']);?>" /> + <strong> + A reference to a specific host that is running an Oracle database instance. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Oracle User</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("orauser", "formfld user"); ?> name="orauser" id="orauser" value="<?=htmlspecialchars($pconfig['orauser']);?>" /> + <strong> + Username, that will be used to connect to a Oracle database server instance. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Oracle Password</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("orapwd", "formfld pwd"); ?> name="orapwd" id="orapwd" value="<?=htmlspecialchars($pconfig['orapwd']);?>" /> + <strong> + Password, that will be used to connect to a Oracle database server instance. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Oracle Schema</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("orasch", "formfld unknown"); ?> name="orasch" id="orasch" value="<?=htmlspecialchars($pconfig['orasch']);?>" /> + <strong> + Schema name, that contains DSPAM data. + </strong> + </td> + </tr> + </tbody> + <?php if ($pconfig['sdriver'] == "hash"): ?> + <tbody id="DBhash" style="display: table-row-group;"> + <?php else: ?> + <tbody id="DBhash" style="display: none;"> + <?php endif; ?> + <tr> + <td width="22%" valign="top" class="vncell">Hash Rec Max</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("hsrmax", "formfld unknown"); ?> name="hsrmax" id="hsrmax" value="<?=htmlspecialchars($pconfig['hsrmax']);?>" /> + <strong> + Default number of records to create in the initial segment when building hash files. + </strong> + <p> + <span class="vexpl"> + 100,000 yields files 1.6MB in size, but can fill up fast, so be sure to increase this + (to a million or more) if you're not using autoextend. + </span> + </p> + <p> + <span class="vexpl"> + Primes List: + <pre> +53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, 98317, 196613, +393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, +100663319, 201326611, 402653189, 805306457, 1610612741, 3221225473, +4294967291 + </pre> + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Hash Auto Extend</td> + <td width="78%" class="vtable"> + <input type="checkbox" class="formfld" name="hsatex" id="hsatex" value="yes" <?php if (isset($pconfig['hsatex'])) echo 'checked="checked"'; ?> /> + <strong> + Autoextend hash databases when they fill up. This allows them to continue + to train by adding extents (extensions) to the file. + </strong> + <p> + <span class="vexpl"> + Note: There will be a small delay during the growth process, + as everything needs to be closed and remapped. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Hash Max Extents</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("hsmxex", "formfld unknown"); ?> name="hsmxex" id="hsmxex" value="<?=htmlspecialchars($pconfig['hsmxex']);?>" /> + <strong> + The maximum number of extents that may be created in a single hash file. + </strong> + <p> + <span class="vexpl"> + Note: Set this to zero for unlimited. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Hash Extent Size</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("hsexsz", "formfld unknown"); ?> name="hsexsz" id="hsexsz" value="<?=htmlspecialchars($pconfig['hsexsz']);?>" /> + <strong> + The record size for newly created extents. + </strong> + <p> + <span class="vexpl"> + Note: Creating this too small could result in many extents + being created. Creating this too large could result in + excessive disk space usage. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Hash Max Seek</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("hsmxse", "formfld unknown"); ?> name="hsmxse" id="hsmxse" value="<?=htmlspecialchars($pconfig['hsmxse']);?>" /> + <strong> + The maximum number of records to seek to insert a new record + before failing or adding a new extent. + </strong> + <p> + <span class="vexpl"> + Note: Setting this too high will exhaustively scan each segment + and kill performance. Typically, a low value is acceptable as + even older extents will continue to fill over time. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Hash Concurrent User</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("hsccus", "formfld unknown"); ?> name="hsccus" id="hsccus" value="<?=htmlspecialchars($pconfig['hsccus']);?>" /> + <strong> + If you are using a single, stateful hash database in daemon mode, + specifying a concurrent user will cause the user to be permanently + mapped into memory and shared via rwlocks. + </strong> + <p> + <span class="vexpl"> + Note: Leave this field blank, if you do not want to use this option. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Hash Connection Cache</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("hscoca", "formfld unknown"); ?> name="hscoca" id="hscoca" value="<?=htmlspecialchars($pconfig['hscoca']);?>" /> + <strong> + If running in daemon mode, this is the max # of concurrent + connections that will be supported. + </strong> + <p> + <span class="vexpl"> + Note: If you are using HashConcurrentUser, this option is ignored, + as all connections are read write locked instead of mutex locked. + </span> + </p> + </td> + </tr> + </tbody> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'db';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic"><a name="del" style="visibility: hidden;"> </a>Delivery Settings</td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Trusted Delivery Agent</td> + <td width="78%" class="vtable"> + <select name="dagent" class="formselect"> + <option value="procmail" <?php if($pconfig['dagent'] == "procmail") echo('selected="selected"');?>>procmail</option> + <option value="mail" <?php if($pconfig['dagent'] == "mail") echo('selected="selected"');?>>mail</option> + <option value="mail.local" <?php if($pconfig['dagent'] == "mail.local") echo('selected="selected"');?>>mail.local</option> + <option value="deliver" <?php if($pconfig['dagent'] == "deliver") echo('selected="selected"');?>>deliver</option> + <option value="maildrop" <?php if($pconfig['dagent'] == "maildrop") echo('selected="selected"');?>>maildrop</option> + <option value="exim" <?php if($pconfig['dagent'] == "exim") echo('selected="selected"');?>>exim</option> + </select> + <strong>Specifies the local delivery agent DSPAM should call when delivering mail as a trusted user.</strong> + <p> + <span class="vexpl"> + Note: Use %u to specify the user DSPAM is processing mail for. It is generally a good idea to + allow the MTA to specify the pass-through arguments at run-time, but they may also be specified + here. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">DSPAM Thin Client</td> + <td width="78%" class="vtable"> + <input type="checkbox" name="dsthinc" id="dsthinc" value="yes" <?php if (isset($pconfig['dsthinc'])) echo 'checked="checked"'; ?> /> + <strong>Use <code>dspamc</code> instead of the <code>dspam</code> binary.</strong> + <p> + <span class="vexpl"> + Note: This requires to enable the dspam daemon as well (section: <i>DSPAM Daemon Settings (Server)</i>). + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">TCP/IP Based Delivery</td> + <td width="78%" class="vtable"> + <input type="checkbox" name="tcpipdel" id="tcpipdel" value="yes" <?php if (isset($pconfig['tcpipdel'])) echo 'checked="checked"'; ?> onClick="enable_change(false, 5);" /> + <strong>Use TCP/IP based delivery.</strong> + <p> + <span class="vexpl"> + Note: This option needs to be ticked if you are going to deliver via LMTP or SMTP. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Deliver Host</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("dhost", "formfld host"); ?> name="dhost" id="dhost" value="<?=htmlspecialchars($pconfig['dhost']);?>" <?php if (! isset($pconfig['tcpipdel'])) echo 'disabled="disabled"'; ?> /> + <strong>Alternatively, you may wish to use SMTP or LMTP delivery to deliver your message to the mail server.</strong> + <p> + <span class="vexpl"> + Note: You will need to configure with <code>--enable-daemon</code> to use host delivery, + however you do not need to operate in daemon mode. Specify an IP address or UNIX path to a + domain socket below as a host. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Deliver Port</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("dport", "formfld unknown"); ?> name="dport" id="dport" value="<?=htmlspecialchars($pconfig['dport']);?>" <?php if (! isset($pconfig['tcpipdel'])) echo 'disabled="disabled"'; ?> /> + <strong>Port number of a particular host.</strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Deliver Ident</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("dident", "formfld unknown"); ?> name="dident" id="dident" value="<?=htmlspecialchars($pconfig['dident']);?>" <?php if (! isset($pconfig['tcpipdel'])) echo 'disabled="disabled"'; ?> /> + <strong>A particular identification string</strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">TCP/IP Delivery Protocol</td> + <td width="78%" class="vtable"> + <select name="delproto" class="formselect" <?php if (! isset($pconfig['tcpipdel'])) echo 'disabled="disabled"'; ?>> + <option value="smtp" <?php if($pconfig['delproto'] == "smtp") echo('selected="selected"');?>>smtp</option> + <option value="lmtp" <?php if($pconfig['delproto'] == "lmtp") echo('selected="selected"');?>>lmtp</option> + </select> + <strong>A particular protocol typ. Either <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> + or <acronym title="Local Mail Transfer Protocol">LMTP</acronym>.</strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">On Fail</td> + <td width="78%" class="vtable"> + <select name="onfail" class="formselect"> + <option value="error" <?php if($pconfig['onfail'] == "error") echo('selected="selected"');?>>error</option> + <option value="unlearn" <?php if($pconfig['onfail'] == "unlearn") echo('selected="selected"');?>>unlearn</option> + </select> + <strong>What to do if local delivery or quarantine should fail.</strong> + <p> + <span class="vexpl"> + Note: If set to "unlearn", DSPAM will unlearn the message prior to exiting with an un + successful return code. The default option, "error" will not unlearn the message but + return the appropriate error code. The unlearn option is use-ful on some systems where local + delivery failures will cause the message to be requeued for delivery, and could result in the + message being processed multiple times. During a very large failure, however, this could cause + a significant load increase. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'del';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic"><a name="priv" style="visibility: hidden;"> </a>DSPAM Privileges</td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Trusted Users</td> + <td width="78%" class="vtable"> + <strong>Unix users which are allowed to perform certain actions.</strong> + <p> + <span class="vexpl"> + Note: Only the users specified below will be allowed to perform + administrative functions in DSPAM such as setting the active user and + accessing tools. All other users attempting to run DSPAM will be restricted; + their uids will be forced to match the active username and they will not be + able to specify delivery agent privileges or use tools. + </span> + </p> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="55%" class="listhdrr"><?=gettext("UNIX username");?></td> + <td width="35%" class="listhdr"><?=gettext("Description");?></td> + <td width="10%" class="list"></td> + </tr> + <?php if(is_array($t_users)): ?> + <?php $i = 0; foreach ($t_users as $user): ?> + <?php if($user['name'] <> ""): ?> + + <tr> + <td class="listlr" ondblclick="document.location='dspam-settings-tuser.php?id=<?=$i;?>§ionid=priv';"> + <?=htmlspecialchars($user['name']);?> + </td> + <td class="listbg" ondblclick="document.location='dspam-settings-tuser.php?id=<?=$i;?>§ionid=priv';"> + <font color="#FFFFFF"><?=htmlspecialchars($user['descr']);?> </font> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-tuser.php?id=<?=$i;?>§ionid=priv"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="dspam-settings.php?act=del&what=tuser&id=<?=$i;?>§ionid=priv" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + <?php endif; ?> + <?php $i++; endforeach; ?> + <?php endif; ?> + <tr> + <td class="list" colspan="3"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-tuser.php?sectionid=priv"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'priv';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td valign="top" class="listtopic"><a name="dbg" style="visibility: hidden;"> </a>DSPAM Debugging Options</td> + <td align="right" valign="top" class="listtopic"> + <input type="checkbox" name="enabledbg" id="enabledbg" value="yes" <?php if (isset($pconfig['enabledbg'])) echo 'checked="checked"'; ?> onClick="enable_change(false, 0);" /> + <strong>Enable</strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Debug</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("debug", "formfld unknown"); ?> name="debug" id="debug" value="<?=htmlspecialchars($pconfig['debug']);?>" <?php if (! isset($pconfig['enabledbg'])) echo 'disabled="disabled"'; ?> /> + <strong>Enables debugging for some or all users.</strong> + <p> + <span class="vexpl"> + IMPORTANT: DSPAM must be compiled with debug support in order to use this option. + DSPAM should never be running in production with debug active unless you are + troubleshooting problems. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Debug Options</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("dopt", "formfld unknown"); ?> name="dopt" id="dopt" value="<?=htmlspecialchars($pconfig['dopt']);?>" <?php if (! isset($pconfig['enabledbg'])) echo 'disabled="disabled"'; ?> /> + <strong>One or more of: process, classify, spam, fp, inoculation, corpus</strong> + <p> + <span class="vexpl"> + <pre> +process standard message processing +classify message classification using --classify +spam error correction of missed spam +fp error correction of false positives +inoculation message inoculations (source=inoculation) +corpus corpusfed messages (source=corpus) + </pre> + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'dbg';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic"><a name="eng" style="visibility: hidden;"> </a>DSPAM Engine Settings</td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Training Mode</td> + <td width="78%" class="vtable"> + <select name="tmode" class="formselect"> + <option value="toe" <?php if($pconfig['tmode'] == "toe") echo('selected="selected"');?>>toe</option> + <option value="tum" <?php if($pconfig['tmode'] == "tum") echo('selected="selected"');?>>tum</option> + <option value="teft" <?php if($pconfig['tmode'] == "teft") echo('selected="selected"');?>>teft</option> + <option value="notrain" <?php if($pconfig['tmode'] == "notrain") echo('selected="selected"');?>>notrain</option> + </select> + <strong> + The default training mode to use for all operations, when one has not been + specified on the commandline or in the user's preferences. + </strong> + <p> + <span class="vexpl"> + Acceptable values are: toe, tum, teft, notrain + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Test Conditional Training</td> + <td width="78%" class="vtable"> + <input name="testct" type="checkbox" id="testct" value="yes" <?php if (isset($pconfig['testct'])) echo 'checked="checked"'; ?> /> + <strong> + By default, dspam will retrain certain errors + until the condition is no longer met. + </strong> + <p> + <span class="vexpl"> + Note: This usually accelerates learning. Some people argue that this can increase + the risk of errors, however. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Features</td> + <td width="78%" class="vtable"> + <strong> + Specify features to activate by default; can also be specified + on the commandline. See the documentation for a list of available features. + If _any_ features are specified on the commandline, these are ignored. + </strong> + <p> + <span class="vexpl"> + Note: For standard "CRM114" Markovian weighting, use sbph + </span> + </p> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="55%" class="listhdrr"><?=gettext("DSPAM Feature");?></td> + <td width="35%" class="listhdr"><?=gettext("Description");?></td> + <td width="10%" class="list"></td> + </tr> + <?php if(is_array($t_features)): ?> + <?php $i = 0; foreach ($t_features as $feature): ?> + <?php if($feature['name'] <> ""): ?> + + <tr> + <td class="listlr" ondblclick="document.location='dspam-settings-feat.php?id=<?=$i;?>§ionid=eng';"> + <?=htmlspecialchars($feature['name']);?> + </td> + <td class="listbg" ondblclick="document.location='dspam-settings-feat.php?id=<?=$i;?>§ionid=eng';"> + <font color="#FFFFFF"><?=htmlspecialchars($feature['descr']);?> </font> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-feat.php?id=<?=$i;?>§ionid=eng"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="dspam-settings.php?act=del&what=feat&id=<?=$i;?>§ionid=eng" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + <?php endif; ?> + <?php $i++; endforeach; ?> + <?php endif; ?> + <tr> + <td class="list" colspan="3"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-feat.php?sectionid=eng"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Algorithms</td> + <td width="78%" class="vtable"> + <strong> + Specify the statistical algorithms to use, overriding any + defaults configured in the build. + </strong> + <p> + <span class="vexpl"> + The options are: + <pre> +naive Naive-Bayesian (All Tokens) +graham Graham-Bayesian ("A Plan for Spam") +burton Burton-Bayesian (SpamProbe) +robinson Robinson's Geometric Mean Test (Obsolete) +chi-square Fisher-Robinson's Chi-Square Algorithm + </pre> + </span> + </p> + <p> + <span class="vexpl"> + You may have multiple algorithms active simultaneously, but it is strongly + recommended that you group Bayesian algorithms with other Bayesian + algorithms, and any use of Chi-Square remain exclusive. + </p> + <p> + <span class="vexpl"> + NOTE: For standard "CRM114" Markovian weighting, use ‘naive’, or consider + using ‘burton’ for slightly better accuracy. + </span> + </p> + <p> + <span class="vexpl"> + Don't mess with this unless you know what you're doing + </span> + </p> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="55%" class="listhdrr"><?=gettext("DSPAM Algorithm");?></td> + <td width="35%" class="listhdr"><?=gettext("Description");?></td> + <td width="10%" class="list"></td> + </tr> + <?php if(is_array($t_algos)): ?> + <?php $i = 0; foreach ($t_algos as $algo): ?> + <?php if($algo['name'] <> ""): ?> + + <tr> + <td class="listlr" ondblclick="document.location='dspam-settings-algo.php?id=<?=$i;?>§ionid=eng';"> + <?=htmlspecialchars($algo['name']);?> + </td> + <td class="listbg" ondblclick="document.location='dspam-settings-algo.php?id=<?=$i;?>§ionid=eng';"> + <font color="#FFFFFF"><?=htmlspecialchars($algo['descr']);?> </font> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-algo.php?id=<?=$i;?>§ionid=eng"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="dspam-settings.php?act=del&what=algo&id=<?=$i;?>§ionid=eng" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + <?php endif; ?> + <?php $i++; endforeach; ?> + <?php endif; ?> + <tr> + <td class="list" colspan="3"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-algo.php?sectionid=eng"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">PValue</td> + <td width="78%" class="vtable"> + <select name="pvalue" class="formselect"> + <option value="graham" <?php if($pconfig['pvalue'] == "toe") echo('selected="selected"');?>>graham</option> + <option value="robinson" <?php if($pconfig['pvalue'] == "toe") echo('selected="selected"');?>>robinson</option> + <option value="markov" <?php if($pconfig['pvalue'] == "toe") echo('selected="selected"');?>>markov</option> + </select> + <strong> + Specify the technique used for calculating PValues, overriding any defaults + configured in the build. + </strong> + <p> + <span class="vexpl"> + These options are: + <pre> +graham Graham's Technique ("A Plan for Spam") +robinson Robinson's Technique +markov Markovian Weighted Technique + </pre> + </span> + </p> + <p> + <span class="vexpl"> + Unlike algorithms, you may only have one of these defined. Use of the + chi-square algorithm automatically changes this to robinson. + </span> + </p> + <p> + <span class="vexpl"> + Don't mess with this unless you know what you're doing. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Improbability Drive</td> + <td width="78%" class="vtable"> + <input name="ipdrive" type="checkbox" id="ipdrive" value="yes" <?php if (isset($pconfig['ipdrive'])) echo 'checked="checked"'; ?> /> + <strong> + Calculate odds-ratios for ham/spam, and add to X-DSPAM-Improbability headers + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Preferences</td> + <td width="78%" class="vtable"> + <strong> + Specify any preferences to set by default, unless otherwise + overridden by the user (see next section) or a default.prefs file. + </strong> + <p> + <span class="vexpl"> + Note: If user or default.prefs are found, the user's + preferences will override any defaults. + </span> + </p> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="55%" class="listhdrr"><?=gettext("DSPAM Preference Value");?></td> + <td width="35%" class="listhdr"><?=gettext("Description");?></td> + <td width="10%" class="list"></td> + </tr> + <?php if(is_array($t_prefs)): ?> + <?php $i = 0; foreach ($t_prefs as $pref): ?> + <?php if($pref['value'] <> ""): ?> + + <tr> + <td class="listlr" ondblclick="document.location='dspam-settings-prefs.php?id=<?=$i;?>§ionid=eng';"> + <?=htmlspecialchars($pref['value']);?> + </td> + <td class="listbg" ondblclick="document.location='dspam-settings-prefs.php?id=<?=$i;?>§ionid=eng';"> + <font color="#FFFFFF"><?=htmlspecialchars($pref['descr']);?> </font> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-prefs.php?id=<?=$i;?>§ionid=eng"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="dspam-settings.php?act=del&what=pref&id=<?=$i;?>§ionid=eng" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + <?php endif; ?> + <?php $i++; endforeach; ?> + <?php endif; ?> + <tr> + <td class="list" colspan="3"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-prefs.php?sectionid=eng"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Overrides</td> + <td width="78%" class="vtable"> + <strong> + Specifies the user preferences which may override + configuration and commandline defaults. + </strong> + <p> + <span class="vexpl"> + Note: Any other preferences supplied by an untrusted user will be ignored. + </span> + </p> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="55%" class="listhdrr"><?=gettext("DSPAM Override Value");?></td> + <td width="35%" class="listhdr"><?=gettext("Description");?></td> + <td width="10%" class="list"></td> + </tr> + <?php if(is_array($t_overr)): ?> + <?php $i = 0; foreach ($t_overr as $over): ?> + <?php if($over['value'] <> ""): ?> + + <tr> + <td class="listlr" ondblclick="document.location='dspam-settings-overr.php?id=<?=$i;?>§ionid=eng';"> + <?=htmlspecialchars($over['value']);?> + </td> + <td class="listbg" ondblclick="document.location='dspam-settings-overr.php?id=<?=$i;?>§ionid=eng';"> + <font color="#FFFFFF"><?=htmlspecialchars($over['descr']);?> </font> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-overr.php?id=<?=$i;?>§ionid=eng"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="dspam-settings.php?act=del&what=overr&id=<?=$i;?>§ionid=eng" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + <?php endif; ?> + <?php $i++; endforeach; ?> + <?php endif; ?> + <tr> + <td class="list" colspan="3"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-overr.php?sectionid=eng"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'eng';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td valign="top" class="listtopic"><a name="ldap" style="visibility: hidden;"> </a>LDAP Settings</td> + <td align="right" valign="top" class="listtopic"> + <input name="enableldap" type="checkbox" id="enableldap" value="yes" <?php if (isset($pconfig['enableldap'])) echo 'checked="checked"'; ?> onClick="enable_change(false, 1);" /> + <strong>Enable</strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">LDAP Mode</td> + <td width="78%" class="vtable"> + <select name="ldapmode" class="formselect" <?php if (! isset($pconfig['enableldap'])) echo 'disabled="disabled"'; ?>> + <option value="verify" selected="selected">verify</option> + </select> + <strong> + Perform various LDAP functions depending on LDAPMode variable. + </strong> + <p> + <span class="vexpl"> + Note: Presently, the only mode supported is 'verify', which will verify the + existence of an unknown user in LDAP prior to creating them as a new user in + the system. This is useful on some systems acting as gateway machines. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">LDAP Host</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("hldaphost", "formfld host"); ?> name="ldaphost" id="ldaphost" value="<?=htmlspecialchars($pconfig['ldaphost']);?>" <?php if (! isset($pconfig['enableldap'])) echo 'disabled="disabled"'; ?> /> + <strong> + Hostname of the LDAP directory server. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">LDAP Filter</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("ldapfilter", "formfld unknown"); ?> name="ldapfilter" id="ldapfilter" value="<?=htmlspecialchars($pconfig['ldapfilter']);?>" <?php if (! isset($pconfig['enableldap'])) echo 'disabled="disabled"'; ?> /> + <strong> + A specific query filter, that should be used while querying the LDAP server. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">LDAP Base</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("ldapbase", "formfld unknown"); ?> name="ldapbase" id="ldapbase" value="<?=htmlspecialchars($pconfig['ldapbase']);?>" <?php if (! isset($pconfig['enableldap'])) echo 'disabled="disabled"'; ?> /> + <strong> + A particular distinguish name from where to start LDAP queries. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'ldap';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic"><a name="misc" style="visibility: hidden;"> </a>Miscellaneous Settings</td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Failover Attempts</td> + <td width="78%" class="vtable"> + <input type="text" size="30"<?= checkForErrorClass("foatt", "formfld unknown"); ?> name="foatt" id="foatt" value="<?=htmlspecialchars($pconfig['foatt']);?>" /> + <strong> + A particular number of attempts. + </strong> + <p> + <span class="vexpl"> + If the storage fails, the agent will follow each profile's failover up to + a maximum number of failover attempts. This should be set to a maximum of + the number of profiles you have, otherwise the agent could loop and try + the same profile multiple times (unless this is your desired behavior). + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Ignore Headers</td> + <td width="78%" class="vtable"> + <p> + <span class="vexpl"> + If DSPAM is behind other tools which may add a header to + incoming emails, it may be beneficial to ignore these headers - especially + if they are coming from another spam filter. If you are _not_ using one of + these tools, however, leaving the appropriate headers commented out will + allow DSPAM to use them as telltale signs of forged email. + </span> + </p> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="55%" class="listhdrr"><?=gettext("Header Name");?></td> + <td width="35%" class="listhdr"><?=gettext("Description");?></td> + <td width="10%" class="list"></td> + </tr> + <?php if(is_array($t_headers)): ?> + <?php $i = 0; foreach ($t_headers as $header): ?> + <?php if($header['name'] <> ""): ?> + + <tr> + <td class="listlr" ondblclick="document.location='dspam-settings-header.php?id=<?=$i;?>§ionid=misc';"> + <?=htmlspecialchars($header['name']);?> + </td> + <td class="listbg" ondblclick="document.location='dspam-settings-header.php?id=<?=$i;?>§ionid=misc';"> + <font color="#FFFFFF"><?=htmlspecialchars($header['descr']);?> </font> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-header.php?id=<?=$i;?>§ionid=misc"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="dspam-settings.php?act=del&what=header&id=<?=$i;?>§ionid=misc" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + <?php endif; ?> + <?php $i++; endforeach; ?> + <?php endif; ?> + <tr> + <td class="list" colspan="3"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-header.php?sectionid=misc"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">SBL Lookup</td> + <td width="78%" class="vtable"> + <p> + <input type="checkbox" name="enablesbl" id="enablesbl" value="yes" <?php if (isset($pconfig['enablesbl'])) echo 'checked="checked"'; ?> onClick="enable_change(false, 2);" /> + <strong> + Enable checks against a particular <acronym title="Streamlined Blackhole List">SBL</acronym> host. + </strong> + </p> + <p> + <input type="text" size="30" c<?= checkForErrorClass("sblhost", "formfld host"); ?> name="sblhost" id="sblhost" value="<?=htmlspecialchars($pconfig['sblhost']);?>" <?php if (! isset($pconfig['enablesbl'])) echo 'disabled="disabled"'; ?> /> + <strong> + A particular SBL hostname. + </strong> + </p> + <p> + <span class="vexpl"> + Perform lookups on streamlined blackhole list servers (see + <a href="http://www.nuclearelephant.com/projects/sbl/" target="_blank">http://www.nuclearelephant.com/projects/sbl/</a>). + The streamlined blacklist + server is machine-automated, unsupervised blacklisting system designed to + provide real-time and highly accurate blacklisting based on network spread. + When performing a lookup, DSPAM will automatically learn the inbound message + as spam if the source IP is listed. Until an official public RABL server is + available, this feature is only useful if you are running your own + streamlined blackhole list server for internal reporting among multiple mail + servers. Provide the name of the lookup zone below to use. + </span> + </p> + <p> + <span class="vexpl"> + This function performs standard reverse-octet.domain lookups, and while it + will function with many RBLs, it's strongly discouraged to use those + maintained by humans as they're often inaccurate and could hurt filter + learning and accuracy. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">RBL Inoculate</td> + <td width="78%" class="vtable"> + <input name="enablerbl" type="checkbox" id="enablerbl" value="yes" <?php if (isset($pconfig['enablerbl'])) echo 'checked="checked"'; ?> /> + <strong> + Enable <acronym title="Realtime Blackhole List">RBL</acronym> inoculation support. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Enable Notification</td> + <td width="78%" class="vtable"> + <input name="enablenoti" type="checkbox" id="enablenoti" value="yes" <?php if (isset($pconfig['enablenoti'])) echo 'checked="checked"'; ?> onClick="enable_change(false, 2);" /> + <strong> + Enable the sending of notification emails to users (first message, quarantine full, etc.) + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">DSPAM Support Contact</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("dspamcontact", "formfld mail"); ?> name="dspamcontact" id="dspamcontact" value="<?=htmlspecialchars($pconfig['dspamcontact']);?>" <?php if (empty($pconfig['enablenoti'])) echo 'disabled="disabled"'; ?> /> + <strong> + The username of the person who provides DSPAM support for this DSPAM installation + </strong> + (This is the left most part of an email address before the @ sign). + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Email Domain Name</td> + <td width="78%" class="vtable"> + <input name="whichdomain" type="checkbox" id="whichdomain" value="yes" <?php if (empty($pconfig['dspamdomain'])) echo 'checked="checked"'; if (empty($pconfig['enablenoti'])) echo 'disabled="disabled"'; ?> onClick="toggleDSPAMDomain(false, this);" /> + <strong> + Use global domain settings while trying to send an email message. + </strong> + </td> + </tr> + <?php if (isset($pconfig['dspamdomain'])): ?> + <tbody id="emailnotitb" style="display: table-row-group;"> + <?php else: ?> + <tbody id="emailnotitb" style="display: none;"> + <?php endif; ?> + <tr> + <td width="22%" valign="top" class="vncell">DSPAM Domain Name</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("dspamdomain", "formfld url"); ?> name="dspamdomain" id="dspamdomain" value="<?=htmlspecialchars($pconfig['dspamdomain']);?>" /> + <strong> + Use this domain name while trying to send an email message. + </strong> + </td> + </tr> + </tbody> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'misc';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic"><a name="main" style="visibility: hidden;"> </a>Maintainance Settings</td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <p> + <span class="vexpl"> + Set dspam_clean purge default options, if not + otherwise specified on the commandline. You may set some of + the below values to <code>off</code>, for instance if you are + using a SQL-based database backend for DSPAM. Please consult your + DSPAM manual for any details. + </span> + </p> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Purge Signatures</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("psig", "formfld unknown"); ?> name="psig" id="psig" value="<?=htmlspecialchars($pconfig['psig']);?>" /> + <strong> + Purge stale signatures + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Purge Neutral</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("pneut", "formfld unknown"); ?> name="pneut" id="pneut" value="<?=htmlspecialchars($pconfig['pneut']);?>" /> + <strong> + Purge tokens with neutralish probabilities + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Purge Unused</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("punu", "formfld unknown"); ?> name="punu" id="punu" value="<?=htmlspecialchars($pconfig['punu']);?>" /> + <strong> + Purge unused tokens + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Purge Hapaxes</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("phapa", "formfld unknown"); ?> name="phapa" id="phapa" value="<?=htmlspecialchars($pconfig['phapa']);?>" /> + <strong> + Purge tokens with less than 5 hits (hapaxes) + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Purge Hits 1S</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("pones", "formfld unknown"); ?> name="pones" id="pones" value="<?=htmlspecialchars($pconfig['pones']);?>" /> + <strong> + Purge tokens with only 1 spam hit + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Purge Hits 1I</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("ponei", "formfld unknown"); ?> name="ponei" id="ponei" value="<?=htmlspecialchars($pconfig['ponei']);?>" /> + <strong> + Purge tokens with only 1 innocent hit + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'main';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic"><a name="sys" style="visibility: hidden;"> </a>System Settings</td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Local MX</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("locmx", "formfld host"); ?> name="locmx" id="locmx" value="<?=htmlspecialchars($pconfig['locmx']);?>" /> + <strong> + Local Mail Exchangers: Used for source address tracking, tells DSPAM which + mail exchangers are local and therefore should be ignored in the Received: + header when tracking the source of an email. Note: you should use the address + of the host as appears between brackets [ ] in the Received header. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <span class="vexpl"> + Disabling logging for users will make usage graphs unavailable to + them. Disabling system logging will make admin graphs unavailable. + </span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Enable System Log</td> + <td width="78%" class="vtable"> + <input name="enablesysl" type="checkbox" id="enablesysl" value="yes" <?php if (isset($pconfig['enablesysl'])) echo 'checked="checked"'; ?> /> + <strong> + Enable system logging. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Enable User Log</td> + <td width="78%" class="vtable"> + <input name="enableusel" type="checkbox" id="enableusel" value="yes" <?php if (isset($pconfig['enableusel'])) echo 'checked="checked"'; ?> /> + <strong> + Enable user logging. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Opt Settings</td> + <td width="78%" class="vtable"> + <select name="optinout" class="formselect"> + <option value="out" <?php if($pconfig['optinout'] == "out") echo('selected="selected"');?>>out</option> + <option value="in" <?php if($pconfig['optinout'] == "in") echo('selected="selected"');?>>in</option> + </select> + <p> + <span class="vexpl"> + Opt: in or out; determines DSPAM's default filtering behavior. If this value + is set to in, users must opt-in to filtering by dropping a .dspam file in + <code>/var/dspam/opt-in/user.dspam</code> (or if you have homedirs configured, a .dspam + folder in their home directory). The default is opt-out, which means all + users will be filtered unless a <code>.nodspam</code> file is dropped in + <code>/var/dspam/opt-out/user.nodspam</code> + <span class="vexpl"> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <span class="vexpl"> + In lieu of setting up individual aliases for each user, + DSPAM can be configured to automatically parse the To: address for spam and + false positive forwards. From there, it can be configured to either set the + DSPAM user based on the username specified in the header and/or change the + training class and source accordingly. The options below can be used to + customize most common types of header parsing behavior to avoid the need for + multiple aliases, or if using LMTP, aliases entirely.. + </span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Parse To Headers</td> + <td width="78%" class="vtable"> + <input name="enableptoh" type="checkbox" id="enableptoh" value="yes" <?php if (isset($pconfig['enableptoh'])) echo 'checked="checked"'; ?> /> + <strong> + Parse the <i>To:</i> headers of an incoming message. + </strong> + <p> + <span class="vexpl"> + This must be set to ‘on’ to use either of the following features. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Change Mode On Parse</td> + <td width="78%" class="vtable"> + <input name="enablecmop" type="checkbox" id="enablecmop" value="yes" <?php if (isset($pconfig['enablecmop'])) echo 'checked="checked"'; ?> /> + <strong> + Automatically change the class (to spam or innocent). + </strong> + <p> + <span class="vexpl"> + This depends on whether spam- or notspam- was specified, and change + the source to ‘error’. This is convenient if you're not + using aliases at all, but are delivering via LMTP. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Change User On Parse</td> + <td width="78%" class="vtable"> + <input name="enablecuop" type="checkbox" id="enablecuop" value="yes" <?php if (isset($pconfig['enablecuop'])) echo 'checked="checked"'; ?> /> + <strong> + Automatically change the username to match that specified in the <i>To:</i> header. + </strong> + <p> + <span class="vexpl"> + For example, <code>spam-bob@domain.tld</code> will set the username + to bob, ignoring any --user passed in. This may not always be desirable if + you are using virtual email addresses as usernames. Options: + on or user take the portion before the @ sign only + full take everything after the initial {spam,notspam}-. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Broken MTA Settings</td> + <td width="78%" class="vtable"> + <input name="enablebmta" type="checkbox" id="enablebmta" value="yes" <?php if (isset($pconfig['enablebmta'])) echo 'checked="checked"'; ?> /> + <strong> + Enable broken MTA settings. + </strong> + <p> + <span class="vexpl"> + Broken MTA Options: Some MTAs don't support the proper functionality + necessary. In these cases you can activate certain features in DSPAM to + compensate. ‘returnCodes’ causes DSPAM to return an exit code of 99 if + the message is spam, 0 if not, or a negative code if an error has occured. + Specifying ‘case’ causes DSPAM to force the input usernames to lowercase. + Spceifying ‘lineStripping’ causes DSPAM to strip ˆM's from messages passed + </span> + </p> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="55%" class="listhdrr"><?=gettext("Broken MTA Option");?></td> + <td width="35%" class="listhdr"><?=gettext("Description");?></td> + <td width="10%" class="list"></td> + </tr> + <?php if(is_array($t_bmtas)): ?> + <?php $i = 0; foreach ($t_bmtas as $bmta): ?> + <?php if($bmta['name'] <> ""): ?> + + <tr> + <td class="listlr" ondblclick="document.location='dspam-settings-bmta.php?id=<?=$i;?>§ionid=sys';"> + <?=htmlspecialchars($bmta['name']);?> + </td> + <td class="listbg" ondblclick="document.location='dspam-settings-bmta.php?id=<?=$i;?>§ionid=sys';"> + <font color="#FFFFFF"><?=htmlspecialchars($bmta['descr']);?> </font> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-bmta.php?id=<?=$i;?>§ionid=sys"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="dspam-settings.php?act=del&what=bmta&id=<?=$i;?>§ionid=sys" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + <?php endif; ?> + <?php $i++; endforeach; ?> + <?php endif; ?> + <tr> + <td class="list" colspan="3"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-bmta.php?sectionid=sys"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Max Message Size</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("maxmsgs", "formfld unknown"); ?> name="maxmsgs" id="maxmsgs" value="<?=htmlspecialchars($pconfig['maxmsgs']);?>" /> + <strong> + You may specify a maximum message size for DSPAM to process. + </strong> + <p> + <span class="vexpl"> + If the message is larger than the maximum size, it will be delivered + without processing. Value is in bytes. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Processor Bias</td> + <td width="78%" class="vtable"> + <input type="checkbox" name="procbias" id="procbias" value="yes" <?php if (isset($pconfig['procbias'])) echo 'checked="checked"'; ?> /> + <strong> + Bias causes the filter to lean more toward ‘innocent’, and + usually greatly reduces false positives. It is the default behavior of + most Bayesian filters (including dspam). + </strong> + <p> + <span class="vexpl"> + Note: You probably DONT want this if you're using Markovian Weighting, + unless you are paranoid about false positives. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'sys';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td valign="top" class="listtopic"><a name="clam" style="visibility: hidden;"> </a>ClamAV Engine Settings</td> + <td align="right" valign="top" class="listtopic"> + <input name="enableclam" type="checkbox" id="enableclam" value="yes" <?php if (isset($pconfig['enableclam'])) echo 'checked="checked"'; ?> onClick="enable_change(false, 3);" /> + <strong>Enable</strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <p> + <span class="vexpl"> + If you are running clamd, DSPAM can perform stream-based + virus checking using TCP. Uncomment the values below to enable virus + checking. + </span> + </p> + <p> + <span class="vexpl"> + ClamAVResponse: + <dl> + <dt>reject</dt> + <dd>(reject or drop the message with a permanent failure)</dd> + <dt>accept</dt> + <dd>(accept the message and quietly drop the message)</dd> + <dt>spam</dt> + <dd>(treat as spam and quarantine/tag/whatever)</dd> + </dl> + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">ClamAV Port</td> + <td width="78%" class="vtable"> + <p> + <input type="text" size="30" <?= checkForErrorClass("clamport", "formfld unknown"); ?> name="clamport" id="clamport" value="<?=htmlspecialchars($pconfig['clamport']);?>" <?php if (! isset($pconfig['enableclam'])) echo 'disabled="disabled"'; ?> /> + <strong> + A number that specifies the port the ClamAV daemon is listening to. + </strong> + </p> + <p> + <span class="vexpl"> + If the message is larger than the maximum size, it will be delivered + without processing. Value is in bytes. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">ClamAV Host</td> + <td width="78%" class="vtable"> + <input type="text" size="30" <?= checkForErrorClass("clamhost", "formfld host"); ?> name="clamhost" id="clamhost" value="<?=htmlspecialchars($pconfig['clamhost']);?>" <?php if (! isset($pconfig['enableclam'])) echo 'disabled="disabled"'; ?> /> + <strong> + An IP address that points to the host the ClamAV daemon is running on. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">ClamAV Response</td> + <td width="78%" class="vtable"> + <select name="clamresp" class="formselect" <?php if (! isset($pconfig['enableclam'])) echo 'disabled="disabled"'; ?>> + <option value="reject" <?php if($pconfig['clamresp'] == "reject") echo('selected="selected"');?>>reject</option> + <option value="accept" <?php if($pconfig['clamresp'] == "accept") echo('selected="selected"');?>>accept</option> + <option value="spam" <?php if($pconfig['clamresp'] == "spam") echo('selected="selected"');?>>spam</option> + </select> + <strong> + The action that should take place, if ClamAV reports a positive. + </strong> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'clam';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic"><a name="srv" style="visibility: hidden;"> </a>DSPAM Daemon Settings (Server)</td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <span class="vexpl"> + If you are running DSPAM as a daemonized server using + <code>--daemon</code>, the following parameters will override the default. Use the + ServerPass option to set up accounts for each client machine. The DSPAM + server will process and deliver the message based on the parameters + specified. If you want the client machine to perform delivery, use + the <code>--stdout</code> option in conjunction with a local setup. + </span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Server Port</td> + <td width="78%" class="vtable"> + <p> + <input type="text" size="30" <?= checkForErrorClass("dsport", "formfld unknown"); ?> name="dsport" id="dsport" value="<?=htmlspecialchars($pconfig['dsport']);?>" /> + <strong> + A number that specifies the port the DSPAM daemon is listening to. + </strong> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Server Queue Size</td> + <td width="78%" class="vtable"> + <p> + <input type="text" size="30" <?= checkForErrorClass("dsqsize", "formfld unknown"); ?> name="dsqsize" id="dsqsize" value="<?=htmlspecialchars($pconfig['dsqsize']);?>" /> + <strong> + A number that specifies the server's queue size. + </strong> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Server PID</td> + <td width="78%" class="vtable"> + <p> + <input type="text" size="30" <?= checkForErrorClass("dspid", "formfld file"); ?> name="dspid" id="dspid" value="<?=htmlspecialchars($pconfig['dspid']);?>" /> + <strong> + Keep this is sync with <code>/usr/local/etc/rc.d/dspam.rc</code> script. + </strong> + </p> + <p> + <span class="vexpl"> + Note: Don't change this value unless you know what you are doing. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Server Mode</td> + <td width="78%" class="vtable"> + <p> + <select name="dssmode" class="formselect"> + <option value="dspam" <?php if($pconfig['dssmode'] == "dspam") echo('selected="selected"');?>>dspam</option> + <option value="standard" <?php if($pconfig['dssmode'] == "standard") echo('selected="selected"');?>>standard</option> + <option value="auto" <?php if($pconfig['dssmode'] == "auto") echo('selected="selected"');?>>auto</option> + </select> + <strong> + Specifies the type of LMTP server to start. + </strong> + <p> + <span class="vexpl"> + This can be one of: + <dl> + <dt>dspam</dt> + <dd>DSPAM-proprietary DLMTP server, for communicating with dspamc</dd> + <dt>standard</dt> + <dd>Standard LMTP server, for communicating with Postfix or other MTA</dd> + <dt>auto</dt> + <dd>Speak both DLMTP and LMTP; auto-detect by ServerPass.IDENT</dd> + </dl> + </span> + </p> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" rowspan="2" class="vncell"> </td> + <td width="78%" class="vtable"> + <p> + <span class="vexpl"> + If supporting DLMTP (dspam) mode, dspam clients will require authentication + as they will be passing in parameters. The idents below will be used to + determine which clients will be speaking DLMTP, so if you will be using + both LMTP and DLMTP from the same host, be sure to use something other + than the server's hostname below (which will be sent by the MTA during a + standard LMTP LHLO). + </span> + </p> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="55%" class="listhdrr"><?=gettext("DLMTP Password Value");?></td> + <td width="35%" class="listhdr"><?=gettext("Description");?></td> + <td width="10%" class="list"></td> + </tr> + <?php if(is_array($t_spwds)): ?> + <?php $i = 0; foreach ($t_spwds as $spwd): ?> + <?php if($spwd['value'] <> ""): ?> + + <tr> + <td class="listlr" ondblclick="document.location='dspam-settings-spwd.php?id=<?=$i;?>§ionid=srv';"> + <?=htmlspecialchars($spwd['value']);?> + </td> + <td class="listbg" ondblclick="document.location='dspam-settings-spwd.php?id=<?=$i;?>§ionid=srv';"> + <font color="#FFFFFF"><?=htmlspecialchars($spwd['descr']);?> </font> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-spwd.php?id=<?=$i;?>§ionid=srv"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="dspam-settings.php?act=del&what=spwd&id=<?=$i;?>§ionid=srv" onclick="return confirm('<?=gettext("Do you really want to delete this mapping?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + <?php endif; ?> + <?php $i++; endforeach; ?> + <?php endif; ?> + <tr> + <td class="list" colspan="3"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="dspam-settings-spwd.php?sectionid=srv"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td width="78%" class="vtable"> + <p> + <span class="vexpl"> + If supporting standard LMTP mode, server parameters will need to be specified + here, as they will not be passed in by the mail server. The ServerIdent + specifies the 250 response code ident sent back to connecting clients and + should be set to the hostname of your server, or an alias. + </span> + </p> + <p> + <span class="vexpl"> + Note: If you specify <code>--user</code> in ServerParameters, the RCPT TO will be used + only for delivery, and not set as the active user for processing. + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Server Parameters</td> + <td width="78%" class="vtable"> + <p> + <input type="text" size="30" class="formfld" name="serverparam" id="serverparam" value="<?=htmlspecialchars($pconfig['serverparam']);?>" /> + <strong> + Parameters which will be passed to the LMTP server. + </strong> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Server Ident</td> + <td width="78%" class="vtable"> + <p> + <input type="text" size="30" <?= checkForErrorClass("serverid", "formfld host"); ?> name="serverid" id="serverid" value="<?=htmlspecialchars($pconfig['serverid']);?>" /> + <strong> + An identification string which will be used to be passed to the LMTP server. + </strong> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Server Domain Socket Path</td> + <td width="78%" class="vtable"> + <p> + <input type="text" size="30" <?= checkForErrorClass("serversock", "formfld file"); ?> name="serversock" id="serversock" value="<?=htmlspecialchars($pconfig['serversock']);?>" /> + <strong> + A local Unix domain socket. + </strong> + </p> + <p> + <span class="vexpl"> + If you wish to use a local domain socket instead of a TCP socket, uncomment + the following. It is strongly recommended you use local domain sockets if + you are running the client and server on the same machine, as it eliminates + much of the bandwidth overhead. + </span> + </p> + <p> + <span class="vexpl"> + Keep this is sync with <code>/usr/local/etc/rd.d/dspam.rc</code> script + </span> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'srv';" /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td valign="top" class="listtopic"><a name="cli" style="visibility: hidden;"> </a>DSPAM Daemon Settings (Client)</td> + <td align="right" valign="top" class="listtopic"> + <input name="enabledsclient" type="checkbox" id="enabledsclient" value="yes" <?php if (isset($pconfig['enabledsclient'])) echo 'checked="checked"'; ?> onClick="enable_change(false, 4);" /> + <strong>Enable</strong> + </td> + </tr> + + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <p> + <span class="vexpl"> + If you are running DSPAM in client/server mode, uncomment and + set these variables. A ClientHost beginning with a <code>/</code> + will be treated as a domain socket. + </span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Client Host</td> + <td width="78%" class="vtable"> + <p> + <input type="text" size="30" <?= checkForErrorClass("dsclhost", "formfld host"); ?> name="dsclhost" id="dsclhost" value="<?=htmlspecialchars($pconfig['dsclhost']);?>" <?php if (! isset($pconfig['enabledsclient'])) echo 'disabled="disabled"'; ?> /> + <strong> + A IP address or a Unix domain socket. + </strong> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Client Port</td> + <td width="78%" class="vtable"> + <p> + <input type="text" size="30" <?= checkForErrorClass("dsclhost", "formfld host"); ?> name="dsclport" id="dsclport" value="<?=htmlspecialchars($pconfig['dsclport']);?>" <?php if (! isset($pconfig['enabledsclient'])) echo 'disabled="disabled"'; ?> /> + <strong> + Will be only used if this client uses TCP/IP communication. + </strong> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Client Ident</td> + <td width="78%" class="vtable"> + <p> + <input type="text" size="30" <?= checkForErrorClass("dsclident", "formfld unknown"); ?> name="dsclident" id="dsclident" value="<?=htmlspecialchars($pconfig['dsclident']);?>" <?php if (! isset($pconfig['enabledsclient'])) echo 'disabled="disabled"'; ?> /> + <strong> + A string that will be used to identify the client against a server. + </strong> + </p> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <!-- <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" /> --> + <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="document.iform.sectionid.value = 'cli';" /> + </td> + </tr> + </table> + </td> + </tr> + </table> + </div> + </td> + </tr> + </table> + </form> + <br> + <?= checkForInputErrors(); ?> +<? + } else { +?> +<?php + $input_errors[] = "Access to this particular site was denied. You need DSPAM admin access rights to be able to view it."; + + include("head.inc"); + echo $pfSenseHead->getHTML(); +?> +<?php include("fbegin.inc");?> +<?php if ($input_errors) print_input_errors($input_errors);?> +<?php if ($savemsg) print_info_box($savemsg);?> + <body link="#000000" vlink="#000000" alink="#000000"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td valign="top" class="listtopic">Access denied for: <?=$HTTP_SERVER_VARS['AUTH_USER']?></td> + </tr> + </table> +<?php + } // end of access denied code +?> +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-train.php b/packages/dspam/www/dspam-train.php new file mode 100644 index 00000000..22c2e8ba --- /dev/null +++ b/packages/dspam/www/dspam-train.php @@ -0,0 +1,284 @@ +<?php +/* $Id$ */ +/* + dspam-train.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Train Filter")); + +/* omit no-cache headers because it confuses IE with file downloads */ +$omit_nocacheheaders = true; +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +function prepare_compressed_mbox_data($type) { + global $CURRENT_USER; + /* prepare directories */ + mwexec("mkdir -m 0755 -p /tmp/dspam-data/{$CURRENT_USER}/mbox"); + mwexec("mkdir -m 0755 -p /tmp/dspam-data/{$CURRENT_USER}/mdir"); + + switch ($type) { + case 0: + move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/" . $_FILES['archfile']['name']); + mwexec("/usr/local/bin/unzip /tmp/{$_FILES['archfile']['name']} -d /tmp/dspam-data/{$CURRENT_USER}/mbox"); + unlink("/tmp/{$_FILES['archfile']['name']}"); + mwexec("/usr/local/bin/mb2md -s /tmp/dspam-data/{$CURRENT_USER}/mbox -R -d /tmp/dspam-data/{$CURRENT_USER}/mdir"); + break; + case 1: + move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/dspam-data/" . $_SESSION['Username'] . "/mbox/" . $_FILES['archfile']['name']); + mwexec("/usr/bin/gunzip /tmp/dspam-data/{$CURRENT_USER}/mbox/{$_FILES['archfile']['name']}"); + mwexec("/usr/local/bin/mb2md -s /tmp/dspam-data/{$CURRENT_USER}/mbox -R -d /tmp/dspam-data/{$CURRENT_USER}/mdir"); + break; + case 2: + move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/dspam-data/" . $_SESSION['Username'] . "/mbox/" . $_FILES['archfile']['name']); + mwexec("/usr/bin/bunzip2 /tmp/dspam-data/{$CURRENT_USER}/mbox/{$_FILES['archfile']['name']}"); + mwexec("/usr/local/bin/mb2md -s /tmp/dspam-data/{$CURRENT_USER}/mbox -R -d /tmp/dspam-data/{$CURRENT_USER}/mdir"); + break; + } +} + +function prepare_compressed_mdir_data($type) { + global $CURRENT_USER; + /* prepare directories */ + mwexec("mkdir -m 0755 -p /tmp/dspam-data/{$CURRENT_USER}/mdir"); + + switch ($type) { + case 0: + move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/" . $_FILES['archfile']['name']); + mwexec("/usr/local/bin/unzip /tmp/{$_FILES['archfile']['name']} -d /tmp/dspam-data/{$CURRENT_USER}/mdir"); + unlink("/tmp/{$_FILES['archfile']['name']}"); + break; + case 1: + move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/dspam-data/" . $_SESSION['Username'] . "/mdir/" . $_FILES['archfile']['name']); + mwexec("/usr/bin/gunzip /tmp/dspam-data/{$CURRENT_USER}/mdir/{$_FILES['archfile']['name']}"); + break; + case 2: + move_uploaded_file($_FILES['archfile']['tmp_name'], "/tmp/dspam-data/" . $_SESSION['Username'] . "/mdir/" . $_FILES['archfile']['name']); + mwexec("/usr/bin/bunzip2 /tmp/dspam-data/{$CURRENT_USER}/mdir/{$_FILES['archfile']['name']}"); + break; + } +} + +function prepare_compressed_data($type) { + if ($_POST['archformat'] == "mbox") { + prepare_compressed_mbox_data($type); + } else { + prepare_compressed_mdir_data($type); + } +} + +if ($_POST) { + unset($input_errors); + + if(! extension_loaded( 'fileinfo' )) { + /* fileinfo pecl extension unavailable? */ + if(! @dl( 'fileinfo.so' )) { + if ($_POST['cotype'] == "zip") { + prepare_compressed_data(0); + } else if ($_POST['cotype'] == "gzip") { + prepare_compressed_data(1); + } else if ($_POST['cotype'] == "bzip") { + prepare_compressed_data(2); + } else { + $input_errors[] = "unable to determine compression type."; + } + } else { + if (is_uploaded_file($_FILES['archfile']['tmp_name'])) { + $info = finfo_open( FILEINFO_MIME, '/usr/share/misc/magic' ); + $type = finfo_file( $info, $_FILES['archfile']['tmp_name'] ); + + if ($type == "application/x-zip") { + prepare_compressed_data(0); + } else if ($type == "application/x-gzip") { + prepare_compressed_data(1); + } else if ($type == "application/x-bzip2") { + prepare_compressed_data(2); + } else { + $input_errors[] = "unable to determine compression type."; + } + } + } + } + + /* tell DSPAM to train the messages contained within the maildir */ + if ($_POST['msgtype'] == "spam") { + mwexec("find /tmp/dspam-data/{$CURRENT_USER}/mdir -name '*' -exec /usr/local/bin/dspam_spamfeed {$CURRENT_USER} {} \\;"); + } else if ($_POST['msgtype'] == "ham") { + mwexec("find /tmp/dspam-data/{$CURRENT_USER}/mdir -name '*' -exec /usr/local/bin/dspam_innocentfeed {$CURRENT_USER} {} \\;"); + mwexec("rm -rf /tmp/dspam-data"); + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ + $jscriptstr = <<<EOD +<script type="text/javascript"> +<!-- + +EOD; + + $jscriptstr .= getJScriptFunction(0); + $jscriptstr .= <<<EOD +//--> +</script> +EOD; + + $pfSenseHead->addScript($jscriptstr); +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam-train.php" method="post" enctype="multipart/form-data"> +<input type="hidden" name="MAX_FILE_SIZE" value="<?= (diskfreespace('/') - (10 * pow(10, 6))); ?>"> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("Info", false, "/dspam.php?{$CURRENT_USER}"); + $tab_array[] = array("Performance", false, "/dspam-perf.php?{$CURRENT_USER}"); + $tab_array[] = array("Preferences", false, "/dspam-prefs.php?{$CURRENT_USER}"); + $tab_array[] = array("Alerts", false, "/pkg.php?xml=dspam_alerts.xml&user={$CURRENT_USER}"); + $tab_array[] = array("Quarantine ({$DATA['TOTAL_QUARANTINED_MESSAGES']})", false, "/dspam-quarantine.php?{$CURRENT_USER}"); + $tab_array[] = array("Analysis", false, "/dspam-analysis.php?{$CURRENT_USER}"); + $tab_array[] = array("History", false, "/dspam-history.php?{$CURRENT_USER}"); + $tab_array[] = array("Train Filter", true, "/dspam-train.php?{$CURRENT_USER}"); + if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + $tab_array[] = array("Admin Suite", false, "/dspam-admin.php"); + } + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="2">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Username</td> + <td width="78%" class="vtable"> + <?php if(isset($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <input type="text" name="username" id="username" value="<?= $CURRENT_USER ?>" class="formfld user"<?php if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { echo " readonly=\"readonly\""; } ?> /> + <?php else: ?> + <input type="text" name="username" id="username" value="Please provide a username" class="formfld user" onFocus="this.value='';" /> + <?php endif; ?> + + <?php + if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + $action = "onClick=\"changeuser();\""; + else + $action = "onClick=\"document.iform.submit();\""; + ?> + <input type="button" name="change_user" id="change_user" class="formbtn" value="Change" <?= $action ?> /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" class="listtopic"><?=gettext("Upload Message Archive");?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Archive Type</td> + <td width="78%" class="vtable"> + <?php if($config['installedpackages']['mb2md'] || file_exists('/usr/local/bin/mb2md')): ?> + <input type="radio" name="archformat" id="mbxformat" value="mbox" class="formfld" /> + <a href="http://en.wikipedia.org/wiki/Mbox" target="_blank">Mailbox</a> format (like it is used for example by Mozilla Thunderbird) + <br /> + <?php endif; ?> + <input type="radio" name="archformat" id="mdirformat" value="mdir" class="formfld" checked="checked"/> + <a href="http://en.wikipedia.org/wiki/Maildir" target="_blank">Maildir</a> format (like it was initially introduced by qmail) + <p> + <strong> + <span class="red"><?=gettext("Note");?>:</span> + </strong> + <br /> + <?=gettext("DSPAM is only able to handle Maildir message archives natively. Mailbox message archives need to be converted (the conversion from mbx to maildir will be done on the fly while you are uploading a message archive).");?> + <br /> + </p> + </td> + </tr> + <?php if(! extension_loaded( 'fileinfo' )): ?> + <?php if(! @dl( 'fileinfo.so' )): ?> + <tr> + <td width="22%" valign="baseline" class="vncell">Compression Type</td> + <td width="78%" class="vtable"> + <input type="radio" name="cotype" id="ziptype" value="zip" class="formfld" /> + Archive was compressed using a ZIP algorithm. + <br /> + <input type="radio" name="cotype" id="gziptype" value="gzip" class="formfld" /> + Archive was compressed using a GNU ZIP algorithm. + <br /> + <input type="radio" name="cotype" id="bziptype" value="bzip" class="formfld" checked="checked" /> + Archive was compressed using a bzip2 algorithm + <br /> + </td> + </tr> + <?php endif; ?> + <?php endif; ?> + <tr> + <td width="22%" valign="baseline" class="vncell">Message Type</td> + <td width="78%" class="vtable"> + <input type="radio" name="msgtype" id="spamtype" value="spam" class="formfld" checked="checked" /> + Archive to be uploaded contains Spam messages. + <br /> + <input type="radio" name="msgtype" id="hamtype" value="ham" class="formfld" /> + Archive to be uploaded contains Ham messages. + <br /> + </td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell"> </td> + <td width="78%" class="vtable"> + <p> + <?=gettext("Open a Ham or Spam message archive (please either zip, gzip or bzip your files).");?> + </p> + <p> + <input name="archfile" type="file" class="formfld file" id="archfile" size="40" maxlength="<?= (diskfreespace('/') - (10 * pow(10, 6))); ?>" /> + </p> + <p> + <input name="Submit" type="submit" class="formbtn" id="restore" value="<?=gettext("Upload Message Archive");?>" /> + </p> + <p> + <strong> + <span class="red"><?=gettext("Note");?>:</span> + </strong> + <br /> + <?=gettext("It may take a long time until the filter stops training, if you are going to upload a huge archive. Therefore the the allowed filesize to be uploaded has been set to " . ((diskfreespace('/') - (10 * pow(10, 6))) / pow(10, 6)) . " MByte (available space minus 10 MByte).");?> + <br /> + </p> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> +</form> + +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam-viewmsg.php b/packages/dspam/www/dspam-viewmsg.php new file mode 100644 index 00000000..13c55477 --- /dev/null +++ b/packages/dspam/www/dspam-viewmsg.php @@ -0,0 +1,158 @@ +<?php +/* $Id$ */ +/* + dspam-train.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Quarantine"), + gettext("View Message")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +/* if this is an AJAX caller then handle via JSON */ +if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ + $jscriptstr = <<<EOD +<script type="text/javascript"> +<!-- + +EOD; + + $jscriptstr .= getJScriptFunction(0); + $jscriptstr .= <<<EOD +//--> +</script> +EOD; + + $pfSenseHead->addScript($jscriptstr); +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam-quarantine.php" method="post" name="iform" id="iform"> +<input type="hidden" name="command" value="processFalsePositive" /> +<input type="hidden" name="signatureID" value="<?= $DATA['MESSAGE_ID']; ?>" /> +<input type="hidden" name="qpage" value="<?= $DATA['QPAGE']; ?>" /> +<input type="hidden" name="sortby" value="<?= $DATA['SORTBY']; ?>" > +<input type="hidden" name="qperpage" value="<?= $CONFIG['QUARANTINE_PER_PAGE']; ?>" > +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<p> + <span class="vexpl"> + The contents of the message in the quarantine is shown below. + </span> +</p> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $querystr = "?user=?{$CURRENT_USER}&page={$DATA['QPAGE']}&sortby={$DATA['SORTBY']}&qperpage={$CONFIG['QUARANTINE_PER_PAGE']}"; + + $tab_array = array(); + $tab_array[] = array("Info", false, "/dspam.php?{$CURRENT_USER}"); + $tab_array[] = array("Performance", false, "/dspam-perf.php?{$CURRENT_USER}"); + $tab_array[] = array("Preferences", false, "/dspam-prefs.php?{$CURRENT_USER}"); + $tab_array[] = array("Alerts", false, "/pkg.php?xml=dspam_alerts.xml&user={$CURRENT_USER}"); + $tab_array[] = array("Quarantine (View)", true, "/dspam-quarantine.php{$querystr}"); + $tab_array[] = array("Analysis", false, "/dspam-analysis.php?{$CURRENT_USER}"); + $tab_array[] = array("History", false, "/dspam-history.php?{$CURRENT_USER}"); + $tab_array[] = array("Train Filter", false, "/dspam-train.php?{$CURRENT_USER}"); + if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + $tab_array[] = array("Admin Suite", false, "/dspam-admin.php"); + } + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="3">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="15%" valign="baseline" class="vncell">Username</td> + <td width="85%" class="vtable" colspan="2"> + <?php if(isset($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <input type="text" name="username" id="username" value="<?= $CURRENT_USER ?>" class="formfld user"<?php if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { echo " readonly=\"readonly\""; } ?> /> + <?php else: ?> + <input type="text" name="username" id="username" value="Please provide a username" class="formfld user" onFocus="this.value='';" /> + <?php endif; ?> + + <?php + if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + $action = "onClick=\"changeuser();\""; + else + $action = "onClick=\"document.iform.submit();\""; + ?> + <input type="button" name="change_user" id="change_user" class="formbtn" value="Change" <?= $action ?> /> + </td> + </tr> + <tr> + <td class="list" height="12" colspan="3"> </td> + </tr> + <tr> + <td align="left" valign="middle" class="qnavtd" colspan="3"> + <input type="submit" class="formbtn" title="Deliver Message" value="Deliver Message" name="delmsg" id="delmsg" /> + <label for="delmsg"> because it is <strong>not</strong> SPAM</label> + </td> + </tr> + <tr> + <td class="list" height="12" colspan="3"> </td> + </tr> + <?php if(! extension_loaded( 'mailparse' ) && $CONFIG['USE_MAILPARSE']): ?> + <?php if(! @dl( 'mailparse.so' )): ?> + <tr> + <td align="left" valign="top" class="listtopic" colspan="3">Mail Message</td> + </tr> + <tr> + <td align="center" valign="top" colspan="3" class="vncell"> + <textarea rows="36" cols="87" readonly="readonly"> + <?= $DATA['MESSAGE']; ?> + </textarea> + </td> + </tr> + <?php else: ?> + <?= getLayoutedMessage($DATA['MESSAGE'], $DATA['MESSAGE_ID'], $DATA['SHOWPART'], $DATA['CONTENT_TYPE']); ?> + <?php endif; ?> + <?php else: ?> + <tr> + <td align="left" valign="top" class="listtopic" colspan="3">Mail Message</td> + </tr> + <tr> + <td align="center" valign="top" colspan="3" class="vncell"> + <textarea rows="36" cols="87" readonly="readonly"> + <?= $DATA['MESSAGE']; ?> + </textarea> + </td> + </tr> + <?php endif; ?> + </table> + </div> + </td> + </tr> +</table> +</form> + +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/dspam.php b/packages/dspam/www/dspam.php new file mode 100644 index 00000000..488bed1b --- /dev/null +++ b/packages/dspam/www/dspam.php @@ -0,0 +1,264 @@ +<?php +/* $Id$ */ +/* + dspam.php + + Copyright (C) 2006 Daniel S. Haischt. + All rights reserved. +*/ + +$pgtitle = array(gettext("Services"), + gettext("DSPAM"), + gettext("Overview")); + +require("guiconfig.inc"); +include("/usr/local/pkg/dspam.inc"); + +if ($_POST) { + unset($input_errors); + + if (is_uploaded_file($_FILES['nionelic']['tmp_name'])) { + conf_mount_rw(); + config_lock(); + move_uploaded_file($_FILES['nionelic']['tmp_name'], "{$g['conf_path']}/{$_FILES['nionelic']['name']}"); + chmod("{$g['conf_path']}/{$_FILES['nionelic']['name']}", 0400); + config_unlock(); + conf_mount_ro(); + } + if (is_uploaded_file($_FILES['nionelicchk']['tmp_name'])) { + conf_mount_rw(); + config_lock(); + move_uploaded_file($_FILES['nionelicchk']['tmp_name'], "{$g['conf_path']}/{$_FILES['nionelicchk']['name']}"); + chmod("{$g['conf_path']}/{$_FILES['nionelicchk']['name']}", 0400); + config_unlock(); + conf_mount_ro(); + } + + /* if this is an AJAX caller then handle via JSON */ + if(isAjax() && is_array($input_errors)) { + input_errors2Ajax($input_errors); + exit; + } +} + +/* if ajax is calling, give them an update message */ +if(isAjax()) + print_info_box_np($savemsg); + +include("head.inc"); +/* put your custom HTML head content here */ +/* using some of the $pfSenseHead function calls */ + $jscriptstr = <<<EOD +<script type="text/javascript"> +<!-- + +EOD; + + $jscriptstr .= getJScriptFunction(0); + $jscriptstr .= <<<EOD +//--> +</script> +EOD; + + $pfSenseHead->addScript($jscriptstr); +echo $pfSenseHead->getHTML(); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<form action="dspam.php" method="post" enctype="multipart/form-data"> +<input type="hidden" name="MAX_FILE_SIZE" value="<?= (diskfreespace('/') - (10 * pow(10, 6))); ?>"> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<table width="100%" border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> +<?php + $tab_array = array(); + $tab_array[] = array("Info", true, "/dspam.php?{$CURRENT_USER}"); + $tab_array[] = array("Performance", false, "/dspam-perf.php?{$CURRENT_USER}"); + $tab_array[] = array("Preferences", false, "/dspam-prefs.php?{$CURRENT_USER}"); + $tab_array[] = array("Alerts", false, "/pkg.php?xml=dspam_alerts.xml&user={$CURRENT_USER}"); + $tab_array[] = array("Quarantine ({$DATA['TOTAL_QUARANTINED_MESSAGES']})", false, "/dspam-quarantine.php?{$CURRENT_USER}"); + $tab_array[] = array("Analysis", false, "/dspam-analysis.php?{$CURRENT_USER}"); + $tab_array[] = array("History", false, "/dspam-history.php?{$CURRENT_USER}"); + $tab_array[] = array("Train Filter", false, "/dspam-train.php?{$CURRENT_USER}"); + if (isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { + $tab_array[] = array("Admin Suite", false, "/dspam-admin.php"); + } + display_top_tabs($tab_array); +?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td align="left" valign="top" class="listhdrr" colspan="2">Statistical SPAM Protection for...</td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Username</td> + <td width="78%" class="vtable"> + <?php if(isset($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <input type="text" name="username" id="username" value="<?= $CURRENT_USER ?>" class="formfld user"<?php if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) { echo " readonly=\"readonly\""; } ?> /> + <?php else: ?> + <input type="text" name="username" id="username" value="Please provide a username" class="formfld user" onFocus="this.value='';" /> + <?php endif; ?> + + <?php + if (! isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])) + $action = "onClick=\"changeuser();\""; + else + $action = "onClick=\"document.iform.submit();\""; + ?> + <input type="button" name="change_user" id="change_user" class="formbtn" value="Change" <?= $action ?> /> + </td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" class="listtopic"><?=gettext("DSPAM Software Details");?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">DSPAM Version</td> + <td width="78%" class="vtable"><?= $DATA['DSPAM_VERSION']; ?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">DSPAM Copyright</td> + <td width="78%" class="vtable"><?= $DATA['DSPAM_COPYRIGHT']; ?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">DSPAM Copyright Text</td> + <td width="78%" class="vtable"><?= $DATA['DSPAM_COPYRIGHT_TEXT']; ?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">DSPAM Website</td> + <td width="78%" class="vtable"> + <a href="<?= $DATA['DSPAM_WEBSITE']; ?>" target="_blank"><?= $DATA['DSPAM_WEBSITE']; ?></a> + </td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">DSPAM Configure Args</td> + <td width="78%" class="vtable"> + <code style="font-size: small;"><?= $DATA['DSPAM_CONFIGURE_ARGS']; ?></code> + </td> + </tr> + <?php if($CONFIG['OPENSOURCE'] == false): ?> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" class="listtopic"><?=gettext("Ni-ONE License Information");?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">License User</td> + <td width="78%" class="vtable"><?= $DATA['OWNER']; ?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Company</td> + <td width="78%" class="vtable"><?= $DATA['COMPANY']; ?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">License Key</td> + <td width="78%" class="vtable"><?= $DATA['LICENSE_KEY']; ?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">License Validity</td> + <td width="78%" class="vtable"> + <?= $DATA['LICENSE_VALIDITY']; ?> + <?php if(strpos($DATA['LICENSE_VALIDITY'], "expired") !== false && isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <a href="http://www.niefert.net/nione.php?customer<?= $DATA['LICENSE_KEY']; ?>" target="_blank">Renew License</a> + <?php endif; ?> + </td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Purchase Date</td> + <td width="78%" class="vtable"><?= $DATA['PURCHASE_DATE']; ?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Expiry Date</td> + <td width="78%" class="vtable"><?= $DATA['EXPIRY_DATE']; ?></td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Ni-ONE Website</td> + <td width="78%" class="vtable"> + <a href="http://www.niefert.net/nione.php" target="_blank">http://www.niefert.net/nione.php</a> + </td> + </tr> + <?php if($DATA['LICENSE_VALIDITY'] == "valide"): ?> + <tr> + <td width="22%" valign="baseline" class="vncell">Support Request</td> + <td width="78%" class="vtable"> + <a href="http://www.niefert.net/nione.php?supportreq=true&customer=<?= $DATA['LICENSE_KEY']; ?>" target="_blank">Issue a support request</a> + </td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">Ni-ONE Customer Forum</td> + <td width="78%" class="vtable"> + <a href="http://www.niefert.net/nione-forum.php?customer=<?= $DATA['LICENSE_KEY']; ?>" target="_blank">Visit Ni-ONE Customer Forum</a> + </td> + </tr> + <?php endif; ?> + <?php if(strpos($DATA['LICENSE_VALIDITY'], "found") !== false && isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <tr> + <td width="22%" valign="baseline" class="vncell">License File (nione.lic)</td> + <td width="78%" class="vtable"> + <input type="file" name="nionelic" id="nionelic" class="formfld file" size="50" maxlength="100" /> + </td> + </tr> + <tr> + <td width="22%" valign="baseline" class="vncell">License Checksum (nione.lic.sha1)</td> + <td width="78%" class="vtable"> + <input type="file" name="nionelicchk" id="nionelicchk" class="formfld file" size="50" maxlength="100" /> + </td> + </tr> + <?php endif; ?> + <?php if($DATA['LICENSE_VALIDITY'] == "valide"): ?> + <tr> + <td width="22%" valign="baseline" class="vncell">License Disclaimer</td> + <td width="78%" class="vtable"> + <p> + The Ni-ONE appliance solution is based on open source software. Hence you + are allowed to use the corresponding software components (i.e. DSPAM and + its dependencies) under the terms of the accompanying open source license. + </p> + <p> + The Ni-ONE license provides 1<sup>st</sup> class priority support for a period + of one year starting from the day you did purchase a valide license option. If the + license is marked as <i>expired</i>, you may consider to purchase a renewal license + option using the <i>renew license</i> button that will be provided by the web + interface in such circumstances. + </p> + </td> + </tr> + <?php endif; ?> + <?php if(strpos($DATA['LICENSE_VALIDITY'], "found") !== false && isDSPAMAdmin($HTTP_SERVER_VARS['AUTH_USER'])): ?> + <tr> + <td width="22%" valign="baseline"> </td> + <td width="78%"> + <input name="Submit" type="submit" class="formbtn" id="restore" value="<?=gettext("Upload License");?>" /> + <p> + <strong> + <span class="red"><?=gettext("Note");?>:</span> + </strong> + <br /> + <?=gettext("You may have to hit the reload button of your browser after uploading your license files to be able to see the license data.");?> + <br /> + </p> + </td> + </tr> + <?php endif; ?> + <?php endif; ?> + </table> + </div> + </td> + </tr> +</table> +</form> + +<?php include("fend.inc"); ?> +</body> +</html>
\ No newline at end of file diff --git a/packages/dspam/www/p3scan_rules.php b/packages/dspam/www/p3scan_rules.php new file mode 100644 index 00000000..487cb57d --- /dev/null +++ b/packages/dspam/www/p3scan_rules.php @@ -0,0 +1,12 @@ +/* + p3scan_rules.inc + part of pfSense (www.pfSense.com) + Copyright (C) 2006 Daniel S. Haischt + All rights reserved. + +*/ +$wanif = get_real_wan_interface(); +$anchor = "natearly"; +$natrules .= "rdr pass on {$wanif} proto tcp from <p3scan> to port pop3 -> 127.0.0.1 port 8110\n"; +$label = "p3scan"; +add_rule_to_anchor($anchor, $rule, $label); diff --git a/packages/dspam/www/themes/metallic/dspam.css b/packages/dspam/www/themes/metallic/dspam.css new file mode 100644 index 00000000..5b39ba32 --- /dev/null +++ b/packages/dspam/www/themes/metallic/dspam.css @@ -0,0 +1,115 @@ +.qrowEven { + background-color: #DDDDDD; + padding-right: 20px; + padding-left: 8px; + border-bottom: 1px solid #999999; +} +.qrowOdd { + background-color: #FFFFFF; + padding-right: 20px; + padding-left: 8px; + border-bottom: 1px solid #999999; +} +.qrowAlert { + background-color: yellow; + padding-right: 20px; + padding-left: 8px; + border-bottom: 1px solid #999999; +} +.qrowHighlight { + background-color: white; + font-weight: bold; + padding-right: 20px; + padding-left: 8px; + border-bottom: 1px solid #999999; +} +.qrowDivider { + padding-right: 20px; + padding-left: 8px; + border-left: 1px solid black; + border-bottom: 1px solid #999999; +} + +.innocent {color: limegreen; background-color: green;} +.whitelisted {color: magenta; background-color: purple;} +.spam {color: red; background-color: darkred;} +.false {color: white; font-weight: bold; background-color: green;} +.missed {color: white; font-weight: bold; background-color: darkred;} +.inoculation {color: dodgerblue; background-color: darkblue;} +.corpus {color: black; background-color: white;} +.relay {color: white; background-color: #994400;} +.low {color: darkblue; font-weight: bold;} +.medium {color: steelblue; font-weight: bold;} +.high {color: darkorange; font-weight: bold;} + +.small { font-size: 9px;} +.hollow { border: 0px; } + +.qnavtd { + border: 1px solid #CCCCCC; +} +.qnavtdl { + border-top: 1px solid #CCCCCC; + border-bottom: 1px solid #CCCCCC; + border-left: 1px solid #CCCCCC; +} +.qnavtdr { + border-top: 1px solid #CCCCCC; + border-bottom: 1px solid #CCCCCC; + border-right: 1px solid #CCCCCC; +} +.qnavbtnhl { + font-size: 9px !important; + border-right: 1px solid #FF7F7F; + border-bottom: 1px solid #FF7F7F; + border-left: 1px solid #5F0000; + border-top: 1px solid #5F0000; + padding-left: 3px; + padding-right: 3px; + padding-bottom: 2px; + padding-top: 2px; + background-color: #FF7F7F; +} +.qnavbtn { + font-size: 9px !important; + border-right: 1px solid #FF7F7F; + border-bottom: 1px solid #FF7F7F; + border-left: 1px solid #5F0000; + border-top: 1px solid #5F0000; + padding-left: 3px; + padding-right: 3px; + padding-bottom: 2px; + padding-top: 2px; + background-color: #507DCD; + cursor: pointer; +} +.qnavbtn a:link { + font-size: 9px !important; + font-weight: bold; + color: #FFFFFF; + text-decoration:none; +} +.qnavbtn a:visited { + font-size: 9px !important; + font-weight: bold; + color: #FFFFFF; + text-decoration:none; +} +.qnavbtn a:focus { + font-size: 9px !important; + font-weight: bold; + color: #FFFFFF; + text-decoration:underline; +} +.qnavbtn a:hover { + font-size: 9px !important; + font-weight: bold; + color: #FFFFFF; + text-decoration:none; +} +.qnavbtn a:active { + font-size: 9px !important; + font-weight: bold; + color: #FFFFFF; + text-decoration:underline; +}
\ No newline at end of file diff --git a/packages/dspam/www/wizards/dspam-lda-proxy.png b/packages/dspam/www/wizards/dspam-lda-proxy.png Binary files differnew file mode 100644 index 00000000..7a4565ec --- /dev/null +++ b/packages/dspam/www/wizards/dspam-lda-proxy.png diff --git a/packages/dspam/www/wizards/dspam-pop-proxy.png b/packages/dspam/www/wizards/dspam-pop-proxy.png Binary files differnew file mode 100644 index 00000000..fa373385 --- /dev/null +++ b/packages/dspam/www/wizards/dspam-pop-proxy.png diff --git a/packages/dspam/www/wizards/dspam-smtp-relay.png b/packages/dspam/www/wizards/dspam-smtp-relay.png Binary files differnew file mode 100644 index 00000000..07f554c8 --- /dev/null +++ b/packages/dspam/www/wizards/dspam-smtp-relay.png diff --git a/packages/dspam/www/wizards/dspam_wizard.xml b/packages/dspam/www/wizards/dspam_wizard.xml new file mode 100644 index 00000000..659eaff1 --- /dev/null +++ b/packages/dspam/www/wizards/dspam_wizard.xml @@ -0,0 +1,1830 @@ +<?xml version="1.0" encoding="utf-8" ?> +<pfsensewizard> +<!-- + Tags which can be used to exec arbitrary PHP code: + + <stepsubmitbeforesave /> + <stepsubmitphpaction /> + <stepbeforeformdisplay /> + <formvalidate /> + <disableallfieldsbydefault /> + <stepafterformdisplay /> + <javascriptafterformdisplay /> +--> +<copyright> +/* + dspam_wizard.xml + part of pfSense (http://www.pfsense.org/) + + Copyright (C) 2006 Daniel S. Haischt + All rights reserved. +*/ +</copyright> +<totalsteps>15</totalsteps> +<title>Services: DSPAM: DSPAM Wizard</title> +<step> + <id>1</id> + <includefile>dspam.inc</includefile> + <title>DSPAM Setup Wizard</title> + <disableheader>true</disableheader> + <description>This wizard will guide you through the initial configuration of the DSPAM filter.</description> + <fields> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>2</id> + <includefile>dspam.inc</includefile> + <title>DSPAM Profile Selection</title> + <disableheader>true</disableheader> + <description>DSPAM can be used in different network environment. Hence we are providing three distinct profiles to suit different DSPAM use cases. Please select a particular profile from the below profile selection.</description> + <fields> + <field> + <name>dspamprofile</name> + <type>radio</type> + <bindstofield>installedpackages->dspam->config->0->dspam-profile</bindstofield> + <description> + <center> + <p> +When your mail server gets ready to deliver mail to a user's mailbox it calls +a delivery agent of some sort. On most UNIX systems, this is procmail, maildrop, +mail.local, or a similar tool. When used as a delivery proxy, the DSPAM agent +is called in place of your existing agent - or better put, it can masquerade +as the local delivery agent. DSPAM then processes the message and will call +the /real/ delivery agent to pass the good mail into the user's mailbox, +quarantining the bad mail. DSPAM can optionally tag and deliver both spam +and legitimate mail. + </p> + <p> +In the diagram below, MTA refers to Mail Transfer Agent, or your mail server +software: Postfix, Sendmail, Exim, etc. LDA refers to the Local Delivery +Agent: Procmail, Maildrop, etc.. + </p> + </center> + </description> + <value>lda</value> + <dontdisplayname /> + <typehint><center><img src="/wizards/dspam-lda-proxy.png" alt="DSPAM acts as a LDA proxy" border="0" /></center></typehint> + </field> + <field> + <name>dspamprofile</name> + <type>radio</type> + <bindstofield>installedpackages->dspam->config->0->dspam-profile</bindstofield> + <description> + <center> +If you don't want to tinker with your existing mail server setup, DSPAM can +be combined with one of a few open source programs designed to act as a POP3 +proxy. This means spam is filtered whenever the user checks their mail, +rather than when it is delivered. The benefit to this is that you can set up +a small machine on your network that will connect to your existing mail server, +so no integration is needed. It also allows your users to arbitarily point their +mail client at it if they desire filtering. The drawback to this approach is +that the POP3 protocol has no way to tell the mail client that a message is +spam, and so the user will have to download the spam (tagged, of course). + </center> + </description> + <value>pop</value> + <dontdisplayname /> + <typehint><center><img src="/wizards/dspam-pop-proxy.png" alt="DSPAM will be invoked by a POP3 proxy" border="0" /></center></typehint> + </field> + <field> + <name>dspamprofile</name> + <type>radio</type> + <bindstofield>installedpackages->dspam->config->0->dspam-profile</bindstofield> + <description> + <center> +Newer versions of DSPAM have seen features that allow it to function more +easily as an SMTP relay. An SMTP relay sits in front of your existing mail +server (requiring no integration). To use an SMTP relay, the MX records for +your domains are repointed to the relay machine running DSPAM. DSPAM then +relays the good (and optionally bad) mail to the existing SMTP server. This +allows you to use DSPAM with even a Windows-based destination mail server +as no integration is necessary. See doc/relay.txt for one example of how to +do this with Postfix. + </center> + </description> + <value>smtp</value> + <dontdisplayname /> + <typehint><center><img src="/wizards/dspam-smtp-relay.png" alt="DSPAM acts as a SMTP realy" border="0" /></center></typehint> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> + <stepsubmitphpaction> + if($_POST['dspamprofile'] != "") { + + /* set default trusted users */ + $config['installedpackages']['dspam']['config'][0]['tuser'][0]['name'] = "root"; + $config['installedpackages']['dspam']['config'][0]['tuser'][0]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['tuser'][1]['name'] = "mail"; + $config['installedpackages']['dspam']['config'][0]['tuser'][1]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['tuser'][2]['name'] = "mailnull"; + $config['installedpackages']['dspam']['config'][0]['tuser'][2]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['tuser'][3]['name'] = "smmsp"; + $config['installedpackages']['dspam']['config'][0]['tuser'][3]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['tuser'][4]['name'] = "daemon"; + $config['installedpackages']['dspam']['config'][0]['tuser'][4]['descr'] = "desc"; + /* set default features */ + $config['installedpackages']['dspam']['config'][0]['feature'][0]['name'] = "chained"; + $config['installedpackages']['dspam']['config'][0]['feature'][0]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['feature'][1]['name'] = "whitelist"; + $config['installedpackages']['dspam']['config'][0]['feature'][1]['descr'] = "desc"; + /* set default algorithms */ + $config['installedpackages']['dspam']['config'][0]['algorithm'][0]['name'] = "graham"; + $config['installedpackages']['dspam']['config'][0]['algorithm'][0]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['algorithm'][1]['name'] = "burton"; + $config['installedpackages']['dspam']['config'][0]['algorithm'][1]['descr'] = "desc"; + /* set default prefs */ + $config['installedpackages']['dspam']['config'][0]['preference'][0]['value'] = "\"spamAction=quarantine\""; + $config['installedpackages']['dspam']['config'][0]['preference'][0]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['preference'][1]['value'] = "\"signatureLocation=message\""; + $config['installedpackages']['dspam']['config'][0]['preference'][1]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['preference'][2]['value'] = "\"showFactors=on\""; + $config['installedpackages']['dspam']['config'][0]['preference'][2]['descr'] = "desc"; + /* set default overrides */ + $config['installedpackages']['dspam']['config'][0]['override'][0]['value'] = "trainingMode"; + $config['installedpackages']['dspam']['config'][0]['override'][0]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['override'][1]['value'] = "spamAction spamSubject"; + $config['installedpackages']['dspam']['config'][0]['override'][1]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['override'][2]['value'] = "statisticalSedation"; + $config['installedpackages']['dspam']['config'][0]['override'][2]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['override'][3]['value'] = "enableBNR"; + $config['installedpackages']['dspam']['config'][0]['override'][3]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['override'][4]['value'] = "enableWhitelist"; + $config['installedpackages']['dspam']['config'][0]['override'][4]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['override'][5]['value'] = "signatureLocation"; + $config['installedpackages']['dspam']['config'][0]['override'][5]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['override'][6]['value'] = "showFactors"; + $config['installedpackages']['dspam']['config'][0]['override'][6]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['override'][7]['value'] = "optIn optOut"; + $config['installedpackages']['dspam']['config'][0]['override'][7]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['override'][8]['value'] = "whitelistThreshold"; + $config['installedpackages']['dspam']['config'][0]['override'][8]['descr'] = "desc"; + + if($_POST['dspamprofile'] == "lda" || $_POST['dspamprofile'] == "pop") { + $config['installedpackages']['dspam']['config'][0]['tdelivery-agent'] = "mail"; + /* TCP/IP based deliver is not needed */ + unset($config['installedpackages']['dspam']['config'][0]['tcpip-delivery']); + unset($config['installedpackages']['dspam']['config'][0]['tcpip-delivery-host']); + unset($config['installedpackages']['dspam']['config'][0]['tcpip-delivery-port']); + unset($config['installedpackages']['dspam']['config'][0]['tcpip-delivery-ident']); + unset($config['installedpackages']['dspam']['config'][0]['tcpip-delivery-proto']); + $config['installedpackages']['dspam']['config'][0]['delivery-onfail'] = "error"; + + /* We will asume that the user is going to use the dspam and not the dspamc + * binary. Hence we are unsetting server/client settings. + */ + unset($config['installedpackages']['dspam']['config'][0]['dspam-server-port']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-server-queue-size']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-server-pid']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-server-mode']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-server-params']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-server-id']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-server-socket']); + /* Client */ + unset($config['installedpackages']['dspam']['config'][0]['dspam-client-enable']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-client-host']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-client-port']); + unset($config['installedpackages']['dspam']['config'][0]['dspam-client-id']); + } else if($_POST['dspamprofile'] == "smtp") { + /* TCP/IP based deliver is not needed */ + $config['installedpackages']['dspam']['config'][0]['tcpip-delivery'] = "on"; + $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-host'] = "127.0.0.1"; + $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-port'] = "25"; + $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-ident'] = "localhost"; + $config['installedpackages']['dspam']['config'][0]['tcpip-delivery-proto'] = "smtp"; + $config['installedpackages']['dspam']['config'][0]['delivery-onfail'] = "error"; + + /* We will asume that the user is going to use the dspam and not the dspamc + * binary. Hence we are unsetting server/client settings. + */ + $config['installedpackages']['dspam']['config'][0]['dspam-server-port'] = "24"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-queue-size'] = "32"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-pid'] = "/var/run/dspam/dspam.pid"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-mode'] = "standard"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-params'] = "--deliver=innocent -d %u"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-id'] = "localhost"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-socket'] = "/var/run/dspam/dspam.sock"; + /* server passwords */ + $config['installedpackages']['dspam']['config'][0]['server-pwd'][0]['value'] = "secret"; + $config['installedpackages']['dspam']['config'][0]['server-pwd'][0]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['server-pwd'][1]['value'] = "password"; + $config['installedpackages']['dspam']['config'][0]['server-pwd'][1]['descr'] = "desc"; + /* Client */ + $config['installedpackages']['dspam']['config'][0]['dspam-client-enable'] = "on"; + $config['installedpackages']['dspam']['config'][0]['dspam-client-host'] = "/tmp/dspam.sock"; + $config['installedpackages']['dspam']['config'][0]['dspam-client-port'] = "24"; + $config['installedpackages']['dspam']['config'][0]['dspam-client-id'] = "secret@Relay1"; + } + + write_config(); + } + </stepsubmitphpaction> +</step> +<step> + <id>3</id> + <includefile>dspam.inc</includefile> + <title>Database Settings</title> + <description> + On this screen you will set the storage driver type that will be used to store + DSPAM tokens. After having completed this wizard you have to configure the + database that you did select herein. + </description> + <fields> + <field> + <name>storagedriver</name> + <type>select</type> + <bindstofield>installedpackages->dspam->config->0->storage-driver</bindstofield> + <description>Specifies the storage driver backend (library) to use.</description> + <default_value>mysql</default_value> + <onchange>toggleDBSettings();</onchange> + <size>1</size> + <options> + <option> + <name>mysql</name> + <value>mysql</value> + </option> + <option> + <name>sqlite</name> + <value>sqlite</value> + </option> + <option> + <name>bdb</name> + <value>bdb</value> + </option> + <option> + <name>pgsql</name> + <value>pgsql</value> + </option> + <option> + <name>oracle</name> + <value>oracle</value> + </option> + <option> + <name>hash</name> + <value>hash</value> + </option> + </options> + </field> + <field> + <name>msqlserver</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->mysql-server</bindstofield> + <description>Either a reference to a Unix domain socket or a reference to a specific host.</description> + <default_value>/tmp/mysql.sock</default_value> + <validate>^[a-z0-9.|/]+$</validate> + <message>Server name field is invalid</message> + <required /> + </field> + <field> + <name>msqlport</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->mysql-port</bindstofield> + <description>Use this variable if you are going to a MySQL server instance using TCP/IP instead of a socket connection.</description> + <default_value>3306</default_value> + <validate>^[0-9]+$</validate> + <message>Port field is invalid</message> + <required /> + </field> + <field> + <name>msqluser</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->mysql-user</bindstofield> + <description>Username, that will be used to connect to a MySQL server instance.</description> + <default_value>dspam</default_value> + <required /> + </field> + <field> + <name>msqlpwd</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->mysql-password</bindstofield> + <description>Password, that will be used to connect to a MySQL server instance.</description> + <default_value>dspam</default_value> + <required /> + </field> + <field> + <name>msqldb</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->mysql-database</bindstofield> + <description>Database name, that contains DSPAM data.</description> + <default_value>dspam</default_value> + <required /> + </field> + <field> + <name>msqlcomp</name> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->mysql-compress</bindstofield> + <description>Indicates whether communication data between DSPAM and MySQL should be compressed.</description> + <default_value>on</default_value> + </field> + <field> + <name>msqlsuqt</name> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->mysql-squote</bindstofield> + <description>Use this if you have the 4.1 quote bug (see doc/mysql.txt).</description> + </field> + <field> + <name>msqlccache</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->mysql-ccache</bindstofield> + <description>Conection cache default set to 10.</description> + <default_value>10</default_value> + <validate>^[0-9]+$</validate> + <message>Connection cache field is invalid</message> + <required /> + </field> + <field> + <name>msqluid</name> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->mysql-uid</bindstofield> + <description>Insert user id into the DSPAM signature.</description> + <default_value>on</default_value> + </field> + <field> + <name>slitepr</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->sqlite-pragma</bindstofield> + <description>A particular SQLite pragma command to be used.</description> + </field> + <field> + <name>pgserver</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->pgsql-server</bindstofield> + <description>A reference to a specific host that is running a PostgreSQL instance.</description> + <default_value>127.0.0.1</default_value> + <validate>^[a-z0-9.|-]+$</validate> + <message>Server name field is invalid</message> + <required /> + </field> + <field> + <name>pgport</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->pgsql-port</bindstofield> + <description>A number that represents the port a specific PostgreSQL instance is listening to.</description> + <default_value>5432</default_value> + <validate>^[0-9]+$</validate> + <message>Port field is invalid</message> + <required /> + </field> + <field> + <name>pguser</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->pgsql-user</bindstofield> + <description>Username, that will be used to connect to a PostgreSQL server instance.</description> + <default_value>dspam</default_value> + <required /> + </field> + <field> + <name>pgpwd</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->pgsql-password</bindstofield> + <description>Password, that will be used to connect to a PostgreSQL server instance.</description> + <default_value>dspam</default_value> + <required /> + </field> + <field> + <name>pgdb</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->pgsql-database</bindstofield> + <description>Database name, that contains DSPAM data.</description> + <default_value>dspam</default_value> + <required /> + </field> + <field> + <name>pgccache</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->pgsql-ccache</bindstofield> + <description>Conection cache default set to 3.</description> + <default_value>3</default_value> + <validate>^[0-9]+$</validate> + <message>Connection cache field is invalid</message> + <required /> + </field> + <field> + <name>pguid</name> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->pgsql-uid</bindstofield> + <description>Insert user id into the DSPAM signature.</description> + <default_value>on</default_value> + </field> + <field> + <name>oraserver</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->ora-server</bindstofield> + <description>A reference to a specific host that is running an Oracle database instance.</description> + <size>50</size> + <default_value>"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))"</default_value> + <required /> + </field> + <field> + <name>orauser</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->ora-user</bindstofield> + <description>Username, that will be used to connect to a Oracle database server instance.</description> + <default_value>dspam</default_value> + <required /> + </field> + <field> + <name>orapwd</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->ora-password</bindstofield> + <description>Password, that will be used to connect to a Oracle database server instance.</description> + <default_value>dspam</default_value> + <required /> + </field> + <field> + <name>orasch</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->ora-schema</bindstofield> + <description>Schema name, that contains DSPAM data.</description> + <default_value>dspam</default_value> + <required /> + </field> + <field> + <name>hsrmax</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->hash-rec-max</bindstofield> + <description>Default number of records to create in the initial segment when building hash files.</description> + <default_value>98317</default_value> + <validate>^[0-9]+$</validate> + <message>Default number of record field is invalid</message> + <required /> + </field> + <field> + <name>hsatex</name> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->hash-auto-ex</bindstofield> + <description>Autoextend hash databases when they fill up. This allows them to continue to train by adding extents (extensions) to the file.</description> + <default_value>on</default_value> + <required /> + </field> + <field> + <name>hsmxex</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->hash-max-ext</bindstofield> + <description>The maximum number of extents that may be created in a single hash file.</description> + <default_value>0</default_value> + <validate>^[0-9]+$</validate> + <message>Default number of record field is invalid</message> + <required /> + </field> + <field> + <name>hsexsz</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->hash-ext-size</bindstofield> + <description>The record size for newly created extents.</description> + <default_value>49157</default_value> + <validate>^[0-9]+$</validate> + <message>Default number of record field is invalid</message> + <required /> + </field> + <field> + <name>hsmxse</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->hash-max-seek</bindstofield> + <description>The maximum number of records to seek to insert a new record before failing or adding a new extent.</description> + <default_value>100</default_value> + <validate>^[0-9]+$</validate> + <message>Default number of record field is invalid</message> + <required /> + </field> + <field> + <name>hsccus</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->hash-co-user</bindstofield> + <description>If you are using a single, stateful hash database in daemon mode, specifying a concurrent user will cause the user to be permanently mapped into memory and shared via rwlocks.</description> + <default_value>user</default_value> + <required /> + </field> + <field> + <name>hscoca</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dbsettings->0->hash-co-cache</bindstofield> + <description>If running in daemon mode, this is the max # of concurrent connections that will be supported.</description> + <default_value>10</default_value> + <validate>^[0-9]+$</validate> + <message>Default number of record field is invalid</message> + <required /> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> + <stepsubmitphpaction> + if ($_POST['storagedriver'] == "mysql") { + /* ============================================================================================= */ + /* == SQLite == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['sqlite-pragma']); + /* ============================================================================================= */ + /* == PostgreSQL == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-port']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-database']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-ccache']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-uid']); + /* ============================================================================================= */ + /* == Oracle == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-schema']); + /* ============================================================================================= */ + /* == Hash == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-rec-max']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-auto-ex']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-ext']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-ext-size']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-seek']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-cache']); + } else if ($_POST['storagedriver'] == "sqlite") { + /* ============================================================================================= */ + /* == MySQL == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-port']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-database']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-compress']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-squote']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-ccache']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-uid']); + /* ============================================================================================= */ + /* == PostgreSQL == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-port']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-database']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-ccache']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-uid']); + /* ============================================================================================= */ + /* == Oracle == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-schema']); + /* ============================================================================================= */ + /* == Hash == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-rec-max']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-auto-ex']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-ext']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-ext-size']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-seek']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-cache']); + } else if ($_POST['storagedriver'] == "bdb") { + /* NOP */ + } else if ($_POST['storagedriver'] == "pgsql") { + /* ============================================================================================= */ + /* == MySQL == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-port']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-database']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-compress']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-squote']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-ccache']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-uid']); + /* ============================================================================================= */ + /* == SQLite == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['sqlite-pragma']); + /* ============================================================================================= */ + /* == Oracle == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-schema']); + /* ============================================================================================= */ + /* == Hash == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-rec-max']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-auto-ex']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-ext']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-ext-size']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-seek']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-cache']); + } else if ($_POST['storagedriver'] == "oracle") { + /* ============================================================================================= */ + /* == MySQL == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-port']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-database']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-compress']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-squote']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-ccache']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-uid']); + /* ============================================================================================= */ + /* == SQLite == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['sqlite-pragma']); + /* ============================================================================================= */ + /* == PostgreSQL == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-port']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-database']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-ccache']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-uid']); + /* ============================================================================================= */ + /* == Hash == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-rec-max']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-auto-ex']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-ext']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-ext-size']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-max-seek']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['hash-co-cache']); + } else if ($_POST['storagedriver'] == "hash") { + /* ============================================================================================= */ + /* == MySQL == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-port']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-database']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-compress']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-squote']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-ccache']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['mysql-uid']); + /* ============================================================================================= */ + /* == SQLite == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['sqlite-pragma']); + /* ============================================================================================= */ + /* == PostgreSQL == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-port']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-database']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-ccache']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['pgsql-uid']); + /* ============================================================================================= */ + /* == Oracle == */ + /* ============================================================================================= */ + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-server']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-user']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-password']); + unset($config['installedpackages']['dspam']['config'][0]['dbsettings'][0]['ora-schema']); + } + </stepsubmitphpaction> + <javascriptafterformdisplay> + function toggleDBSettings(idx) { + if (idx) + idx = idx; + else + idx = document.iform.storagedriver.selectedIndex; + + switch (idx) { + case 0: /* mysql */ + /* mysql specifics */ + trNode = document.iform.msqlserver.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.msqlport.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.msqluser.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.msqlpwd.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.msqldb.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.msqlcomp.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.msqlsuqt.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.msqlccache.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.msqluid.parentNode.parentNode; + trNode.style.display = "table-row"; + /* sqlite specifics */ + trNode = document.iform.slitepr.parentNode.parentNode; + trNode.style.display = "none"; + /* pgsql specifics */ + trNode = document.iform.pgserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgport.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pguser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgpwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgdb.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgccache.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pguid.parentNode.parentNode; + trNode.style.display = "none"; + /* oracle specifics */ + trNode = document.iform.oraserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orauser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orapwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orasch.parentNode.parentNode; + trNode.style.display = "none"; + /* hash specifics */ + trNode = document.iform.hsrmax.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsatex.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsmxex.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsexsz.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsmxse.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsccus.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hscoca.parentNode.parentNode; + trNode.style.display = "none"; + break; + case 1: /* sqlite */ + /* mysql specifics */ + trNode = document.iform.msqlserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlport.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqluser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlpwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqldb.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlcomp.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlsuqt.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlccache.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqluid.parentNode.parentNode; + trNode.style.display = "none"; + /* sqlite specifics */ + trNode = document.iform.slitepr.parentNode.parentNode; + trNode.style.display = "table-row"; + /* pgsql specifics */ + trNode = document.iform.pgserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgport.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pguser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgpwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgdb.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgccache.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pguid.parentNode.parentNode; + trNode.style.display = "none"; + /* oracle specifics */ + trNode = document.iform.oraserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orauser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orapwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orasch.parentNode.parentNode; + trNode.style.display = "none"; + /* hash specifics */ + trNode = document.iform.hsrmax.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsatex.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsmxex.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsexsz.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsmxse.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsccus.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hscoca.parentNode.parentNode; + trNode.style.display = "none"; + break; + case 2: /* bdb */ + /* mysql specifics */ + trNode = document.iform.msqlserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlport.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqluser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlpwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqldb.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlcomp.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlsuqt.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlccache.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqluid.parentNode.parentNode; + trNode.style.display = "none"; + /* sqlite specifics */ + trNode = document.iform.slitepr.parentNode.parentNode; + trNode.style.display = "none"; + /* pgsql specifics */ + trNode = document.iform.pgserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgport.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pguser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgpwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgdb.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgccache.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pguid.parentNode.parentNode; + trNode.style.display = "none"; + /* oracle specifics */ + trNode = document.iform.oraserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orauser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orapwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orasch.parentNode.parentNode; + trNode.style.display = "none"; + /* hash specifics */ + trNode = document.iform.hsrmax.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsatex.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsmxex.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsexsz.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsmxse.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsccus.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hscoca.parentNode.parentNode; + trNode.style.display = "none"; + break; + case 3: /* pgsql */ + /* mysql specifics */ + trNode = document.iform.msqlserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlport.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqluser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlpwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqldb.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlcomp.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlsuqt.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlccache.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqluid.parentNode.parentNode; + trNode.style.display = "none"; + /* sqlite specifics */ + trNode = document.iform.slitepr.parentNode.parentNode; + trNode.style.display = "none"; + /* pgsql specifics */ + trNode = document.iform.pgserver.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.pgport.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.pguser.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.pgpwd.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.pgdb.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.pgccache.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.pguid.parentNode.parentNode; + trNode.style.display = "table-row"; + /* oracle specifics */ + trNode = document.iform.oraserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orauser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orapwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orasch.parentNode.parentNode; + trNode.style.display = "none"; + /* hash specifics */ + trNode = document.iform.hsrmax.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsatex.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsmxex.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsexsz.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsmxse.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsccus.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hscoca.parentNode.parentNode; + trNode.style.display = "none"; + break; + case 4: /* oracle */ + /* mysql specifics */ + trNode = document.iform.msqlserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlport.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqluser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlpwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqldb.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlcomp.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlsuqt.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlccache.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqluid.parentNode.parentNode; + trNode.style.display = "none"; + /* sqlite specifics */ + trNode = document.iform.slitepr.parentNode.parentNode; + trNode.style.display = "none"; + /* pgsql specifics */ + trNode = document.iform.pgserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgport.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pguser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgpwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgdb.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgccache.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pguid.parentNode.parentNode; + trNode.style.display = "none"; + /* oracle specifics */ + trNode = document.iform.oraserver.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.orauser.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.orapwd.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.orasch.parentNode.parentNode; + trNode.style.display = "table-row"; + /* hash specifics */ + trNode = document.iform.hsrmax.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsatex.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsmxex.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsexsz.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsmxse.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hsccus.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.hscoca.parentNode.parentNode; + trNode.style.display = "none"; + break; + case 5: /* hash */ + /* mysql specifics */ + trNode = document.iform.msqlserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlport.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqluser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlpwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqldb.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlcomp.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlsuqt.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqlccache.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.msqluid.parentNode.parentNode; + trNode.style.display = "none"; + /* sqlite specifics */ + trNode = document.iform.slitepr.parentNode.parentNode; + trNode.style.display = "none"; + /* pgsql specifics */ + trNode = document.iform.pgserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgport.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pguser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgpwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgdb.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pgccache.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.pguid.parentNode.parentNode; + trNode.style.display = "none"; + /* oracle specifics */ + trNode = document.iform.oraserver.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orauser.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orapwd.parentNode.parentNode; + trNode.style.display = "none"; + trNode = document.iform.orasch.parentNode.parentNode; + trNode.style.display = "none"; + /* hash specifics */ + trNode = document.iform.hsrmax.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.hsatex.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.hsmxex.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.hsexsz.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.hsmxse.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.hsccus.parentNode.parentNode; + trNode.style.display = "table-row"; + trNode = document.iform.hscoca.parentNode.parentNode; + trNode.style.display = "table-row"; + break; + } + } + + toggleDBSettings(0); + </javascriptafterformdisplay> +</step> +<step> + <id>4</id> + <includefile>dspam.inc</includefile> + <title>Delivery Settings</title> + <description> + On this page you will specify how DSPAM should deliver email messages to + their final destination. This could be either a local delivery method or + a TCP/IP based delivery method. + </description> + <fields> + <field> + <name>dagent</name> + <description>Specifies the local delivery agent DSPAM should call when delivering mail as a trusted user.</description> + <type>select</type> + <options> + <option> + <name>procmail</name> + <value>procmail</value> + </option> + <option> + <name>mail</name> + <value>mail</value> + </option> + <option> + <name>mail.local</name> + <value>mail.local</value> + </option> + <option> + <name>deliver</name> + <value>deliver</value> + </option> + <option> + <name>maildrop</name> + <value>maildrop</value> + </option> + <option> + <name>exim</name> + <value>exim</value> + </option> + </options> + <bindstofield>installedpackages->dspam->config->0->tdelivery-agent</bindstofield> + </field> + <field> + <donotdisable>true</donotdisable> + <name>dspamc</name> + <description>Use <code>dspamc</code> instead of <code>dspam</code> to locally deliver mails from the MTA to the user's mailbox (this pulls in DSPAM client/server settings).</description> + <type>checkbox</type> + </field> + <field> + <donotdisable>true</donotdisable> + <name>tcpipdel</name> + <description>Use TCP/IP based delivery. This option needs to be ticked if you are going to deliver via LMTP or SMTP.</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->tcpip-delivery</bindstofield> + <enablefields>dhost,dport,dident,delproto</enablefields> + </field> + <field> + <name>dhost</name> + <type>input</type> + <donotdisable>false</donotdisable> + <bindstofield>installedpackages->dspam->config->0->tcpip-delivery-host</bindstofield> + <description>Alternatively, you may wish to use SMTP or LMTP delivery to deliver your message to the mail server.</description> + <validate>^[a-z0-9.|-]+$</validate> + <message>Host name field is invalid</message> + </field> + <field> + <name>dport</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->tcpip-delivery-port</bindstofield> + <description>Port number of a particular host.</description> + <validate>^[0-9]+$</validate> + <message>Port field is invalid</message> + </field> + <field> + <name>dident</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->tcpip-delivery-ident</bindstofield> + <description>A particular identification string.</description> + </field> + <field> + <name>delproto</name> + <description>A particular protocol typ. Either SMTP or LMTP.</description> + <type>select</type> + <options> + <option> + <name>ltmp</name> + <value>lmtp</value> + </option> + <option> + <name>smtp</name> + <value>smtp</value> + </option> + </options> + <bindstofield>installedpackages->dspam->config->0->tcpip-delivery-proto</bindstofield> + </field> + <field> + <name>onfail</name> + <description>What to do if local delivery or quarantine should fail.</description> + <type>select</type> + <options> + <option> + <name>error</name> + <value>error</value> + </option> + <option> + <name>unlearn</name> + <value>unlearn</value> + </option> + </options> + <bindstofield>installedpackages->dspam->config->0->delivery-onfail</bindstofield> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> + <stepsubmitphpaction> + if($_POST['dspamc'] != "") { + /* DSPAM server settings */ + $config['installedpackages']['dspam']['config'][0]['dspam-server-port'] = "24"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-queue-size'] = "32"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-pid'] = "/var/run/dspam/dspam.pid"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-mode'] = "auto"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-params'] = "--deliver=innocent -d %u"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-id'] = "abysseleven.abyssworld.de"; + $config['installedpackages']['dspam']['config'][0]['dspam-server-socket'] = "/var/run/dspam/dspam.sock"; + + /* server passwords */ + $config['installedpackages']['dspam']['config'][0]['server-pwd'][0]['value'] = "secret"; + $config['installedpackages']['dspam']['config'][0]['server-pwd'][0]['descr'] = "desc"; + $config['installedpackages']['dspam']['config'][0]['server-pwd'][1]['value'] = "password"; + $config['installedpackages']['dspam']['config'][0]['server-pwd'][1]['descr'] = "desc"; + + /* DSPAM client settings */ + $config['installedpackages']['dspam']['config'][0]['dspam-client-enable'] = "on"; + $config['installedpackages']['dspam']['config'][0]['dspam-client-host'] = "/tmp/dspam.sock"; + $config['installedpackages']['dspam']['config'][0]['dspam-client-port'] = "24"; + $config['installedpackages']['dspam']['config'][0]['dspam-client-id'] = "secret@Relay1"; + write_config(); + } + </stepsubmitphpaction> +</step> +<step> + <id>5</id> + <includefile>dspam.inc</includefile> + <title> DSPAM Debugging Options</title> + <description> + Usually the DSPAM binary that ships with pfSense does not contain debugging symbols. + Hence it makes little sense to enable debugging options. If you are quite certain that + your DSPAM distribution comes with debugging enabled you may tweak the below debugging + options. + </description> + <fields> + <field> + <donotdisable>true</donotdisable> + <name>enabledbg</name> + <description>Enable debugging.</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->debug-enable</bindstofield> + <enablefields>debug,dopt</enablefields> + </field> + <field> + <name>debug</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->debug-whom</bindstofield> + <description>Enables debugging for some or all users.</description> + </field> + <field> + <name>dopt</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->debug-options</bindstofield> + <description>One or more of: process, classify, spam, fp, inoculation, corpus</description> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>6</id> + <includefile>dspam.inc</includefile> + <title>DSPAM Engine Settings</title> + <description> + On this page you will find some specific options required to operate the DSPAM engine. Please + consult your <code>dspam.conf</code> for a detailed explanation of each option. + If you are unsure about the meaning of a particular option, please use the default values. + </description> + <fields> + <field> + <name>tmode</name> + <description> + The default training mode to use for all operations, when one has not + been specified on the commandline or in the user's preferences (default: teft). + </description> + <type>select</type> + <default_value>teft</default_value> + <options> + <option> + <name>toe</name> + <value>toe</value> + </option> + <option> + <name>tum</name> + <value>tum</value> + </option> + <option> + <name>teft</name> + <value>teft</value> + </option> + <option> + <name>notrain</name> + <value>notrain</value> + </option> + </options> + <bindstofield>installedpackages->dspam->config->0->training-mode</bindstofield> + </field> + <field> + <donotdisable>true</donotdisable> + <name>testct</name> + <default_value>on</default_value> + <description> + By default, dspam will retrain certain errors until the condition is + no longer met (default: enabled). + </description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->test-cond-training</bindstofield> + </field> + <field> + <name>pvalue</name> + <description> + Specify the technique used for calculating PValues, overriding any + defaults configured in the build (default: graham). + </description> + <type>select</type> + <default_value>teft</default_value> + <options> + <option> + <name>graham</name> + <value>graham</value> + </option> + <option> + <name>robinson</name> + <value>robinso</value> + </option> + <option> + <name>markov</name> + <value>markov</value> + </option> + </options> + <bindstofield>installedpackages->dspam->config->0->pvalue</bindstofield> + </field> + <field> + <donotdisable>true</donotdisable> + <name>ipdrive</name> + <default_value>on</default_value> + <description> + Calculate odds-ratios for ham/spam, and add to X-DSPAM-Improbability + headers (default: disabled). + </description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->improbability-drive</bindstofield> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>7</id> + <includefile>dspam.inc</includefile> + <title>LDAP Settings</title> + <description> + DSPAM comes with the ability to verify users agains user records stored within a LDAP directory. + If using this option, it would be for example possible to verify mail users against Windows + user entries stored within an Active Directory. Please consider this feature as somewhat experimental. + </description> + <fields> + <field> + <donotdisable>true</donotdisable> + <name>enableldap</name> + <description>Enable checks against a LDAP directory.</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->ldap-enable</bindstofield> + <enablefields>ldapmode,ldaphost,ldapfilter,ldapbase</enablefields> + </field> + <field> + <name>ldapmode</name> + <description> + Perform various LDAP functions depending on LDAPMode variable. + </description> + <type>select</type> + <default_value>verify</default_value> + <options> + <option> + <name>verify</name> + <value>verify</value> + </option> + </options> + <bindstofield>installedpackages->dspam->config->0->ldap-mode</bindstofield> + </field> + <field> + <name>ldaphost</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->ldap-host</bindstofield> + <description>Hostname of the LDAP directory server.</description> + </field> + <field> + <name>ldapfilter</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->ldap-filter</bindstofield> + <description>A specific query filter, that should be used while querying the LDAP server.</description> + </field> + <field> + <name>ldapbase</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->ldap-base</bindstofield> + <description>A particular distinguish name from where to start LDAP queries.</description> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>8</id> + <includefile>dspam.inc</includefile> + <title>Miscellaneous Settings</title> + <description> + On this page we will give you an opertunity to fine-tune the DSPAM engine. As mentioned earlier, + if you are unsure about the meaning of a particular option, use its default value. + </description> + <fields> + <field> + <name>foatt</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->failover-attempts</bindstofield> + <description>A particular number of attempts (default: 1).</description> + </field> + <field> + <donotdisable>true</donotdisable> + <name>enablesbl</name> + <description>Enable checks against a particular SBL host (default: disabled).</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->sbl-enable</bindstofield> + <enablefields>sblhost</enablefields> + </field> + <field> + <name>sblhost</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->sbl-host</bindstofield> + <description>A particular SBL hostname (default: none).</description> + <size>30</size> + </field> + <field> + <donotdisable>true</donotdisable> + <name>enablerbl</name> + <description>Enable RBL inoculation support (default: disabled).</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->rbl-inoculate</bindstofield> + </field> + <field> + <donotdisable>true</donotdisable> + <name>enablenoti</name> + <description>Enable the sending of notification emails to users (first message, quarantine full, etc. default: disabled).</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->notification-email</bindstofield> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>9</id> + <includefile>dspam.inc</includefile> + <title>Maintainance Settings</title> + <description> + DSPAM stores token data etc. in some kind of a database (e.g. a RDBMS or flat files). + Over time, this token data may consume lots of space. Hence it makes sense to run + certain routines to clean up unused data. + </description> + <fields> + <field> + <name>psig</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->purge-signatures</bindstofield> + <description>Purge stale signatures (default: 14).</description> + </field> + <field> + <name>pneut</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->purge-neutral</bindstofield> + <description>Purge tokens with neutralish probabilities (default: 90).</description> + </field> + <field> + <name>punu</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->purge-unused</bindstofield> + <description>Purge unused tokens (default: 90).</description> + </field> + <field> + <name>phapa</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->purge-hapaxes</bindstofield> + <description> Purge tokens with less than 5 hits (hapaxes - default: 30).</description> + </field> + <field> + <name>pones</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->purge-hits-1s</bindstofield> + <description>Purge tokens with only 1 spam hit (default: 15).</description> + </field> + <field> + <name>ponei</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->purge-hits-1i</bindstofield> + <description> Purge tokens with only 1 innocent hit (default: 15).</description> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>10</id> + <includefile>dspam.inc</includefile> + <title>System Settings</title> + <description> + This page contains additional settings related to the DSPAM system such as logging, + message processing behaviour et cetera. + </description> + <fields> + <field> + <name>locmx</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->local-mx</bindstofield> + <description> + Local Mail Exchangers: Used for source address tracking, tells DSPAM + which mail exchangers are local and therefore should be ignored in the + Received: header when tracking the source of an email. Note: you should + use the address of the host as appears between brackets [ ] in the + Received header (default: 127.0.0.1). + </description> + </field> + <field> + <donotdisable>true</donotdisable> + <name>enablesysl</name> + <description>Enable system logging (default: enabled).</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->system-log</bindstofield> + </field> + <field> + <donotdisable>true</donotdisable> + <name>enableusel</name> + <description>Enable per user logging (default: enabled).</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->user-log</bindstofield> + </field> + <field> + <name>optinout</name> + <description> + Opt: in or out; determines DSPAM's default filtering behavior (default: out). + </description> + <type>select</type> + <default_value>out</default_value> + <options> + <option> + <name>out</name> + <value>out</value> + </option> + <option> + <name>in</name> + <value>in</value> + </option> + </options> + <bindstofield>installedpackages->dspam->config->0->filter-opt</bindstofield> + </field> + <field> + <donotdisable>true</donotdisable> + <name>enableptoh</name> + <description>Parse the To: headers of an incoming message. (default: disabled).</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->parse-to-headers</bindstofield> + </field> + <field> + <donotdisable>true</donotdisable> + <name>enablecmop</name> + <description>Automatically change the class (to spam or innocent - default: disabled).</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->change-mode-on-parse</bindstofield> + </field> + <field> + <donotdisable>true</donotdisable> + <name>enablecuop</name> + <description>Automatically change the username to match that specified in the To: header (default: enabled).</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->change-user-on-parse</bindstofield> + </field> + <field> + <name>maxmsgs</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->max-message-size</bindstofield> + <description> + You may specify a maximum message size in bytes for DSPAM to process. (default: 307200). + </description> + </field> + <field> + <donotdisable>true</donotdisable> + <name>procbias</name> + <description> + Bias causes the filter to lean more toward "innocent", and usually + greatly reduces false positives. It is the default behavior of most + Bayesian filters, including dspam (default: enabled). + </description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->processor-bias</bindstofield> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>11</id> + <includefile>dspam.inc</includefile> + <title>ClamAV Engine Settings</title> + <description> + DSPAM comes with an additional feature which allows to scan mail messages + for malicious code (i.e. virii). If you require messages not only to be + classified as Spam/Ham but additionally to be scanned for virii, enable + to appropriate option below. + </description> + <fields> + <field> + <donotdisable>true</donotdisable> + <name>enableclam</name> + <description>Enable ClamAV Engine (default: disabled).</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->clamav-enable</bindstofield> + <enablefields>clamport,clamhost,clamresp</enablefields> + </field> + <field> + <name>clamport</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->clamav-port</bindstofield> + <description>A number that specifies the port the ClamAV daemon is listening to (default: none).</description> + </field> + <field> + <name>clamhost</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->clamav-host</bindstofield> + <description>An IP address that points to the host the ClamAV daemon is running on (default: none).</description> + </field> + <field> + <name>clamresp</name> + <description>The action that should take place, if ClamAV reports a positive (default: none).</description> + <type>select</type> + <default_value>accept</default_value> + <options> + <option> + <name>reject</name> + <value>reject</value> + </option> + <option> + <name>accept</name> + <value>accept</value> + </option> + <option> + <name>spam</name> + <value>spam</value> + </option> + </options> + <bindstofield>installedpackages->dspam->config->0->clamav-response</bindstofield> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>12</id> + <includefile>dspam.inc</includefile> + <title>DSPAM Daemon Settings (Server)</title> + <description> + DSPAM can be either invoked per message (i.e. a thread per message) or it + can be run as a daemon in the background. The latter option enables DSPAM + to maintain database connection pools which may increase overall performance. + Based on the profile, that you did choose initially, some of the below options + may be already set. + </description> + <fields> + <field> + <name>dsport</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dspam-server-port</bindstofield> + <description>A number that specifies the port the DSPAM daemon is listening to (default: none).</description> + </field> + <field> + <name>dsqsize</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dspam-server-queue-size</bindstofield> + <description>A number that specifies the server's queue size (default: none).</description> + </field> + <field> + <name>dspid</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dspam-server-pid</bindstofield> + <description> Keep this is sync with <code>/usr/local/etc/rc.d/dspam.rc</code> script (default: none).</description> + <size>40</size> + </field> + <field> + <name>dssmode</name> + <description>Specifies the type of LMTP server to start. (default: none).</description> + <type>select</type> + <default_value>auto</default_value> + <options> + <option> + <name>dspam</name> + <value>dspam</value> + </option> + <option> + <name>standard</name> + <value>standard</value> + </option> + <option> + <name>auto</name> + <value>auto</value> + </option> + </options> + <bindstofield>installedpackages->dspam->config->0->dspam-server-mode</bindstofield> + </field> + <field> + <name>serverparam</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dspam-server-params</bindstofield> + <description>Parameters which will be passed to the LMTP server (default: none).</description> + </field> + <field> + <name>serverid</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dspam-server-id</bindstofield> + <description>An identification string which will be used to be passed to the LMTP server (default: none).</description> + </field> + <field> + <name>serversock</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dspam-server-socket</bindstofield> + <description>A local Unix domain socket (default: none).</description> + <size>40</size> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>13</id> + <includefile>dspam.inc</includefile> + <title>DSPAM Daemon Settings (Client)</title> + <description> + If you did configure DSPAM to run in dspam mode, it is required to configure + client settings because DSPAM needs for example to authenticate against its + server counterpart. + </description> + <fields> + <field> + <donotdisable>true</donotdisable> + <name>enabledsclient</name> + <description>Run DSPAM in client mode (default: disabled).</description> + <type>checkbox</type> + <bindstofield>installedpackages->dspam->config->0->dspam-client-enable</bindstofield> + <enablefields>dsclhost,dsclport,dsclident</enablefields> + </field> + <field> + <name>dsclhost</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dspam-client-host</bindstofield> + <description>An IP address or a Unix domain socket (default: none).</description> + </field> + <field> + <name>dsclport</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dspam-client-port</bindstofield> + <description>Will be only used if this client uses TCP/IP communication (default: none).</description> + </field> + <field> + <name>dsclident</name> + <type>input</type> + <bindstofield>installedpackages->dspam->config->0->dspam-client-id</bindstofield> + <description>A string that will be used to identify the client against a server. (default: none).</description> + <size>40</size> + </field> + <field> + <name>Next</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>14</id> + <includefile>dspam.inc</includefile> + <title>Reload configuration</title> + <disableheader>true</disableheader> + <description>Click 'Reload' to reload the DSPAM daemon with new changes.</description> + <fields> + <field> + <name>Reload</name> + <type>submit</type> + </field> + </fields> +</step> +<step> + <id>15</id> + <includefile>dspam.inc</includefile> + <title>Reload in progress</title> + <description> + A reload is now in progress. Please wait. <p> The system will + automatically try to access DSPAM settings in 120 page seconds. <p> + You can click on the icon above to access the site more quickly. + </description> + <javascriptafterformdisplay> + window.setTimeout('window.location.href = "/dspam-settings.php"', 120000); + </javascriptafterformdisplay> + <stepafterformdisplay> + dspam_configure(); + mwexec("/usr/local/etc/rc.d/spamd.sh stop"); + mwexec("/usr/local/etc/rc.d/spamd.sh start"); + </stepafterformdisplay> +</step> +</pfsensewizard> |