diff options
author | Charlie <root@testfbsd8.localdomain> | 2009-07-08 14:45:06 +0000 |
---|---|---|
committer | Charlie <root@testfbsd8.localdomain> | 2009-07-08 14:45:29 +0000 |
commit | cc47995dd0b4f7a44c36a94d6f4feabddc418e12 (patch) | |
tree | d54a022f4a72f025e16d50b6ab708b47e7fbecfe /config/spamd.inc | |
parent | dae4090094c2d03a8659d8a1c2e69763f06139bb (diff) | |
download | pfsense-packages-cc47995dd0b4f7a44c36a94d6f4feabddc418e12.tar.gz pfsense-packages-cc47995dd0b4f7a44c36a94d6f4feabddc418e12.tar.bz2 pfsense-packages-cc47995dd0b4f7a44c36a94d6f4feabddc418e12.zip |
Add needed code to packages to confirm to 2.0 rules for adding firewall rules. NOTE: other packages might need intervention but for now this is the neccessary minimum to remove dependency on pkg-utils.inc on filter.inc
Diffstat (limited to 'config/spamd.inc')
-rw-r--r-- | config/spamd.inc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/config/spamd.inc b/config/spamd.inc index 3088d037..6ee72ad7 100644 --- a/config/spamd.inc +++ b/config/spamd.inc @@ -160,6 +160,35 @@ function sync_package_spamd() { log_error("SpamD setup completed"); } +function spamd_generate_rules($type) { + global $config; + + $natrules = ""; + switch($type) { + case 'rdr': + $natrules .= "\n# spam table \n"; + $wanif = $FilterIflist["wan"]['if']; + $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"; + } + + break; + } + + return $natrules; +} + function remove_spaces($string) { $string = str_replace(" ", "", $string); return $string; @@ -286,4 +315,4 @@ function spamd_validate_input($post, $input_errors) { } } -?>
\ No newline at end of file +?> |