diff options
author | PiBa-NL <pba_2k3@yahoo.com> | 2015-08-07 21:17:24 +0200 |
---|---|---|
committer | PiBa-NL <pba_2k3@yahoo.com> | 2015-08-07 21:18:40 +0200 |
commit | c58cd3009ae4dc2a612864ba3cc8c332440f6be5 (patch) | |
tree | 3161c7c42a108f561eaa1416245f00f04b8f3b8a /config/spamd/spamd.inc | |
parent | f52fab33c15ba4b92201737c2c8dd4306486c31f (diff) | |
download | pfsense-packages-c58cd3009ae4dc2a612864ba3cc8c332440f6be5.tar.gz pfsense-packages-c58cd3009ae4dc2a612864ba3cc8c332440f6be5.tar.bz2 pfsense-packages-c58cd3009ae4dc2a612864ba3cc8c332440f6be5.zip |
spamd, allow configuring interface to listen/intercept on
Diffstat (limited to 'config/spamd/spamd.inc')
-rw-r--r-- | config/spamd/spamd.inc | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/config/spamd/spamd.inc b/config/spamd/spamd.inc index 71f20106..fd09837c 100644 --- a/config/spamd/spamd.inc +++ b/config/spamd/spamd.inc @@ -199,21 +199,35 @@ 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; } |