SPAMD & MultiWAN



  • I have two WAN interfaces: WAN and OPT1.
    Below I have described the movements with which I made ​​spamd run on two WAN interfaces.

    1. I created in a folder /usr/local/pkg file spamd.inc.patch:

    *** spamd.inc Tue May 10 16:05:26 2011
    –- spamd.inc_multiwan Tue May 10 16:10:45 2011


    *** 192,210 ****
    --- 192,215 ----
      case 'nat':
      $natrules .= "\n# spam table \n";
                      $wanif = get_real_interface("wan");
    +                $optif = get_real_interface("opt1");
                      $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 {$optif} 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 {$optif} 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";
    +                $natrules .= "rdr pass on {$optif} 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 .= "rdr pass on {$optif} proto tcp from <spamd-white>to port smtp -> {$nextmta} port smtp\n";
                      }

    break;

    2. I created in a folder /usr/local/sbin file spamd_patch.sh:

    #!/bin/sh
    SUCCESS=0
    word=opt1
    filename="/usr/local/pkg/spamd.inc"
    cd /usr/local/pkg
    grep -q "$word" "$filename"
    if [ $? -eq $SUCCESS ]
    then
      /etc/rc.filter_configure_sync && pfctl -f /tmp/rules.debug
    else
      patch -i /usr/local/pkg/spamd.inc.patch && /etc/rc.filter_configure_sync && pfctl -f /tmp/rules.debug
    fi
    exit

    3. Recorded in Shellcmd:
    (attachment)


    </spamd-white></spamd-white></spamd-white></spamd-white></spamd></spamd></blacklist></blacklist></spamd-white></spamd></blacklist></whitelist>


Log in to reply