aboutsummaryrefslogtreecommitdiffstats
path: root/config/spamd/spamd.inc
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 /config/spamd/spamd.inc
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
Diffstat (limited to 'config/spamd/spamd.inc')
-rw-r--r--config/spamd/spamd.inc47
1 files changed, 32 insertions, 15 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;
}