diff options
Diffstat (limited to 'config/postfix')
-rwxr-xr-x | config/postfix/pkg_postfix.inc | 11 | ||||
-rwxr-xr-x | config/postfix/postfix.inc | 54 | ||||
-rw-r--r-- | config/postfix/postfix.php | 9 | ||||
-rw-r--r-- | config/postfix/postfix.xml | 27 | ||||
-rwxr-xr-x | config/postfix/postfix_about.php | 4 | ||||
-rw-r--r-- | config/postfix/postfix_acl.xml | 10 | ||||
-rwxr-xr-x | config/postfix/postfix_queue.php | 2 | ||||
-rw-r--r-- | config/postfix/postfix_recipients.xml | 17 | ||||
-rwxr-xr-x | config/postfix/postfix_search.php | 2 | ||||
-rw-r--r-- | config/postfix/postfix_view_config.php | 2 |
10 files changed, 106 insertions, 32 deletions
diff --git a/config/postfix/pkg_postfix.inc b/config/postfix/pkg_postfix.inc new file mode 100755 index 00000000..18da1c11 --- /dev/null +++ b/config/postfix/pkg_postfix.inc @@ -0,0 +1,11 @@ +<?php + +global $shortcuts; + +$shortcuts['postfix'] = array(); +$shortcuts['postfix']['main'] = "pkg_edit.php?xml=postfix.xml"; +$shortcuts['postfix']['log'] = "diag_logs_resolver.php"; +$shortcuts['postfix']['status'] = "status_services.php"; +$shortcuts['postfix']['service'] = "postfix"; + +?> diff --git a/config/postfix/postfix.inc b/config/postfix/postfix.inc index 193ec6c7..50979f38 100755 --- a/config/postfix/postfix.inc +++ b/config/postfix/postfix.inc @@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE. */ +$shortcut_section = "postfix"; require_once("util.inc"); require_once("functions.inc"); require_once("pkg-utils.inc"); @@ -580,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)){ @@ -610,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 @@ -646,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=""; @@ -656,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.php b/config/postfix/postfix.php index a11af2dd..78eb551d 100644 --- a/config/postfix/postfix.php +++ b/config/postfix/postfix.php @@ -150,10 +150,13 @@ function grep_log(){ $m=date('M',strtotime($postfix_arg['time'],$curr_time)); $j=substr(" ".date('j',strtotime($postfix_arg['time'],$curr_time)),-3); # file grep loop + $maillog_filename = "/var/log/maillog"; foreach ($postfix_arg['grep'] as $hour){ - print "/usr/bin/grep '^".$m.$j." ".$hour.".*".$grep."' /var/log/maillog\n"; + if (!file_exists($maillog_filename) || !is_readable($maillog_filename)) + continue; + print "/usr/bin/grep '^".$m.$j." ".$hour.".*".$grep."' {$maillog_filename}\n"; $lists=array(); - exec("/usr/bin/grep " . escapeshellarg('^'.$m.$j." ".$hour.".*".$grep)." /var/log/maillog", $lists); + exec("/usr/bin/grep " . escapeshellarg('^'.$m.$j." ".$hour.".*".$grep)." {$maillog_filename}", $lists); foreach ($lists as $line){ #check where is first mail record if (preg_match("/ delay=(\d+)/",$line,$delay)){ @@ -294,7 +297,7 @@ function grep_log(){ } $config=parse_xml_config("{$g['conf_path']}/config.xml", $g['xml_rootobj']); - print count($config['installedpackages']); + //print count($config['installedpackages']); #start db replication if configured if ($config['installedpackages']['postfixsync']['config'][0]['rsync']) foreach ($config['installedpackages']['postfixsync']['config'] as $rs ) diff --git a/config/postfix/postfix.xml b/config/postfix/postfix.xml index 25f7a81d..e9d2d953 100644 --- a/config/postfix/postfix.xml +++ b/config/postfix/postfix.xml @@ -145,6 +145,11 @@ <prefix>/usr/local/bin/</prefix> <chmod>0755</chmod> </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/www/shortcuts/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.org/packages/config/postfix/pkg_postfix.inc</item> + </additional_files_needed> <tabs> <tab> <text>General</text> @@ -202,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_acl.xml b/config/postfix/postfix_acl.xml index 4eeda7a4..d704c189 100644 --- a/config/postfix/postfix_acl.xml +++ b/config/postfix/postfix_acl.xml @@ -110,7 +110,7 @@ See http://www.postfix.org/header_checks.5.html for more help]]> </description> <type>textarea</type> - <cols>83</cols> + <cols>80</cols> <rows>15</rows> <encoding>base64</encoding> </field> @@ -124,7 +124,7 @@ See http://www.postfix.org/postconf.5.html#smtpd_helo_restrictions for more help]]> </description> <type>textarea</type> - <cols>83</cols> + <cols>80</cols> <rows>15</rows> <encoding>base64</encoding> </field> @@ -142,7 +142,7 @@ <strong>Note: a result of "OK" in this field is not allowed/wanted for safety reasons(it may accept forged senders as it will not do other spam checks). Instead, use DUNNO in order to exclude specific hosts from blacklists.</strong>]]> </description> <type>textarea</type> - <cols>83</cols> + <cols>80</cols> <rows>15</rows> <encoding>base64</encoding> </field> @@ -154,7 +154,7 @@ /^Content-(Disposition|Type):\s+.+?(?:file)?name="?.+?\.(386|ad[ept]|drv|em(ai)?l|ex[_e]|xms|\{[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}\})\b/ REJECT ".$2" file attachment types not allowed]]> </description> <type>textarea</type> - <cols>83</cols> + <cols>80</cols> <rows>15</rows> <encoding>base64</encoding> </field> @@ -166,7 +166,7 @@ ~^[[:alnum:]+/]{60,}$~ OK]]> </description> <type>textarea</type> - <cols>83</cols> + <cols>80</cols> <rows>15</rows> <encoding>base64</encoding> </field> 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_recipients.xml b/config/postfix/postfix_recipients.xml index 97e39fb2..2b07bae8 100644 --- a/config/postfix/postfix_recipients.xml +++ b/config/postfix/postfix_recipients.xml @@ -9,7 +9,7 @@ /* postfix_recipients.xml part of the Postfix package for pfSense - Copyright (C) 2011 Marcello Coutinho + Copyright (C) 2011-2013 Marcello Coutinho All rights reserved. */ /* ========================================================================== */ @@ -119,33 +119,38 @@ Before using LDAP fetch you must install p5-perl-ldap package(hint: <strong>/usr/sbin/pkg_add -r p5-perl-ldap</strong>)]]></description> </field> <field> - <fielddescr><![CDATA[<strong>HINTS</strong><br>Hostname:<br>dc1.mysite.com<br><br>Domain:<br>dc=mysite,dc=com<br><br>Username:<br>cn=antispam,cn=Users<br>]]></fielddescr> <fieldname>none</fieldname> <type>rowhelper</type> + <dontdisplayname/> + <usecolspan2/> + <movable>on</movable> <rowhelper> <rowhelperfield> <fielddescr>Hostname</fielddescr> + <description><![CDATA[<strong>Hostname Hint:</strong><br>dc1.mysite.com]]></description> <fieldname>dc</fieldname> <type>input</type> - <size>20</size> + <size>23</size> </rowhelperfield> <rowhelperfield> <fielddescr>Domain</fielddescr> + <description><![CDATA[<strong>Domain Hint:</strong><br>dc=mysite,dc=com]]></description> <fieldname>cn</fieldname> <type>input</type> - <size>22</size> + <size>25</size> </rowhelperfield> <rowhelperfield> <fielddescr>Username</fielddescr> + <description><![CDATA[<strong>Username Hint:</strong><br>Username:cn=antispam,cn=Users]]></description> <fieldname>username</fieldname> <type>input</type> - <size>20</size> + <size>24</size> </rowhelperfield> <rowhelperfield> <fielddescr>Password</fielddescr> <fieldname>password</fieldname> <type>password</type> - <size>10</size> + <size>12</size> </rowhelperfield> </rowhelper> </field> 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) |