function Roundcubehack($instance,$account,$ip){ if($ip=="127.0.0.1"){return;} $enable=$GLOBALS["CLASS_SOCKET"]->GET_INFO("RoundCubeHackEnabled"); if($enable==null){$enable=1;} if($enable==0){return;} $maxCount=$GLOBALS["CLASS_SOCKET"]->GET_INFO("RoundCubeHackMaxAttempts"); $maxCountTimeMin=$GLOBALS["CLASS_SOCKET"]->GET_INFO("RoundCubeHackMaxAttemptsTimeMin"); $attempts=unserialize(base64_decode($GLOBALS["CLASS_SOCKET"]->GET_INFO("RoundCubeHackAttempts"))); if($maxCount==null){$maxCount=6;} if($maxCountTimeMin==null){$maxCountTimeMin=10;} $attempts_first_time=$attempts[$instance][$ip]["TIME"]; $attempts_count=$attempts[$instance][$ip]["COUNT"]; if($attempts_first_time==null){$attempts_first_time=time();} $minutes=calc_time_min($attempts_first_time); if($attempts_count==null){$attempts_count=0;} $attempts_count++; events("ROUNDCUBE HACK:: instance \"$instance\" $ip ($account) $attempts_count attempts/$maxCount in {$minutes}mn [ arraof: attempts[$instance][$ip] ]"); $attempts[$instance][$ip]["TIME"]=$attempts_first_time; $attempts[$instance][$ip]["COUNT"]=$attempts_count; if($attempts_count>=$maxCount){ if($minutes<=$maxCountTimeMin){ events("ROUNDCUBE HACK:: block $ip"); $unix=new unix(); $GLOBALS["CLASS_UNIX"]->send_email_events("RoundCube Hack: $ip from instance $instance is banned","Acount:<b>$account</b>"); $RoundCubeHackConfig=unserialize(base64_decode($GLOBALS["CLASS_SOCKET"]->GET_INFO("RoundCubeHackConfig"))); if(!isset($RoundCubeHackConfig[$instance][$ip])){ $RoundCubeHackConfig[$instance][$ip]=true; } unset($attempts[$instance][$ip]); $GLOBALS["CLASS_SOCKET"]->SaveConfigFile(base64_encode(serialize($RoundCubeHackConfig)),"RoundCubeHackConfig"); $GLOBALS["CLASS_UNIX"]->THREAD_COMMAND_SET("{$GLOBALS["LOCATE_PHP5_BIN"]} /usr/share/artica-postfix/exec.roundcube.php --hacks"); }else{ unset($attempts[$instance][$ip]); } } $GLOBALS["CLASS_SOCKET"]->SaveConfigFile(base64_encode(serialize($attempts)),"RoundCubeHackAttempts"); }
function group120() { if (!is_numeric($GLOBALS["TIME"]["GROUP120"])) { $GLOBALS["TIME"]["GROUP120"] = time(); return; } if ($GLOBALS["TIME"]["GROUP120"] == 0) { $GLOBALS["TIME"]["GROUP120"] = time(); return; } $mins = calc_time_min($GLOBALS["TIME"]["GROUP120"]); if ($mins < 120) { return; } $GLOBALS["TIME"]["GROUP120"] = time(); events("Starting {$GLOBALS["GROUP120"]}", __FUNCTION__, __LINE__); $array[] = "exec.apt-get.php --update"; $array[] = "exec.cleanfiles.php"; if ($GLOBALS["POSTFIX_INSTALLED"]) { $array[] = "exec.smtp.export.users.php --sync"; $array[] = "exec.quarantine-clean.php"; $array[] = "exec.awstats.php --postfix"; $array[] = "exec.awstats.php --cleanlogs"; $array[] = "exec.postfix.finder.php --logrotate"; } if ($GLOBALS["DANSGUARDIAN_INSTALLED"]) { $array["exec.dansguardian.compile.php --patterns"] = "exec.dansguardian.compile.php --patterns"; } if ($GLOBALS["CYRUS_IMAP_INSTALLED"]) { $array["exec.cyrus.php --DirectorySize"] = "exec.cyrus.php --DirectorySize"; } $array["exec.web-community-filter.php --export"] = "exec.web-community-filter.php --export"; if ($GLOBALS["KAV4PROXY_INSTALLED"]) { $array["exec.kav4proxy.buildstats.php --days"]; } while (list($index, $file) = each($array)) { $cmd = "{$GLOBALS["PHP5"]} /usr/share/artica-postfix/{$file}"; events("schedule {$cmd}", __FUNCTION__, __LINE__); $GLOBALS["CMDS"][] = $cmd; } $array2[] = "artica-install --awstats-generate"; $array2[] = "artica-update"; $array2[] = "artica-install --cups-drivers"; $array2[] = "artica-update --spamassassin-bl"; $array2[] = "artica-install -watchdog daemon"; $array2[] = "artica-make APP_MOD_QOS"; $array2[] = "artica-install --usb-scan-write"; if ($GLOBALS["EnableArticaWatchDog"] == 1) { $array2[] = "artica-install --urgency-start"; } while (list($index, $file) = each($array2)) { events("schedule {$cmd}", __FUNCTION__, __LINE__); $cmd = "/usr/share/artica-postfix/bin/{$file}"; $GLOBALS["CMDS"][] = $cmd; } $GLOBALS["CMDS"][] = "/etc/init.d/artica-postfix restart clamd"; @file_put_contents("/etc/artica-postfix/pids/" . basename(__FILE__) . ".GLOBALS", serialize($GLOBALS["TIME"])); }
function postfix_multi_status(){ if(!is_array($GLOBALS["MULTI-INSTANCES-LIST"])){$calc=true;} if($GLOBALS["MULTI-INSTANCES-TIME"]==null){$cacl=true;} if(calc_time_min($GLOBALS["MULTI-INSTANCES-TIME"])>5){$cacl=true;} $version=GetVersionOf("postfix"); if($GLOBALS["VERBOSE"]){echo "calc=\"$cacl\" postfix v$version\n";} if($calc){ $GLOBALS["MULTI-INSTANCES-LIST"]=$GLOBALS["CLASS_UNIX"]->POSTFIX_MULTI_INSTANCES_LIST(); $GLOBALS["MULTI-INSTANCES-TIME"]=time(); } if(is_array($GLOBALS["MULTI-INSTANCES-LIST"])){ while (list ($num, $instance) = each ($GLOBALS["MULTI-INSTANCES-LIST"]) ){ if($instance==null){continue;} $l[]="[POSTFIX-MULTI-$instance]"; $l[]="service_name=$instance"; $l[]="master_version=".GetVersionOf("postfix"); $l[]="service_cmd=postfix-multi"; $l[]="service_disabled=1"; $l[]="remove_cmd=--postfix-remove"; $l[]="family=postfix"; $master_pid=$GLOBALS["CLASS_UNIX"]->POSTFIX_MULTI_PID($instance); if(!$GLOBALS["CLASS_UNIX"]->process_exists($master_pid)){ $l[]="";return implode("\n",$l);return; } $l[]=GetMemoriesOf($master_pid); $l[]=""; } } if(is_array($l)){return implode("\n",$l);} }