aboutsummaryrefslogtreecommitdiffstats
path: root/config/postfix/postfix.inc
diff options
context:
space:
mode:
Diffstat (limited to 'config/postfix/postfix.inc')
-rw-r--r--config/postfix/postfix.inc58
1 files changed, 43 insertions, 15 deletions
diff --git a/config/postfix/postfix.inc b/config/postfix/postfix.inc
index f76b523a..e64f8cca 100644
--- a/config/postfix/postfix.inc
+++ b/config/postfix/postfix.inc
@@ -34,6 +34,10 @@ require_once("functions.inc");
require_once("pkg-utils.inc");
require_once("globals.inc");
+$uname=posix_uname();
+if ($uname['machine']=='amd64')
+ ini_set('memory_limit', '250M');
+
function px_text_area_decode($text){
return preg_replace('/\r\n/', "\n",base64_decode($text));
}
@@ -148,7 +152,7 @@ function check_cron(){
"command"=> $cron_cmd);
switch ($matches[2]){
case m:
- $cron_postfix["month"]="*/".$matches[1];
+ $cron_postfix["minute"]="*/".$matches[1];
break;
case h:
$cron_postfix["minute"]="0";
@@ -204,11 +208,13 @@ function check_cron(){
#check valid_recipients cron
if ($cron["command"] == $cron_cmd){
#postfix cron cmd found
- if($postfix_enabled=="on")
+ if($postfix_enabled=="on"){
$cron_found=$cron;
- if($postfix_recipients_config['enable_ldap'] && $postfix_enabled=="on")
- #update cron schedule
- $new_cron['item'][]=$cron_postfix;
+ if($postfix_recipients_config['enable_ldap'] || $postfix_recipients_config['enable_url']){
+ #update cron schedule
+ $new_cron['item'][]=$cron_postfix;
+ }
+ }
}
#check sqlite update queue
else if(!preg_match("/.usr.local.www.postfix.php/",$cron["command"])){
@@ -219,7 +225,7 @@ function check_cron(){
}
$write_cron=1;
# Check if crontab must be changed to valid recipients cmd
- if ($postfix_recipients_config['enable_ldap']){
+ if ($postfix_recipients_config['enable_ldap'] || $postfix_recipients_config['enable_url']){
if ($cron_found!=$cron_postfix){
#update postfix cron schedule
if (! is_array($cron_found) && $postfix_enabled=="on")
@@ -268,6 +274,17 @@ function check_cron(){
function sync_package_postfix() {
global $config;
+ # detect boot process
+ if (is_array($_POST)){
+ if (preg_match("/\w+/",$_POST['__csrf_magic']))
+ unset($boot_process);
+ else
+ $boot_process="on";
+ }
+
+ if(is_process_running("master") && isset($boot_process))
+ return;
+
#check patch in /etc/inc/config.
$relay_domains = "";
$transport = "";
@@ -448,7 +465,9 @@ smtpd_sender_restrictions = reject_non_fqdn_sender,
permit
# Allow connections from specified local clients and strong check everybody else.
-smtpd_client_restrictions = check_client_access pcre:/usr/local/etc/postfix/cal_pcre,
+smtpd_client_restrictions = permit_mynetworks,
+ reject_unauth_destination,
+ check_client_access pcre:/usr/local/etc/postfix/cal_pcre,
check_client_access cidr:/usr/local/etc/postfix/cal_cidr,
reject_unknown_client_hostname,
reject_unauth_pipelining,
@@ -456,23 +475,22 @@ smtpd_client_restrictions = check_client_access pcre:/usr/local/etc/postfix/cal_
permit
smtpd_recipient_restrictions = permit_mynetworks,
+ reject_unauth_destination,
+ reject_unauth_pipelining,
check_client_access pcre:/usr/local/etc/postfix/cal_pcre,
check_client_access cidr:/usr/local/etc/postfix/cal_cidr,
+ check_sender_access hash:/usr/local/etc/postfix/sender_access,
reject_invalid_helo_hostname,
- reject_unknown_recipient_domain,
reject_non_fqdn_helo_hostname,
+ reject_unknown_recipient_domain,
reject_non_fqdn_recipient,
- reject_unauth_destination,
- reject_unauth_pipelining,
reject_multi_recipient_bounce,
- check_sender_access hash:/usr/local/etc/postfix/sender_access,
SPFSPFSPFRBLRBLRBL
EOF;
}
else
{
- #erro nas listas de bloqueio
$postfix_main .= <<<EOF
#Just reject after helo,sender,client,recipient tests
smtpd_delay_reject = yes
@@ -485,14 +503,20 @@ smtpd_sender_restrictions = reject_unknown_sender_domain,
RBLRBLRBL
# Allow connections from specified local clients and rbl check everybody else if rbl check are set.
-smtpd_client_restrictions = check_client_access pcre:/usr/local/etc/postfix/cal_pcre,
- check_client_access cidr:/usr/local/etc/postfix/cal_cidr,
+smtpd_client_restrictions = permit_mynetworks,
+ reject_unauth_destination,
+ check_sender_access hash:/usr/local/etc/postfix/sender_access,
+ check_client_access pcre:/usr/local/etc/postfix/cal_pcre,
+ check_client_access cidr:/usr/local/etc/postfix/cal_cidr
RBLRBLRBL
# Whitelisting: local clients may specify any destination domain.
#,
smtpd_recipient_restrictions = permit_mynetworks,
reject_unauth_destination,
+ check_sender_access hash:/usr/local/etc/postfix/sender_access,
+ check_client_access pcre:/usr/local/etc/postfix/cal_pcre,
+ check_client_access cidr:/usr/local/etc/postfix/cal_cidr,
SPFSPFSPFRBLRBLRBL
EOF;
@@ -678,7 +702,11 @@ MASTEREOF2;
touch("/etc/mail/aliases");
exec("/usr/local/bin/newaliases");
postfix_start();
- postfix_sync_on_changes();
+
+ #Do not sync during boot
+ if(!isset($boot_process))
+ postfix_sync_on_changes();
+
}
function postfix_start(){
global $config;