aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2015-08-16 00:12:43 -0500
committerChris Buechler <cmb@pfsense.org>2015-08-16 00:12:43 -0500
commit21fd7e810b732289f207f1c3ee4566be30f75659 (patch)
tree2e8ffb77744ad962a3dcd22c0e57ff1d6b3140a7
parent7f77d22a3bca3c6c3e048fb823a893b85eedee49 (diff)
parent3b12fa7aec920d072592c8801d1da4a84aac6056 (diff)
downloadpfsense-packages-21fd7e810b732289f207f1c3ee4566be30f75659.tar.gz
pfsense-packages-21fd7e810b732289f207f1c3ee4566be30f75659.tar.bz2
pfsense-packages-21fd7e810b732289f207f1c3ee4566be30f75659.zip
Merge pull request #955 from PiBa-NL/spamd_1.1.2
-rw-r--r--config/spamd/spamd.inc47
-rw-r--r--config/spamd/spamd_db.php31
-rw-r--r--config/spamd/spamd_settings.xml10
-rw-r--r--pkg_config.10.xml2
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
6 files changed, 63 insertions, 31 deletions
diff --git a/config/spamd/spamd.inc b/config/spamd/spamd.inc
index bbfae23e..a7be4587 100644
--- a/config/spamd/spamd.inc
+++ b/config/spamd/spamd.inc
@@ -194,21 +194,38 @@ function spamd_generate_rules($type) {
switch($type) {
case 'nat':
$natrules .= "\n# spam table \n";
- $wanif = get_real_interface("wan");
- $natrules .= "table <whitelist> persist\n";
- $natrules .= "table <blacklist> persist\n";
- $natrules .= "table <spamd> persist\n";
- if(file_exists("/var/db/whitelist.txt"))
- $natrules .= "table <spamd-white> persist file \"/var/db/whitelist.txt\"\n";
- $natrules .= "rdr pass on {$wanif} proto tcp from <blacklist> to port smtp -> 127.0.0.1 port spamd\n";
- $natrules .= "rdr pass on {$wanif} proto tcp from <spamd> to port smtp -> 127.0.0.1 port spamd\n";
- $natrules .= "rdr pass on {$wanif} proto tcp from !<spamd-white> to port smtp -> 127.0.0.1 port spamd\n";
- if($config['installedpackages']['spamdsettings']['config'])
- foreach($config['installedpackages']['spamdsettings']['config'] as $ss)
- $nextmta = $ss['nextmta'];
- if($nextmta <> "") {
- $natrules .= "rdr pass on {$wanif} proto tcp from <spamd-white> to port smtp -> {$nextmta} port smtp\n";
- }
+ $natrules .= "table <whitelist> persist\n";
+ $natrules .= "table <blacklist> persist\n";
+ $natrules .= "table <spamd> persist\n";
+ if (file_exists("/var/db/whitelist.txt")) {
+ $natrules .= "table <spamd-white> persist file \"/var/db/whitelist.txt\"\n";
+ }
+
+ if (is_array($config['installedpackages']['spamdsettings']['config'])) {
+ $spamdconfig = $config['installedpackages']['spamdsettings']['config']['0'];
+ } else {
+ $spamdconfig = $config['installedpackages']['spamdsettings']['config'];
+ }
+
+ if ($spamdconfig) {
+ $nextmta = $spamdconfig['nextmta'];
+ $spamdbinds = explode(',', $spamdconfig['spamdbinds_array']);
+ if (is_array($spamdbinds)) {
+ foreach ($spamdbinds as $interface) {
+ $wanif = get_real_interface($interface);
+ if (!isset($wanif)) {
+ continue;
+ }
+ $natrules .= "rdr pass on {$wanif} proto tcp from <blacklist> to port smtp -> 127.0.0.1 port spamd\n";
+ $natrules .= "rdr pass on {$wanif} proto tcp from <spamd> to port smtp -> 127.0.0.1 port spamd\n";
+ $natrules .= "rdr pass on {$wanif} proto tcp from !<spamd-white> to port smtp -> 127.0.0.1 port spamd\n";
+ if ($nextmta <> "") {
+ $natrules .= "rdr pass on {$wanif} proto tcp from <spamd-white> to port smtp -> {$nextmta} port smtp\n";
+ }
+ }
+ }
+ }
+ $natrules .= "\n";
break;
}
diff --git a/config/spamd/spamd_db.php b/config/spamd/spamd_db.php
index 83601805..3fe439ef 100644
--- a/config/spamd/spamd_db.php
+++ b/config/spamd/spamd_db.php
@@ -320,6 +320,11 @@ if (typeof getURL == 'undefined') {
<td class="list"></td>
</tr>
<?php
+
+function formatspamddatetime($dt) {
+ return date("Y-m-d", $dt) . "<br/>" . date("H:i:s", $dt);
+}
+
if($filter) {
if($not) {
$fd = fopen("/tmp/spamdb", "w");
@@ -383,9 +388,9 @@ if (typeof getURL == 'undefined') {
switch($pkgdb_split[0]) {
case "SPAMTRAP":
$recordtype = htmlentities($pkgdb_split[0]);
- $srcip = htmlentities($pkgdb_split[1]);
- $fromaddress = htmlentities($pkgdb_split[3]);
- $toaddress = htmlentities($pkgdb_split[4]);
+ $srcip = "";
+ $fromaddress = htmlentities($pkgdb_split[1]);
+ $toaddress = "";
$first = "";
$pass = "";
$expire = "";
@@ -398,7 +403,7 @@ if (typeof getURL == 'undefined') {
$toaddress = "";
$first = "";
$pass = "";
- $expire = htmlentities($pkgdb_split[2]);
+ $expire = formatspamddatetime($pkgdb_split[2]);
$attempts = "";
break;
case "GREY":
@@ -406,9 +411,9 @@ if (typeof getURL == 'undefined') {
$srcip = htmlentities($pkgdb_split[1]);
$fromaddress = htmlentities($pkgdb_split[3]);
$toaddress = htmlentities($pkgdb_split[4]);
- $first = htmlentities($pkgdb_split[5]);
- $pass = htmlentities($pkgdb_split[6]);
- $expire = htmlentities($pkgdb_split[7]);
+ $first = formatspamddatetime($pkgdb_split[5]);
+ $pass = formatspamddatetime($pkgdb_split[6]);
+ $expire = formatspamddatetime($pkgdb_split[7]);
$attempts = htmlentities($pkgdb_split[8]);
break;
case "WHITE":
@@ -416,9 +421,9 @@ if (typeof getURL == 'undefined') {
$srcip = htmlentities($pkgdb_split[1]);
$fromaddress = "";
$toaddress = "";
- $first = htmlentities($pkgdb_split[4]);
- $pass = htmlentities($pkgdb_split[5]);
- $expire = htmlentities($pkgdb_split[6]);
+ $first = formatspamddatetime($pkgdb_split[4]);
+ $pass = formatspamddatetime($pkgdb_split[5]);
+ $expire = formatspamddatetime($pkgdb_split[6]);
$attempts = htmlentities($pkgdb_split[8]);
break;
}
@@ -429,9 +434,9 @@ if (typeof getURL == 'undefined') {
echo "<td class=\"listr\">{$srcip}</td>";
echo "<td class=\"listr\">{$fromaddress}</td>";
echo "<td class=\"listr\">{$toaddress}</td>";
- echo "<td class=\"listr\"><span style='white-space: nowrap;'>" . date("Y-m-d", $first) . "<br/>" . date("H:i:s", $first) . "</span></td>";
- echo "<td class=\"listr\"><span style='white-space: nowrap;'>" . date("Y-m-d", $pass) . "<br/>" . date("H:i:s", $pass) . "</span></td>";
- echo "<td class=\"listr\"><span style='white-space: nowrap;'>" . date("Y-m-d", $expire) . "<br/>" . date("H:i:s", $expire) . "</span></td>";
+ echo "<td class=\"listr\"><span style='white-space: nowrap;'>" . $first . "</span></td>";
+ echo "<td class=\"listr\"><span style='white-space: nowrap;'>" . $pass . "</span></td>";
+ echo "<td class=\"listr\"><span style='white-space: nowrap;'>" . $expire . "</span></td>";
echo "<td class=\"listr\">{$attempts}</td>";
echo "<td>";
$rowtext = "<NOBR><a href='javascript:toggle_on(\"w{$rows}\", \"/themes/{$g['theme']}/images/icons/icon_plus_p.gif\"); getURL(\"spamd_db.php?buttonid=w{$rows}&srcip={$srcip}&action=whitelist\", outputrule);'><img title=\"Add to whitelist\" name='w{$rows}' id='w{$rows}' border=\"0\" alt=\"Add to whitelist\" src=\"/themes/{$g['theme']}/images/icons/icon_plus.gif\"></a> ";
diff --git a/config/spamd/spamd_settings.xml b/config/spamd/spamd_settings.xml
index 3fdab415..225ef4a6 100644
--- a/config/spamd/spamd_settings.xml
+++ b/config/spamd/spamd_settings.xml
@@ -83,6 +83,16 @@
will be parsed and rendered for the user as a gui with input, and selectboxes. -->
<fields>
<field>
+ <fielddescr>Intercept on interfaces</fielddescr>
+ <fieldname>spamdbinds_array</fieldname>
+ <description>
+ <![CDATA[These are the interfaces spamd will intercept smtp connections on.]]>
+ </description>
+ <type>interfaces_selection</type>
+ <multiple>true</multiple>
+ <hideinterfaceregex>loopback</hideinterfaceregex>
+ </field>
+ <field>
<fielddescr>Identifier</fielddescr>
<fieldname>identifier</fieldname>
<description>The SMTP version banner that is reported upon initial connection.</description>
diff --git a/pkg_config.10.xml b/pkg_config.10.xml
index 4c59a2e5..0ecde95c 100644
--- a/pkg_config.10.xml
+++ b/pkg_config.10.xml
@@ -438,7 +438,7 @@
<category>Services</category>
<config_file>https://packages.pfsense.org/packages/config/spamd/spamd.xml</config_file>
<depends_on_package_pbi>spamd-4.9.1_2-##ARCH##.pbi</depends_on_package_pbi>
- <version>1.1.2</version>
+ <version>1.1.3</version>
<status>Beta</status>
<required_version>2.2</required_version>
<port_category>mail</port_category>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 752cfa4a..ce02021b 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -513,7 +513,7 @@
<depends_on_package_base_url>https://files.pfsense.org/packages/8/All/</depends_on_package_base_url>
<depends_on_package>spamd-4.9.1.tbz</depends_on_package>
<depends_on_package_pbi>spamd-4.9.1-i386.pbi</depends_on_package_pbi>
- <version>4.9.1 v1.1.2</version>
+ <version>4.9.1 v1.1.3</version>
<status>Beta</status>
<required_version>1.2.1</required_version>
<configurationfile>spamd.xml</configurationfile>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index a76eb087..9751fe3e 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -500,7 +500,7 @@
<depends_on_package_base_url>https://files.pfsense.org/packages/amd64/8/All/</depends_on_package_base_url>
<depends_on_package>spamd-4.9.1.tbz</depends_on_package>
<depends_on_package_pbi>spamd-4.9.1-amd64.pbi</depends_on_package_pbi>
- <version>4.9.1 v1.1.2</version>
+ <version>4.9.1 v1.1.3</version>
<status>Beta</status>
<required_version>1.2.1</required_version>
<configurationfile>spamd.xml</configurationfile>