diff options
author | Marcello Coutinho <marcellocoutinho@gmail.com> | 2013-12-06 20:14:30 -0200 |
---|---|---|
committer | Marcello Coutinho <marcellocoutinho@gmail.com> | 2013-12-06 20:14:30 -0200 |
commit | 6379357ef42d6d42067f3184a92c531405bc9c5a (patch) | |
tree | c5a4b97cc86e539fe989648b2424b6dc238611a2 /config | |
parent | 1f05146a61256ad51e20e88dcbca232a808b803c (diff) | |
download | pfsense-packages-6379357ef42d6d42067f3184a92c531405bc9c5a.tar.gz pfsense-packages-6379357ef42d6d42067f3184a92c531405bc9c5a.tar.bz2 pfsense-packages-6379357ef42d6d42067f3184a92c531405bc9c5a.zip |
postfix - include ipv4,ipv6,virtual and all listen options and fix shortcut call on view,search,queue and about tab
Diffstat (limited to 'config')
-rwxr-xr-x | config/postfix/postfix.inc | 53 | ||||
-rw-r--r-- | config/postfix/postfix.xml | 22 | ||||
-rwxr-xr-x | config/postfix/postfix_about.php | 4 | ||||
-rwxr-xr-x | config/postfix/postfix_queue.php | 2 | ||||
-rwxr-xr-x | config/postfix/postfix_search.php | 2 | ||||
-rw-r--r-- | config/postfix/postfix_view_config.php | 2 |
6 files changed, 67 insertions, 18 deletions
diff --git a/config/postfix/postfix.inc b/config/postfix/postfix.inc index cf7cd786..50979f38 100755 --- a/config/postfix/postfix.inc +++ b/config/postfix/postfix.inc @@ -581,6 +581,34 @@ switch ($antispam['zombie_blocker']) $postfix_main.="soft_bounce = yes\n"; } + //check ips to listen on + $inet_protocols=($postfix_config['inet_protocol'] ? $postfix_config['inet_protocol'] : "ipv4"); + $inet_interfaces =array(); + if (preg_match("/All/",$postfix_config['enabled_interface'])){ + $inet_interfaces[]=""; + } + elseif ($postfix_config['enabled_interface'] == "lo0"){ + $inet_interfaces[]="loopback-only"; + } + else{ + $ifaces = ($postfix_config['enabled_interface'] ? $postfix_config['enabled_interface'] : 'wan'); + foreach (explode(',',$ifaces) as $listenon){ + if (is_ipaddrv6($listenon) && preg_match("/(ipv6|all)/i",$inet_protocols)) + $inet_interfaces[]= "{$listenon}"; + elseif (is_ipaddr($listenon) && preg_match("/(ipv4|all)/i",$inet_protocols)) + $inet_interfaces[]= "{$listenon}"; + else{ + $listenon=(pfSense_get_interface_addresses(convert_friendly_interface_to_real_interface_name($listenon))); + if (is_ipaddr($listenon['ipaddr']) && preg_match("/(ipv4|all)/i",$inet_protocols)) + $inet_interfaces []= "{$listenon['ipaddr']}"; + if(is_ipaddrv6($listenon['ipaddr6']) && preg_match("/(ipv6|all)/i",$inet_protocols)) + $inet_interfaces []= "{$listenon['ipaddr6']}"; + } + } + } + $postfix_main.= "inet_protocols = {$inet_protocols}\n"; + $postfix_main.= "inet_interfaces = ".implode(",",$inet_interfaces)."\n"; + if ($postscreen==1) #Postscreen enabled { if(preg_match("/(\d+),(\d+)(s|m|h|w)/",$antispam['greet_time'],$greet)){ @@ -611,16 +639,17 @@ switch ($antispam['zombie_blocker']) $postfix_main.="postscreen_blacklist_action= ".$antispam['zombie_blocker']."\n"; #postscreen interface loop - $ifaces = ($postfix_config['enabled_interface'] ? $postfix_config['enabled_interface'] : 'wan'); - $real_ifaces = array(); - $postfix_master=""; - foreach (explode(",", $ifaces) as $i => $iface) { - $real_ifaces[] = px_get_real_interface_address($iface); - if($real_ifaces[$i][0]) { - $postfix_master .=$real_ifaces[$i][0].":25 inet n - n - 1 postscreen\n\t-o user=postfix\n"; - $postfix_master .=($antispam['soft_bounce'] == "postscreen"?"\t-o soft_bounce=yes\n":""); - } - } + //$ifaces = ($postfix_config['enabled_interface'] ? $postfix_config['enabled_interface'] : 'wan'); + //$real_ifaces = array(); + //$postfix_master=""; + //foreach (explode(",", $ifaces) as $i => $iface) { + // $real_ifaces[] = px_get_real_interface_address($iface); + // if($real_ifaces[$i][0]) { + // $postfix_master .=$real_ifaces[$i][0].":25 inet n - n - 1 postscreen\n\t-o user=postfix\n"; + $postfix_master = "smtp inet n - n - 1 postscreen\n\t-o user=postfix\n"; + $postfix_master .=($antispam['soft_bounce'] == "postscreen"?"\t-o soft_bounce=yes\n":""); + // } + //} $postfix_master .= $postfix_inets.<<<MASTEREOF smtpd pass - - n - - smtpd dnsblog unix - - n - 0 dnsblog @@ -647,7 +676,7 @@ MASTEREOF; } #interface loop - $postfix_inets=""; + /*$postfix_inets=""; $ifaces = ($postfix_config['enabled_interface'] ? $postfix_config['enabled_interface'] : 'loopback'); $real_ifaces = array(); $postfix_master=""; @@ -657,6 +686,8 @@ MASTEREOF; $postfix_master .=$real_ifaces[$i][0].":25 inet n - n - - smtpd\n"; } } + */ + $postfix_master ="25 inet n - n - - smtpd\n"; } $rbl2.=($rbl2 !=""?"\t\t\t\tpermit\n":"permit\n"); diff --git a/config/postfix/postfix.xml b/config/postfix/postfix.xml index c3b3664f..e9d2d953 100644 --- a/config/postfix/postfix.xml +++ b/config/postfix/postfix.xml @@ -207,13 +207,31 @@ <description></description> </field> <field> - <fielddescr>Listen interface(s)</fielddescr> + <fielddescr>Listen Protocol</fielddescr> + <fieldname>inet_protocol</fieldname> + <description><![CDATA[Specify what protocols Postfix will use when it makes or accepts network connections<br> + This option controls what DNS lookups Postfix will use when it makes network connections.<br><br> + <b>Restart postfix daemon after changing Listen protocol.</b>]]></description> + <type>select</type> + <options> + <option><name>ipv4 (DEFAULT: enable IPv4 only)</name><value>ipv4</value></option> + <option><name>all (enable IPv4, and IPv6 if supported)</name><value>all</value></option> + <option><name>ipv4, ipv6 (enable both IPv4 and IPv6)</name><value>ipv4,ipv6</value></option> + <option><name>ipv6 (enable IPv6 only</name><value>ipv6</value></option> + </options> + <required/> + </field> + <field> + <fielddescr>Listen on</fielddescr> <fieldname>enabled_interface</fieldname> <description><![CDATA[Interface(s) that daemon will bind to.<br>Do not listen on WAN without a good "antispam/close relay" configuration.<br> - If you need postfix on other ip then Interface address, choose localhost and then create a nat rule from external ip to localhost.]]></description> + If you need postfix on other ip then Interface address, choose localhost and then create a nat rule from external ip to localhost.<br><br> + <b>Restart postfix daemon after changing Listen on addresses/interfaces.</b>]]></description> <type>interfaces_selection</type> <required/> <default_value>loopback</default_value> + <showlistenall/> + <showvirtualips/> <multiple/> </field> <field> diff --git a/config/postfix/postfix_about.php b/config/postfix/postfix_about.php index 3f3e272a..56645646 100755 --- a/config/postfix/postfix_about.php +++ b/config/postfix/postfix_about.php @@ -2,7 +2,7 @@ /* postfix_about.php part of pfSense (http://www.pfsense.com/) - Copyright (C) 2011 Marcello Coutinho <marcellocoutinho@gmail.com> + Copyright (C) 2011-2013 Marcello Coutinho <marcellocoutinho@gmail.com> based on varnish_view_config. All rights reserved. @@ -27,7 +27,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +$shortcut_section = "postfix"; require("guiconfig.inc"); $pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); diff --git a/config/postfix/postfix_queue.php b/config/postfix/postfix_queue.php index 76bed31f..f60ac83e 100755 --- a/config/postfix/postfix_queue.php +++ b/config/postfix/postfix_queue.php @@ -27,7 +27,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +$shortcut_section = "postfix"; require("guiconfig.inc"); $uname=posix_uname(); diff --git a/config/postfix/postfix_search.php b/config/postfix/postfix_search.php index a1cf6b3f..85648287 100755 --- a/config/postfix/postfix_search.php +++ b/config/postfix/postfix_search.php @@ -27,7 +27,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +$shortcut_section = "postfix"; require("guiconfig.inc"); $uname=posix_uname(); diff --git a/config/postfix/postfix_view_config.php b/config/postfix/postfix_view_config.php index 5e1f6271..59deb11e 100644 --- a/config/postfix/postfix_view_config.php +++ b/config/postfix/postfix_view_config.php @@ -27,7 +27,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +$shortcut_section = "postfix"; require("guiconfig.inc"); $pf_version=substr(trim(file_get_contents("/etc/version")),0,3); if ($pf_version > 2.0) |