aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rwxr-xr-xconfig/postfix/postfix.inc126
-rw-r--r--config/postfix/postfix.php50
-rwxr-xr-xconfig/postfix/postfix.widget.php25
-rw-r--r--config/postfix/postfix.xml2
-rwxr-xr-xconfig/postfix/postfix_about.php10
-rw-r--r--config/postfix/postfix_acl.xml2
-rw-r--r--config/postfix/postfix_antispam.xml4
-rw-r--r--config/postfix/postfix_domains.xml4
-rwxr-xr-xconfig/postfix/postfix_queue.php30
-rw-r--r--config/postfix/postfix_recipients.xml2
-rwxr-xr-xconfig/postfix/postfix_search.php20
-rw-r--r--config/postfix/postfix_sync.xml2
-rw-r--r--config/postfix/postfix_view_config.php22
13 files changed, 150 insertions, 149 deletions
diff --git a/config/postfix/postfix.inc b/config/postfix/postfix.inc
index 50979f38..8f27680d 100755
--- a/config/postfix/postfix.inc
+++ b/config/postfix/postfix.inc
@@ -3,7 +3,7 @@
postfix.inc
part of the Postfix package for pfSense
Copyright (C) 2010 Erik Fonnesbeck
- Copyright (C) 2011-2013 Marcello Coutinho
+ Copyright (C) 2011-2014 Marcello Coutinho
All rights reserved.
@@ -40,14 +40,14 @@ if ($pf_version > 2.0)
define('POSTFIX_LOCALBASE', '/usr/pbi/postfix-' . php_uname("m"));
else
define('POSTFIX_LOCALBASE','/usr/local');
-
+
$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));
+ return preg_replace('/\r\n/', "\n",base64_decode($text));
}
function px_get_real_interface_address($iface) {
@@ -85,8 +85,8 @@ function sync_relay_recipients($via_cron="cron"){
if (!file_exists($ldap_recipients))
system('/usr/bin/touch '. $ldap_recipients);
$relay_ldap_recipients=file_get_contents($ldap_recipients);
- }
- else{
+ }
+ else{
#running via crontab, time to get ldap content.
$ldap_temp=array();
foreach ($postfix_recipients_config['row'] as $postfix_ldap) {
@@ -121,7 +121,7 @@ function sync_relay_recipients($via_cron="cron"){
print "Total ldap recipients:".count($ldap_all)."\tunique:".count($ldap_unique)."\n";
foreach($ldap_unique as $recipient)
$relay_ldap_recipients.=($recipient != ""?preg_replace("/\s+/","",$recipient)." OK\n":"");
-
+
#save ldap relay recipients
file_put_contents(POSTFIX_LOCALBASE."/etc/postfix/relay_ldap_recipients.txt",$relay_ldap_recipients, LOCK_EX);
}
@@ -137,11 +137,11 @@ function sync_relay_recipients($via_cron="cron"){
}
if($relay_recipients !="" || $relay_ldap_recipients!="")
return("relay_recipient_maps = hash:".POSTFIX_LOCALBASE."/etc/postfix/relay_recipients\n");
-
+
}
function check_cron(){
global $config, $g;
- #check crontab
+ #check crontab
$new_cron=array();
$cron_cmd_sqlite = "";
$cron_postfix_sqlite="";
@@ -207,7 +207,7 @@ function check_cron(){
}
}
}
-
+
#check crontab relay recipients
$cron_found="";
if (is_array($config['cron']['item'])){
@@ -224,7 +224,7 @@ function check_cron(){
}
}
}
- #check sqlite update queue
+ #check sqlite update queue
else if(!preg_match("/.usr.local.www.postfix.php/",$cron["command"])){
#keep all non postfix cron cmds if not empty
if ($cron["command"] != "")
@@ -235,7 +235,7 @@ function check_cron(){
# Check if crontab must be changed to valid recipients cmd
if ($postfix_recipients_config['enable_ldap'] || $postfix_recipients_config['enable_url']){
if ($cron_found!=$cron_postfix){
- #update postfix cron schedule
+ #update postfix cron schedule
if (! is_array($cron_found) && $postfix_enabled=="on")
$new_cron['item'][]=$cron_postfix;
$write_cron=1;
@@ -255,7 +255,7 @@ function check_cron(){
}
}
- #call cron functions
+ #call cron functions
if ($write_cron==1){
$config['cron']=$new_cron;
write_config('Postfix - sync remote sqlite database',$backup = false);
@@ -271,17 +271,17 @@ function check_cron(){
else
$new_crontab .= $line;
}
- if ($old_cron==1)
+ if ($old_cron==1)
file_put_contents("/etc/crontab",$new_crontab, LOCK_EX);
-
+
#print "<pre>". var_dump($new_cron). var_dump($cron_postfix_sqlite).var_dump($config['cron']);
#exit;
-
-
+
+
}
function sync_package_postfix($via_rpc="no") {
global $config;
-
+
log_error("sync_package_postfix called with via_rpc={$via_rpc}");
# detect boot process
if (is_array($_POST)){
@@ -290,10 +290,10 @@ function sync_package_postfix($via_rpc="no") {
else
$boot_process="on";
}
-
+
if(is_process_running("master") && isset($boot_process) && $via_rpc=="no")
return;
-
+
#check patch in /etc/inc/config.
$relay_domains = "";
$transport = "";
@@ -346,10 +346,10 @@ function sync_package_postfix($via_rpc="no") {
}
file_put_contents($sys_log_file,$new_sys_log, LOCK_EX);
#mwexec('/usr/local/bin/php -q /usr/local/www/postfix_syslog.php');
- #restart syslog daemon
+ #restart syslog daemon
system_syslogd_start();
}
-
+
#check_debug
if($postfix_config['debug_list'] && $postfix_config['debug_list']!=""){
$check_debug ="\n#Debugging postfix\n";
@@ -358,7 +358,7 @@ function sync_package_postfix($via_rpc="no") {
}
#check relay recipients
$all_relay_recipients=sync_relay_recipients('gui');
-
+
$copyright=<<<ABOUT
#Part of the Postfix package for pfSense
#Copyright (C) 2010 Erik Fonnesbeck
@@ -416,14 +416,14 @@ EOF;
$cal_cidr = px_text_area_decode($config['installedpackages']['postfixacl']['config'][0]['cal_cidr']);
else
#formatar o arquivo retirando os 'oks'
- $cal_cidr_tmp = px_text_area_decode($config['installedpackages']['postfixacl']['config'][0]['cal_cidr']);
+ $cal_cidr_tmp = px_text_area_decode($config['installedpackages']['postfixacl']['config'][0]['cal_cidr']);
$cal_cidr = preg_replace('/ ok/i'," permit",$cal_cidr_tmp);
}
#Client PCRE
if ($config['installedpackages']['postfixacl']['config'][0]['cal_pcre']){
$cal_pcre = px_text_area_decode($config['installedpackages']['postfixacl']['config'][0]['cal_pcre']);
}
- $postfix_main .= px_text_area_decode($postfix_config['maincf'])."\n".
+ $postfix_main .= px_text_area_decode($postfix_config['maincf'])."\n".
"relay_domains ={$relay_domains}\n" .
"transport_maps = hash:".POSTFIX_LOCALBASE."/etc/postfix/transport\n" .
"local_recipient_maps =\n" .
@@ -434,7 +434,7 @@ EOF;
"default_process_limit = {$process_limit}\n";
#assign antispam options
$antispam=$config['installedpackages']['postfixantispam']['config'][0];
-
+
if($antispam['antispam_enabled']){
switch ($antispam['antispam_software']){
case "mailscanner":
@@ -452,16 +452,16 @@ smtpd_client_restrictions = check_policy_service {$antispam['antispam_location']
smtpd_restriction_classes =
has_our_domain_as_sender
client_throttle
-smtpd_end_of_data_restrictions = check_policy_service {$antispam['antispam_location']}
+smtpd_end_of_data_restrictions = check_policy_service {$antispam['antispam_location']}
EOF;
}
else{
- $postfix_main_antispam = "Policyd v2 has no location set.\n\n";
+ $postfix_main_antispam = "Policyd v2 has no location set.\n\n";
}
break;
- }
+ }
}
if ($antispam['reject_unknown_helo_hostname']){
$reject_unknown_helo_hostname = <<<EOF
@@ -470,7 +470,7 @@ smtpd_helo_restrictions = check_helo_access pcre:{$pf_dir}/etc/postfix/helo_chec
reject_invalid_helo_hostname,
reject_non_fqdn_helo_hostname,
permit
-
+
EOF;
}
if ($antispam['header_check'] == "strong")
@@ -492,7 +492,7 @@ smtpd_sender_restrictions = reject_non_fqdn_sender,
reject_multi_recipient_bounce,
permit
-# Allow connections from specified local clients and strong check everybody else.
+# Allow connections from specified local clients and strong check everybody else.
smtpd_client_restrictions = permit_mynetworks,
reject_unauth_destination,
check_client_access pcre:{$pf_dir}/etc/postfix/cal_pcre,
@@ -500,7 +500,7 @@ smtpd_client_restrictions = permit_mynetworks,
reject_unknown_client_hostname,
reject_unauth_pipelining,
reject_multi_recipient_bounce,
- permit
+ permit
smtpd_recipient_restrictions = permit_mynetworks,
reject_unauth_destination,
@@ -522,13 +522,13 @@ else
$postfix_main .= <<<EOF
#Just reject after helo,sender,client,recipient tests
smtpd_delay_reject = yes
-
+
# Don't talk to mail systems that don't know their own hostname.
smtpd_helo_required = yes
{$reject_unknown_helo_hostname}
smtpd_sender_restrictions = reject_unknown_sender_domain,
- RBLRBLRBL
+ RBLRBLRBL
# Allow connections from specified local clients and rbl check everybody else if rbl check are set.
smtpd_client_restrictions = permit_mynetworks,
@@ -540,7 +540,7 @@ smtpd_client_restrictions = permit_mynetworks,
# Whitelisting: local clients may specify any destination domain.
#,
-smtpd_recipient_restrictions = permit_mynetworks,
+smtpd_recipient_restrictions = permit_mynetworks,
reject_unauth_destination,
check_sender_access hash:{$pf_dir}/etc/postfix/sender_access,
check_client_access pcre:{$pf_dir}/etc/postfix/cal_pcre,
@@ -571,16 +571,16 @@ switch ($antispam['zombie_blocker'])
case "ignore":
$postscreen=1;
break;
-
+
case "disabled":
$postscreen=0;
break;
}
if ($antispam['soft_bounce'] == "enabled")
{
- $postfix_main.="soft_bounce = yes\n";
+ $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();
@@ -633,7 +633,7 @@ switch ($antispam['zombie_blocker'])
if(preg_match("/postscreen_greet_check/",$antispam['after_greeting'])){
$postfix_main.="postscreen_greet_action = ".$antispam['zombie_blocker']."\n";
}
-
+
$postfix_main.="postscreen_access_list = permit_mynetworks,\n\t\t\tcidr:".POSTFIX_LOCALBASE."/etc/postfix/cal_cidr\n";
$postfix_main.="postscreen_dnsbl_action= ".$antispam['zombie_blocker']."\n";
$postfix_main.="postscreen_blacklist_action= ".$antispam['zombie_blocker']."\n";
@@ -674,7 +674,7 @@ MASTEREOF;
$rbl2.= $prefix."reject_rbl_client $rbl,\n";
}
}
-
+
#interface loop
/*$postfix_inets="";
$ifaces = ($postfix_config['enabled_interface'] ? $postfix_config['enabled_interface'] : 'loopback');
@@ -688,16 +688,16 @@ MASTEREOF;
}
*/
$postfix_master ="25 inet n - n - - smtpd\n";
-
+
}
$rbl2.=($rbl2 !=""?"\t\t\t\tpermit\n":"permit\n");
$postfix_main=preg_replace("/RBLRBLRBL/",$rbl2,$postfix_main);
-
+
#Header Maps
$anvil_config=$config['installedpackages']['postfixantispam']['config'][0]['anvil'];
if ($anvil_config =='enabled' || ($anvil_config =='postscreen' && $postscreen==1))
$anvil='anvil unix - - n - 1 anvil';
-
+
$postfix_master .= <<<MASTEREOF2
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
@@ -725,7 +725,7 @@ scache unix - - n - 1 scache
{$anvil}
MASTEREOF2;
-
+
conf_mount_rw();
log_error("Writing out configuration");
@@ -745,13 +745,13 @@ MASTEREOF2;
{
mwexec(POSTFIX_LOCALBASE."/sbin/postmap ".POSTFIX_LOCALBASE."/etc/postfix/".$file);
}
-
+
#check postix dirs
$dirs=array("/var/spool/postfix","/etc/mail","/var/db/postfix","/var/mail/postfix");
foreach ($dirs as $dir)
if (!is_dir($dir) && !file_exists($dir))
mkdir($dir, 0755,TRUE);
-
+
#check postfix owners
$dirs=array("/var/db/postfix","/var/mail/postfix");
foreach ($dirs as $dir){
@@ -762,27 +762,27 @@ MASTEREOF2;
touch("/etc/mail/aliases");
exec("/usr/local/bin/newaliases");
postfix_start();
-
+
#Do not sync during boot
if(!isset($boot_process) || $via_rpc=="yes")
postfix_sync_on_changes();
-
+
}
function postfix_start(){
global $config;
$pf_dir=POSTFIX_LOCALBASE;
$start=<<<EOF
-
+
sysctl kern.ipc.nmbclusters=65536
sysctl kern.ipc.somaxconn=16384
sysctl kern.maxfiles=131072
sysctl kern.maxfilesperproc=104856
sysctl kern.threads.max_threads_per_proc=4096
{$pf_dir}/sbin/postfix start
-
+
EOF;
$stop = POSTFIX_LOCALBASE."/sbin/postfix stop\n";
- log_error("Writing rc_file");
+ log_error("Writing rc_file");
write_rcfile(array("file" => "postfix.sh", "start" => $start, "stop" => $stop));
sleep(1);
@@ -797,7 +797,7 @@ EOF;
mwexec("/usr/local/etc/rc.d/postfix.sh stop");
system('/bin/chmod -x /usr/local/etc/rc.d/postfix.sh');
}
-
+
conf_mount_ro();
}
@@ -806,11 +806,11 @@ function postfix_validate_input($post, &$input_errors) {
if (empty($value))
continue;
if($key == "greet_time" && !preg_match("/(\d+),(\d+)(s|m|h|w)/",$value))
- $input_errors[] = "Wrong greet time sintax.";
+ $input_errors[] = "Wrong greet time sintax.";
if($key == "message_size_limit" && !is_numeric($value))
$input_errors[] = "Message size limit must be numeric.";
if($key == "process_limit" && !is_numeric($value))
- $input_errors[] = "Process limit must be numeric.";
+ $input_errors[] = "Process limit must be numeric.";
if($key == "freq" && (!preg_match("/^\d+(h|m|d)$/",$value) || $value == 0))
$input_errors[] = "A valid number with a time reference is required for the field 'Frequency'";
if (substr($key, 0, 2) == "dc" && !is_hostname($value))
@@ -845,7 +845,7 @@ function postfix_php_deinstall_command() {
/* Uses XMLRPC to synchronize the changes to a remote node */
function postfix_sync_on_changes() {
- global $config, $g;
+ global $config, $g;
if (is_array($config['installedpackages']['postfixsync']['config'])){
$postfix_sync=$config['installedpackages']['postfixsync']['config'][0];
$synctimeout = $postfix_sync['synctimeout'];
@@ -877,7 +877,7 @@ function postfix_sync_on_changes() {
log_error("[postfix] xmlrpc sync is enabled but there is no system backup hosts to push postfix config.");
return;
}
- break;
+ break;
default:
return;
break;
@@ -905,13 +905,13 @@ function postfix_do_xmlrpc_sync($sync_to_ip,$username,$password,$sync_type,$sync
if(!$username)
$username="admin";
-
+
if(!$password)
return;
if(!$sync_to_ip)
return;
-
+
if(!$synctimeout)
$synctimeout=120;
@@ -923,9 +923,9 @@ function postfix_do_xmlrpc_sync($sync_to_ip,$username,$password,$sync_type,$sync
$port = $config['system']['webgui']['port'];
/* if port is empty lets rely on the protocol selection */
if($port == "") {
- if($config['system']['webgui']['protocol'] == "http")
+ if($config['system']['webgui']['protocol'] == "http")
$port = "80";
- else
+ else
$port = "443";
}
$synchronizetoip .= $sync_to_ip;
@@ -948,7 +948,7 @@ function postfix_do_xmlrpc_sync($sync_to_ip,$username,$password,$sync_type,$sync
XML_RPC_encode($password),
XML_RPC_encode($xml)
);
-
+
/* set a few variables needed for sync code borrowed from filter.inc */
$url = $synchronizetoip;
log_error("Beginning Postfix XMLRPC sync to {$url}:{$port}.");
@@ -973,18 +973,18 @@ function postfix_do_xmlrpc_sync($sync_to_ip,$username,$password,$sync_type,$sync
} else {
log_error("Postfix XMLRPC sync successfully completed with {$url}:{$port}.");
}
-
+
/* tell postfix to reload our settings on the destionation sync host. */
$method = 'pfsense.exec_php';
$execcmd = "require_once('/usr/local/pkg/postfix.inc');\n";
$execcmd .= "sync_package_postfix('yes');";
-
+
/* assemble xmlrpc payload */
$params = array(
XML_RPC_encode($password),
XML_RPC_encode($execcmd)
);
-
+
log_error("postfix XMLRPC reload data {$url}:{$port}.");
$msg = new XML_RPC_Message($method, $params);
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
diff --git a/config/postfix/postfix.php b/config/postfix/postfix.php
index 774c7573..4cf85033 100644
--- a/config/postfix/postfix.php
+++ b/config/postfix/postfix.php
@@ -2,7 +2,7 @@
/*
postfix.php
part of pfSense (https://www.pfsense.org/)
- Copyright (C) 2011-2013 Marcello Coutinho <marcellocoutinho@gmail.com>
+ Copyright (C) 2011-2014 Marcello Coutinho <marcellocoutinho@gmail.com>
based on varnish_view_config.
All rights reserved.
@@ -42,13 +42,13 @@ function get_remote_log(){
$curr_time = time();
$log_time=date('YmdHis',$curr_time);
#get protocol
- if($config['system']['webgui']['protocol'] != "")
+ if($config['system']['webgui']['protocol'] != "")
$synchronizetoip = $config['system']['webgui']['protocol']. "://";
#get port
$port = $config['system']['webgui']['port'];
- #if port is empty lets rely on the protocol selection
+ #if port is empty lets rely on the protocol selection
if($port == "")
- $port =($config['system']['webgui']['protocol'] == "http"?"80":"443");
+ $port =($config['system']['webgui']['protocol'] == "http"?"80":"443");
$synchronizetoip .= $sync_to_ip;
if (is_array($config['installedpackages']['postfixsync']))
foreach($config['installedpackages']['postfixsync']['config'][0]['row'] as $sh){
@@ -59,7 +59,7 @@ function get_remote_log(){
#get remote data
if ($sync_type=='fetch'){
$url= $synchronizetoip . $sync_to_ip;
- print "$sync_to_ip $url, $port\n";
+ print "$sync_to_ip $url, $port\n";
$method = 'pfsense.exec_php';
$execcmd = "require_once('/usr/local/www/postfix.php');\n";
$execcmd .= '$toreturn=get_sql('.$log_time.');';
@@ -93,7 +93,7 @@ function get_remote_log(){
die ("Cannot execute query. $error\n".$update['sql']."\n");
}
else{
- if ($debug=true)
+ if ($debug=true)
print "ok\n";
}
sqlite_close($dbhandle);
@@ -114,12 +114,12 @@ function get_remote_log(){
$resp = $cli->send($msg, "250");
}
}
- }
+ }
}
function get_sql($log_time){
global $config,$xmlrpc_g;
$server=$_SERVER['REMOTE_ADDR'];
-
+
if (is_array($config['installedpackages']['postfixsync']))
foreach($config['installedpackages']['postfixsync']['config'][0]['row'] as $sh){
$sync_to_ip = $sh['ipaddress'];
@@ -141,7 +141,7 @@ function flush_sql($log_time){
function grep_log(){
global $postfix_dir,$postfix_arg,$config,$g;
-
+
$total_lines=0;
$days=array();
$grep="\(MailScanner\|postfix.cleanup\|postfix.smtp\|postfix.error\|postfix.qmgr\)";
@@ -203,7 +203,7 @@ function grep_log(){
#Nov 16 00:00:14 srvch011 postfix/smtp[7363]: 7AEB91F797D: to=<alessandra.bueno@mg.test.com>, relay=mail.mg.test.com[172.25.3.5]:25, delay=39, delays=35/1.1/0.04/2.7, dsn=5.7.1, status=bounced (host mail.mg.test.com[172.25.3.5] said: 550 5.7.1 Unable to relay for alessandra.bueno@mg.test.com (in reply to RCPT TO command))
else if(preg_match("/(\w+\s+\d+\s+[0-9,:]+) (\w+) postfix.\w+\W\d+\W+(\w+): to=\<(.*)\>, relay=(.*), delay=([0-9,.]+), .* dsn=([0-9,.]+), status=(\w+) (.*)/",$line,$email)){
$stm_queue[$day].= "insert or ignore into mail_status (info) values ('".$email[8]."');\n";
- $stm_queue[$day].= "insert or ignore into mail_to (from_id,too,status,status_info,relay,delay,dsn) values ((select id from mail_from where sid='".$email[3]."' and server='".$email[2]."'),'".strtolower($email[4])."',(select id from mail_status where info='".$email[8]."'),'".preg_replace("/(\<|\>|\s+|\'|\")/"," ",$email[9])."','".$email[5]."','".$email[6]."','".$email[7]."');\n";
+ $stm_queue[$day].= "insert or ignore into mail_to (from_id,too,status,status_info,relay,delay,dsn) values ((select id from mail_from where sid='".$email[3]."' and server='".$email[2]."'),'".strtolower($email[4])."',(select id from mail_status where info='".$email[8]."'),'".preg_replace("/(\<|\>|\s+|\'|\")/"," ",$email[9])."','".$email[5]."','".$email[6]."','".$email[7]."');\n";
$stm_queue[$day].= "update or ignore mail_to set status=(select id from mail_status where info='".$email[8]."'), status_info='".preg_replace("/(\<|\>|\s+|\'|\")/"," ",$email[9])."', dsn='".$email[7]."', delay='".$email[6]."', relay='".$email[5]."', too='".strtolower($email[4])."' where from_id in (select id from mail_from where sid='".$email[3]."' and server='".$email[2]."');\n";
}
#Nov 13 01:48:44 srvch011 postfix/cleanup[16914]: D995B1F570B: message-id=<61.40.11745.10E3FBE4@ofertas6>
@@ -223,7 +223,7 @@ function grep_log(){
$stm_queue[$day].= "insert or ignore into mail_status (info) values ('".$email[8]."');\n";
$stm_queue[$day].= "update mail_to set status=(select id from mail_status where info='reject'), status_info='queue file size limit exceeded' where from_id in (select id from mail_from where sid='".$email[3]."' and server='".$email[2]."');\n";
}
-
+
#Nov 9 02:14:57 srvch011 postfix/cleanup[6856]: 617A51F5AC5: warning: header Subject: Mapeamento de Processos from lxalpha.12b.com.br[66.109.29.225]; from=<apache@lxalpha.12b.com.br> to=<ritiele.faria@mail.test.com> proto=ESMTP helo=<lxalpha.12b.com.br>
#Nov 8 09:31:50 srvch011 postfix/cleanup[11471]: 19C281F59C8: reject: header From: "Giuliana Flores - Parceiro do Grupo Virtual" <publicidade@parceiro-grupovirtual.com.br> from pm03-974.auinmeio.com.br[177.70.232.225]; from=<publicidade@parceiro-grupovirtual.com.br> to=<jorge.lustosa@mail.test.com> proto=ESMTP helo=<pm03-974.auinmeio.com.br>: 5.7.1 [SN007]
#Nov 13 00:03:24 srvch011 postfix/cleanup[4192]: 8A5B31F52D2: reject: body http://platform.roastcrack.info/mj0ie6p-48qtiyq from move2.igloojack.info[173.239.63.16]; from=<ljmd6u8lrxke4@move2.igloojack.info> to=<edileva@aasdf..br> proto=SMTP helo=<move2.igloojack.info>: 5.7.1 [BD040]
@@ -271,9 +271,9 @@ function grep_log(){
$status['status_info']=$email[4];
$status['from']=$email[5];
$status['to']=$email[6];
- $status['helo']=$email[7];
+ $status['helo']=$email[7];
$values="'".$status['date']."','".$status['status']."','".$status['status_info']."','".strtolower($status['from'])."','".strtolower($status['to'])."','".$status['helo']."','".$status['server']."'";
- $stm_noqueue[$day].='insert or ignore into mail_noqueue(date,status,status_info,fromm,too,helo,server) values ('.$values.');'."\n";
+ $stm_noqueue[$day].='insert or ignore into mail_noqueue(date,status,status_info,fromm,too,helo,server) values ('.$values.');'."\n";
}
if ($total_lines%1500 == 0){
#save log in database
@@ -295,7 +295,7 @@ function grep_log(){
$stm_queue[$d]="BEGIN;\n";
}
}
-
+
$config=parse_xml_config("{$g['conf_path']}/config.xml", $g['xml_rootobj']);
//print count($config['installedpackages']);
#start db replication if configured
@@ -310,7 +310,7 @@ function grep_log(){
postfix_do_xmlrpc_sync($sync_to_ip, $password,$sync_type);
print "ok\n";
}
-
+
}
function write_db($stm,$table,$days){
@@ -341,7 +341,7 @@ function write_db($stm,$table,$days){
if ($debug=true)
print " writing to local db $day...";
$dbhandle = sqlite_open($postfix_dir.$day.".db", 0666, $error);
- if (!$dbhandle) die ($error);
+ if (!$dbhandle) die ($error);
#file_put_contents("/tmp/".$key.'-'.$update['day'].".sql",gzuncompress(base64_decode($update['sql'])), LOCK_EX);
$ok = sqlite_exec($dbhandle, $stm[$day]."COMMIT;", $error);
if (!$ok){
@@ -356,13 +356,13 @@ function write_db($stm,$table,$days){
}
#write update sql files
if (count ($do_sync) > 0 ){
-
+
foreach($do_sync as $ip)
file_put_contents('/var/db/postfix/'.$ip.'.sql',${$ip},LOCK_EX);
conf_mount_ro();
}
#write local file
-
+
}
function create_db($postfix_db){
@@ -513,14 +513,14 @@ switch ($argv[1]){
'12:','13:','14:','15:','16:','17:','18:','19:','20:','21:','22:','23:'),
'time' => '-03 day');
break;
-
+
default:
die ("invalid parameters\n");
}
# get remote log from remote server
get_remote_log();
# get local log from logfile
-grep_log();
+grep_log();
}
#http client call
@@ -540,7 +540,7 @@ if ($_REQUEST['files']!= ""){
$stm_fetch=array();
$total_result=0;
foreach ($files as $postfix_db)
- if (file_exists($postfix_dir.'/'.$postfix_db)){
+ if (file_exists($postfix_dir.'/'.$postfix_db)){
$dbhandle = sqlite_open($postfix_dir.'/'.$postfix_db, 0666, $error);
if ($_REQUEST['from']!= ""){
$next=($last_next==" and "?" and ":" where ");
@@ -595,7 +595,7 @@ if ($_REQUEST['files']!= ""){
else
$stm .=$next."server = '".$_REQUEST['server']."'";
}
-
+
if ($_REQUEST['status']!= ""){
$next=($last_next==" and "?" and ":" where ");
$last_next=" and ";
@@ -604,7 +604,7 @@ if ($_REQUEST['files']!= ""){
#print "<pre>".$stm;
#$stm = "select * from mail_to,mail_status where mail_to.status=mail_status.id";
$result = sqlite_query($dbhandle, $stm." order by date desc $limit_prefix $limit ");
- #$result = sqlite_query($dbhandle, $stm." $limit_prefix $limit ");
+ #$result = sqlite_query($dbhandle, $stm." $limit_prefix $limit ");
if (preg_match("/\d+/",$_REQUEST['limit'])){
for ($i = 1; $i <= $limit; $i++) {
$row = sqlite_fetch_array($result, SQLITE_ASSOC);
@@ -744,8 +744,8 @@ if ($_REQUEST['files']!= ""){
print '<tr>';
print '<td ><strong>Total:</strong></td>';
print '<td ><strong>'.$total_result.'</strong></td>';
- print '</tr>';
+ print '</tr>';
print '</table>';
- }
+ }
}
?> \ No newline at end of file
diff --git a/config/postfix/postfix.widget.php b/config/postfix/postfix.widget.php
index b7fc7af9..e61274b9 100755
--- a/config/postfix/postfix.widget.php
+++ b/config/postfix/postfix.widget.php
@@ -1,6 +1,7 @@
-<?php
+<?php
/*
- Copyright 2011 Marcello Coutinho
+ postfix.widget.php
+ Copyright 2011-2014 Marcello Coutinho
Part of pfSense widgets (www.pfsense.org)
Redistribution and use in source and binary forms, with or without
@@ -31,7 +32,7 @@
$uname=posix_uname();
if ($uname['machine']=='amd64')
ini_set('memory_limit', '250M');
-
+
function open_table(){
echo "<table style=\"padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
echo" <tr>";
@@ -39,7 +40,7 @@ function open_table(){
function close_table(){
echo" </tr>";
echo"</table>";
-
+
}
$pfb_table=array();
@@ -49,20 +50,20 @@ $img['Healthy']="<img src ='/themes/{$g['theme']}/images/icons/icon_interface_up
#var_dump($pfb_table);
#exit;
-?><div id='postfix'><?php
+?><div id='postfix'><?php
global $config;
$size=$config['installedpackages']['postfix']['config'][0]['widget_size'];
if (preg_match('/\d+/',$config['installedpackages']['postfix']['config'][0]['widget_days']))
- $days=$config['installedpackages']['postfix']['config'][0]['widget_days'] * -1;
+ $days=$config['installedpackages']['postfix']['config'][0]['widget_days'] * -1;
else
$days=-3;
if (preg_match('/\d+/',$config['installedpackages']['postfix']['config'][0]['widget_size']))
- $size=$config['installedpackages']['postfix']['config'][0]['widget_size'];
+ $size=$config['installedpackages']['postfix']['config'][0]['widget_size'];
else
$size='100000000';#100mb
-
+
$postfix_dir="/var/db/postfix/";
$curr_time = time();
for ($z = 0; $z > $days; $z--){
@@ -71,7 +72,7 @@ if ($z==0)
$postfix_db=date("Y-m-d");
else
$postfix_db=date("Y-m-d",strtotime("$z day",$curr_time));
-
+
if (file_exists($postfix_dir.'/'.$postfix_db.".db")){
#noqueue
open_table();
@@ -83,7 +84,7 @@ if (file_exists($postfix_dir.'/'.$postfix_db.".db")){
$stm="select count(*) as total from mail_noqueue";
$result = sqlite_query($dbhandle, $stm);
$row_noqueue = sqlite_fetch_array($result, SQLITE_ASSOC);
-
+
#queue
$result = sqlite_query($dbhandle, $stm);
$stm="select mail_status.info as status,count(*) as total from mail_to,mail_status where mail_to.status=mail_status.id group by status order by mail_status.info";
@@ -96,7 +97,7 @@ if (file_exists($postfix_dir.'/'.$postfix_db.".db")){
if (preg_match("/\w+/",$row['status'])){
$reader.="<td class=\"listlr\"width=50%><strong>".ucfirst($row['status'])."</strong></td>\n";
if ($row['status']=="reject")
- $row['total']=+$row_noqueue['total'];
+ $row['total']=+$row_noqueue['total'];
$count.="<td class=\"listlr\">".$row['total']."</td>\n";
}
}
@@ -111,7 +112,7 @@ if (file_exists($postfix_dir.'/'.$postfix_db.".db")){
}
close_table();
echo "<br>";
-
+
}
}
echo" </tr>";
diff --git a/config/postfix/postfix.xml b/config/postfix/postfix.xml
index 46233828..8e70fd7a 100644
--- a/config/postfix/postfix.xml
+++ b/config/postfix/postfix.xml
@@ -10,7 +10,7 @@
postfix.xml
part of the Postfix package for pfSense
Copyright (C) 2010 Erik Fonnesbeck
- Copyright (C) 2011-2013 Marcello Coutinho
+ Copyright (C) 2011-2014 Marcello Coutinho
All rights reserved.
*/
diff --git a/config/postfix/postfix_about.php b/config/postfix/postfix_about.php
index 87d0cf69..397c8e06 100755
--- a/config/postfix/postfix_about.php
+++ b/config/postfix/postfix_about.php
@@ -2,7 +2,7 @@
/*
postfix_about.php
part of pfSense (https://www.pfsense.org/)
- Copyright (C) 2011-2013 Marcello Coutinho <marcellocoutinho@gmail.com>
+ Copyright (C) 2011-2014 Marcello Coutinho <marcellocoutinho@gmail.com>
based on varnish_view_config.
All rights reserved.
@@ -48,7 +48,7 @@ include("head.inc");
<?php if ($savemsg) print_info_box($savemsg); ?>
<!-- <form action="postfix_view_config.php" method="post"> -->
-
+
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
@@ -68,7 +68,7 @@ include("head.inc");
?>
</td></tr>
<tr>
-
+
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="8" cellspacing="0">
@@ -86,11 +86,11 @@ include("head.inc");
If you want that your donation goes to this package developer, make a note on donation forwarding it to me.<br><br>");?></td>
</tr>
</table>
-
+
</div>
</td>
</tr>
-
+
</table>
<br>
diff --git a/config/postfix/postfix_acl.xml b/config/postfix/postfix_acl.xml
index 60b23a22..8df5255e 100644
--- a/config/postfix/postfix_acl.xml
+++ b/config/postfix/postfix_acl.xml
@@ -9,7 +9,7 @@
/*
postfix.xml
part of the Postfix package for pfSense
- Copyright (C) 2011-2013 Marcello Coutinho
+ Copyright (C) 2011-2014 Marcello Coutinho
All rights reserved.
*/
/* ========================================================================== */
diff --git a/config/postfix/postfix_antispam.xml b/config/postfix/postfix_antispam.xml
index 6c3f5911..9d55e47e 100644
--- a/config/postfix/postfix_antispam.xml
+++ b/config/postfix/postfix_antispam.xml
@@ -7,9 +7,9 @@
/* $Id$ */
/* ========================================================================== */
/*
- postfix.xml
+ postfix_antispam.xml
part of the Postfix package for pfSense
- Copyright (C) 2011 Marcello Coutinho
+ Copyright (C) 2011-2014 Marcello Coutinho
All rights reserved.
*/
diff --git a/config/postfix/postfix_domains.xml b/config/postfix/postfix_domains.xml
index 539ef60e..ea19297d 100644
--- a/config/postfix/postfix_domains.xml
+++ b/config/postfix/postfix_domains.xml
@@ -7,10 +7,10 @@
/* $Id$ */
/* ========================================================================== */
/*
- postfix.xml
+ postfix_domains.xml
part of the Postfix package for pfSense
Copyright (C) 2010 Erik Fonnesbeck
- Copyright (C) 2011 Marcello Coutinho
+ Copyright (C) 2011-2014 Marcello Coutinho
All rights reserved.
*/
diff --git a/config/postfix/postfix_queue.php b/config/postfix/postfix_queue.php
index 7afd8fe7..4f072eba 100755
--- a/config/postfix/postfix_queue.php
+++ b/config/postfix/postfix_queue.php
@@ -2,7 +2,7 @@
/*
postfix_view_config.php
part of pfSense (https://www.pfsense.org/)
- Copyright (C) 2011-2013 Marcello Coutinho <marcellocoutinho@gmail.com>
+ Copyright (C) 2011-2014 Marcello Coutinho <marcellocoutinho@gmail.com>
based on varnish_view_config.
All rights reserved.
@@ -39,7 +39,7 @@ if ($pf_version > 2.0)
define('POSTFIX_LOCALBASE', '/usr/pbi/postfix-' . php_uname("m"));
else
define('POSTFIX_LOCALBASE','/usr/local');
-
+
function get_cmd(){
if ($_REQUEST['cmd'] =='mailq'){
#exec("/usr/local/bin/mailq" . escapeshellarg('^'.$m.$j." ".$hour.".*".$grep)." /var/log/maillog", $lists);
@@ -67,13 +67,13 @@ function get_cmd(){
elseif (preg_match("/\s+(\w+.*)/",$line,$matches) && $sid !=""){
print $td.$matches[1].'</td></tr>';
$sid="";
- }
+ }
}
print '</table>';
}
if ($_REQUEST['cmd'] =='qshape'){
if ($_REQUEST['qshape']!="")
- exec(POSTFIX_LOCALBASE."/bin/qshape -".preg_replace("/\W/","",$_REQUEST['type'])." ". preg_replace("/\W/","",$_REQUEST['qshape']), $qshape);
+ exec(POSTFIX_LOCALBASE."/bin/qshape -".preg_replace("/\W/","",$_REQUEST['type'])." ". preg_replace("/\W/","",$_REQUEST['qshape']), $qshape);
else
exec(POSTFIX_LOCALBASE."/bin/qshape", $qshape);
print '<table class="tabcont" width="100%" border="0" cellpadding="8" cellspacing="0">';
@@ -107,22 +107,22 @@ else{
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
if ($pf_version < 2.0)
$one_two = true;
-
+
$pgtitle = "Status: Postfix Mail Queue";
include("head.inc");
-
+
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
-
+
<?php if($one_two): ?>
<p class="pgtitle"><?=$pgtitle?></font></p>
<?php endif; ?>
-
+
<?php if ($savemsg) print_info_box($savemsg); ?>
-
+
<form action="postfix_view_config.php" method="post">
-
+
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
@@ -167,7 +167,7 @@ else{
<option value="1" selected>Never</option>
</select><br><?=gettext("Select how often queue cmd will run.");?></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("qshape Report flags: ");?></td>
<td width="78%" class="vtable">
<select name="drop3" id="qshape" multiple="multiple" size="5">
@@ -178,7 +178,7 @@ else{
<option value="maildrop">maildrop</option>
</select><br><?=gettext("Select how often queue will be queried.");?></td>
</tr>
- <tr>
+ <tr>
<td width="22%" valign="top" class="vncell"><?=gettext("qshape Report type: ");?></td>
<td width="78%" class="vtable">
<select name="drop3" id="qtype">
@@ -201,7 +201,7 @@ else{
<tr>
<td class="tabcont" >
<div id="file_div"></div>
-
+
</td>
</tr>
</table>
@@ -223,7 +223,7 @@ else{
}
return(selectedArray);
}
-
+
function get_queue(loop) {
//prevent multiple instances
if ($('run').value=="show queue" || loop== 'running'){
@@ -255,7 +255,7 @@ else{
}
}
</script>
- <?php
+ <?php
include("fend.inc");
}
?>
diff --git a/config/postfix/postfix_recipients.xml b/config/postfix/postfix_recipients.xml
index d8f9707e..946bd79f 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-2013 Marcello Coutinho
+ Copyright (C) 2011-2014 Marcello Coutinho
All rights reserved.
*/
/* ========================================================================== */
diff --git a/config/postfix/postfix_search.php b/config/postfix/postfix_search.php
index c29d8cf2..5e146269 100755
--- a/config/postfix/postfix_search.php
+++ b/config/postfix/postfix_search.php
@@ -2,7 +2,7 @@
/*
postfix_search.php
part of pfSense (https://www.pfsense.org/)
- Copyright (C) 2011-2013 Marcello Coutinho <marcellocoutinho@gmail.com>
+ Copyright (C) 2011-2014 Marcello Coutinho <marcellocoutinho@gmail.com>
based on varnish_view_config.
All rights reserved.
@@ -52,7 +52,7 @@ include("head.inc");
<?php if ($savemsg) print_info_box($savemsg); ?>
<!-- <form action="postfix_view_config.php" method="post"> -->
-
+
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
@@ -72,7 +72,7 @@ include("head.inc");
?>
</td></tr>
<tr>
-
+
<td>
<div id="mainarea">
<table class="tabcont" width="100%" border="0" cellpadding="8" cellspacing="0">
@@ -151,7 +151,7 @@ include("head.inc");
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Sqlite files: ");?></td>
<td width="78%" class="vtable">
-
+
<?php if ($handle = opendir('/var/db/postfix')) {
$total_files=0;
$array_files=array();
@@ -159,14 +159,14 @@ include("head.inc");
if (preg_match("/(\d+-\d+-\d+).db$/",$file,$matches))
$array_files[]=array($file,$matches[1]);
closedir($handle);
- asort($array_files);
+ asort($array_files);
foreach ($array_files as $file)
$select_output= '<option value="'.$file[0].'">'.$file[1]."</option>\n" . $select_output;
-
+
echo '<select name="drop1" id="Select1" size="'.(count($array_files)>10?10:count($array_files)+2).'" multiple="multiple">';
echo $select_output;
echo '</select><br>'.gettext("Select what database files you want to use in your search.").'</td></td>';
- }?>
+ }?>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Message Fields: ");?></td>
@@ -188,17 +188,17 @@ include("head.inc");
<option value="helo">Helo</option>
</select><br><?=gettext("Max log messages to fetch per Sqlite file.");?></td>
</tr>
-
+
<tr>
<td width="22%" valign="top"></td>
<td width="78%"><input name="Submit" type="submit" class="formbtn" id="search" value="<?=gettext("Search");?>" onclick="getsearch_results('search')">
&nbsp;<input name="Submit" type="submit" class="formbtn" id="export" value="<?=gettext("Export");?>" onclick="getsearch_results('export')"></td>
</table>
-
+
</div>
</td>
</tr>
-
+
</table>
<br>
diff --git a/config/postfix/postfix_sync.xml b/config/postfix/postfix_sync.xml
index 97a88e2c..727305ff 100644
--- a/config/postfix/postfix_sync.xml
+++ b/config/postfix/postfix_sync.xml
@@ -9,7 +9,7 @@
/*
postfix_sync.xml
part of the Postfix package for pfSense
- Copyright (C) 2011-2013 Marcello Coutinho
+ Copyright (C) 2011-2014 Marcello Coutinho
All rights reserved.
*/
/* ========================================================================== */
diff --git a/config/postfix/postfix_view_config.php b/config/postfix/postfix_view_config.php
index 24bfd575..f82c9371 100644
--- a/config/postfix/postfix_view_config.php
+++ b/config/postfix/postfix_view_config.php
@@ -2,7 +2,7 @@
/*
postfix_view_config.php
part of pfSense (https://www.pfsense.org/)
- Copyright (C) 2011-2013 Marcello Coutinho <marcellocoutinho@gmail.com>
+ Copyright (C) 2011-2014 Marcello Coutinho <marcellocoutinho@gmail.com>
based on varnish_view_config.
All rights reserved.
@@ -34,7 +34,7 @@ if ($pf_version > 2.0)
define('POSTFIX_LOCALBASE', '/usr/pbi/postfix-' . php_uname("m"));
else
define('POSTFIX_LOCALBASE','/usr/local');
-
+
function get_file($file){
$files['main']=POSTFIX_LOCALBASE."/etc/postfix/main.cf";
$files['master']=POSTFIX_LOCALBASE."/etc/postfix/master.cf";
@@ -59,22 +59,22 @@ else{
$pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
if ($pf_version < 2.0)
$one_two = true;
-
+
$pgtitle = "Services: Postfix View Configuration";
include("head.inc");
-
+
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
-
+
<?php if($one_two): ?>
<p class="pgtitle"><?=$pgtitle?></font></p>
<?php endif; ?>
-
+
<?php if ($savemsg) print_info_box($savemsg); ?>
-
+
<form action="postfix_view_config.php" method="post">
-
+
<div id="mainlevel">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td>
@@ -117,7 +117,7 @@ else{
<tr>
<td class="tabcont" >
<div id="file_div"></div>
-
+
</td>
</tr>
</table>
@@ -153,8 +153,8 @@ else{
scroll(0,0);
}
</script>
- <?php
- include("fend.inc");
+ <?php
+ include("fend.inc");
}
?>
</body>