function page_active_directory() { $acl = new squid_acls(); $ad = new external_ad_search(); $DNDUMP = $ad->DNDUMP($_GET["LoadGroupSettings"]); $GroupName = $DNDUMP["samaccountname"][0]; $RULES = $acl->GetRulesFromADGroup($GroupName); if ($GLOBALS["VERBOSE"]) { echo "<span style='color:red;font-size:22px'>{$GroupName}:: " . count($RULES) . " RULES</span><br>\n"; } if (is_array($RULES)) { while (list($key, $ligne) = each($RULES)) { $MAIN_SQUIDRULES[$key] = $ligne; } if ($GLOBALS["VERBOSE"]) { echo "<span style='color:red;font-size:28px'>{$GroupName}:: \$MAIN_SQUIDRULES:" . count($MAIN_SQUIDRULES) . " RULES</span><br>\n"; } } $sock = new sockets(); if ($sock->EnableUfdbGuard() == 1) { $MAIN_WEBRULES[0] = "{default}"; $RULES = $acl->GetWebfilteringRulesFromADGroup($GroupName); if ($GLOBALS["VERBOSE"]) { echo "<span style='color:red;font-size:22px'>{$GroupName}:: " . count($RULES) . " RULES</span><br>\n"; } if (is_array($RULES)) { while (list($key, $ligne) = each($RULES)) { $MAIN_WEBRULES[$key] = $ligne; } if ($GLOBALS["VERBOSE"]) { echo "<span style='color:red;font-size:22px'>{$GroupName}:: \$MAIN_WEBRULES:" . count($MAIN_WEBRULES) . " RULES</span><br>\n"; } } } if (count($MAIN_SQUIDRULES) > 0) { $rules_title = "{rules}"; if (count($MAIN_SQUIDRULES) < 2) { $rules_title = "{rule}"; } while (list($aclid, $aclname) = each($MAIN_SQUIDRULES)) { $jsGRP = "Loadjs('squid.acls-rules.php?Addacl-js=yes&ID={$aclid}');"; $XTRGB[] = "<tr>\n\t\t\t<td style='width:48px'><img src='img/folder-script-database-48.png'></td>\n\t\t\t<td style='font-size:22px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\"\n\t\t\tstyle='text-decoration:underline'>{$aclname}</a></td>\n\t\t\t</tr>"; } $proxay_acls = "</tr>\n\t\t<tr style='height:70px'>\n\t\t<td valign=middle style='font-size:30px' class=legend>" . count($MAIN_SQUIDRULES) . " {$rules_title} (Proxy):</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td><table style='width:100%'>" . @implode("", $XTRGB) . "</table></td>\n\t\t</tr>"; } if (count($MAIN_WEBRULES) > 0) { $XTRGB = array(); while (list($aclid, $aclname) = each($MAIN_WEBRULES)) { $jsGRP = "YahooWin3('1100','dansguardian2.edit.php?ID={$aclid}&t=0','{$aclid} {$aclname}');"; $XTRGB[] = "<tr>\n\t<td style='width:48px'><img src='img/folder-script-database-48.png'></td>\n\t<td style='font-size:22px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\"\n\tstyle='text-decoration:underline'>{$aclname}</a></td>\n\t</tr>"; } $rules_title = "{rules}"; if (count($MAIN_WEBRULES) < 2) { $rules_title = "{rule}"; } $webfilter_acls = "</tr>\n\t<tr style='height:70px'>\n\t<td valign=middle style='font-size:30px' class=legend>" . count($MAIN_WEBRULES) . " {$rules_title} ({webfiltering}):</td>\n\t</tr>\n\t<tr>\n\t<td></td>\n\t<td><table style='width:100%'>" . @implode("", $XTRGB) . "</table></td>\n\t</tr>"; } $tpl = new templates(); echo $tpl->_ENGINE_parse_body("<center style='width:98%' class=form><table style='width:100%'>{$proxay_acls}{$webfilter_acls}</table></center>"); }
function build() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $unix = new unix(); $sock = new sockets(); $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { die; } $php = $unix->LOCATE_PHP5_BIN(); @file_put_contents($pidfile, getmypid()); progress("{get_system_informations}", 30); support_step1(); progress("{APP_UFDBGUARD}", 40); $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); if ($EnableUfdbGuard == 1) { $ufdbguardd = $unix->find_program("ufdbguardd"); if (is_file($ufdbguardd)) { shell_exec("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force --verbose >/usr/share/artica-postfix/ressources/support/build-ufdbguard.log 2>&1"); } } progress("{get_all_logs}", 50); support_step2(); progress("{get_all_logs}", 70); export_tables(); progress("{compressing_package}", 90); support_step3(); progress("{success}", 100); }
function popup() { $tpl = new templates(); $page = CurrentPageName(); $sock = new sockets(); $EnableUfdbGuard = $sock->EnableUfdbGuard(); $SquidActHasReverse = $sock->GET_INFO("SquidActHasReverse"); $EnablePDNS = $sock->GET_INFO("EnablePDNS"); if (!is_numeric($EnableUfdbGuard)) { $EnableUfdbGuard = 0; } if (!is_numeric($SquidActHasReverse)) { $SquidActHasReverse = 0; } if (!is_numeric($EnablePDNS)) { $EnablePDNS = 0; } $help = "<hr>\n\t<div style='text-align:right'>\n\t<a href=\"javascript:blur();\"\n\tOnClick=\"javascript:s_PopUpFull('http://proxy-appliance.org/index.php?cID=365','1024','900');\"\n\tstyle=\"font-size:16px;font-weight:bold;text-decoration:underline\">{online_help}</a>\n\t</div>"; if ($EnablePDNS == 0) { echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{PDNS_IS_NOT_ENABLED}{$help}")); return; } if ($EnableUfdbGuard == 0) { echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{UFDBGUARD_NOT_ENABLED_EXPLAIN}{$help}")); return; } if ($SquidActHasReverse == 1) { echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{SQUID_IS_IN_REVERSE_MODE}{$help}")); return; } $t = time(); $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance"); if (!is_numeric($EnableRemoteStatisticsAppliance)) { $EnableRemoteStatisticsAppliance = 0; } $PDSNInUfdb = $sock->GET_INFO("PDSNInUfdb"); if (!is_numeric($PDSNInUfdb)) { $PDSNInUfdb = 0; } $PDSNInUfdbWebsite = $sock->GET_INFO("PDSNInUfdbWebsite"); if ($PDSNInUfdbWebsite == null) { $PDSNInUfdbWebsite = "google.com"; } $form = Paragraphe_switch_img("{activate_pdnsinufdb}", "{activate_pdnsinufdb_explain}", "PDSNInUfdb", $PDSNInUfdb, null, 550); $html = "\n\t<div id='{$t}'></div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td colspan=2>{$form}</td>\n\t</tR>\n\t<tr>\n\t<td class=legend style='font-size:16px'>{redirect_queries_to}:</td>\n\t<td>" . Field_text("PDSNInUfdbWebsite", $PDSNInUfdbWebsite, "font-size:16px;width:250px") . "</td>\n\t\t</tr>\n\n\n\t<tr>\n\t\t<td align='right' colspan=2><hr>" . button("{apply}", "Save{$t}()", "18px") . "</td>\n\t</tr>\n\t</table>\n\t{$help}\n\t\t\t<script>\n\t\t\tvar x_Save{$t}=function (obj) {\n\t\t\t\tvar tempvalue=obj.responseText;\n\t\t\t\tif(tempvalue.length>3){alert(tempvalue);}\n\t\t\t\tdocument.getElementById('{$t}').innerHTML='';\n\t\t\t\tif(document.getElementById('squid-status')){\n\t\t\t\t\tLoadAjax('squid-status','squid.main.quicklinks.php?status=yes');\n\t\t\t\t}\n\t\t\t\tYahooWin4Hide();\n\t\t\t}\n\n\t\t\tfunction Save{$t}(){\n\t\t\t\tvar lock={$EnableRemoteStatisticsAppliance};\n\t\t\t\tif(lock==1){Loadjs('squid.newbee.php?error-remote-appliance=yes');return;}\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('PDSNInUfdbWebsite',document.getElementById('PDSNInUfdbWebsite').value);\n\t\t\t\tXHR.appendData('PDSNInUfdb',document.getElementById('PDSNInUfdb').value);\n\t\t\t\tAnimateDiv('{$t}');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_Save{$t});\n\t\t\t}\n\n\t\t\t</script>\n\t\t\t"; echo $tpl->_ENGINE_parse_body($html); }
function popup() { $t = time(); $page = CurrentPageName(); $tpl = new templates(); $familysite = $_GET["familysite"]; $q = new mysql_squid_builder(); $sock = new sockets(); $ldap = new clladp(); if ($ldap->IsKerbAuth()) { $whitelist_auth = "\t<center style='width:98%' class=form>\n\t\t<center>" . button("{do_not_authenticate_this_website}", "WhiteNTLMThis{$t}()", 30) . "</center>\n\t\t\t<center style='font-size:16px;margin-top:15px;margin-bottom:20px'>{do_not_authenticate_this_website_explain}\n\t\t\t<br>« <a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.urlrewriteaccessdeny.php?add-ntlm-js=yes')\"\n\t\t\t\t\tstyle='text-decoration:underline'>{authentication_whitelist}</a> »\n\t\t\t\n\t\t\t</center>\n\t\t</center>\n\t\t<p> </p>"; } $EnableRangeOffset = intval($sock->GET_INFO("EnableRangeOffset")); if ($EnableRangeOffset == 1) { $rangeoffset = "\t<center style='width:98%' class=form>\n\t\t\t<center>" . button("{enforce_partial_content}", "RangeOffsetLimit{$t}()", 30) . "</center>\n\t\t\t\t<center style='font-size:16px;margin-top:15px;margin-bottom:20px'>{enforce_partial_content_explain}\n\t\t\t\t<br>« <a href=\"javascript:blur();\" \n\t\t\t\t\tOnClick=\"javascript:Loadjs('squid.urlrewriteaccessdeny.php?add-rangeoffsetlimit-js=yes')\"\n\t\t\t\t\tstyle='text-decoration:underline'>{partial_content_list}</a> »\n\t\t\t\n\t\t\t\t</center>\n\t\t\t</center>\n\t\t\t<p> </p>"; } if ($sock->EnableUfdbGuard()) { $results = $q->QUERY_SQL("SELECT * FROM personal_categories"); while ($ligne = mysql_fetch_assoc($results)) { $PERSO[$ligne["category"]] = true; } $results = $q->QUERY_SQL("SELECT category FROM webfilter_blks WHERE modeblk=1"); $WHITECATS[null] = "{select}"; while ($ligne = mysql_fetch_assoc($results)) { if (!isset($PERSO[$ligne["category"]])) { continue; } $WHITECATS[$ligne["category"]] = $ligne["category"]; } $whitelist_ufdb = "\t<center style='width:98%' class=form>\n\t\t\t<center>" . button("{whitelist_this_website}", "WhiteThis{$t}()", 30) . "</center>\n\t\t\t\t<center style='font-size:16px;margin-top:15px;margin-bottom:20px'>{whitelist_this_website_explain}\n\t\t\t\t<br>« <a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.urlrewriteaccessdeny.php?add-www-js=yes')\"\n\t\t\t\t\t\tstyle='text-decoration:underline'>{global_whitelists}</a> »\t\t\n\t\t\t\t\t\t\n\t\t\t\t</center>\n\t\t\t</center>\n\t\t\t<p> </p>"; $blacklist_ufdb = "\t<center style='width:98%' class=form>\n\t\t<center>" . button("{blacklist_this_website}", "BlackUFDBThis{$t}()", 30) . "</center>\n\t\t\t<center style='font-size:16px;margin-top:15px;margin-bottom:20px'>{blacklist_this_website_explain}\n\t\t\t<br>« <a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.urlrewriteaccessdeny.php?add-black-js=yes')\"\n\t\t\t\t\tstyle='text-decoration:underline'>{global_blacklist}</a> »\n\t\t\t\n\t\t\t</center>\n\t\t</center>\n\t\t<p> </p>"; $white_category = "\t<p> </p>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='font-size:22px' class=legend>{save_into_a_whitelisted_category}:</td>\n\t\t<td>" . Field_array_Hash($WHITECATS, "category-{$t}", null, "style:font-size:22px") . "</td>\n\t</tr>\n\t<tr>\n\t<td colspan=2 align='right'><hr>" . button("{add}", "CatzThis{$t}()", 30) . "</td>\n\t</tr>\n\t</table>"; } $html = "<div style='font-size:35px;margin-bottom:20px'>« {$familysite} »</div>\n\t{$whitelist_auth}\n\t{$whitelist_ufdb}\n\t{$rangeoffset}\n\t\t<center style='width:98%' class=form>\t\n\t\t<center>" . button("{do_not_cache}", "NocacheThis{$t}()", 30) . "</center>\n\t\t\t<center style='font-size:16px;margin-top:15px;margin-bottom:20px'>{do_not_cache_this_web_site_explain}\n\t\t\t<br>« <a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.urlrewriteaccessdeny.php?add-nocache-js=yes')\"\n\t\t\t\t\tstyle='text-decoration:underline'>{global_deny_cache_list}</a> »\t\t\n\t\t\t\t\t\n\t\t\t</center>\n\t\t</center>\t\n\t{$blacklist_ufdb}\t\t\t\n\t\t\t<p> </p>\t\t\n\t\t\t\t\n\t\t\t{$white_category}\n\t</div>\n<script>\n\nvar CallBack{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\tvar category=document.getElementById('category-{$t}').value;\n\tYahooWinBrowseHide();\n\tLoadjs('ufdbguard.compile.category.php?category='+category);\n}\t\nvar CallBackNocacheThis{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\tYahooWinBrowseHide();\n\tLoadjs('squid.global.wl.center.progress.php');\n}\nfunction CatzThis{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('add-to-cat', '{$familysite}');\n\tXHR.appendData('category', document.getElementById('category-{$t}').value);\t \n\tXHR.sendAndLoad('{$page}', 'POST',CallBack{$t}); \t\t\t\n}\n\nfunction NocacheThis{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('nocache_single', '{$familysite}'); \n\tXHR.sendAndLoad('squid.urlrewriteaccessdeny.php', 'POST',CallBackNocacheThis{$t}); \n\n}\n\nfunction RangeOffsetLimit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('rangeoffsetlimit_single', '{$familysite}'); \n\tXHR.sendAndLoad('squid.urlrewriteaccessdeny.php', 'POST',CallBackNocacheThis{$t}); \n}\n\nfunction WhiteNTLMThis{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('nonntlm_single', '{$familysite}'); \n\tXHR.sendAndLoad('squid.urlrewriteaccessdeny.php', 'POST',CallBackNocacheThis{$t}); \n\n}\n\nvar CallBack2{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\tvar category=document.getElementById('category-{$t}').value;\n\tYahooWinBrowseHide();\n\tLoadjs('squid.compile.whiteblack.progress.php');\n}\n\t\n// \nfunction WhiteThis{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('whitelist-single', '{$familysite}');\t\t\n\tXHR.sendAndLoad('squid.urlrewriteaccessdeny.php', 'POST',CallBack2{$t}); \n\n\t}\nfunction BlackUFDBThis{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('blacklist-single', '{$familysite}');\t\t\n\tXHR.sendAndLoad('squid.urlrewriteaccessdeny.php', 'POST',CallBack2{$t}); \n\n\t}\t\n\n</script>\t\t\t\n\t\t\t\n\t\t\t\n"; echo $tpl->_ENGINE_parse_body($html); }
function all_status($asroot=false){ if($asroot){$GLOBALS["AS_ROOT"]=true;} if(!$GLOBALS["AS_ROOT"]){ if(is_file("/usr/share/artica-postfix/ressources/logs/web/squid.services.html")){ $tpl=new templates(); echo $tpl->_ENGINE_parse_body(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/squid.services.html")); return; } } if(GET_CACHED(__FILE__, __FUNCTION__,__FUNCTION__)){return;} $page=CurrentPageName(); $sock=new sockets(); $ini=new Bs_IniHandler(); $tpl=new templates(); $users=new usersMenus(); $squid=new squidbee(); $t=time(); $APP_SAMBA_WINBIND=null; $winbind=null; $UseDynamicGroupsAclsTR=null; $ufdbbutt=null; $cicapButt=null; if(!isset($_GET["miniadmin"])){ $SecondScript=" function RefreshAdKer$t(){ LoadAjaxTiny('squid-adker-status','squid.adker.php?status=yes&t=squid-adker-status'); } RefreshAdKer$t(); setTimeout('RefreshAdKer$t()',2000); "; } $Authenticator_cacheFile="/usr/share/artica-postfix/ressources/logs/web/ntlmauthenticator.cache"; $cacheSwap="/usr/share/artica-postfix/ressources/logs/web/squid_swap_status.html"; $ini->loadString(base64_decode($sock->getFrameWork('cmd.php?squid-ini-status=yes'))); $DisableAnyCache=$sock->GET_INFO("DisableAnyCache"); $SquidActHasReverse=$sock->GET_INFO("SquidActHasReverse"); $AsSquidLoadBalancer=$sock->GET_INFO("AsSquidLoadBalancer"); $EnableRemoteStatisticsAppliance=$sock->GET_INFO("EnableRemoteStatisticsAppliance"); $EnableKerbAuth=$sock->GET_INFO("EnableKerbAuth"); if(!is_numeric($DisableAnyCache)){$DisableAnyCache=0;} $SquidBoosterMem=$sock->GET_INFO("SquidBoosterMem"); $WizardStatsApplianceSeen=$sock->GET_INFO("WizardStatsApplianceSeen"); if(!is_numeric($EnableKerbAuth)){$EnableKerbAuth=0;} if(!is_numeric($SquidBoosterMem)){$SquidBoosterMem=0;} if(!is_numeric($DisableAnyCache)){$DisableAnyCache=0;} if(!is_numeric($SquidActHasReverse)){$SquidActHasReverse=0;} if(!is_numeric($AsSquidLoadBalancer)){$AsSquidLoadBalancer=0;} if(!is_numeric($AsSquidLoadBalancer)){$AsSquidLoadBalancer=0;} if(!is_numeric($WizardStatsApplianceSeen)){$WizardStatsApplianceSeen=0;} $UnlockWebStats=$sock->GET_INFO("UnlockWebStats"); if(!is_numeric($UnlockWebStats)){$UnlockWebStats=0;} if($UnlockWebStats==1){$EnableRemoteStatisticsAppliance=0;} $squid_status=DAEMON_STATUS_ROUND("SQUID",$ini,null,1); $dansguardian_status=DAEMON_STATUS_ROUND("DANSGUARDIAN",$ini,null,1); $kav=DAEMON_STATUS_ROUND("KAV4PROXY",$ini,null,1); $cicap=DAEMON_STATUS_ROUND("C-ICAP",$ini,null,1); $APP_PROXY_PAC=DAEMON_STATUS_ROUND("APP_PROXY_PAC",$ini,null,1); $APP_SQUIDGUARD_HTTP=DAEMON_STATUS_ROUND("APP_SQUIDGUARD_HTTP",$ini,null,1); $APP_UFDBGUARD=DAEMON_STATUS_ROUND("APP_UFDBGUARD",$ini,null,1); $APP_UFDBGUARD_CLIENT=DAEMON_STATUS_ROUND("APP_UFDBGUARD_CLIENT",$ini,null,1); $APP_UFDBCAT=DAEMON_STATUS_ROUND("APP_UFDBCAT",$ini,null,1); $APP_HYPERCACHE_WEB=DAEMON_STATUS_ROUND("APP_HYPERCACHE_WEB",$ini,null,1); $APP_FRESHCLAM=DAEMON_STATUS_ROUND("APP_FRESHCLAM",$ini,null,1); $APP_ARTICADB=DAEMON_STATUS_ROUND("APP_ARTICADB",$ini,null,1); $APP_SQUID_DB=DAEMON_STATUS_ROUND("APP_SQUID_DB",$ini,null,1); $APP_HAARP=DAEMON_STATUS_ROUND("APP_HAARP",$ini,null,1); $APP_CNTLM=DAEMON_STATUS_ROUND("APP_CNTLM",$ini,null,1); $APP_CNTLM_PARENT=DAEMON_STATUS_ROUND("APP_CNTLM_PARENT",$ini,null,1); $APP_SQUID_NAT=DAEMON_STATUS_ROUND("APP_SQUID_NAT",$ini,null,1); $CLAMAV=DAEMON_STATUS_ROUND("CLAMAV",$ini,null,1); $DNSCACHE=DAEMON_STATUS_ROUND("DNSMASQ_SQUID",$ini,null,1); $UCARP_MASTER=DAEMON_STATUS_ROUND("UCARP_MASTER",$ini,null,1); $UCARP_SLAVE=DAEMON_STATUS_ROUND("UCARP_SLAVE",$ini,null,1); $HOTSPOT_WWW=DAEMON_STATUS_ROUND("HOTSPOT_WWW",$ini,null,1); $HOTSPOT_FW=DAEMON_STATUS_ROUND("HOTSPOT_FW",$ini,null,1); $HOTSPOT_SERVICE=DAEMON_STATUS_ROUND("HOTSPOT_SERVICE",$ini,null,1); $APP_ZIPROXY=DAEMON_STATUS_ROUND("APP_ZIPROXY",$ini,null,1); $APP_SARG=DAEMON_STATUS_ROUND("APP_SARG",$ini,null,1); //$APP_CONNTRACKD=DAEMON_STATUS_ROUND("APP_CONNTRACKD",$ini,null,1); if($users->PROXYTINY_APPLIANCE){$APP_ARTICADB=null;} if($EnableRemoteStatisticsAppliance==1){$APP_ARTICADB=null;} $APP_FTP_PROXY=DAEMON_STATUS_ROUND("APP_FTP_PROXY",$ini,null,1); $CacheManagement2=$sock->GET_INFO("CacheManagement2"); if(!is_numeric($CacheManagement2)){$CacheManagement2=0;} if($EnableKerbAuth==1){ $APP_SAMBA_WINBIND=DAEMON_STATUS_ROUND("SAMBA_WINBIND",$ini,null,1); } $tr[]="<div id='squid-mem-status'></div><script>LoadAjaxTiny('squid-mem-status','$page?squid-mem-status=yes');</script>"; $tr[]="<div id='squid-stores-status'></div>"; $tr[]="<div id='squid-info-status'></div>"; if(is_file($cacheSwap)){ $tr[]=@file_get_contents($cacheSwap); } if(is_file($Authenticator_cacheFile)){ $tr[]="<div id='squid-ntlmauth-status'></div><script>LoadAjaxTiny('squid-ntlmauth-status','$page?squid-ntlmauth-status=yes');</script>"; } $cacheFile="/usr/share/artica-postfix/ressources/logs/web/dnsperformances.cache"; $data=@file_get_contents($cacheFile); if(strlen($data)>10){ $tr[]=$data; } $md=md5(date('Ymhis')); if(!$users->WEBSTATS_APPLIANCE){ $swappiness=intval($sock->getFrameWork("cmd.php?sysctl-value=yes&key=".base64_encode("vm.swappiness"))); $sock=new sockets(); $swappiness_saved=unserialize(base64_decode($sock->GET_INFO("kernel_values"))); if(!is_numeric($swappiness_saved["swappiness"])){ if($swappiness>30){ $tr[]=DAEMON_STATUS_ROUND_TEXT("warning-panneau-42.png","{high_swap_value}", "{high_swap_value_text}","Loadjs('squid.perfs.php')"); } } $q=new mysql(); $SquidAsSeenCache=$sock->GET_INFO("SquidAsSeenCache"); if(!is_numeric($SquidAsSeenCache)){$SquidAsSeenCache=0;} if($q->COUNT_ROWS("squid_speed", "artica_backup")==0){ if($SquidAsSeenCache==0){ $tr[]=DAEMON_STATUS_ROUND_TEXT("warning-panneau-42.png","{cached_rules_not_set}", "{cached_rules_not_set_explain}","Loadjs('squid.caches.rules.php')"); } } $SquidAsSeenCacheCenter=$sock->GET_INFO("SquidAsSeenCacheCenter"); if(!is_numeric($SquidAsSeenCacheCenter)){$SquidAsSeenCacheCenter=0;} if($CacheManagement2==0){ if($SquidAsSeenCacheCenter==0){ $tr[]=DAEMON_STATUS_ROUND_TEXT("48-infos.png","{CacheManagement2}", "{CacheManagement2_explain}","Loadjs('squid.caches.ManagementChoose.php')"); } } if($WizardStatsApplianceSeen==0){ $tr[]=DAEMON_STATUS_ROUND_TEXT("warning-panneau-42.png","{use_remote_server_stats}", "{use_remote_server_stats_explain}","Loadjs('squid.stats-appliance.php')"); } } $CicapEnabled=0; if($users->C_ICAP_INSTALLED){ $CicapEnabled=$sock->GET_INFO("CicapEnabled"); if(!is_numeric($CicapEnabled)){$CicapEnabled=0;} } $squid_status=null; $ini=new Bs_IniHandler(); $ini->loadString(base64_decode($sock->getFrameWork('squid.php?smp-status=yes'))); if(is_array($ini->_params)){ while (list ($index, $line) = each ($ini->_params) ){ if($GLOBALS["VERBOSE"]){echo __FUNCTION__."::".__LINE__."::$index -> DAEMON_STATUS_ROUND<br>\n";} $tr[]=DAEMON_STATUS_ROUND($index,$ini,null,1); } } if($SquidBoosterMem>0){ if($DisableAnyCache==0){ $tr[]=squid_booster_smp(); } } $tr[]=$squid_status; $tr[]=$APP_SQUID_NAT; $tr[]=$APP_HAARP; $tr[]=$APP_HYPERCACHE_WEB; $tr[]=$APP_SAMBA_WINBIND; $tr[]=$APP_CNTLM; $tr[]=$APP_CNTLM_PARENT; $tr[]=$dansguardian_status; $tr[]=$kav; $tr[]=$cicap; $tr[]=$DNSCACHE; $tr[]=$CLAMAV; $tr[]=$APP_PROXY_PAC; $tr[]=$APP_SQUIDGUARD_HTTP; $tr[]=$APP_SARG; $tr[]=$HOTSPOT_WWW; $tr[]=$HOTSPOT_SERVICE; $tr[]=$HOTSPOT_FW; $tr[]=$APP_ZIPROXY; $tr[]=$APP_UFDBGUARD; $tr[]=$APP_UFDBGUARD_CLIENT; $tr[]=$APP_UFDBCAT; $tr[]=$APP_ARTICADB; $tr[]=$APP_SQUID_DB; $tr[]=$APP_FTP_PROXY; $tr[]=$UCARP_MASTER; $tr[]=$UCARP_SLAVE; if(isset($_GET["miniadmin"])){ echo $tpl->_ENGINE_parse_body(CompileTr3($tr,true)); return; } $EnableUfdbGuard=$sock->EnableUfdbGuard(); if(!is_numeric($EnableUfdbGuard)){$EnableUfdbGuard=0;} if(!$users->APP_UFDBGUARD_INSTALLED){$EnableUfdbGuard=0;} $tables[]="<div style='min-height:350px;'> <table style='width:100%' class='TableRemove TableMarged'><tr>"; $t=0; while (list ($key, $line) = each ($tr) ){ $line=trim($line); if($line==null){continue;} $t=$t+1; $tables[]="<td valign='top'>$line</td>"; if($t==2){$t=0;$tables[]="</tr><tr>";} } if($t<2){ for($i=0;$i<=$t;$i++){ $tables[]="<td valign='top'> </td>"; } } $SquidBoosterMemText=" <tr> <td width=1%><img src='img/memory-32.png'></td> <td><div id='ptx-status'></div></td> </tr> "; if($EnableKerbAuth==1){ $winbind=" <tr> <td width=1%><img src='img/32-logs.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('winbindd.events.php');\" style='font-size:12px;text-decoration:underline'>{APP_SAMBA_WINBIND}</a></td> </tr> "; $UseDynamicGroupsAcls=$sock->GET_INFO("UseDynamicGroupsAcls"); if(!is_numeric($UseDynamicGroupsAcls)){$UseDynamicGroupsAcls=0;} if($UseDynamicGroupsAcls==1){ $UseDynamicGroupsAclsTR=" <tr> <td width=1%><img src='img/32-logs.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('DynamicGroupsAcls.events.php');\" style='font-size:12px;text-decoration:underline'>{dynamicgroupsAcls_events}</a></td> </tr> "; } } if($EnableUfdbGuard==1){ $ufdbbutt=" <tr> <td width=1%><img src='img/service-check-32.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:ReconfigureUfdb();\" style='font-size:12px;text-decoration:underline'>{reconfigure_webfilter_service}</a></td> </tr> "; } if($CicapEnabled==1){ $cicapButt=" <tr> <td width=1%><img src='img/icon-antivirus-32.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('c-icap.index.php');\" style='font-size:12px;text-decoration:underline'>{antivirus_parameters}</a></td> </tr> "; } $supportpckg=" <tr> <td width=1%><img src='img/technical-support-32.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.support.package.php');\" style='font-size:12px;text-decoration:underline'>{build_support_package}</a></td> </tr> "; $dns_query=" <tr> <td width=1%><img src='img/dns-32.png' id='events-dns-32-squid'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('system.dns.query.php?img=events-rotate-32-squid&src=events-dns-32-squid');\" style='font-size:12px;text-decoration:underline'>{dns_query}</a></td> </tr> "; $squid_rotate=" <tr> <td width=1%><img src='img/events-rotate-32.png' id='events-rotate-32-squid'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.perf.logrotate.php?img=events-rotate-32-squid&src=events-rotate-32.png');\" style='font-size:12px;text-decoration:underline'>{squid_logrotate_perform}</a></td> </tr> "; $reconfigure=" <tr> <td width=1%><img src='img/reconfigure-32.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.compile.progress.php');\" style='font-size:12px;text-decoration:underline'>{reconfigure}</a></td> </tr> "; $debug_compile=" <tr> <td width=1%><img src='img/32-logs.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.debug.compile.php');\" style='font-size:12px;text-decoration:underline'>{compile_in_debug}</a></td> </tr> "; $current_sessions=" <tr> <td width=1%><img src='img/32-many-users.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.squidclient.clientlist.php');\" style='font-size:12px;text-decoration:underline'>{display_current_sessions}</a></td> </tr> "; $squidconf=" <tr> <td width=1%><img src='img/script-32.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.conf.php');\" style='font-size:12px;text-decoration:underline'>{configuration_file}</a></td> </tr> "; $performances=" <tr> <td width=1%><img src='img/performance-tuning-32.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.squidclient.info.php');\" style='font-size:12px;text-decoration:underline'>{display_performance_status}</a></td> </tr> "; $restart_all_services=" <tr> <td width=1%><img src='img/service-restart-32.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.restart.php');\" style='font-size:12px;text-decoration:underline'>{restart_all_services}</a></td> </tr> "; $restart_service_only=" <tr> <td width=1%><img src='img/service-restart-32.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.restart.php?onlySquid=yes');\" style='font-size:12px;text-decoration:underline'>{restart_onlysquid}</a></td> </tr> "; $reloadservice=" <tr> <td width=1%><img src='img/reload-32.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.restart.php?onlyreload=yes');\" style='font-size:12px;text-decoration:underline'>{reload_service}</a></td> </tr> "; $checkCaches=" <tr> <td width=1%><img src='img/database-connect-32-2.png'></td> <td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.restart.php?CheckCaches=yes');\" style='font-size:12px;text-decoration:underline'>{check_caches}</a></td> </tr> "; $users=new usersMenus(); if($users->WEBSTATS_APPLIANCE){ $squid_rotate=null; $debug_compile=null; $current_sessions=null; $restart_service_only=null; $performances=null; $SquidBoosterMemText=null; $supportpckg=null; $squidconf=null; } if($DisableAnyCache==1){ $SquidBoosterMemText=null; } $refresh=imgtootltip("refresh-32.png","{refresh}","LoadAjax('squid-services','$page?squid-services=yes&force=yes');"); $tables[]=" <div id='squid-adker-status'></div> </table> <div style='text-align:right;margin-top:-15px'>$refresh</div> </div> <table style='width:99%' class=form> <tr> <td valign='top' width='50%'> <table style='width:100%'> $squidconf $reconfigure $restart_all_services $restart_service_only $SquidBoosterMemText $squid_rotate $winbind $UseDynamicGroupsAclsTR $dns_query </table> </td> <td valign='top' width='50%'> <table style='width:100%'> $reloadservice $checkCaches $ufdbbutt $debug_compile $supportpckg $cicapButt $current_sessions $performances </table> </td> </tr> </table>"; if($asroot){ $tables[]="<div style='width:100%;text-align:right'><i>". date("H:i:s")."</i></div>"; } $html=@implode("\n", $tables)." <script> var x_ReconfigureUfdb= function (obj) { var res=obj.responseText; if (res.length>3){alert(res);} RefreshTab('squid_main_svc'); } function ReconfigureUfdb(){ var XHR = new XHRConnection(); XHR.appendData('ReconfigureUfdb', 'yes'); AnimateDiv('squid-services'); XHR.sendAndLoad('$page', 'POST',x_ReconfigureUfdb); } LoadAjaxTiny('ptx-status','$page?ptx-status=yes'); $SecondScript </script> "; if($GLOBALS["AS_ROOT"]){ @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/squid.services.html", $html); @chmod("/usr/share/artica-postfix/ressources/logs/web/squid.services.html",0755); return; } SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html); if($asroot){ return; } echo $tpl->_ENGINE_parse_body($html); }
function rules_toolbox_left() { if (!isset($_GET["t"])) { $_GET["t"] = time(); } $updateutility = null; $q = new mysql_squid_builder(); $page = CurrentPageName(); $tpl = new templates(); $users = new usersMenus(); $mouse = "OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\""; $t = $_GET["t"]; if (!is_numeric($t)) { $t = time(); } $Computers = $q->COUNT_ROWS("webfilters_nodes"); if (!$q->TABLE_EXISTS("webfilter_certs")) { $q->CheckTables(); } if ($q->COUNT_ROWS("webfilter_certs") == 0) { $q->fill_webfilter_certs(); } $Computers = numberFormat($Computers, 0, "", " "); $sock = new sockets(); $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); $tablescat = $q->LIST_TABLES_CATEGORIES(); $CountDeCategories = numberFormat(count($tablescat), 0, "", " "); $categoryuris_malware = numberFormat($q->COUNT_ROWS("categoryuris_malware"), 0, "", " "); $disable_service = $tpl->_ENGINE_parse_body("{disable_service}"); $datasUFDB = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig"))); if (!is_numeric($datasUFDB["DebugAll"])) { $datasUFDB["DebugAll"] = 0; } $update_parameters = $tpl->_ENGINE_parse_body("{update_parameters}"); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); $SquidDatabasesUtlseEnable = $sock->GET_INFO("SquidDatabasesUtlseEnable"); $UseRemoteUfdbguardService = $sock->GET_INFO("UseRemoteUfdbguardService"); $UFDB = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig"))); $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth"); $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); if (!is_numeric($UseRemoteUfdbguardService)) { $UseRemoteUfdbguardService = 0; } if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if (!is_numeric($UseRemoteUfdbguardService)) { $UseRemoteUfdbguardService = 0; } if (!is_numeric($EnableKerbAuth)) { $EnableKerbAuth = 0; } if (!is_numeric($SquidDatabasesUtlseEnable)) { $SquidDatabasesUtlseEnable = 1; } $SquidDatabasesArticaEnable = $sock->GET_INFO("SquidDatabasesArticaEnable"); if (!is_numeric($SquidDatabasesArticaEnable)) { $SquidDatabasesArticaEnable = 1; } if ($EnableWebProxyStatsAppliance == 1) { $EnableUfdbGuard = 1; } if ($UseRemoteUfdbguardService == 0) { if ($UFDB["UseRemoteUfdbguardService"] == 1) { $sock->SET_INFO("UseRemoteUfdbguardService", 1); $UseRemoteUfdbguardService = 1; } } if ($users->WEBSTATS_APPLIANCE) { $EnableWebProxyStatsAppliance = 1; } if (!$users->APP_UFDBGUARD_INSTALLED) { $EnableUfdbGuard = 0; } if ($users->UPDATE_UTILITYV2_INSTALLED) { $updateutility = "\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/kaspersky-update-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.UpdateUtility.php')\" nowrap>UpdateUtility</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>"; } $ufdbgverb_icon = "ok24-grey.png"; $ufdbgverb_txt = "OFF"; if ($datasUFDB["DebugAll"] == 1) { $ufdbgverb_icon = "ok32.png"; $ufdbgverb_txt = "ON"; } if ($SquidDatabasesUtlseEnable == 1) { $SquidDatabasesUtlseEnable_P = "<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.toulouse-university.disable.php')\" nowrap>\n\t\t\t\t<b><span style='font-size:13px;text-decoration:underline'>{toulouse_university} {enabled}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>\t\t\n\t\t"; } else { $SquidDatabasesUtlseEnable_P = "<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32-grey.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline'\n\t\tOnClick=\"javascript:Loadjs('squid.toulouse-university.disable.php')\" nowrap>\n\t\t<b><span style='font-size:13px;text-decoration:underline'>{toulouse_university} {disabled}</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t"; } if ($SquidDatabasesArticaEnable == 1) { $SquidDatabasesArticaEnable_P = "<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline'\n\t\tOnClick=\"javascript:Loadjs('squid.artica-databases.disable.php')\" nowrap>\n\t\t<b><span style='font-size:13px;text-decoration:underline'>{artica_databases} {enabled}</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t"; } else { $SquidDatabasesArticaEnable_P = "<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32-grey.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline'\n\t\tOnClick=\"javascript:Loadjs('squid.artica-databases.disable.php')\" nowrap>\n\t\t<b><span style='font-size:13px;text-decoration:underline'>{artica_databases} {disabled}</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t"; } if (!$users->CORP_LICENSE) { $SquidDatabasesArticaEnable_P = "<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32-grey.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline'\n\t\tOnClick=\"javascript:blur()\" nowrap>\n\t\t<b><span style='font-size:13px;text-decoration:underline'>{artica_databases} {no_license}</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t"; } if ($EnableUfdbGuard == 1) { $DisableUfdbGuard = "\n\t\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.disableUfdb.php')\" nowrap><b><span style='font-size:13px;text-decoration:underline'>{$disable_service}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t{$SquidDatabasesArticaEnable_P}\n\t\t{$SquidDatabasesUtlseEnable_P}\t\n\t\t"; } if ($UseRemoteUfdbguardService == 1) { $DisableUfdbGuard = null; } $html = "\n\t<table style='width:98%' class=form>\n\t{$DisableUfdbGuard}\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/computer-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.nodes.php',true)\" nowrap><b><span style='font-size:13px;text-decoration:underline'>{$Computers}</span></b><span style='font-size:13px'> {computers}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/check-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.categories.urls.php?popup-js=yes&category=malware&tablesize=695');\" nowrap><b><span style='font-size:13px;text-decoration:underline'>{$categoryuris_malware} Malware Uris</span></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\n\t\n\t\n\t\n\t\n\t"; $html = $html . "\n\t\t\t\n\t\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/check-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.tests.php')\" nowrap>\n\t\t\t\t<span style='font-size:13px;text-decoration:underline'>{verify_rules}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\t\n\t\n\t\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/loupe-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.category.tests.php')\" nowrap><span style='font-size:13px;text-decoration:underline'>{test_categories}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\t\t\n\t\n\t\n\t\n"; if ($UseRemoteUfdbguardService == 0) { $html = $html . "<tr>\n\t\t<td valign='middle' width=1%><img src='img/service-restart-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.php?force-reload-js=yes')\" nowrap><span style='font-size:13px;text-decoration:underline'>{reload_service}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/events-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.sevents.php?js=yes')\" nowrap><span style='font-size:13px;text-decoration:underline'>{service_events}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/{$ufdbgverb_icon}'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline;text-transform:capitalize' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.debug.php')\" nowrap><span style='font-size:13px;text-decoration:underline'>{debug} [{$ufdbgverb_txt}]</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/32-stop.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squidguardweb.php')\" nowrap><span style='font-size:13px;text-decoration:underline'>{banned_page_webservice}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t"; } $html = $html . ""; if ($UseRemoteUfdbguardService == 0) { $html = $html . "\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/script-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.conf.php');\" nowrap>\n\t\t\t\t\t<span style='font-size:13px;text-decoration:underline'>{config_status}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\n\t{$updateutility}\t\n"; } $html = $html . "\n\n\t</table> \n\t\n\t\n\t"; $shield = null; if ($EnableUfdbGuard == 1) { if ($UseRemoteUfdbguardService == 0) { if (!$users->CORP_LICENSE) { $shield = "shield-warn-64.png"; $warn["{warn_ufdbguard_no_license}"] = null; } $ini = new Bs_IniHandler(); $sock = new sockets(); $sock->getFrameWork('squid2.php?ufdb-ini-status-write=yes'); $ini->loadFile("/usr/share/artica-postfix/ressources/interface-cache/UFDB_STATUS"); $restartlocalservice = "Loadjs('system.services.cmd.php?APPNAME=APP_UFDBGUARD&action=restart&cmd=%2Fetc%2Finit.d%2Fufdb&id=ed8cebc50034e96ed26a4d3cb953403f&appcode=APP_UFDBGUARD');"; $redirector_file = "/usr/share/artica-postfix/ressources/logs/web/squid_redirectors_status.db"; $redirectors_array = unserialize(@file_get_contents($redirector_file)); if (count($redirectors_array) > 1) { $redirectors_count = count($redirectors_array); if (strlen($redirectors_count) == 1) { $redirectors_count = "0{$redirectors_count}"; } $OBS["{redirectors}:{$redirectors_count}"] = "Loadjs('squid.redirectors.php');"; } if ($ini->_params["APP_UFDBGUARD"]["running"] == 0) { $shield = "shield-red-64.png"; $err["{warn_ufdbguard_stopped}"] = $restartlocalservice; } else { if ($shield == null) { $shield = "shield-ok-64.png"; } $OBS["{running_since}: {$ini->_params["APP_UFDBGUARD"]["uptime"]}"] = null; $OBS["{memory}: " . FormatBytes($ini->_params["APP_UFDBGUARD"]["master_memory"])] = null; } } if ($UseRemoteUfdbguardService == 1) { $server = $UFDB["remote_server"]; $port = $UFDB["remote_port"] = 3977; if (!@fsockopen($server, $port, $errno, $errstr, 1)) { $shield = "shield-red-64.png"; $err["{server}:«{$server}»:{$port}<br>{error} {$errno} {$errstr}"] = "Loadjs('ufdbguard.php?client-js=yes');"; } else { $OBS["{warn_ufdbguard_remote_use}"] = "Loadjs('ufdbguard.php?client-js=yes')"; } } if ($EnableWebProxyStatsAppliance == 0) { if (trim($sock->getFrameWork("squid.php?isufdbguard-squidconf=yes")) != "OK") { $shield = "shield-warn-64.png"; $warn["{warn_ufdbguard_not_squidconf}"] = "Loadjs('squid.compile.progress.php')"; } } $OBS["{refresh}"] = "LoadAjaxTiny('rules-toolbox-left','{$page}?rules-toolbox-left=yes&RemoveCache=yes');"; $html2[] = "\n\t <table style='width:100%'>\n\t <tr>\n\t \t<td valign='top' style='width:64px'><img src='img/{$shield}'></td>\n\t \t<td>\t\t\n\t \t\t<table style='width:100%'>\n\t "; while (list($num, $js) = each($warn)) { if ($js == null) { $js = "blur();"; } $html2[] = "\n\t \t\t<tr>\n\t \t\t<td width=16px style='vertical-align:top'><img src='img/arrow-right-yellow-16.png'></td>\n\t\t\t<td>\n\t \t\t<a href=\"javascript:blur();\" \n\t \t\tOnClick=\"javascript:{$js}\" \n\t \t\tstyle='color:#black !important;font-weight:normal !important;font-size:12px;text-decoration:underline'>{$num}</a>\n\t \t\t<hr style='border:1px'>\n\t \t\t</td>\n\t \t\t</tr>\n\t \t\t"; } while (list($num, $js) = each($err)) { if ($js == null) { $js = "blur();"; } $html2[] = "\n\t \t<tr>\n\t \t<td width=16px style='vertical-align:top'><img src='img/arrow-right-red-16.png'></td>\n\t \t<td >\n\t \t\t<a href=\"javascript:blur();\" \n\t \t\tOnClick=\"javascript:{$js}\" \n\t \t\tstyle='color:#d32d2d !important;text-decoration:underline;font-weight:bold !important;font-size:12px'>{$num}</a>\n\t \t\t<hr style='border:1px'>\n\t \t</td>\n\t \t</tr>\n\t \t"; } while (list($num, $js) = each($OBS)) { if ($js == null) { $js = "blur();"; } $html2[] = "\n\t \t<tr>\n\t \t<td width=16px style='vertical-align:top'><img src='img/arrow-right-16.png'></td>\n\t \t<td >\n\t \t\t<a href=\"javascript:blur();\" \n\t \t\tOnClick=\"javascript:{$js}\" \n\t \t\tstyle='color:#46a346 !important;font-weight:bold !important;font-size:12px;text-decoration:underline'>{$num}</a>\n\t \t\t\n\t \t</td>\n\t \t\n\t \t</td>\n\t \t</tr>\n\t \t"; } $html2[] = "</table>\n\t </td>\n\t </tr>\n\t </table>\n\t <p> </p>\n\t "; echo $tpl->_ENGINE_parse_body(@implode("\n", $html2)); } $t = time(); $users = new usersMenus(); $PERF = true; $serverMem = round($users->MEM_TOTAL_INSTALLEE / 1024); $CPU = $users->CPU_NUMBER; if ($serverMem < 2000) { $PERF = FALSE; } if ($CPU < 2) { $PERF = FALSE; } if (!$PERF) { $echo1 = $echo1 . $tpl->_ENGINE_parse_body("\n\t\t<div id='{$t}' style='width:90%;margin-bottom:20px' class=form>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='top' width=99%>\n\t\t<div style='font-size:14px;color:#CC0A0A'>\n\t\t<img src='img/warning-panneau-42.png' style='float:left;margin:3px'>\n\t\t<span style='font-size:11px'>{warn_no_performance_minimal}</span>\n\t\t</div>\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>"); } $t = time() + 1; echo $tpl->_ENGINE_parse_body($echo1 . $html); }
function popup() { $users = new usersMenus(); $ad = new external_ad_search(); $DNDUMP = $ad->DNDUMP($_GET["DN"]); $tpl = new templates(); if (isset($DNDUMP["description"][0])) { $description = $DNDUMP["description"][0]; } $title = $DNDUMP["samaccountname"][0]; if (isset($DNDUMP["givenname"][0])) { $title = "{$DNDUMP["givenname"][0]} {$DNDUMP["sn"][0]}"; } $MAIN_SQUIDRULES = array(); $MAIN_WEBRULES = array(); for ($i = 0; $i < $DNDUMP["memberof"]["count"]; $i++) { $DN = $DNDUMP["memberof"][$i]; $XGRP = $ad->DNinfos($DN); $GroupName = $XGRP[0]["samaccountname"][0]; if ($users->SQUID_INSTALLED) { $acl = new squid_acls(); $RULES = $acl->GetRulesFromADGroup($GroupName); if ($GLOBALS["VERBOSE"]) { echo "<span style='color:red;font-size:22px'>{$GroupName}:: " . count($RULES) . " RULES</span><br>\n"; } if (is_array($RULES)) { while (list($key, $ligne) = each($RULES)) { $MAIN_SQUIDRULES[$key] = $ligne; } if ($GLOBALS["VERBOSE"]) { echo "<span style='color:red;font-size:22px'>{$GroupName}:: \$MAIN_SQUIDRULES:" . count($MAIN_SQUIDRULES) . " RULES</span><br>\n"; } } $sock = new sockets(); if ($sock->EnableUfdbGuard() == 1) { $MAIN_WEBRULES[0] = "{default}"; $RULES = $acl->GetWebfilteringRulesFromADGroup($GroupName); if ($GLOBALS["VERBOSE"]) { echo "<span style='color:red;font-size:22px'>{$GroupName}:: " . count($RULES) . " RULES</span><br>\n"; } if (is_array($RULES)) { while (list($key, $ligne) = each($RULES)) { $MAIN_WEBRULES[$key] = $ligne; } if ($GLOBALS["VERBOSE"]) { echo "<span style='color:red;font-size:22px'>{$GroupName}:: \$MAIN_WEBRULES:" . count($MAIN_WEBRULES) . " RULES</span><br>\n"; } } } } $jsGRP = "Loadjs('domains.edit.group.php?js=yes&group-id=" . urlencode($DN) . "',true)"; $XTRG[] = "<tr>\n\t\t\t\t\t<td style='width:16px'><img src='img/wingroup.png'></td>\n\t\t\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\" style='text-decoration:underline'>{$GroupName}</a></td>\n\t\t\t\t</tr>"; } if (count($MAIN_SQUIDRULES) > 0) { $rules_title = "{rules}"; if (count($MAIN_SQUIDRULES) < 2) { $rules_title = "{rule}"; } while (list($aclid, $aclname) = each($MAIN_SQUIDRULES)) { $jsGRP = "Loadjs('squid.acls-rules.php?Addacl-js=yes&ID={$aclid}');"; $XTRGB[] = "<tr>\n\t\t\t<td style='width:16px'><img src='img/scripts-16.png'></td>\n\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\" \n\t\t\t\tstyle='text-decoration:underline'>{$aclname}</a></td>\n\t\t\t</tr>"; } $proxay_acls = "</tr>\n\t\t<tr style='height:70px'>\n\t\t<td valign=middle style='font-size:26px' class=legend>" . count($MAIN_SQUIDRULES) . " {$rules_title} (Proxy):</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td></td>\n\t\t<td><table style='width:100%'>" . @implode("", $XTRGB) . "</table></td>\n\t\t</tr>"; } if (count($MAIN_WEBRULES) > 0) { $XTRGB = array(); while (list($aclid, $aclname) = each($MAIN_WEBRULES)) { $jsGRP = "YahooWin3('1100','dansguardian2.edit.php?ID={$aclid}&t=0','{$aclid} {$aclname}');"; $XTRGB[] = "<tr>\n\t\t\t<td style='width:16px'><img src='img/scripts-16.png'></td>\n\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\"\n\t\t\tstyle='text-decoration:underline'>{$aclname}</a></td>\n\t\t\t</tr>"; } $rules_title = "{rules}"; if (count($MAIN_WEBRULES) < 2) { $rules_title = "{rule}"; } $webfilter_acls = "</tr>\n\t\t<tr style='height:70px'>\n\t\t<td valign=middle style='font-size:26px' class=legend>" . count($MAIN_WEBRULES) . " {$rules_title} ({webfiltering}):</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td></td>\n\t\t<td><table style='width:100%'>" . @implode("", $XTRGB) . "</table></td>\n\t\t</tr>"; } $picture_link = "img/impersonate-photo.png"; $html = "\n\t\t\t\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='width:190px;vertical-align:top'>\n\t\t<center style='margin-top:15px'>\n\t\t<img style='border-radius: 50% 50% 50% 50%;\n \t\tbox-shadow: 0 0 5px silver;height: 180px;margin: 0 32px;width: 180px;' src='{$picture_link}'></a>\n <center style='font-size: 24px;line-height: 1.2;word-wrap: break-word;margin-top:30px;margin-bottom:30px'>{$title}</center>\n\n \n </center>\t\n\t</td>\n\t\t<td style='width:80%;vertical-aglin:top'>\n\t\t\t<table style='width:100%'>\n\t\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr style='height:70px'>\n\t\t\t\t<td valign=middle style='font-size:26px' class=legend><div>{Contact_Information}:</div><i style='font-size:16px'>{$description}</i></td>\n\t\t\t</tr>\n\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{member}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["givenname"][0]} {$DNDUMP["sn"][0]}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{name}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["name"][0]}</strong></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{account}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["samaccountname"][0]}</strong></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{email}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["mail"][0]}</strong></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{telephoneNumber}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["telephonenumber"][0]}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{mobile}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["mobile"][0]}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t\t<tr style='height:70px'>\n\t\t\t\t<td valign=middle style='font-size:26px' class=legend>{$DNDUMP["memberof"]["count"]} {groups}:</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td><table style='width:100%'>" . @implode("", $XTRG) . "</table></td>\n\t\t\t</tr>\n\t\t\t{$proxay_acls}\n\t\t\t{$webfilter_acls}\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t</table>\n\t<p> </p>\n\t</div>\n\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function daemons() { $ci = new cicap(); $page = CurrentPageName(); $sock = new sockets(); $EnableSquidGuardInCiCAP = $sock->GET_INFO("EnableSquidGuardInCiCAP"); $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); $EnableClamavInCiCap = $sock->GET_INFO("EnableClamavInCiCap"); $MaxCICAPWorkTimeMin = $sock->GET_INFO("MaxCICAPWorkTimeMin"); $MaxCICAPWorkSize = $sock->GET_INFO("MaxCICAPWorkSize"); if (!is_numeric($MaxCICAPWorkTimeMin)) { $MaxCICAPWorkTimeMin = 1440; } if (!is_numeric($MaxCICAPWorkSize)) { $MaxCICAPWorkSize = 5000; } $CICAPListenAddress = $sock->GET_INFO("CICAPListenAddress"); if (!is_numeric($EnableSquidGuardInCiCAP)) { $EnableSquidGuardInCiCAP = 0; } if (!is_numeric($EnableClamavInCiCap)) { $EnableClamavInCiCap = 1; } if ($CICAPListenAddress == null) { $CICAPListenAddress = "127.0.0.1"; } $users = new usersMenus(); if (!$users->SQUIDGUARD_INSTALLED) { $disableSquiduard = true; $EnableSquidGuardInCiCAP = 0; } if ($users->APP_UFDBGUARD_INSTALLED) { if ($EnableUfdbGuard == 1) { $disableSquiduard = true; $EnableSquidGuardInCiCAP = 0; } } if ($disableSquiduard) { $DisableSquidGuardCheckCicap = "DisableSquidGuardCheckCicap();"; } $tcp = new networking(); $ips = $tcp->ALL_IPS_GET_ARRAY(); $notifyVirHTTPServer = false; if ($ci->main_array["CONF"]["ViralatorMode"] == 1) { if (preg_match('#https://(.*?)/exec#', $ci->main_array["CONF"]["VirHTTPServer"], $re)) { if (trim($re[1]) == null) { $notifyVirHTTPServer = true; } if (trim($re[1]) == "127.0.0.1") { $notifyVirHTTPServer = true; } if (trim($re[1]) == "localhost") { $notifyVirHTTPServer = true; } } } if ($notifyVirHTTPServer == true) { $color = "color:#d32d2d;font-weight:bolder"; } for ($i = 1; $i < 13; $i++) { $f[$i] = $i; } $html = "\n\t\n\t<div style='font-size:26px;margin-bottom:20px'>{daemon_settings_text}</div>\n\t\n\t<input type='hidden' id='EnableClamavInCiCapCheck' value='{$EnableClamavInCiCap}'>\n\t<div id='ffmcc1' style='width:95%' class=form>\n\t<table style='width:100%'>\t\n\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_address}:</td>\n\t\t<td style='font-size:22px'>" . Field_array_Hash($ips, 'CICAPListenAddress', $CICAPListenAddress, null, null, 0, 'font-size:22px;padding:3px') . "</td>\n\t\t<td></td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{Timeout}", "{Timeout_text}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text('Timeout', $ci->main_array["CONF"]["Timeout"], 'width:150px;font-size:22px;padding:3px') . " {seconds}</td>\n\t</tr>\n\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px'>" . texttooltip("{MaxKeepAliveRequests}", "{MaxKeepAliveRequests_text}") . ":</td>\n\t\t<td>" . Field_text('MaxKeepAliveRequests', $ci->main_array["CONF"]["MaxKeepAliveRequests"], 'width:150px;font-size:22px;padding:3px') . " </td>\n\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px'>" . texttooltip("{KeepAliveTimeout}", "{KeepAliveTimeout_text}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text('KeepAliveTimeout', $ci->main_array["CONF"]["KeepAliveTimeout"], 'width:150px;font-size:22px;padding:3px') . " {seconds}</td>\n\t</tr>\n\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px'>" . texttooltip("{MaxServers}", "{MaxServers_text}") . ":</td>\n\t\t<td>" . Field_text('MaxServers', $ci->main_array["CONF"]["MaxServers"], 'width:150px;font-size:22px;padding:3px') . " </td>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px'>" . texttooltip("{MinSpareThreads}", "{MinSpareThreads_text}") . ":</td>\n\t\t<td>" . Field_text('MinSpareThreads', $ci->main_array["CONF"]["MinSpareThreads"], 'width:150px;font-size:22px;padding:3px') . " </td>\n\t</tr>\t\t\n\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px'>" . texttooltip("{MaxSpareThreads}", "{MaxSpareThreads_text}") . ":</td>\n\t\t<td>" . Field_text('MaxSpareThreads', $ci->main_array["CONF"]["MaxSpareThreads"], 'width:150px;font-size:22px;padding:3px') . " </td>\n\t</tr>\t\n\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px'>" . texttooltip("{ThreadsPerChild}", "{ThreadsPerChild_text}") . ":</td>\n\t\t<td>" . Field_text('ThreadsPerChild', $ci->main_array["CONF"]["ThreadsPerChild"], 'width:150px;font-size:22px;padding:3px') . " </td>\n\t</tr>\t\n\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px'>" . texttooltip("{MaxRequestsPerChild}", "{MaxRequestsPerChild_text}") . ":</td>\n\t\t<td>" . Field_text('MaxRequestsPerChild', $ci->main_array["CONF"]["MaxRequestsPerChild"], 'width:150px;font-size:22px;padding:3px') . " </td>\n\t</tr>\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{debug_mode}", "{log level_text}") . ":</td>\n\t\t<td>" . Field_array_Hash($f, "DebugLevel", $ci->main_array["CONF"]["DebugLevel"], null, null, 0, 'font-size:22px;padding:3px') . " </td>\n\t</tr>\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td colspan=3> </td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3 style='border-top:1px solid #CCCCCC'> </td>\n\t</tr>\n\n\t\t\t\t\n\t</tr>\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{max_time_in_tmp}", "{max_time_in_tmp_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("MaxCICAPWorkTimeMin", $MaxCICAPWorkTimeMin, 'width:150px;font-size:22px;padding:3px') . " {minutes}</td>\n\t</tr>\t\t\t\t\n\t</tr>\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{max_tempdir_size}", "{max_tempdir_size_explain}") . ":</td>\n\t\t<td style='font-size:22px'>" . Field_text("MaxCICAPWorkSize", $MaxCICAPWorkSize, 'width:150px;font-size:22px;padding:3px') . " MB</td>\n\t</tr>\t\t\t\t\t\n\n\t\t\t\t\n\t<tr>\n\t\t<td colspan=3> </td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3 style='border-top:1px solid #CCCCCC'> </td>\n\t</tr>\n\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:22px'>" . texttooltip("{ViralatorMode}", "{ViralatorMode_text}") . ":</td>\n\t\t<td>" . Field_checkbox_design("ViralatorMode", 1, $ci->main_array["CONF"]["ViralatorMode"], "EnableDisableViralatorMode()") . "</td>\n\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{VirSaveDir}", "{VirSaveDir_text}") . ":</td>\n\t\t<td>" . Field_text('VirSaveDir', $ci->main_array["CONF"]["VirSaveDir"], 'width:490px;font-size:22px;padding:3px') . " </td>\n\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='{$color};font-size:22px'>" . texttooltip("{VirHTTPServer}", "{VirHTTPServer_text}") . ":</td>\n\t\t<td>" . Field_text('VirHTTPServer', $ci->main_array["CONF"]["VirHTTPServer"], 'width:290px;font-size:22px;padding:3px') . " </td>\n\t</tr>\n\t<tr>\t\n\t\t<td class=legend>{example}:</td>\n\t\t<td colspan=2><strong><a href='https://{$_SERVER['SERVER_NAME']}/exec.cicap.php?usename=%f&remove=1&file='>https://{$_SERVER['SERVER_NAME']}/exec.cicap.php?usename=%f&remove=1&file=</a></strong></td>\n\t</tr>\t\n\t\t\t\n\t\n\n\t<tr>\n\t\t<td colspan=3 align='right'>\n\t\t<hr>\n\t\t\t" . button("{apply}", "SaveIcapDaemonSet()", 26) . "\n\t\t</td>\n\t</tr>\n\t</table>\n\t</div>\n\t\n\t<script>\nvar x_SaveIcapDaemonSet=function(obj){\n var tempvalue=obj.responseText;\n\t if(tempvalue.length>3){alert(tempvalue);}\n\t RefreshTab('main_config_cicap');\n\t\n\t}\t\n\t\n\tfunction SaveIcapDaemonSet(){\n\t\tvar XHR = new XHRConnection();\n\t XHR.appendData('Timeout',document.getElementById('Timeout').value);\n\t XHR.appendData('MaxKeepAliveRequests',document.getElementById('MaxKeepAliveRequests').value);\n\t XHR.appendData('KeepAliveTimeout',document.getElementById('KeepAliveTimeout').value);\n\t \n\t XHR.appendData('MaxServers',document.getElementById('MaxServers').value);\n\t XHR.appendData('MinSpareThreads',document.getElementById('MinSpareThreads').value);\n\t XHR.appendData('ThreadsPerChild',document.getElementById('ThreadsPerChild').value);\n\t XHR.appendData('MaxRequestsPerChild',document.getElementById('MaxRequestsPerChild').value);\n\t XHR.appendData('VirSaveDir',document.getElementById('VirSaveDir').value);\n\t XHR.appendData('VirHTTPServer',document.getElementById('VirHTTPServer').value);\n\t XHR.appendData('DebugLevel',document.getElementById('DebugLevel').value);\n\t XHR.appendData('CICAPListenAddress',document.getElementById('CICAPListenAddress').value);\n\t if(document.getElementById('ViralatorMode').checked){XHR.appendData('ViralatorMode',1);}else{XHR.appendData('ViralatorMode',0);}\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveIcapDaemonSet);\n\t}\n\t\n\tfunction EnableDisableViralatorMode(){\n\t\t document.getElementById('VirSaveDir').disabled=true;\n\t document.getElementById('VirHTTPServer').disabled=true;\n\t if(document.getElementById('EnableClamavInCiCapCheck').value==0){return;}\n\t \n\t \n\t if(document.getElementById('ViralatorMode').checked){\n\t document.getElementById('VirSaveDir').disabled=false;\n\t document.getElementById('VirHTTPServer').disabled=false;\n\t\t }\n\t\n\t}\n\t\n\tfunction DisableSquidGuardCheckCicap(){\n\t \tif(document.getElementById('EnableSquidGuardInCiCAP')){\n\t \t\tdocument.getElementById('EnableSquidGuardInCiCAP').checked=false;\n\t \t\tdocument.getElementById('EnableSquidGuardInCiCAP').disabled=true;\n\t\t}\n\t}\n\t\n\tEnableDisableViralatorMode();\n\t{$DisableSquidGuardCheckCicap}\n\t\n</script>\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function build() { $users = new usersMenus(); $sock = new sockets(); $unix = new unix(); $SystemLoadNotif = $sock->GET_INFO("SystemLoadNotif"); if (!is_numeric($SystemLoadNotif)) { $SystemLoadNotif = 0; } $EnableSyslogDB = $sock->GET_INFO("EnableSyslogDB"); if (!is_numeric($EnableSyslogDB)) { $EnableSyslogDB = 0; } $MySQLSyslogType = $sock->GET_INFO("MySQLSyslogType"); if (!is_numeric($MySQLSyslogType)) { $MySQLSyslogType = 1; } $ZarafaDedicateMySQLServer = $sock->GET_INFO("ZarafaDedicateMySQLServer"); if (!is_numeric($ZarafaDedicateMySQLServer)) { $ZarafaDedicateMySQLServer = 0; } $ini = new Bs_IniHandler(); $ini->loadFile('/etc/artica-postfix/smtpnotif.conf'); if (!is_numeric($ini->_params["SMTP"]["EnableNotifs"])) { $ini->_params["SMTP"]["EnableNotifs"] = 0; } if (!is_numeric($ini->_params["SMTP"]["tls_enabled"])) { $ini->_params["SMTP"]["tls_enabled"] = 0; } $smtp_server = trim($ini->_params["SMTP"]['smtp_server_name']); $smtp_server_port = $ini->_params["SMTP"]['smtp_server_port']; $smtp_dest = $ini->_params["SMTP"]['smtp_dest']; $smtp_sender = $ini->_params["SMTP"]['smtp_sender']; $smtp_auth_user = $ini->_params["SMTP"]['smtp_auth_user']; $smtp_auth_passwd = $ini->_params["SMTP"]['smtp_auth_passwd']; $tls_enabled = $ini->_params["SMTP"]["tls_enabled"]; $recipientsZ = explode("\n", "/etc/artica-postfix/settings/Daemons/SmtpNotificationConfigCC"); $recipients = array(); while (list($index, $to) = each($recipientsZ)) { if (trim($to) == null) { continue; } $recipients[] = $to; } if ($smtp_server == null) { $ini->_params["SMTP"]["EnableNotifs"] = 0; } if ($smtp_dest == null) { if (count($recipients) == 0) { $ini->_params["SMTP"]["EnableNotifs"] = 0; } } if (!is_numeric($smtp_server_port)) { $smtp_server_port = 25; } $EnableNotifs = $ini->_params["SMTP"]["EnableNotifs"]; $monit_not_on = 'instance,action'; $f[] = 'set daemon 60 with start delay 5'; $f[] = 'set idfile /var/run/monit/monit.id'; $cpunum = $unix->CPU_NUMBER(); $normal = $cpunum * 2 + 1; $normal2 = $cpunum * 2; $busy = $cpunum * 4; $EnableMONITSmtpNotif = $sock->GET_INFO("EnableMONITSmtpNotif"); if (!is_numeric($EnableMONITSmtpNotif)) { $EnableMONITSmtpNotif = 1; } $EnableWatchMemoryUsage = $sock->GET_INFO("EnableWatchMemoryUsage"); if (!is_numeric($EnableWatchMemoryUsage)) { $EnableWatchMemoryUsage = 1; } $EnableWatchCPUsage = $sock->GET_INFO("EnableWatchCPUsage"); if (!is_numeric($EnableWatchCPUsage)) { $EnableWatchCPUsage = 1; } $SystemWatchMemoryUsage = $sock->GET_INFO("SystemWatchMemoryUsage"); if (!is_numeric($SystemWatchMemoryUsage)) { $SystemWatchMemoryUsage = 75; } $EnableWatchCPUsage = $sock->GET_INFO("EnableWatchCPUsage"); if (!is_numeric($EnableWatchCPUsage)) { $EnableWatchCPUsage = 1; } $SystemWatchCPUUser = $sock->GET_INFO("SystemWatchCPUUser"); if (!is_numeric($SystemWatchCPUUser)) { $SystemWatchCPUUser = 80; } $SystemWatchCPUSystem = $sock->GET_INFO("SystemWatchCPUSystem"); if (!is_numeric($SystemWatchCPUSystem)) { $SystemWatchCPUSystem = 80; } $EnableLoadAvg1mnUser = $sock->GET_INFO("EnableLoadAvg1mnUser"); if (!is_numeric($EnableLoadAvg1mnUser)) { $EnableLoadAvg1mnUser = 1; } $EnableLoadAvg5mnUser = $sock->GET_INFO("EnableLoadAvg5mnUser"); if (!is_numeric($EnableLoadAvg5mnUser)) { $EnableLoadAvg5mnUser = 1; } $EnableLoadAvg15mnUser = $sock->GET_INFO("EnableLoadAvg15mnUser"); if (!is_numeric($EnableLoadAvg15mnUser)) { $EnableLoadAvg15mnUser = 1; } $Load1mn = $sock->GET_INFO("Load1mn"); if (!is_numeric($Load1mn)) { $Load1mn = $busy; } $Load15mn = $sock->GET_INFO("Load15mn"); if (!is_numeric($Load15mn)) { $Load15mn = $normal2; } $Load5mn = $sock->GET_INFO("Load5mn"); if (!is_numeric($Load5mn)) { $Load5mn = $normal; } $DoNotCheckSystem = 0; if ($EnableLoadAvg1mnUser == 0) { if ($EnableLoadAvg5mnUser == 0) { if ($EnableLoadAvg15mnUser == 0) { if ($EnableWatchMemoryUsage == 0) { if ($SystemLoadNotif == 0) { if ($EnableWatchCPUsage == 0) { $DoNotCheckSystem = 1; } } } } } } $php5 = $unix->LOCATE_PHP5_BIN(); $rmbin = $unix->find_program("rm"); $echo = $unix->find_program("echo"); if ($SystemWatchCPUSystem > 100) { $SystemWatchCPUSystem = 99; } if ($SystemWatchCPUUser > 100) { $SystemWatchCPUUser = 99; } if ($SystemWatchMemoryUsage > 10) { $SystemWatchMemoryUsage = 99; } if ($SystemWatchCPUSystem < 5) { $SystemWatchCPUSystem = 99; } if ($SystemWatchCPUUser < 5) { $SystemWatchCPUUser = 99; } if ($SystemWatchMemoryUsage < 5) { $SystemWatchMemoryUsage = 99; } $SQUIDEnable = $sock->GET_INFO("SQUIDEnable"); if (!is_numeric($SQUIDEnable)) { $SQUIDEnable = 1; } $f[] = 'set logfile syslog facility log_daemon'; $f[] = 'set statefile /var/run/monit/monit.state'; $f[] = ''; if ($EnableNotifs == 1) { if ($EnableMONITSmtpNotif == 1) { $f[] = "set mailserver {$smtp_server} PORT {$smtp_server_port}"; if (strlen($smtp_auth_user) > 0) { $f[] = "\tUSERNAME \"{$smtp_auth_user}\" PASSWORD \"{$smtp_auth_passwd}\""; } if ($tls_enabled == 1) { $f[] = "\tusing TLSV1"; } $f[] = "\tset eventqueue"; $f[] = "\tbasedir /var/monit"; $f[] = "\tslots 100"; $f[] = "\tset mail-format {"; $f[] = "\t\tfrom: {$smtp_sender}"; $f[] = "\t\tsubject: Artica service monitor: \$SERVICE \$EVENT"; $f[] = "\t\tmessage: Artica service monitor \$ACTION \$SERVICE at \$DATE on \$HOST: \$DESCRIPTION"; $f[] = "\t}"; $f[] = "set alert {$smtp_dest} but not on {{$monit_not_on}}"; if ($recipients > 0) { while (list($index, $to) = each($recipientsZ)) { $f[] = "set alert {$to} but not on {{$monit_not_on}}"; } } } } $allips = $unix->NETWORK_ALL_INTERFACES(true); $f[] = "set httpd port 2874 and use address 127.0.0.1"; $f[] = "\tallow 127.0.0.1"; while (list($tcpi, $to) = each($allips)) { $f[] = "\tallow {$tcpi}"; } $top = $unix->find_program("top"); $hostname = $unix->hostname_g(); if ($DoNotCheckSystem == 0) { $f[] = "check system " . $unix->hostname_g(); if ($SystemLoadNotif > 0) { $f[] = "\tif loadavg (1min) > {$SystemLoadNotif} then exec \"{$php5} /usr/share/artica-postfix/exec.watchdog.php --loadavg-notif\""; } if ($EnableLoadAvg1mnUser == 1) { $f[] = "\tif loadavg (1min) > {$Load1mn} for 5 cycles then alert"; } if ($EnableLoadAvg5mnUser == 1) { $f[] = "\tif loadavg (5min) > {$Load5mn} for 5 cycles then alert"; } if ($EnableLoadAvg15mnUser == 1) { $f[] = "\tif loadavg (15min) > {$Load15mn} for 5 cycles then alert"; } if ($EnableWatchMemoryUsage == 1) { $f[] = "\tif memory usage > {$SystemWatchMemoryUsage}% for 5 cycles then alert"; } if ($EnableWatchCPUsage == 1) { //$f[]="if cpu usage (user) > $SystemWatchCPUUser% for 5 cycles then exec \"/bin/bash -c '$top -b -n 1 >> /var/log/ArticaProc.log;/bin/date >> /var/log/ArticaProc.log'\""; //$f[]="if cpu usage (system) > $SystemWatchCPUSystem% for 5 cycles then exec \"/bin/bash -c '$top -b -n 1 >> /var/log/ArticaProc.log;/bin/date >> /var/log/ArticaProc.log'\""; } } $f[] = "check host loopback with address 127.0.0.1"; $f[] = "\tif failed icmp type echo with timeout 1 seconds then exec \"/bin/loopbackfailed.sh\""; $f[] = ""; $loopbackfailed[] = "#!/bin/sh"; $loopbackfailed[] = "{$php5} /usr/share/artica-postfix/exec.virtuals-ip.php --loopback"; $loopbackfailed[] = ""; @file_put_contents("/bin/loopbackfailed.sh", @implode("\n", $loopbackfailed)); @chmod("/bin/loopbackfailed.sh", 0755); $loopbackfailed = array(); //******************************************************************************************************************** $f[] = "check file php.log with path /var/log/php.log"; $f[] = "\tif size > 100 MB then"; $f[] = "\t\texec \"/bin/clean-phplog.sh\""; $f[] = ""; $f[] = "check file usrphp.log with path /usr/share/artica-postfix/ressources/logs/php.log"; $f[] = " if size > 100 MB then"; $f[] = "\t\texec \"/bin/clean-phplog.sh\""; $f[] = ""; $f[] = "include /etc/monit/conf.d/*"; @file_put_contents("/etc/monit/monitrc", @implode("\n", $f)); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} /etc/monit/monitrc done...\n"; } $AA[] = "#!/bin/sh"; $AA[] = "{$echo} \"\" >/var/log/php.log"; $AA[] = ""; @file_put_contents("/bin/clean-phplog.sh", @implode("\n", $AA)); @chmod("/bin/clean-phplog.sh", 0755); $AA = array(); $monit = new monit(); $monit->save(); $INITD_PATH = $unix->SLAPD_INITD_PATH(); $SLAPD_PID_FILE = $unix->SLAPD_PID_PATH(); $squidbin = $unix->LOCATE_SQUID_BIN(); @unlink("/etc/monit/conf.d/APP_OPENLDAP.monitrc"); //******************************************************************************************************************** $f = array(); //******************************************************************************************************************** $f = array(); $f[] = "check process APP_FRAMEWORK"; $f[] = "with pidfile /var/run/lighttpd/framework.pid"; $f[] = "start program = \"/etc/init.d/artica-framework start --monit\""; $f[] = "stop program = \"/etc/init.d/artica-framework stop --monit\""; $f[] = "if 5 restarts within 5 cycles then timeout"; @file_put_contents("/etc/monit/conf.d/articaframework.monitrc", @implode("\n", $f)); $f = array(); //******************************************************************************************************************** $f = array(); @unlink("/etc/monit/conf.d/APP_OPENSSH.monitrc"); @unlink("/etc/monit/conf.d/APP_MYSQLD.monitrc"); //******************************************************************************************************************** $f = array(); $f[] = "check process APP_ARTICA_STATUS with pidfile /etc/artica-postfix/exec.status.php.pid"; $f[] = "\tstart program = \"/etc/init.d/artica-status start --monit\""; $f[] = "\tstop program = \"/etc/init.d/artica-status stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Artica Status...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ARTICASTATUS.monitrc", @implode("\n", $f)); //******************************************************************************************************************** $f = array(); @unlink("/etc/monit/conf.d/squid.monitrc"); @unlink("/etc/monit/conf.d/APP_SQUIDMAIN.monitrc"); if (is_file($squidbin)) { if ($SQUIDEnable == 1) { $MonitConfig = unserialize(base64_decode($sock->GET_INFO("SquidWatchdogMonitConfig"))); $SquidMgrListenPort = trim($sock->GET_INFO("SquidMgrListenPort")); if (!is_numeric($MonitConfig["watchdog"])) { $MonitConfig["watchdog"] = 1; } if (!is_numeric($MonitConfig["watchdogCPU"])) { $MonitConfig["watchdogCPU"] = 95; } if (!is_numeric($MonitConfig["watchdogMEM"])) { $MonitConfig["watchdogMEM"] = 1500; } if ($MonitConfig["watchdog"] == 1) { if ($MonitConfig["watchdogMEM"] > 500) { $AVAILABLE_MEM = $unix->MEM_TOTAL_INSTALLEE(); $AVAILABLE_MEM = $AVAILABLE_MEM / 1024; $prc = $MonitConfig["watchdogMEM"] / $AVAILABLE_MEM; $prc = round($prc * 100); } $f = array(); $f[] = "check process APP_SQUID with pidfile /var/run/squid/squid.pid"; $f[] = "\tstart program = \"/etc/init.d/squid start --monit\""; $f[] = "\tstop program = \"/etc/init.d/squid stop --monit\""; if ($SquidMgrListenPort > 0) { $f[] = "\tif failed host 127.0.0.1 port {$SquidMgrListenPort} then restart"; } if ($MonitConfig["watchdogCPU"] > 60) { $f[] = "\tif cpu usage > {$MonitConfig["watchdogCPU"]}% for 5 cycles then restart"; } if ($prc > 10) { $f[] = "\tif mem usage > {$prc}% for 5 cycles then restart"; } $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Squid-Cache...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SQUIDMAIN.monitrc", @implode("\n", $f)); } } } // ******************************************************************************************************************** $f = array(); @unlink("/etc/monit/conf.d/APP_SQUIDDB.monitrc"); if (is_dir("/opt/squidsql/data")) { if ($SQUIDEnable == 1) { $f = array(); $f[] = "check process APP_SQUID_DB with pidfile /var/run/squid-db.pid"; $f[] = "\tstart program = \"/etc/init.d/squid-db start --monit\""; $f[] = "\tstop program = \"/etc/init.d/squid-db stop --monit\""; $f[] = "\tif failed unixsocket /var/run/mysqld/squid-db.sock then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Squid MySQL DB...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SQUIDDB.monitrc", @implode("\n", $f)); } } // ******************************************************************************************************************** $f = array(); @unlink("/etc/monit/conf.d/APP_DNSMASQ.monitrc"); if ($users->dnsmasq_installed) { $enabled = $sock->dnsmasq_enabled(); if ($enabled == 1) { $f[] = "check process APP_DNSMASQ with pidfile /var/run/dnsmasq.pid"; $f[] = "\tstart program = \"/etc/init.d/dnsmasq start --monit\""; $f[] = "\tstop program = \"/etc/init.d/dnsmasq stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DnsMASQ...\n"; } @file_put_contents("/etc/monit/conf.d/APP_DNSMASQ.monitrc", @implode("\n", $f)); } } // ******************************************************************************************************************** // ******************************************************************************************************************** $f = array(); @unlink("/etc/monit/conf.d/APP_CICAP.monitrc"); if ($users->C_ICAP_INSTALLED) { if ($SQUIDEnable == 1) { $CicapEnabled = $sock->GET_INFO("CicapEnabled"); if (!is_numeric($CicapEnabled)) { $CicapEnabled = 0; } if ($CicapEnabled == 1) { $f[] = "check process APP_C_ICAP with pidfile /var/run/c-icap/c-icap.pid"; $f[] = "\tstart program = \"/etc/init.d/artica-postfix start cicap\""; $f[] = "\tstop program = \"/etc/init.d/artica-postfix stop cicap\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring C-ICAP...\n"; } @file_put_contents("/etc/monit/conf.d/APP_CICAP.monitrc", @implode("\n", $f)); } } } // ******************************************************************************************************************** @unlink("/etc/monit/conf.d/APP_SYSLOGDB.monitrc"); if ($EnableSyslogDB == 1) { if ($MySQLSyslogType == 1) { $f = array(); $f[] = "check process APP_SYSLOG_DB with pidfile /var/run/syslogdb.pid"; $f[] = "\tstart program = \"/etc/init.d/syslog-db start --monit\""; $f[] = "\tstop program = \"/etc/init.d/syslog-db stop --monit\""; $f[] = "\tif failed unixsocket /var/run/syslogdb.sock then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring syslogd...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SYSLOGDB.monitrc", @implode("\n", $f)); } } //******************************************************************************************************************** @unlink("/etc/monit/conf.d/APP_ZARAFASERVER.monitrc"); @unlink("/etc/monit/conf.d/APP_ZARAFAGATEWAY.monitrc"); @unlink("/etc/monit/conf.d/APP_ZARAFAAPACHE.monitrc"); @unlink("/etc/monit/conf.d/APP_ZARAFAWEB.monitrc"); @unlink("/etc/monit/conf.d/APP_ZARAFASPOOLER.monitrc"); @unlink("/etc/monit/conf.d/APP_ZARAFADB.monitrc"); if (is_file($unix->find_program("zarafa-server"))) { $ZarafaApacheEnable = $sock->GET_INFO("ZarafaApacheEnable"); if (!is_numeric($ZarafaApacheEnable)) { $ZarafaApacheEnable = 1; } $ZarafaApachePort = $sock->GET_INFO("ZarafaApachePort"); if (!is_numeric($ZarafaApachePort)) { $ZarafaApachePort = 9010; } if ($ZarafaDedicateMySQLServer == 1) { $f = array(); $f[] = "check process APP_ZARAFA_DB with pidfile /var/run/zarafa-db.pid"; $f[] = "\tstart program = \"/etc/init.d/zarafa-db start --monit\""; $f[] = "\tstop program = \"/etc/init.d/zarafa-db stop --monit\""; $f[] = "\tif failed unixsocket /var/run/mysqld/zarafa-db.sock then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Zarafa Database...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ZARAFADB.monitrc", @implode("\n", $f)); } $f = array(); $f[] = "check process APP_ZARAFA_SERVER with pidfile /var/run/zarafa-server.pid"; $f[] = "\tstart program = \"/etc/init.d/zarafa-server start --monit\""; $f[] = "\tstop program = \"/etc/init.d/zarafa-server stop --monit\""; $f[] = "\tif failed unixsocket /var/run/zarafa then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Zarafa Server...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ZARAFASERVER.monitrc", @implode("\n", $f)); $f = array(); $f[] = "check process APP_ZARAFA_SPOOLER with pidfile /var/run/zarafa-spooler.pid"; $f[] = "\tstart program = \"/etc/init.d/zarafa-spooler start --monit\""; $f[] = "\tstop program = \"/etc/init.d/zarafa-spooler stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Zarafa Spooler...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ZARAFASPOOLER.monitrc", @implode("\n", $f)); $f = array(); $f[] = "check process APP_ZARAFA_GATEWAY with pidfile /var/run/zarafa-gateway.pid"; $f[] = "\tstart program = \"/etc/init.d/zarafa-gateway start --monit\""; $f[] = "\tstop program = \"/etc/init.d/zarafa-gateway stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Zarafa Gateway...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ZARAFAGATEWAY.monitrc", @implode("\n", $f)); } //******************************************************************************************************************** $EnableClamavDaemon = $sock->GET_INFO("EnableClamavDaemon"); $EnableClamavDaemonForced = $sock->GET_INFO("EnableClamavDaemonForced"); $CicapEnabled = $sock->GET_INFO("CicapEnabled"); $SQUIDEnable = $sock->GET_INFO("SQUIDEnable"); if (!is_numeric($EnableClamavDaemon)) { $EnableClamavDaemon = 0; } if (!is_numeric($EnableClamavDaemonForced)) { $EnableClamavDaemonForced = 0; } if (!is_numeric($SQUIDEnable)) { $SQUIDEnable = 1; } if (!is_numeric($CicapEnabled)) { $CicapEnabled = 0; } if ($SQUIDEnable == 1) { if ($CicapEnabled == 1) { $EnableClamavDaemon = 1; } } if ($EnableClamavDaemonForced == 1) { $EnableClamavDaemon = 1; } //******************************************************************************************************************** @unlink("/etc/monit/conf.d/APP_CLAMAV.monitrc"); $MasterBin = $unix->find_program("clamd"); if (is_file($MasterBin)) { if ($EnableClamavDaemon == 1) { $f = array(); $f[] = "check process APP_CLAMAV"; $f[] = "with pidfile /var/run/clamav/clamd.pid"; $f[] = "start program = \"/etc/init.d/clamav-daemon start --monit\""; $f[] = "stop program = \"/etc/init.d/clamav-daemon stop --monit\""; $f[] = "if 5 restarts within 5 cycles then timeout"; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Clamd service...\n"; } @file_put_contents("/etc/monit/conf.d/APP_CLAMAV.monitrc", @implode("\n", $f)); $f = array(); } } //******************************************************************************************************************** @unlink("/etc/monit/conf.d/ufdb.monitrc"); @unlink("/etc/monit/conf.d/ufdbweb.monitrc"); $ufdbbin = $unix->find_program("ufdbguardd"); if (is_file($ufdbbin)) { $EnableUfdbGuard = $sock->EnableUfdbGuard(); $UseRemoteUfdbguardService = $sock->GET_INFO('UseRemoteUfdbguardService'); $EnableSquidGuardHTTPService = $sock->GET_INFO("EnableSquidGuardHTTPService"); $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); $SquidGuardApachePort = $sock->GET_INFO("SquidGuardApachePort"); $SquidGuardApacheSSLPort = $sock->GET_INFO("SquidGuardApacheSSLPort"); if (!is_numeric($UseRemoteUfdbguardService)) { $UseRemoteUfdbguardService = 0; } if (!is_numeric($EnableUfdbGuard)) { $EnableUfdbGuard = 0; } if (!is_numeric($EnableSquidGuardHTTPService)) { $EnableSquidGuardHTTPService = 1; } if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if ($EnableUfdbGuard == 0) { $EnableSquidGuardHTTPService = 0; } if ($EnableWebProxyStatsAppliance == 1) { $EnableSquidGuardHTTPService = 1; } if (!is_numeric($SquidGuardApachePort)) { $SquidGuardApachePort = "9020"; } if (!is_numeric($SquidGuardApacheSSLPort)) { $SquidGuardApacheSSLPort = 9025; } if ($SquidPerformance > 2) { $EnableSquidGuardHTTPService = 0; } if ($SQUIDEnable == 1) { if ($UseRemoteUfdbguardService == 0) { if ($EnableUfdbGuard == 1) { $f = array(); $f[] = "check process APP_UFDBGUARD"; $f[] = "with pidfile /var/run/urlfilterdb/ufdbguardd.pid"; $f[] = "start program = \"/etc/init.d/ufdb start --monit\""; $f[] = "stop program = \"/etc/init.d/ufdb stop --monit\""; $f[] = "if totalmem > 700 MB for 5 cycles then alert"; $f[] = "if cpu > 95% for 5 cycles then alert"; $f[] = "if 5 restarts within 5 cycles then timeout"; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Web filtering service...\n"; } @file_put_contents("/etc/monit/conf.d/ufdb.monitrc", @implode("\n", $f)); } } if ($EnableSquidGuardHTTPService == 1) { $f = array(); $f[] = "check process APP_SQUIDGUARD_HTTP"; $f[] = "with pidfile /var/run/lighttpd/squidguard-lighttpd.pid"; $f[] = "start program = \"/etc/init.d/squidguard-http start --monit\""; $f[] = "stop program = \"/etc/init.d/squidguard-http stop --monit\""; $f[] = "if failed host 127.0.0.1 port {$SquidGuardApachePort} then restart"; $f[] = "if 5 restarts within 5 cycles then timeout"; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Web filtering HTTP service...\n"; } @file_put_contents("/etc/monit/conf.d/ufdbweb.monitrc", @implode("\n", $f)); } } } //******************************************************************************************************************** $EnableArticaFrontEndToNGninx = $sock->GET_INFO("EnableArticaFrontEndToNGninx"); $EnableArticaFrontEndToApache = $sock->GET_INFO("EnableArticaFrontEndToApache"); if (!is_numeric($EnableArticaFrontEndToNGninx)) { $EnableArticaFrontEndToNGninx = 0; } if (!is_numeric($EnableArticaFrontEndToApache)) { $EnableArticaFrontEndToApache = 0; } $EnableNginx = $sock->GET_INFO("EnableNginx"); $EnableFreeWeb = $sock->GET_INFO("EnableFreeWeb"); if (!is_numeric($EnableFreeWeb)) { $EnableFreeWeb = 0; } if (!is_numeric($EnableNginx)) { $EnableNginx = 1; } if ($EnableNginx == 0) { $EnableArticaFrontEndToNGninx = 0; } $pid = null; @unlink("/etc/monit/conf.d/APP_LIGHTTPD.monitrc"); if ($EnableArticaFrontEndToNGninx == 0) { $pid = "/var/run/lighttpd/lighttpd.pid"; if ($EnableArticaFrontEndToApache == 1) { $pid = "/var/run/artica-apache/apache.pid"; } $f = array(); $f[] = "check process APP_ARTICAWEBCONSOLE with pidfile {$pid}"; $f[] = "\tstart program = \"/etc/init.d/artica-webconsole start --monit\""; $f[] = "\tstop program = \"/etc/init.d/artica-webconsole stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Artica Web Console...\n"; } @file_put_contents("/etc/monit/conf.d/APP_LIGHTTPD.monitrc", @implode("\n", $f)); } //******************************************************************************************************************** @unlink("/etc/monit/conf.d/APP_NGINX.monitrc"); $nginx = $unix->find_program("nginx"); if (is_file($nginx)) { if ($EnableNginx == 1) { $f = array(); $f[] = "check process APP_NGINX with pidfile /var/run/nginx.pid"; $f[] = "\tstart program = \"/etc/init.d/nginx start --monit\""; $f[] = "\tstop program = \"/etc/init.d/nginx stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring NgINX...\n"; } @file_put_contents("/etc/monit/conf.d/APP_NGINX.monitrc", @implode("\n", $f)); } } //******************************************************************************************************************** $f = array(); if (is_file("/etc/init.d/sysklogd")) { $f[] = "check process APP_SYSLOGD with pidfile /var/run/syslogd.pid"; $f[] = "\tstart program = \"/etc/init.d/sysklogd start --monit\""; $f[] = "\tstop program = \"/etc/init.d/sysklogd stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = "\tcheck file syslogd_file with path /var/log/syslog"; $f[] = "\tif timestamp > 10 minutes then restart"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring sysklogd...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SYSKLOGD.monitrc", @implode("\n", $f)); } //******************************************************************************************************************** $binpath = $unix->DHCPD_BIN_PATH(); @unlink("/etc/monit/conf.d/APP_DHCPD.monitrc"); $f = array(); if (is_file($binpath)) { $EnableDHCPServer = $sock->GET_INFO("EnableDHCPServer"); if (!is_numeric($EnableDHCPServer)) { $EnableDHCPServer = 0; } if ($EnableDHCPServer == 1) { $f[] = "check process APP_DHCP with pidfile /var/run/dhcpd.pid"; $f[] = "\tstart program = \"/etc/init.d/isc-dhcp-server start --monit\""; $f[] = "\tstop program = \"/etc/init.d/isc-dhcp-server stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DHCP Service...\n"; } @file_put_contents("/etc/monit/conf.d/APP_DHCPD.monitrc", @implode("\n", $f)); } } //******************************************************************************************************************** $binpath = $unix->find_program("rdpproxy"); @unlink("/etc/monit/conf.d/APP_RDPPROXY.monitrc"); $f = array(); if (is_file($binpath)) { $EnableRDPProxy = $sock->GET_INFO("EnableRDPProxy"); if (!is_numeric($EnableRDPProxy)) { $EnableRDPProxy = 0; } if ($EnableRDPProxy == 1) { $f[] = "check process APP_RDPPROXY with pidfile /var/run/redemption/rdpproxy.pid"; $f[] = "\tstart program = \"/etc/init.d/rdpproxy start --monit\""; $f[] = "\tstop program = \"/etc/init.d/rdpproxy stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring RDP Proxy...\n"; } @file_put_contents("/etc/monit/conf.d/APP_RDPPROXY.monitrc", @implode("\n", $f)); } } //******************************************************************************************************************** @unlink("/etc/monit/conf.d/APP_DNSMASQ.monitrc"); $f = array(); $binpath = $unix->find_program("dnsmasq"); if (is_file($binpath)) { $EnableDNSMASQ = $users->EnableDNSMASQ(); if ($EnableDNSMASQ == 1) { $f[] = "check process APP_DNSMASQ with pidfile /var/run/dnsmasq.pid"; $f[] = "\tstart program = \"/etc/init.d/dnsmasq start --monit\""; $f[] = "\tstop program = \"/etc/init.d/dnsmasq stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DNSMasq Service...\n"; } @file_put_contents("/etc/monit/conf.d/APP_DNSMASQ.monitrc", @implode("\n", $f)); } } //******************************************************************************************************************** if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} checking syslog\n"; } if (is_file("/etc/init.d/syslog")) { checkDebSyslog(); } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} configuration done\n"; } shell_exec($GLOBALS["MONIT_CLASS"]->monitor_all_cmdline . " 2>&1"); }
function CheckAvailable() { $unix = new unix(); $sock = new sockets(); $EnableUfdbGuard = $sock->EnableUfdbGuard(); if ($EnableUfdbGuard == 0) { return false; } $datas = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig"))); if (!isset($datas["UseRemoteUfdbguardService"])) { $datas["UseRemoteUfdbguardService"] = 0; } if (!is_numeric($datas["remote_port"])) { $datas["remote_port"] = 3977; } $Detected = false; $f = explode("\n", @file_get_contents("/etc/squid3/squid.conf")); while (list($index, $line) = each($f)) { $line = trim($line); if ($line == null) { continue; } if (preg_match("#^url_rewrite_program.*?ufdbgclient#", $line)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, OK CLIENT IS LINKED\n"; } if ($GLOBALS["VERBOSE"]) { echo "`{$line}` OK\n"; $Detected = true; break; } } if ($GLOBALS["VERBOSE"]) { echo "`{$line}` no match\n"; } } if ($datas["UseRemoteUfdbguardService"] == 1) { $host = $datas["remote_server"]; $port = $datas["remote_port"]; } else { $array = GetLocalConf(); $host = $array[1]; $port = $array[0]; } if ($host == "all") { $host = "127.0.0.1"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Remote host...: {$host}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Remote port.....: {$port}\n"; } $fsock = fsockopen($host, $port, $errno, $errstr, 5); if (!$fsock) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Failed to connect to the remote Webfiltering service {$host}:{$port}\n"; } squid_admin_mysql(0, "Fatal, failed to connect to the remote Webfiltering service{$GLOBALS["ADPLUS"]}", "{$datas["remote_server"]}:{$datas["remote_port"]} Error number {$errno} {$errstr}", __FILE__, __LINE__); return false; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Success to connect to the remote Webfiltering service {$host}:{$port}\n"; } return true; }
function toolbox() { $page = CurrentPageName(); if (!isset($_SESSION["uid"])) { echo "<script>LoadAjax('services-status','{$page}?services-status-table=yes');</script>"; return; } $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth"); $EnableUfdbGuard = $sock->EnableUfdbGuard(); if (!is_numeric($EnableKerbAuth)) { $EnableKerbAuth = 0; } $scripts = "\tvar x_ReconfigureUfdb= function (obj) {\n\t\tvar res=obj.responseText;\n\t\tif (res.length>3){alert(res);}\n\t\tRefreshTab('prxytab');\n\t}\t\t\n\t\t\n\tfunction ReconfigureUfdb(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t XHR.appendData('ReconfigureUfdb', 'yes');\n\t\t AnimateDiv('squid-services');\n\t\t XHR.sendAndLoad('{$page}', 'POST',x_ReconfigureUfdb); \n\t\t\n\t}"; if ($EnableUfdbGuard == 1) { $ufdbbutt = Paragraphe("service-check-64.png", "UfdbGuard", "{reconfigure_webfilter_service}", "javascript:ReconfigureUfdb()"); } $squid_rotate = Paragraphe("events-rotate-64.png", "Logs rotation", "{squid_logrotate_perform}", "javascript:Loadjs('squid.perf.logrotate.php?img=events-rotate-32-squid&src=events-rotate-32.png')"); $reconfigure = Paragraphe("rebuild-64.png", "{reconfigure}", "{reconfigure}", "javascript:Loadjs('squid.compile.progress.php');"); $debug_compile = Paragraphe("64-logs.png", "{compile_in_debug}", "{compile_in_debug}", "javascript:Loadjs('squid.debug.compile.php');"); $current_sessions = Paragraphe("64-logs.png", "{sessions}", "{display_current_sessions}", "javascript:Loadjs('squid.squidclient.clientlist.php');"); $performances = Paragraphe("performance-tuning-64.png", "{performance}", "{display_performance_status}", "javascript:Loadjs('squid.squidclient.info.php');"); $restart_all_services = Paragraphe("service-restart-64.png", "{restart}", "{restart_all_services}", "javascript:Loadjs('squid.restart.php');"); $restart_service_only = Paragraphe("service-restart-32.png", "{restart_onlysquid}", "{restart_onlysquid}", "javascript:Loadjs('squid.restart.php?onlySquid=yes');"); $html = "<table style='width:100%'>\n\t<tr>\n\t\t<td>{$ufdbbutt}</td>\n\t\t<td>{$current_sessions}</td>\n\t\t<td>{$performances}</td>\n\t\t<td>{$squid_rotate}</td>\n\t</tr>\n\t\t<td>{$reconfigure}</td>\n\t\t<td>{$debug_compile}</td>\n\t\t<td>{$restart_service_only}</td>\n\t\t<td> </td>\t\t\t\t\n\t</tr>\n\t</table>\n\t\n\t<script>\n\t\tLoadAjax('services-status','{$page}?services-status-table=yes');\n\t</script>\n\t\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function squid_filters_infos() { $sock = new sockets(); if (!isset($GLOBALS["CLASS_USERS_MENUS"])) { $users = new usersMenus(); $GLOBALS["CLASS_USERS_MENUS"] = $users; } else { $users = $GLOBALS["CLASS_USERS_MENUS"]; } if (!$users->SQUID_INSTALLED) { return null; } $SQUIDEnable = $sock->GET_INFO("SQUIDEnable"); if (!is_numeric($SQUIDEnable)) { $SQUIDEnable = 1; } if ($SQUIDEnable == 0) { if ($GLOBALS["VERBOSE"]) { echo "DEBUG:squid_filters_infos():: SQUIDEnable is not enabled... Aborting\n"; } return; } $filtered = false; $EnableUfdbGuard = $sock->EnableUfdbGuard(); $squidGuardEnabled = $sock->GET_INFO("squidGuardEnabled"); $DansGuardianEnabled = $sock->GET_INFO("DansGuardianEnabled"); if ($EnableUfdbGuard == 1) { $filtered = true; } if ($squidGuardEnabled == 1) { $filtered = true; } if ($DansGuardianEnabled == 1) { $filtered = true; } $IsIcapClient = trim($sock->getFrameWork("squid.php?IsIcapClient=yes")); if ($IsIcapClient == 'TRUE') { $filtered = true; } if (!$filtered) { if ($GLOBALS["VERBOSE"]) { echo "DEBUG:squid_filters_infos():: Not filtered\n"; } return null; } $EnableCommunityFilters = $sock->GET_INFO("EnableCommunityFilters"); if ($EnableCommunityFilters == null) { $EnableCommunityFilters = 1; } if ($EnableCommunityFilters != 1) { if ($GLOBALS["VERBOSE"]) { echo "DEBUG:squid_filters_infos():: EnableCommunityFilters is not enabled... Aborting\n"; } return; } $sql = "SELECT count(*) as tcount FROM `dansguardian_sitesinfos` WHERE `dbpath` = ''"; $q = new mysql(); $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup')); if ($GLOBALS["VERBOSE"]) { echo "DEBUG:squid_filters_infos():: EnableCommunityFilters {$ligne["tcount"]}\n"; } if ($ligne["tcount"] == 0) { return null; } return NotifyAdmin("32-categories.png", $ligne["tcount"] . " {websites_not_categorized}", "{websites_not_categorized_text}", "javascript:Loadjs('squid.visited.php')", null, 300, 76, 1); }
function CheckUFDBGuardConfig($ForcePid = false) { if ($GLOBALS["FORCE"]) { $ForcePid = false; } $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pidtimeNTP = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".ntp.time"; $unix = new unix(); $sock = new sockets(); if ($ForcePid) { $pid = $unix->get_pid_from_file($pidFile); if ($unix->process_exists($pid)) { if ($unix->PROCCESS_TIME_MIN($pid, 10) < 2) { return; } } } @file_put_contents($pidFile, getmypid()); $time = $unix->file_time_min($pidtime); if ($time < 2) { return; } @unlink($pidtime); @file_put_contents($pidtime, time()); $EnableUfdbGuard = $sock->EnableUfdbGuard(); if ($EnableUfdbGuard == 0) { if ($GLOBALS["VERBOSE"]) { echo "EnableUfdbGuard = {$EnableUfdbGuard}, return...\n"; } return; } $datas = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig"))); if (!isset($datas["UseRemoteUfdbguardService"])) { $datas["UseRemoteUfdbguardService"] = 0; } if (!is_numeric($datas["remote_port"])) { $datas["remote_port"] = 3977; } $Detected = CheckUFDBGuardConfigIsClient(); if ($Detected) { if ($datas["UseRemoteUfdbguardService"] == 1) { $fsock = fsockopen($datas["remote_server"], $datas["remote_port"], $errno, $errstr, 5); if (!$fsock) { @fclose($fsock); squid_admin_mysql(0, "Fatal, failed to connect to the remote Webfiltering service", "{$datas["remote_server"]}:{$datas["remote_port"]} Error number {$errno} {$errstr}", __FILE__, __LINE__); shell_exec("/etc/init.d/ufdb-client stop --watchdog"); } else { @fclose($fsock); if ($GLOBALS["VERBOSE"]) { echo "`{$datas["remote_server"]}:{$datas["remote_port"]}` OK\n"; return; } } } return; } if ($datas["UseRemoteUfdbguardService"] == 1) { $fsock = fsockopen($datas["remote_server"], $datas["remote_port"], $errno, $errstr, 5); if (!$fsock) { squid_admin_mysql(0, "Fatal, failed to connect to the remote Webfiltering service", "{$datas["remote_server"]}:{$datas["remote_port"]} Error number {$errno} {$errstr}", __FILE__, __LINE__); @fclose($fsock); return; } } if ($GLOBALS["VERBOSE"]) { echo "`{$datas["remote_server"]}:{$datas["remote_port"]}` OK\n"; } @fclose($fsock); if (!$Detected) { shell_exec("/etc/init.d/ufdb-client start --watchdog"); } }
function start6() { $cacheFile = "/usr/share/artica-postfix/ressources/logs/web/INTERFACE_WEBFILTER_BLOCKED.db"; @unlink($cacheFile); $unix = new unix(); $squid = $unix->LOCATE_SQUID_BIN(); if (!is_file($squid)) { if ($GLOBALS["VERBOSE"]) { echo "start6: squid no such binary\n"; } return; } $sock = new sockets(); if ($sock->EnableUfdbGuard() == 0) { return; } $zday = date('Ymd'); $table = $zday . "_blocked"; $q = new mysql_squid_builder(); if (!$q->TABLE_EXISTS($table)) { $hier = strtotime($q->HIER() . " 00:00:00"); $zday = date('Ymd', $hier); $table = $zday . "_blocked"; } if (!$q->TABLE_EXISTS($table)) { return; } $sql = "SELECT COUNT(*) as hits,HOUR(zDate) as `hour` FROM {$table} GROUP BY `hour` ORDER BY `hour`"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "{$q->mysql_error}"; return; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $hits = $ligne["hits"]; $xdata[] = $ligne["hour"]; $ydata[] = $hits; } if (count($xdata) < 2) { if ($GLOBALS["VERBOSE"]) { echo "start4(): " . count($xdata) . " < 2\n"; } return; } $array = array($xdata, $ydata); @file_put_contents($cacheFile, serialize($array)); @chmod($cacheFile, 0755); }
function status() { $sock = new sockets(); $users = new usersMenus(); $UseRemoteUfdbguardService = intval($sock->GET_INFO("UseRemoteUfdbguardService")); if ($UseRemoteUfdbguardService == 1) { status_client(); exit; } $shield_ok = "shield-ok-256.png"; $shield_disabled = "shield-grey-256.png"; $shield_red = "shield-red-256.png"; $shield_warn = "shield-warn-256.png"; $ini = new Bs_IniHandler(); $err = array(); $tpl = new templates(); $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\""; if ($sock->EnableUfdbGuard() == 0) { echo "<center><img src='img/{$shield_disabled}'></center>"; return; } $ini->loadString(base64_decode($sock->getFrameWork("squid.php?ufdbguardd-all-status=yes"))); $c = 0; while (list($key, $array) = each($ini->_params)) { $service_name = $array["service_name"]; $service_disabled = intval($array["service_disabled"]); if ($service_disabled == 0) { continue; } $running = intval($array["running"]); $c++; if ($running == 0) { $icon = "disks-128-warn.png"; $err[] = "<tr><td style='font-size:18px;color:#d32d2d;vertical-align:middle' OnClick=\"javascript:GoToServices()\">\n\t\t\t<img src='img/warn-red-32.png' style='float:left;margin-right:10px'>\n\t\t\t{{$service_name}} <span style='text-decoration:underline' {$curs}> {stopped}</span></td></tr>"; } } if (count($err) > 0) { echo "<center><img src='img/{$shield_red}'></center>\n\t\t<table>" . @implode("\n", $err) . "</table>"; } else { echo "<center><img src='img/{$shield_ok}'></center>"; } $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient")); if ($EnableArticaMetaClient == 1) { $LOCAL_VERSION_TEXT = $tpl->time_to_date($sock->GET_INFO("UfdbMetaClientVersion")); } else { $MAINARR = unserialize(base64_decode($sock->GET_INFO("CATZ_ARRAY"))); $LOCAL_VERSION_TEXT = $tpl->time_to_date($MAINARR["TIME"]); } echo $tpl->_ENGINE_parse_body("<center style='font-size:22px;margin-top:10px;font-weight:bold'>{running}</center>"); echo $tpl->_ENGINE_parse_body("<center style='font-size:16px'>{since}: {$ini->_params["APP_UFDBGUARD"]["uptime"]}</center>"); echo $tpl->_ENGINE_parse_body("<center style='font-size:16px'>{memory}: " . FormatBytes($ini->_params["APP_UFDBGUARD"]["master_memory"]) . "</center>"); echo "<hr>"; echo $tpl->_ENGINE_parse_body("<center style='font-size:16px'>{version}: {$LOCAL_VERSION_TEXT}</center>"); }
function dansguardian_service_status_nofilters() { $sock = new sockets(); $users = new usersMenus(); $okFilter = false; $squid = new squidbee(); $kavicapserverEnabled = $sock->GET_INFO("kavicapserverEnabled"); $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); if (!is_numeric($EnableUfdbGuard)) { $EnableUfdbGuard = 0; } $KAV4PROXY_INSTALLED = 0; $APP_UFDBGUARD_INSTALLED = 0; $KAV4PROXY_INSTALLED = 0; if ($users->DANSGUARDIAN_INSTALLED) { $KAV4PROXY_INSTALLED = 1; } if ($users->APP_UFDBGUARD_INSTALLED) { $APP_UFDBGUARD_INSTALLED = 1; } if ($users->KAV4PROXY_INSTALLED) { $KAV4PROXY_INSTALLED = 1; } writelogs("EnableUfdbGuard={$EnableUfdbGuard}; KAV4PROXY_INSTALLED:{$KAV4PROXY_INSTALLED} APP_UFDBGUARD_INSTALLED:{$APP_UFDBGUARD_INSTALLED} KAV4PROXY_INSTALLED:{$KAV4PROXY_INSTALLED}", __FUNCTION__, __FILE__, __LINE__); if ($users->DANSGUARDIAN_INSTALLED) { if ($squid->enable_dansguardian == 1) { $okFilter = true; } } if ($users->APP_UFDBGUARD_INSTALLED) { if ($EnableUfdbGuard == 1) { $okFilter = true; } } if ($users->KAV4PROXY_INSTALLED) { if ($kavicapserverEnabled == 1) { $okFilter = true; } } if ($okFilter) { return; } $okFilterText = "\n\t\t<center style='margin-bottom:20px'>\n\t\t<table style='width:90%' class=form>\n\t\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/warning-panneau-64.png'></td>\n\t\t\t\t<td style='font-size:14px'>\n\t\t\t\t\t\t{dansguardian_no_filters_explain}\n\t\t\t\t\t\t<div style='text-align:right;font-size:12px'>\n\t\t\t\t\t\t\t<a href=\"javascript:blur();\" style='text-align:right;font-size:12px' \n\t\t\t\t\t\t\tOnClick=\"Loadjs('squid.popups.php?script=plugins')\">{click_here_to_enable_filters}</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</tbody>\n\t\t</tr>\n\t\t</table>\n\t\t</center>\n\t\t\n\t\t"; $tpl = new templates(); $html = $tpl->_ENGINE_parse_body($okFilterText, 'squid.index.php'); echo $html . "<script>UnlockPage();</script>"; }
function build() { $users = new usersMenus(); $sock = new sockets(); $unix = new unix(); $SystemLoadNotif = $sock->GET_INFO("SystemLoadNotif"); if (!is_numeric($SystemLoadNotif)) { $SystemLoadNotif = 0; } $EnableSyslogDB = $sock->GET_INFO("EnableSyslogDB"); if (!is_numeric($EnableSyslogDB)) { $EnableSyslogDB = 0; } $MySQLSyslogType = $sock->GET_INFO("MySQLSyslogType"); if (!is_numeric($MySQLSyslogType)) { $MySQLSyslogType = 1; } $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); $EnableIntelCeleron = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableIntelCeleron")); $python = $unix->find_program("python"); $nice = $unix->EXEC_NICE(); $ps = $unix->find_program("ps"); $sort = $unix->find_program("sort"); $head = $unix->find_program("head"); $echo = $unix->find_program("echo"); $date = $unix->find_program("date"); $mkdir = $unix->find_program("mkdir"); $php5 = $unix->LOCATE_PHP5_BIN(); $ZarafaDedicateMySQLServer = $sock->GET_INFO("ZarafaDedicateMySQLServer"); if (!is_numeric($ZarafaDedicateMySQLServer)) { $ZarafaDedicateMySQLServer = 0; } build_progress_restart("{reconfiguring}", 22); $ini = new Bs_IniHandler(); $ini->loadFile('/etc/artica-postfix/smtpnotif.conf'); if (!is_numeric($ini->_params["SMTP"]["EnableNotifs"])) { $ini->_params["SMTP"]["EnableNotifs"] = 0; } if (!is_numeric($ini->_params["SMTP"]["tls_enabled"])) { $ini->_params["SMTP"]["tls_enabled"] = 0; } $smtp_server = trim($ini->_params["SMTP"]['smtp_server_name']); $smtp_server_port = $ini->_params["SMTP"]['smtp_server_port']; $smtp_dest = $ini->_params["SMTP"]['smtp_dest']; $smtp_sender = $ini->_params["SMTP"]['smtp_sender']; $smtp_auth_user = $ini->_params["SMTP"]['smtp_auth_user']; $smtp_auth_passwd = $ini->_params["SMTP"]['smtp_auth_passwd']; $tls_enabled = $ini->_params["SMTP"]["tls_enabled"]; $recipientsZ = explode("\n", "/etc/artica-postfix/settings/Daemons/SmtpNotificationConfigCC"); $recipients = array(); while (list($index, $to) = each($recipientsZ)) { if (trim($to) == null) { continue; } $recipients[] = $to; } if ($smtp_server == null) { $ini->_params["SMTP"]["EnableNotifs"] = 0; } if ($smtp_dest == null) { if (count($recipients) == 0) { $ini->_params["SMTP"]["EnableNotifs"] = 0; } } if (!is_numeric($smtp_server_port)) { $smtp_server_port = 25; } $EnableNotifs = $ini->_params["SMTP"]["EnableNotifs"]; $monit_not_on = 'instance,action'; $f[] = 'set daemon 60 with start delay 5'; $f[] = 'set idfile /var/run/monit/monit.id'; $cpunum = $unix->CPU_NUMBER(); $normal = $cpunum * 2 + 1; $normal2 = $cpunum * 2; $busy = $cpunum * 4; build_progress_restart("{reconfiguring}", 23); $EnableMONITSmtpNotif = $sock->GET_INFO("EnableMONITSmtpNotif"); if (!is_numeric($EnableMONITSmtpNotif)) { $EnableMONITSmtpNotif = 1; } $MonitCPUUsage = intval($sock->GET_INFO("MonitCPUUsage")); $MonitCPUUsageCycles = intval($sock->GET_INFO("MonitCPUUsageCycles")); $MonitMemUsage = intval($sock->GET_INFO("MonitMemUsage")); $MonitMemUsageCycles = intval($sock->GET_INFO("MonitMemUsageCycles")); $MonitReportLoadVG1mn = intval($sock->GET_INFO("MonitReportLoadVG1mn")); $MonitReportLoadVG1mnCycles = intval($sock->GET_INFO("MonitReportLoadVG1mnCycles")); if ($MonitReportLoadVG1mnCycles == 0) { $MonitReportLoadVG1mnCycles = 5; } $MonitReportLoadVG5mn = intval($sock->GET_INFO("MonitReportLoadVG5mn")); $MonitReportLoadVG5mnCycles = intval($sock->GET_INFO("MonitReportLoadVG5mnCycles")); if ($MonitReportLoadVG5mnCycles == 0) { $MonitReportLoadVG5mnCycles = 15; } $MonitReportLoadVG15mn = intval($sock->GET_INFO("MonitReportLoadVG15mn")); $MonitReportLoadVG15mnCycles = intval($sock->GET_INFO("MonitReportLoadVG15mnCycles")); if ($MonitReportLoadVG15mnCycles == 0) { $MonitReportLoadVG15mnCycles = 60; } $MonitMemPurgeCache = intval($sock->GET_INFO("MonitMemPurgeCache")); $MonitMemPurgeCacheCycles = intval($sock->GET_INFO("MonitMemPurgeCacheCycles")); if ($MonitMemPurgeCache == 0) { $MonitMemPurgeCache = 70; } if ($MonitMemPurgeCacheCycles == 0) { $MonitMemPurgeCacheCycles = 5; } if ($MonitMemUsageCycles == 0) { $MonitMemUsageCycles = 5; } if ($MonitCPUUsageCycles == 0) { $MonitCPUUsageCycles = 15; } if ($MonitCPUUsage > 0) { if ($MonitCPUUsage < 50) { $MonitCPUUsage = 90; } } if ($MonitMemUsage > 0) { if ($MonitMemUsage < 50) { $MonitMemUsage = 90; } } build_progress_restart("{reconfiguring}", 24); $rmbin = $unix->find_program("rm"); $echo = $unix->find_program("echo"); $SQUIDEnable = $sock->GET_INFO("SQUIDEnable"); if (!is_numeric($SQUIDEnable)) { $SQUIDEnable = 1; } $f[] = 'set logfile syslog facility log_daemon'; $f[] = 'set statefile /var/run/monit/monit.state'; $f[] = ''; if ($EnableNotifs == 1) { if ($EnableMONITSmtpNotif == 1) { $f[] = "set mailserver {$smtp_server} PORT {$smtp_server_port}"; if (strlen($smtp_auth_user) > 0) { $f[] = "\tUSERNAME \"{$smtp_auth_user}\" PASSWORD \"{$smtp_auth_passwd}\""; } if ($tls_enabled == 1) { $f[] = "\tusing TLSV1"; } $f[] = "\tset eventqueue"; $f[] = "\tbasedir /var/monit"; $f[] = "\tslots 100"; $f[] = "\tset mail-format {"; $f[] = "\t\tfrom: {$smtp_sender}"; $f[] = "\t\tsubject: Artica service monitor: \$SERVICE \$EVENT"; $f[] = "\t\tmessage: Artica service monitor \$ACTION \$SERVICE at \$DATE on \$HOST: \$DESCRIPTION"; $f[] = "\t}"; $f[] = "set alert {$smtp_dest} but not on {{$monit_not_on}}"; if ($recipients > 0) { while (list($index, $to) = each($recipientsZ)) { $f[] = "set alert {$to} but not on {{$monit_not_on}}"; } } } } build_progress_restart("{reconfiguring}", 25); $allips = $unix->NETWORK_ALL_INTERFACES(true); $f[] = "set httpd port 2874 and use address 127.0.0.1"; $f[] = "\tallow 127.0.0.1"; while (list($tcpi, $to) = each($allips)) { $f[] = "\tallow {$tcpi}"; } $top = $unix->find_program("top"); $hostname = $unix->hostname_g(); $TSCR = array(); if ($MonitReportLoadVG1mn > 0) { $TSCR[] = "\tif loadavg (1min) > {$MonitReportLoadVG1mn} for {$MonitReportLoadVG1mnCycles} cycles then exec \"/bin/artica-system-alert.sh LOAD_1 {$MonitReportLoadVG1mn}\""; } if ($MonitReportLoadVG5mn > 0) { $TSCR[] = "\tif loadavg (5min) > {$MonitReportLoadVG5mn} for {$MonitReportLoadVG5mnCycles} cycles then exec \"/bin/artica-system-alert.sh LOAD_5 {$MonitReportLoadVG5mn}\""; } if ($MonitReportLoadVG15mn > 0) { $TSCR[] = "\tif loadavg (15min) > {$MonitReportLoadVG15mn} for {$MonitReportLoadVG15mnCycles} cycles then exec \"/bin/artica-system-alert.sh LOAD_15 {$MonitReportLoadVG15mn}\""; } if ($MonitCPUUsage > 0) { if ($MonitCPUUsage < 75) { $MonitCPUUsage = 75; } $TSCR[] = "\tif cpu usage(system) > {$MonitCPUUsage}% for {$MonitCPUUsageCycles} cycles then exec \"/bin/artica-system-alert.sh CPU_SYSTEM {$MonitCPUUsage}\""; $TSCR[] = "\tif cpu usage(user) > {$MonitCPUUsage}% for {$MonitCPUUsageCycles} cycles then exec \"/bin/artica-system-alert.sh CPU_USER {$MonitCPUUsage}\""; $TSCR[] = "\tif cpu usage(wait) > {$MonitCPUUsage}% for {$MonitCPUUsageCycles} cycles then exec \"/bin/artica-system-alert.sh CPU_WAIT {$MonitCPUUsage}\""; } if ($MonitMemUsage > 0) { if ($MonitMemUsage < 75) { $MonitMemUsage = 75; } $TSCR[] = "\tif memory > {$MonitMemUsage}% for {$MonitMemUsageCycles} cycles then exec \"/bin/artica-system-alert.sh MEM {$MonitMemUsage}\""; } if ($MonitMemPurgeCache > 5) { @chmod("/usr/share/artica-postfix/exec.kernel.purge.cache.php", 0755); $TSCR[] = "\tif memory > {$MonitMemPurgeCache}% for {$MonitMemPurgeCacheCycles} cycles then exec \"/usr/share/artica-postfix/exec.kernel.purge.cache.php\""; } if (count($TSCR) > 1) { $f[] = "check system " . $unix->hostname_g(); $f[] = @implode("\n", $TSCR); } $TSCR = array(); $SCRIPT = array(); $SCRIPT[] = "#!/bin/sh"; $SCRIPT[] = "CURRENT=`{$date} +%s`"; $SCRIPT[] = "DIR=\"/home/artica/system/perf-queue/\$CURRENT\""; $SCRIPT[] = "{$mkdir} -p \"\$DIR\""; $SCRIPT[] = "{$echo} \$CURRENT >\$DIR/time.txt"; $SCRIPT[] = "{$echo} \$1 >\$DIR/why.txt"; $SCRIPT[] = "{$echo} \$2 >\$DIR/why2.txt"; $iotop = $unix->find_program("iotop"); if (is_file($iotop)) { $SCRIPT[] = "{$iotop} -o -a -b -q -t -n 20 >\$DIR/iotop.txt || true"; } $SCRIPT[] = "{$nice} {$python} /usr/share/artica-postfix/bin/ps_mem.py >\$DIR/psmem.txt 2>&1"; $SCRIPT[] = "{$ps} --no-heading -eo user,pid,pcpu,args|{$sort} -grbk 3|{$head} -50 >\$DIR/TOP50-CPU.txt 2>&1"; $SCRIPT[] = "{$ps} --no-heading -eo user,pid,pmem,args|{$sort} -grbk 3|{$head} -50 >\$DIR/TOP50-MEM.txt 2>&1"; $SCRIPT[] = "{$ps} auxww >\$DIR/ALLPS.txt 2>&1"; $SCRIPT[] = ""; @file_put_contents("/bin/artica-system-alert.sh", @implode("\n", $SCRIPT)); @chmod("/bin/artica-system-alert.sh", 0755); $SCRIPT = array(); $f[] = ""; $f[] = "check host loopback with address 127.0.0.1"; $f[] = "\tif failed icmp type echo with timeout 1 seconds then exec \"/bin/loopbackfailed.sh\""; $f[] = ""; $loopbackfailed[] = "#!/bin/sh"; $loopbackfailed[] = "{$php5} /usr/share/artica-postfix/exec.virtuals-ip.php --loopback"; $loopbackfailed[] = ""; @file_put_contents("/bin/loopbackfailed.sh", @implode("\n", $loopbackfailed)); @chmod("/bin/loopbackfailed.sh", 0755); $loopbackfailed = array(); build_progress_restart("{reconfiguring}", 25); //******************************************************************************************************************** $f[] = "check file php.log with path /var/log/php.log"; $f[] = "\tif size > 100 MB then"; $f[] = "\t\texec \"/bin/clean-phplog.sh\""; $f[] = ""; $f[] = "check file usrphp.log with path /usr/share/artica-postfix/ressources/logs/php.log"; $f[] = " if size > 100 MB then"; $f[] = "\t\texec \"/bin/clean-phplog.sh\""; $f[] = ""; $f[] = "check file squid-logger-start.log with path /var/log/artica-postfix/squid-logger-start.log"; $f[] = "\tif size > 100 MB then"; $f[] = "\t\texec \"/bin/squid-logger-start.sh\""; $f[] = ""; build_progress_restart("{reconfiguring}", 26); $f[] = "include /etc/monit/conf.d/*"; @file_put_contents("/etc/monit/monitrc", @implode("\n", $f)); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} /etc/monit/monitrc done...\n"; } $AA[] = "#!/bin/sh"; $AA[] = "{$echo} \"#\" >/var/log/artica-postfix/squid-logger-start.log"; $AA[] = ""; @file_put_contents("/bin/squid-logger-start.sh", @implode("\n", $AA)); @chmod("/bin/squid-logger-start.sh", 0755); $AA = array(); $AA[] = "#!/bin/sh"; $AA[] = "{$echo} \"#\" >/var/log/php.log"; $AA[] = ""; @file_put_contents("/bin/clean-phplog.sh", @implode("\n", $AA)); @chmod("/bin/clean-phplog.sh", 0755); $AA = array(); $monit = new monit(); $monit->save(); $INITD_PATH = $unix->SLAPD_INITD_PATH(); $SLAPD_PID_FILE = $unix->SLAPD_PID_PATH(); $squidbin = $unix->LOCATE_SQUID_BIN(); @unlink("/etc/monit/conf.d/APP_OPENLDAP.monitrc"); //******************************************************************************************************************** $f = array(); //******************************************************************************************************************** build_progress_restart("{reconfiguring}", 27); $f = array(); $f[] = "check process APP_FRAMEWORK"; $f[] = "with pidfile /var/run/lighttpd/framework.pid"; $f[] = "start program = \"/etc/init.d/artica-framework start --monit\""; $f[] = "stop program = \"/etc/init.d/artica-framework stop --monit\""; $f[] = "if 5 restarts within 5 cycles then timeout"; @file_put_contents("/etc/monit/conf.d/articaframework.monitrc", @implode("\n", $f)); $f = array(); //******************************************************************************************************************** $f = array(); @unlink("/etc/monit/conf.d/APP_OPENSSH.monitrc"); @unlink("/etc/monit/conf.d/APP_MYSQLD.monitrc"); //******************************************************************************************************************** $f = array(); build_progress_restart("{reconfiguring}", 28); $f[] = "check process APP_ARTICA_STATUS with pidfile /etc/artica-postfix/exec.status.php.pid"; $f[] = "\tstart program = \"/etc/init.d/artica-status start --monit\""; $f[] = "\tstop program = \"/etc/init.d/artica-status stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Artica Status...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ARTICASTATUS.monitrc", @implode("\n", $f)); //******************************************************************************************************************** $f = array(); $EnableInflux = 1; if ($SquidPerformance > 2) { $EnableInflux = 0; } $InfluxUseRemote = intval($sock->GET_INFO("InfluxUseRemote")); $EnableInfluxDB = intval($sock->GET_INFO("EnableInfluxDB")); if ($InfluxUseRemote == 1) { $EnableInfluxDB = 0; } if ($EnableIntelCeleron == 1) { $EnableInflux = 0; } if ($EnableInfluxDB == 0) { $EnableInflux = 0; } if (is_file("/etc/artica-postfix/STATS_APPLIANCE")) { $EnableInflux = 1; } build_progress_restart("{reconfiguring}", 29); @unlink("/etc/monit/conf.d/APP_INFLUXDB.monitrc"); @unlink("/etc/monit/conf.d/APP_POSTGRES.monitrc"); if (is_file("/usr/local/ArticaStats/bin/postgres")) { if ($EnableInflux == 1) { $InfluxRestartMem = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/InfluxRestartMem")); $f[] = "check process APP_POSTGRES with pidfile /home/ArticaStatsDB/postmaster.pid"; $f[] = "\tstart program = \"/etc/init.d/artica-postgres start --monit\""; $f[] = "\tstop program = \"/etc/init.d/artica-postgres --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; if ($InfluxRestartMem > 50) { $f[] = "\tif totalmem > {$InfluxRestartMem} MB for 5 cycles then restart"; } $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Artica Status...\n"; } @file_put_contents("/etc/monit/conf.d/APP_POSTGRES.monitrc", @implode("\n", $f)); //******************************************************************************************************************** } } $f = array(); @unlink("/etc/monit/conf.d/squid.monitrc"); @unlink("/etc/monit/conf.d/APP_SQUIDMAIN.monitrc"); // ******************************************************************************************************************** $f = array(); @unlink("/etc/monit/conf.d/APP_SQUIDDB.monitrc"); build_progress_restart("{reconfiguring} Proxy service", 30); if (is_dir("/opt/squidsql/data")) { if ($SQUIDEnable == 1) { $f = array(); $f[] = "check process APP_SQUID_DB with pidfile /var/run/squid-db.pid"; $f[] = "\tstart program = \"/etc/init.d/squid-db start --monit\""; $f[] = "\tstop program = \"/etc/init.d/squid-db stop --monit\""; $f[] = "\tif failed unixsocket /var/run/mysqld/squid-db.sock then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Squid MySQL DB...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SQUIDDB.monitrc", @implode("\n", $f)); } } // ******************************************************************************************************************** $f = array(); build_progress_restart("{reconfiguring} Dnsmasq", 31); @unlink("/etc/monit/conf.d/APP_DNSMASQ.monitrc"); if ($users->dnsmasq_installed) { $enabled = $sock->dnsmasq_enabled(); if ($enabled == 1) { $f[] = "check process APP_DNSMASQ with pidfile /var/run/dnsmasq.pid"; $f[] = "\tstart program = \"/etc/init.d/dnsmasq start --monit\""; $f[] = "\tstop program = \"/etc/init.d/dnsmasq stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DnsMASQ...\n"; } @file_put_contents("/etc/monit/conf.d/APP_DNSMASQ.monitrc", @implode("\n", $f)); } } // ******************************************************************************************************************** $f = array(); build_progress_restart("{reconfiguring} Proftpd", 31); @unlink("/etc/monit/conf.d/APP_PROFTPD.monitrc"); $proftpd = $unix->find_program("proftpd"); if (is_file($proftpd)) { $enabled = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableProFTPD")); if ($enabled == 1) { $f[] = "check process APP_PROFTPD with pidfile /var/run/proftpd.pid"; $f[] = "\tstart program = \"/etc/init.d/proftpd start --monit\""; $f[] = "\tstop program = \"/etc/init.d/proftpd stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DnsMASQ...\n"; } @file_put_contents("/etc/monit/conf.d/APP_PROFTPD.monitrc", @implode("\n", $f)); } } // ******************************************************************************************************************** $f = array(); build_progress_restart("{reconfiguring} Bandwidthd", 31); @unlink("/etc/monit/conf.d/APP_BANDWIDTHD.monitrc"); if (is_file("/usr/bandwidthd/bandwidthd")) { $enabled = $sock->Bandwidthd_enabled(); if ($enabled == 1) { $f[] = "check process APP_BANDWIDTHD with pidfile /var/run/bandwidthd.pid"; $f[] = "\tstart program = \"/etc/init.d/bandwidthd start --monit\""; $f[] = "\tstop program = \"/etc/init.d/bandwidthd stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DnsMASQ...\n"; } @file_put_contents("/etc/monit/conf.d/APP_BANDWIDTHD.monitrc", @implode("\n", $f)); } } // ******************************************************************************************************************** $f = array(); build_progress_restart("{reconfiguring} rsyslog", 32); $rsyslogd = $unix->find_program("rsyslogd"); @unlink("/etc/monit/conf.d/APP_RSYSLOG.monitrc"); if (is_file($rsyslogd)) { $SCRIPT = array(); $SCRIPT[] = "#!/bin/sh"; $SCRIPT[] = "{$php5} /usr/share/artica-postfix/exec.watchdog.rsyslogd.php --start"; $SCRIPT[] = ""; @file_put_contents("/bin/artica-rsyslog-start.sh", @implode("\n", $SCRIPT)); @chmod("/bin/artica-rsyslog-start.sh", 0755); $SCRIPT = array(); $SCRIPT[] = "#!/bin/sh"; $SCRIPT[] = "{$php5} /usr/share/artica-postfix/exec.watchdog.rsyslogd.php --stop"; $SCRIPT[] = ""; @file_put_contents("/bin/artica-rsyslog-stop.sh", @implode("\n", $SCRIPT)); @chmod("/bin/artica-rsyslog-stop.sh", 0755); $SCRIPT = array(); $f[] = "check process APP_RSYSLOG with pidfile /var/run/rsyslogd.pid"; $f[] = "\tstart program = \"/bin/artica-rsyslog-start.sh\""; $f[] = "\tstop program = \"/bin/artica-rsyslog-stop.sh\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring rsyslogd...\n"; } @file_put_contents("/etc/monit/conf.d/APP_RSYSLOG.monitrc", @implode("\n", $f)); } // ******************************************************************************************************************** build_progress_restart("{reconfiguring} Squid-tail", 32); $APP_ARTICA_SQUID_TAIL = $unix->SQUID_TAIL_ENABLED(); @unlink("/etc/monit/conf.d/APP_ARTICA_SQUID_TAIL.monitrc"); if ($APP_ARTICA_SQUID_TAIL == 1) { $f = array(); $f[] = "check process APP_ARTICA_SQUID_TAIL with pidfile /etc/artica-postfix/pids/exec.logfile_daemon.php.pid"; $f[] = "\tstart program = \"/etc/init.d/squid-tail start\""; $f[] = "\tstop program = \"/etc/init.d/squid-tail stop\""; $f[] = "\tif cpu usage > 95% for 5 cycles then restart"; $f[] = "\tif totalmem > 550.0 MB for 5 cycles then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring squid-tail...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ARTICA_SQUID_TAIL.monitrc", @implode("\n", $f)); } // ******************************************************************************************************************** build_progress_restart("{reconfiguring} Squid-Proxy", 32); $APP_SQUID = $unix->SQUID_ENABLED(); @unlink("/etc/monit/conf.d/APP_SQUID.monitrc"); if ($APP_SQUID == 1) { $MonitConfig = unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/settings/SquidWatchdogMonitConfig"))); if (!isset($MonitConfig["watchdog"])) { $MonitConfig["watchdog"] = 1; } if (!is_numeric($MonitConfig["watchdog"])) { $MonitConfig["watchdog"] = 1; } $f = array(); if ($MonitConfig["watchdog"] == 1) { $MonitSquidMaxRestartMem = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/MonitSquidMaxRestartMem")); $MonitSquidMaxCPU = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/MonitSquidMaxCPU")); $f[] = "check process APP_SQUID with pidfile /var/run/squid/squid.pid"; $f[] = "\tstart program = \"/etc/init.d/squid start --monit\""; $f[] = "\tstop program = \"/etc/init.d/squid stop --monit\""; if ($MonitSquidMaxCPU > 0) { $f[] = "\tif cpu usage > {$MonitSquidMaxCPU}% for 5 cycles then restart"; } if ($MonitSquidMaxRestartMem > 0) { $f[] = "\tif totalmem > {$MonitSquidMaxRestartMem}.0 MB for 5 cycles then restart"; } $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring squid...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SQUID.monitrc", @implode("\n", $f)); } } // ******************************************************************************************************************** build_progress_restart("{reconfiguring} OpenLDAP", 32); $EnableOpenLDAP = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableOpenLDAP")); $SLAPD_PID_FILE = $unix->SLAPD_PID_PATH(); @unlink("/etc/monit/conf.d/APP_SLAPD.monitrc"); if ($EnableOpenLDAP == 1) { if ($EnableIntelCeleron == 0) { $f = array(); $f[] = "check process APP_SLAPD with pidfile {$SLAPD_PID_FILE}"; $f[] = "\tstart program = \"/etc/init.d/slapd start --force --monit\""; $f[] = "\tstop program = \"/etc/init.d/slapd stop --force\""; $f[] = "\tif cpu usage > 95% for 5 cycles then restart"; $f[] = "\tif totalmem > 550.0 MB for 5 cycles then restart"; $f[] = "\tif failed unixsocket /var/run/slapd/slapd.sock then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring slapd...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SLAPD.monitrc", @implode("\n", $f)); } } // ******************************************************************************************************************** $f = array(); build_progress_restart("{reconfiguring} Suricata", 32); $EnableSuricata = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableSuricata")); @unlink("/etc/monit/conf.d/APP_SURICATA.monitrc"); @unlink("/etc/monit/conf.d/APP_SURICATA_TAIL.monitrc"); $suricata = $unix->find_program("suricata"); if (is_file($suricata)) { if ($EnableSuricata == 1) { $f[] = "check process APP_SURICATA with pidfile /var/run/suricata/suricata.pid"; $f[] = "\tstart program = \"/etc/init.d/suricata start --monit\""; $f[] = "\tstop program = \"/etc/init.d/suricata stop --monit\""; $f[] = "\tif cpu usage > 95% for 5 cycles then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Suricata...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SURICATA.monitrc", @implode("\n", $f)); $f = array(); $f[] = "check process APP_SURICATA_TAIL with pidfile /etc/artica-postfix/exec.suricata-tail.php.pid"; $f[] = "\tstart program = \"/etc/init.d/suricata-tail start --monit\""; $f[] = "\tstop program = \"/etc/init.d/suricata-tail stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Suricata tail...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SURICATA_TAIL.monitrc", @implode("\n", $f)); } } // ******************************************************************************************************************** $f = array(); build_progress_restart("{reconfiguring}", 32); $winbind = $unix->find_program("winbindd"); if (is_file("/etc/monit/conf.d/winbindd.monitrc")) { @unlink("/etc/monit/conf.d/winbindd.monitrc"); } @unlink("/etc/monit/conf.d/winbind.monitrc"); $EnableKerbAuth = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableKerbAuth")); if (is_file($winbind)) { if ($EnableKerbAuth == 1) { $f[] = "check process winbindd with pidfile /var/run/samba/winbindd.pid"; $f[] = "\tstart program = \"/etc/init.d/winbind start\""; $f[] = "\tstop program = \"/etc/init.d/winbind stop\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring winbindd...\n"; } @file_put_contents("/etc/monit/conf.d/winbind.monitrc", @implode("\n", $f)); } } // ******************************************************************************************************************** $f = array(); build_progress_restart("{reconfiguring}", 33); @unlink("/etc/monit/conf.d/APP_CICAP.monitrc"); if ($users->C_ICAP_INSTALLED) { if ($SQUIDEnable == 1) { $CicapEnabled = $sock->GET_INFO("CicapEnabled"); if (!is_numeric($CicapEnabled)) { $CicapEnabled = 0; } if ($CicapEnabled == 1) { $f[] = "check process APP_C_ICAP with pidfile /var/run/c-icap/c-icap.pid"; $f[] = "\tstart program = \"/etc/init.d/artica-postfix start cicap\""; $f[] = "\tstop program = \"/etc/init.d/artica-postfix stop cicap\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring C-ICAP...\n"; } @file_put_contents("/etc/monit/conf.d/APP_CICAP.monitrc", @implode("\n", $f)); } } } // ******************************************************************************************************************** build_progress_restart("{reconfiguring}", 34); @unlink("/etc/monit/conf.d/APP_SYSLOGDB.monitrc"); if ($EnableSyslogDB == 1) { if ($MySQLSyslogType == 1) { $f = array(); $f[] = "check process APP_SYSLOG_DB with pidfile /var/run/syslogdb.pid"; $f[] = "\tstart program = \"/etc/init.d/syslog-db start --monit\""; $f[] = "\tstop program = \"/etc/init.d/syslog-db stop --monit\""; $f[] = "\tif failed unixsocket /var/run/syslogdb.sock then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring syslogd...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SYSLOGDB.monitrc", @implode("\n", $f)); $f = array(); } } //******************************************************************************************************************** $f = array(); @unlink("/etc/monit/conf.d/cron.monitrc"); if (is_file("/etc/monit/templates/rootbin")) { $f[] = "check process crond with pidfile /var/run/crond.pid"; $f[] = " group system"; $f[] = " group crond"; $f[] = " start program = \"/etc/init.d/cron start\""; $f[] = " stop program = \"/etc/init.d/cron stop\""; $f[] = " if 5 restarts with 5 cycles then timeout"; $f[] = " depend cron_bin"; $f[] = " depend cron_rc"; $f[] = " depend cron_spool"; $f[] = ""; $f[] = " check file cron_bin with path /usr/sbin/cron"; $f[] = " group crond"; $f[] = " include /etc/monit/templates/rootbin"; $f[] = ""; $f[] = " check file cron_rc with path \"/etc/init.d/cron\""; $f[] = " group crond"; $f[] = " include /etc/monit/templates/rootbin"; $f[] = ""; $f[] = " check directory cron_spool with path /var/spool/cron/crontabs"; $f[] = " group crond"; $f[] = " if failed permission 1730 then unmonitor"; $f[] = " if failed uid root then unmonitor"; $f[] = " if failed gid crontab then unmonitor"; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring cron...\n"; } @file_put_contents("/etc/monit/conf.d/cron.monitrc", @implode("\n", $f)); $f = array(); } @unlink("/etc/monit/conf.d/APP_ZARAFASERVER.monitrc"); @unlink("/etc/monit/conf.d/APP_ZARAFAGATEWAY.monitrc"); @unlink("/etc/monit/conf.d/APP_ZARAFAAPACHE.monitrc"); @unlink("/etc/monit/conf.d/APP_ZARAFAWEB.monitrc"); @unlink("/etc/monit/conf.d/APP_ZARAFASPOOLER.monitrc"); @unlink("/etc/monit/conf.d/APP_ZARAFADB.monitrc"); build_progress_restart("{reconfiguring}", 35); if (is_file($unix->find_program("zarafa-server"))) { $ZarafaApacheEnable = $sock->GET_INFO("ZarafaApacheEnable"); if (!is_numeric($ZarafaApacheEnable)) { $ZarafaApacheEnable = 1; } $ZarafaApachePort = $sock->GET_INFO("ZarafaApachePort"); if (!is_numeric($ZarafaApachePort)) { $ZarafaApachePort = 9010; } if ($ZarafaDedicateMySQLServer == 1) { $f = array(); $f[] = "check process APP_ZARAFA_DB with pidfile /var/run/zarafa-db.pid"; $f[] = "\tstart program = \"/etc/init.d/zarafa-db start --monit\""; $f[] = "\tstop program = \"/etc/init.d/zarafa-db stop --monit\""; $f[] = "\tif failed unixsocket /var/run/mysqld/zarafa-db.sock then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Zarafa Database...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ZARAFADB.monitrc", @implode("\n", $f)); } $f = array(); $f[] = "check process APP_ZARAFA_SERVER with pidfile /var/run/zarafa-server.pid"; $f[] = "\tstart program = \"/etc/init.d/zarafa-server start --monit\""; $f[] = "\tstop program = \"/etc/init.d/zarafa-server stop --monit\""; $f[] = "\tif failed unixsocket /var/run/zarafa then restart"; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Zarafa Server...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ZARAFASERVER.monitrc", @implode("\n", $f)); $f = array(); $f[] = "check process APP_ZARAFA_SPOOLER with pidfile /var/run/zarafa-spooler.pid"; $f[] = "\tstart program = \"/etc/init.d/zarafa-spooler start --monit\""; $f[] = "\tstop program = \"/etc/init.d/zarafa-spooler stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Zarafa Spooler...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ZARAFASPOOLER.monitrc", @implode("\n", $f)); $f = array(); $f[] = "check process APP_ZARAFA_GATEWAY with pidfile /var/run/zarafa-gateway.pid"; $f[] = "\tstart program = \"/etc/init.d/zarafa-gateway start --monit\""; $f[] = "\tstop program = \"/etc/init.d/zarafa-gateway stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Zarafa Gateway...\n"; } @file_put_contents("/etc/monit/conf.d/APP_ZARAFAGATEWAY.monitrc", @implode("\n", $f)); } //******************************************************************************************************************** build_progress_restart("{reconfiguring}", 36); $EnableClamavDaemon = $sock->GET_INFO("EnableClamavDaemon"); $EnableClamavDaemonForced = $sock->GET_INFO("EnableClamavDaemonForced"); $CicapEnabled = $sock->GET_INFO("CicapEnabled"); $SQUIDEnable = $sock->GET_INFO("SQUIDEnable"); if (!is_numeric($EnableClamavDaemon)) { $EnableClamavDaemon = 0; } if (!is_numeric($EnableClamavDaemonForced)) { $EnableClamavDaemonForced = 0; } if (!is_numeric($SQUIDEnable)) { $SQUIDEnable = 1; } if (!is_numeric($CicapEnabled)) { $CicapEnabled = 0; } if ($SQUIDEnable == 1) { if ($CicapEnabled == 1) { $EnableClamavDaemon = 1; } } if ($EnableClamavDaemonForced == 1) { $EnableClamavDaemon = 1; } //******************************************************************************************************************** build_progress_restart("{reconfiguring}", 37); @unlink("/etc/monit/conf.d/APP_CLAMAV.monitrc"); $MasterBin = $unix->find_program("clamd"); if (is_file($MasterBin)) { if ($EnableClamavDaemon == 1) { $f = array(); $f[] = "check process APP_CLAMAV"; $f[] = "with pidfile /var/run/clamav/clamd.pid"; $f[] = "start program = \"/etc/init.d/clamav-daemon start --monit\""; $f[] = "stop program = \"/etc/init.d/clamav-daemon stop --monit\""; $f[] = "if 5 restarts within 5 cycles then timeout"; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Clamd service...\n"; } @file_put_contents("/etc/monit/conf.d/APP_CLAMAV.monitrc", @implode("\n", $f)); $f = array(); } } //******************************************************************************************************************** @unlink("/etc/monit/conf.d/ufdb.monitrc"); @unlink("/etc/monit/conf.d/ufdbweb.monitrc"); $ufdbbin = $unix->find_program("ufdbguardd"); build_progress_restart("{reconfiguring}", 38); if (is_file($ufdbbin)) { $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); $UseRemoteUfdbguardService = $sock->GET_INFO('UseRemoteUfdbguardService'); $EnableSquidGuardHTTPService = $sock->GET_INFO("EnableSquidGuardHTTPService"); $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); $SquidGuardApachePort = $sock->GET_INFO("SquidGuardApachePort"); $SquidGuardApacheSSLPort = $sock->GET_INFO("SquidGuardApacheSSLPort"); if (!is_numeric($UseRemoteUfdbguardService)) { $UseRemoteUfdbguardService = 0; } if (!is_numeric($EnableUfdbGuard)) { $EnableUfdbGuard = 0; } if (!is_numeric($EnableSquidGuardHTTPService)) { $EnableSquidGuardHTTPService = 1; } if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if ($EnableUfdbGuard == 0) { $EnableSquidGuardHTTPService = 0; } if ($EnableWebProxyStatsAppliance == 1) { $EnableSquidGuardHTTPService = 1; } if (!is_numeric($SquidGuardApachePort)) { $SquidGuardApachePort = "9020"; } if (!is_numeric($SquidGuardApacheSSLPort)) { $SquidGuardApacheSSLPort = 9025; } if ($SquidPerformance > 2) { $EnableSquidGuardHTTPService = 0; } if ($SQUIDEnable == 1) { if ($EnableSquidGuardHTTPService == 1) { $f = array(); $f[] = "check process APP_SQUIDGUARD_HTTP"; $f[] = "with pidfile /var/run/lighttpd/squidguard-lighttpd.pid"; $f[] = "start program = \"/etc/init.d/squidguard-http start --monit\""; $f[] = "stop program = \"/etc/init.d/squidguard-http stop --monit\""; $f[] = "if failed host 127.0.0.1 port {$SquidGuardApachePort} then restart"; $f[] = "if 5 restarts within 5 cycles then timeout"; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Web filtering HTTP service...\n"; } @file_put_contents("/etc/monit/conf.d/ufdbweb.monitrc", @implode("\n", $f)); } } } //******************************************************************************************************************** $EnableArticaFrontEndToNGninx = $sock->GET_INFO("EnableArticaFrontEndToNGninx"); $EnableArticaFrontEndToApache = $sock->GET_INFO("EnableArticaFrontEndToApache"); if (!is_numeric($EnableArticaFrontEndToNGninx)) { $EnableArticaFrontEndToNGninx = 0; } if (!is_numeric($EnableArticaFrontEndToApache)) { $EnableArticaFrontEndToApache = 0; } $EnableNginx = $sock->GET_INFO("EnableNginx"); $EnableFreeWeb = $sock->GET_INFO("EnableFreeWeb"); if (!is_numeric($EnableFreeWeb)) { $EnableFreeWeb = 0; } if (!is_numeric($EnableNginx)) { $EnableNginx = 1; } if ($EnableNginx == 0) { $EnableArticaFrontEndToNGninx = 0; } $pid = null; build_progress_restart("{reconfiguring}", 39); @unlink("/etc/monit/conf.d/APP_LIGHTTPD.monitrc"); if ($EnableArticaFrontEndToNGninx == 0) { $pid = "/var/run/lighttpd/lighttpd.pid"; if ($EnableArticaFrontEndToApache == 1) { $pid = "/var/run/artica-apache/apache.pid"; } $f = array(); $f[] = "check process APP_ARTICAWEBCONSOLE with pidfile {$pid}"; $f[] = "\tstart program = \"/etc/init.d/artica-webconsole start --monit\""; $f[] = "\tstop program = \"/etc/init.d/artica-webconsole stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Artica Web Console...\n"; } @file_put_contents("/etc/monit/conf.d/APP_LIGHTTPD.monitrc", @implode("\n", $f)); } //******************************************************************************************************************** @unlink("/etc/monit/conf.d/APP_NGINX.monitrc"); $nginx = $unix->find_program("nginx"); if (is_file($nginx)) { if ($EnableNginx == 1) { $f = array(); $f[] = "check process APP_NGINX with pidfile /var/run/nginx.pid"; $f[] = "\tstart program = \"/etc/init.d/nginx start --monit\""; $f[] = "\tstop program = \"/etc/init.d/nginx stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring NgINX...\n"; } @file_put_contents("/etc/monit/conf.d/APP_NGINX.monitrc", @implode("\n", $f)); } } //******************************************************************************************************************** build_progress_restart("{reconfiguring}", 40); $f = array(); if (is_file("/etc/init.d/sysklogd")) { $f[] = "check process APP_SYSLOGD with pidfile /var/run/syslogd.pid"; $f[] = "\tstart program = \"/etc/init.d/sysklogd start --monit\""; $f[] = "\tstop program = \"/etc/init.d/sysklogd stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = "\tcheck file syslogd_file with path /var/log/syslog"; $f[] = "\tif timestamp > 10 minutes then restart"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring sysklogd...\n"; } @file_put_contents("/etc/monit/conf.d/APP_SYSKLOGD.monitrc", @implode("\n", $f)); } //******************************************************************************************************************** build_progress_restart("{reconfiguring}", 41); $binpath = $unix->DHCPD_BIN_PATH(); @unlink("/etc/monit/conf.d/APP_DHCPD.monitrc"); $f = array(); if (is_file($binpath)) { $EnableDHCPServer = $sock->GET_INFO("EnableDHCPServer"); if (!is_numeric($EnableDHCPServer)) { $EnableDHCPServer = 0; } if ($EnableDHCPServer == 1) { $f[] = "check process APP_DHCP with pidfile /var/run/dhcpd.pid"; $f[] = "\tstart program = \"/etc/init.d/isc-dhcp-server start --monit\""; $f[] = "\tstop program = \"/etc/init.d/isc-dhcp-server stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DHCP Service...\n"; } @file_put_contents("/etc/monit/conf.d/APP_DHCPD.monitrc", @implode("\n", $f)); } } //******************************************************************************************************************** $binpath = $unix->find_program("rdpproxy"); build_progress_restart("{reconfiguring}", 42); @unlink("/etc/monit/conf.d/APP_RDPPROXY.monitrc"); $f = array(); if (is_file($binpath)) { $EnableRDPProxy = $sock->GET_INFO("EnableRDPProxy"); if (!is_numeric($EnableRDPProxy)) { $EnableRDPProxy = 0; } if ($EnableRDPProxy == 1) { $f[] = "check process APP_RDPPROXY with pidfile /var/run/redemption/rdpproxy.pid"; $f[] = "\tstart program = \"/etc/init.d/rdpproxy start --monit\""; $f[] = "\tstop program = \"/etc/init.d/rdpproxy stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring RDP Proxy...\n"; } @file_put_contents("/etc/monit/conf.d/APP_RDPPROXY.monitrc", @implode("\n", $f)); } } //******************************************************************************************************************** build_progress_restart("{reconfiguring}", 43); @unlink("/etc/monit/conf.d/APP_DNSMASQ.monitrc"); $f = array(); $binpath = $unix->find_program("dnsmasq"); if (is_file($binpath)) { $EnableDNSMASQ = $users->EnableDNSMASQ(); if ($EnableDNSMASQ == 1) { $f[] = "check process APP_DNSMASQ with pidfile /var/run/dnsmasq.pid"; $f[] = "\tstart program = \"/etc/init.d/dnsmasq start --monit\""; $f[] = "\tstop program = \"/etc/init.d/dnsmasq stop --monit\""; $f[] = "\tif 5 restarts within 5 cycles then timeout"; $f[] = ""; if ($GLOBALS["OUTPUT"]) { echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DNSMasq Service...\n"; } @file_put_contents("/etc/monit/conf.d/APP_DNSMASQ.monitrc", @implode("\n", $f)); } } //******************************************************************************************************************** if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} checking syslog\n"; } if (is_file("/etc/init.d/syslog")) { checkDebSyslog(); } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} configuration done\n"; } shell_exec($GLOBALS["MONIT_CLASS"]->monitor_all_cmdline . " 2>&1"); build_progress_restart("{reconfiguring}", 45); }
function compile_ufdb() { $tpl = new templates(); $sock = new sockets(); $users = new usersMenus(); $page = CurrentPageName(); $t = $_GET["t"]; $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); $SquidActHasReverse = $sock->GET_INFO("SquidActHasReverse"); if (!is_numeric($EnableUfdbGuard)) { $EnableUfdbGuard = 0; } if (!is_numeric($SquidActHasReverse)) { $SquidActHasReverse = 0; } if ($SquidActHasReverse == 1) { $EnableUfdbGuard = 0; } $script = "\n\t<div id='compile_ufdb'></div>\n\t<script>\n\t\tChangeStatusSQUID(15);\n\t\tLoadAjaxSilent('compile_ufdb','{$page}?compile-cicap=yes&t={$t}');\n\t</script>\t\n\t\n\t"; if (!$users->APP_UFDBGUARD_INSTALLED) { echo $tpl->_ENGINE_parse_body(build_progress_text("{APP_UFDBGUARD}: {error_module_not_installed}")) . $script; die; } if ($EnableUfdbGuard == 0) { echo $tpl->_ENGINE_parse_body(build_progress_text("{APP_UFDBGUARD}: {error_module_not_enabled}")) . $script; die; } echo $tpl->_ENGINE_parse_body(build_progress_text("{APP_UFDBGUARD}:{please_wait_configuring_the_module}:")) . $script; $sock->getFrameWork("squid.php?ufdbguard-compile-smooth-tenir=yes&MyCURLTIMEOUT=300"); }
function start($aspid = false, $nochecksquid = false) { $unix = new unix(); $sock = new sockets(); $Masterbin = $unix->find_program("ufdbguardd"); if (!is_file($Masterbin)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, ufdbguardd not installed\n"; } return; } if (!$aspid) { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $time = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n"; } return; } @file_put_contents($pidfile, getmypid()); } $pid = PID_NUM(); if ($unix->process_exists($pid)) { $timepid = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Service already started {$pid} since {$timepid}Mn...\n"; } if ($GLOBALS["MONIT"]) { @file_put_contents($GLOBALS["PID_PATH"], $pid); } return; } $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); $UseRemoteUfdbguardService = intval($sock->GET_INFO("UseRemoteUfdbguardService")); if ($UseRemoteUfdbguardService == 1) { $EnableUfdbGuard = 0; } $SquidUFDBUrgency = intval($sock->GET_INFO("SquidUFDBUrgency")); if ($SquidUFDBUrgency == 1) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} * * * * Your Web filtering is on Emergency mode ! * * * *\n"; } stop(); return; } if ($EnableUfdbGuard == 0) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled (see EnableUfdbGuard)\n"; } stop(); return; } $php5 = $unix->LOCATE_PHP5_BIN(); $sysctl = $unix->find_program("sysctl"); $echo = $unix->find_program("echo"); $nohup = $unix->find_program("nohup"); $kill = $unix->find_program("kill"); $PossibleDirs[] = "/var/lib/ftpunivtlse1fr"; $PossibleDirs[] = "/var/lib/ufdbartica"; $PossibleDirs[] = "/var/lib/squidguard"; while (list($index, $Directory) = each($PossibleDirs)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} permissions on `{$Directory}`\n"; } if (is_link($Directory)) { $Directory = readlink($Directory); } $f = explode("/", $Directory); while (list($index, $subdir) = each($f)) { if ($subdir == null) { continue; } $dir = $dir . "/{$subdir}"; @chmod($dir, 0755); } @chmod("{$Directory}", 0755); $unix->chown_func("squid", "squid", "{$Directory}"); } @mkdir(dirname($GLOBALS["PID_PATH"]), 0755, true); @mkdir("/var/lib/squidguard/security", 0755, true); $unix->chown_func("squid", "squid", dirname($GLOBALS["PID_PATH"])); $chmod = $unix->find_program("chmod"); $chown = $unix->find_program("chown"); $php = $unix->LOCATE_PHP5_BIN(); @chmod($GLOBALS["PID_PATH"], 0755); $unix->chown_func("squid", "squid", "/var/lib/squidguard/security/cacerts"); @chmod("/var/lib/squidguard/security/cacerts", 0755); if (!is_file("/etc/squid3/ufdbGuard.conf")) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} building settings\n"; } shell_exec("{$php5} /usr/share/artica-postfix/exec.squidguard.php --build >/dev/null 2>&1"); } $datas = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig"))); if (!isset($datas["listen_port"])) { $datas["listen_port"] = 3977; } if (!isset($datas["tcpsockets"])) { $datas["tcpsockets"] = 1; } $Threads = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/UfdbGuardThreads")); if ($Threads == 0) { $Threads = 64; } if ($Threads > 140) { $Threads = 140; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} pid path: {$GLOBALS["PID_PATH"]}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Threads:{$Threads}\n"; } killbyports(); @unlink($GLOBALS["PID_PATH"]); shell_exec("{$php5} /usr/share/artica-postfix/exec.squidguard.php --dbmem >/dev/null"); shell_exec("{$php5} /usr/share/artica-postfix/exec.squidguard.php --notify-start >/dev/null"); shell_exec("{$php5} /usr/share/artica-postfix/exec.initslapd.php --ufdbguard >/dev/null"); system("/etc/init.d/ufdb-tail start"); if (!is_file("/etc/squid3/ufdbGuard.conf")) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} /etc/squid3/ufdbGuard.conf no such file !!\n"; } system("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force"); } @mkdir("/etc/artica-postfix/pids", 0755, true); shell_exec("{$chmod} 0755 /etc/squid3/ufdbGuard.conf"); shell_exec("{$chown} squid:squid /etc/squid3"); shell_exec("{$chown} squid:squid /etc/squid3/ufdbGuard.conf"); @unlink("/etc/artica-postfix/pids/UfdbGuardReload.time"); @file_put_contents("/etc/artica-postfix/pids/UfdbGuardReload.time", time()); squid_admin_mysql(1, "Starting the Web filtering Daemon...", "This is a notification in order to inform:\n" . basename(__FILE__) . " script start the Web filtering Dameon service", __FILE__, __LINE__); $cmd = "{$Masterbin} -c /etc/squid3/ufdbGuard.conf -U squid -w {$Threads} -N >/dev/null 2>&1 &"; if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service\n"; } system($cmd); for ($i = 1; $i < 5; $i++) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} waiting {$i}/5\n"; } sleep(1); $pid = PID_NUM(); if ($unix->process_exists($pid)) { break; } } @unlink("/var/log/squid/UFDB_SOCKET_ERROR"); $pid = PID_NUM(); if ($unix->process_exists($pid)) { if (IsPortListen() == 0) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} waiting (no listen port)\n"; } continue; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Success PID {$pid}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Checking configuration...\n"; } if (!$nochecksquid) { build_progress("{checking_configuration}", 50); if (!ChecksConfig()) { build_progress("{reconfiguring} {APP_SQUID}", 70); squid_admin_mysql(1, "Web filtering is not linked with the proxy service [action=reconfigure]", null, __FILE__, __LINE__); system("{$php5} /usr/share/artica-postfix/exec.squid.php --build --force"); } } @unlink("/var/log/squid/UFDB_SOCKET_ERROR"); return true; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Failed\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} {$cmd}\n"; } }
function build() { $sock = new sockets(); $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance"); if (!is_numeric($EnableRemoteStatisticsAppliance)) { $EnableRemoteStatisticsAppliance = 0; } if ($EnableRemoteStatisticsAppliance == 1) { return; } send_email_events("Order to rebuild filters configuration", @implode("\nParams:", $argv), "proxy"); $funtion = __FUNCTION__; if (!isset($GLOBALS["VERBOSE"])) { $GLOBALS["VERBOSE"] = false; } if ($GLOBALS["VERBOSE"]) { echo "{$funtion}::" . __LINE__ . " Loading libraries\n"; } $users = new usersMenus(); $sock = new sockets(); $unix = new unix(); $php5 = $unix->LOCATE_PHP5_BIN(); $chown = $unix->find_program("chown"); $chmod = $unix->find_program("chmod"); $squidbin = $unix->find_program("squid3"); $nohup = $unix->find_program("nohup"); $unix->SystemCreateUser("squid", "squid"); @mkdir("/var/tmp", 0775, true); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance"); if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if (!is_numeric($EnableRemoteStatisticsAppliance)) { $EnableRemoteStatisticsAppliance = 0; } $UseRemoteUfdbguardService = $sock->GET_INFO('UseRemoteUfdbguardService'); if (!is_file($squidbin)) { $squidbin = $unix->find_program("squid"); } $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); $SQUIDEnable = $sock->GET_INFO("SQUIDEnable"); if (!is_numeric($SQUIDEnable)) { $SQUIDEnable = 1; } if (!is_numeric($UseRemoteUfdbguardService)) { $UseRemoteUfdbguardService = 0; } if ($GLOBALS["VERBOSE"]) { echo "DEBUG::{$funtion}:: EnableWebProxyStatsAppliance={$EnableWebProxyStatsAppliance}\n"; } if ($GLOBALS["VERBOSE"]) { echo "DEBUG::{$funtion}:: EnableRemoteStatisticsAppliance={$EnableRemoteStatisticsAppliance}\n"; } if ($GLOBALS["VERBOSE"]) { echo "DEBUG::{$funtion}:: EnableUfdbGuard={$EnableUfdbGuard}\n"; } if ($GLOBALS["VERBOSE"]) { echo "DEBUG::{$funtion}:: SQUIDEnable={$SQUIDEnable}\n"; } if ($GLOBALS["VERBOSE"]) { echo "DEBUG::{$funtion}:: UseRemoteUfdbguardService={$UseRemoteUfdbguardService}\n"; } $GLOBALS["SQUIDBIN"] = $squidbin; if ($EnableWebProxyStatsAppliance == 0) { $installed = false; if ($users->SQUIDGUARD_INSTALLED) { $installed = true; echo "Starting......: " . date("H:i:s") . " SquidGuard is installed\n"; } if ($users->APP_UFDBGUARD_INSTALLED) { $installed = true; echo "Starting......: " . date("H:i:s") . " Webfiltering service is installed\n"; } if ($users->DANSGUARDIAN_INSTALLED) { $installed = true; echo "Starting......: " . date("H:i:s") . " Dansguardian is installed\n"; } if (!$installed) { if ($GLOBALS["VERBOSE"]) { echo "No one installed...\n"; shell_exec("{$nohup} " . LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.usrmactranslation.php >/dev/null 2>&1 &"); return false; } } } if ($EnableUfdbGuard == 0) { if ($GLOBALS["VERBOSE"]) { echo "UfDbguard is disabled ( see EnableUfdbGuard ) in line: " . __LINE__ . "\n"; } return; } if ($SQUIDEnable == 0) { if ($GLOBALS["VERBOSE"]) { echo "UfDbguard is disabled ( see SQUIDEnable ) in line: " . __LINE__ . "\n"; } return; } if ($UseRemoteUfdbguardService == 1) { if ($GLOBALS["VERBOSE"]) { echo "UfDbguard is disabled ( see UseRemoteUfdbguardService ) in line: " . __LINE__ . "\n"; } return; } if ($GLOBALS["VERBOSE"]) { echo "FIX_1_CATEGORY_CHECKED()\n"; } FIX_1_CATEGORY_CHECKED(); if ($EnableRemoteStatisticsAppliance == 1) { if ($GLOBALS["VERBOSE"]) { echo "Use the Web statistics appliance to get configuration file...\n"; } shell_exec("{$nohup} " . LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.usrmactranslation.php >/dev/null 2>&1 &"); ufdbguard_remote(); return; } if ($GLOBALS["VERBOSE"]) { echo "{$funtion}::" . __LINE__ . "Loading compile_dansguardian()\n"; } $dans = new compile_dansguardian(); if ($GLOBALS["VERBOSE"]) { echo "{$funtion}::" . __LINE__ . "Loading compile_dansguardian::->build()\n"; } $dans->build(); echo "Starting......: " . date("H:i:s") . " Dansguardian compile done...\n"; if (function_exists('WriteToSyslogMail')) { WriteToSyslogMail("build() -> reconfigure UfdbGuardd", basename(__FILE__)); } build_ufdbguard_config(); ufdbguard_schedule(); if ($EnableWebProxyStatsAppliance == 1) { echo "Starting......: " . date("H:i:s") . " This server is a Squid Appliance, compress databases and notify proxies\n"; CompressCategories(); notify_remote_proxys(); } shell_exec("{$php5} /usr/share/artica-postfix/exec.initslapd.php --ufdbguard"); CheckPermissions(); ufdbguard_admin_events("Service will be rebuiled and restarted", __FUNCTION__, __FILE__, __LINE__, "config"); shell_exec("{$nohup} " . LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.usrmactranslation.php >/dev/null 2>&1 &"); if (!$GLOBALS["RESTART"]) { if (is_file("/etc/init.d/ufdb")) { echo "Starting......: " . date("H:i:s") . " Checking watchdog\n"; ufdbguard_watchdog(); echo "Starting......: " . date("H:i:s") . " Webfiltering service reloading service\n"; build_ufdbguard_HUP(); } } if ($GLOBALS["RESTART"]) { if (is_file("/etc/init.d/ufdb")) { echo "Starting......: " . date("H:i:s") . " Restarting\n"; shell_exec("/etc/init.d/ufdb restart"); } } if ($users->DANSGUARDIAN_INSTALLED) { echo "Starting......: " . date("H:i:s") . " Dansguardian reloading service\n"; shell_exec("/usr/share/artica-postfix/bin/artica-install --reload-dansguardian --withoutconfig"); } }
function tabs() { $boot = new boostrap_form(); $sock = new sockets(); $page = CurrentPageName(); $tpl = new templates(); $array["{APP_SQUID}"] = "{$page}?section-realtime=yes"; $users = new usersMenus(); if ($users->APP_FTP_PROXY) { $EnableFTPProxy = $sock->GET_INFO("EnableFTPProxy"); if (!is_numeric($EnableFTPProxy)) { $EnableFTPProxy = 0; } if ($EnableFTPProxy == 1) { $array["{APP_FTP_PROXY}"] = "miniadm.system.syslog.php?prepend=ftp-proxy,ftp-child"; } } if ($users->APP_UFDBGUARD_INSTALLED) { $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); if (!is_numeric($EnableUfdbGuard)) { $EnableUfdbGuard = 0; } if ($EnableUfdbGuard == 1) { $array["{webfiltering}"] = "{$page}?section-blocked-tabs=yes"; } } echo $boot->build_tab($array); }
function ifSquidUpdatesMustBeExecuted() { $users = new usersMenus(); $sock = new sockets(); if (!$users->APP_UFDBGUARD_INSTALLED) { $GLOBALS["ifMustBeExecuted"][] = "APP_UFDBGUARD_INSTALLED = FALSE"; if ($GLOBALS["OUTPUT"]) { echo "Info..........: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} APP_UFDBGUARD_INSTALLED FALSE\n"; } return false; } $EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer")); if ($EnableArticaMetaServer == 1) { if ($GLOBALS["OUTPUT"]) { echo "Info..........: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} EnableArticaMetaServer TRUE\n"; } return true; } if ($sock->EnableUfdbGuard() == 0) { $GLOBALS["ifMustBeExecuted"][] = "EnableUfdbGuard = FALSE"; if ($GLOBALS["OUTPUT"]) { echo "Info..........: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} EnableUfdbGuard FALSE\n"; } return false; } $UseRemoteUfdbguardService = $sock->GET_INFO('UseRemoteUfdbguardService'); if (!is_numeric($UseRemoteUfdbguardService)) { $UseRemoteUfdbguardService = 0; } if ($UseRemoteUfdbguardService == 1) { $GLOBALS["ifMustBeExecuted"][] = "UseRemoteUfdbguardService = 1"; if ($GLOBALS["OUTPUT"]) { echo "Info..........: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} UseRemoteUfdbguardService TRUE\n"; } return false; } return true; }
function proxy_status() { $ntmlauthenticators_array = array(); $COUNT_DE_CACHES_TEXT = null; $webfilters_paranoid_text = null; $users = new usersMenus(); if ($users->STATS_APPLIANCE) { return influxdb_status(); } if ($users->POSTFIX_INSTALLED) { return postfix_status(); } $sock = new sockets(); $SQUIDEnable = $sock->GET_INFO("SQUIDEnable"); if (!is_numeric($SQUIDEnable)) { $SQUIDEnable = 1; } $EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer")); $EnableNginx = intval($sock->GET_INFO("EnableNginx")); $EnableHaProxy = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableHaProxy")); if ($SQUIDEnable == 0) { if ($EnableArticaMetaServer == 1) { return meta_server_status(); } if ($EnableNginx == 1) { return nginx_server_status(); } if ($EnableHaProxy == 1) { return haproxy_server_status(); } } $SquidCacheLevel = $sock->GET_INFO("SquidCacheLevel"); $HTTrackInSquid = intval($sock->GET_INFO("HTTrackInSquid")); if (!is_numeric($SquidCacheLevel)) { $SquidCacheLevel = 4; } unset($_GET["_"]); $sock = new sockets(); if (!isset($_GET["ForceCache"])) { $md5CacheF = md5("proxy_status{$_SESSION["uid"]}{$tpl->language}" . serialize($_GET)); $cachefile = "/usr/share/artica-postfix/ressources/interface-cache/{$md5CacheF}"; if (file_time_sec_Web($cachefile) < 5) { return @file_get_contents($cachefile); } } if (isset($_GET["ForceCache"])) { $sock->getFrameWork("cmd.php?Global-Applications-Status=yes"); } $q = new mysql_squid_builder(); $tpl = new templates(); $page = CurrentPageName(); $ini = new Bs_IniHandler(); $users = new usersMenus(); $perc_cache = null; $active_resquests = null; $important_events = null; $CountDeServices = null; $icon = "disks-128-ok.png"; $rqs = null; $NOT_CATEGORIZED_ROW = null; $mgr_client_list = $q->COUNT_ROWS("mgr_client_list"); $SNMP_WALK = proxy_snmp(); $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); $SquidUrgency = intval($sock->GET_INFO("SquidUrgency")); $MacToUidUrgency = intval($sock->GET_INFO("MacToUidUrgency")); $SquidSSLUrgency = intval($sock->GET_INFO("SquidSSLUrgency")); $EnableKerbAuth = intval($sock->GET_INFO("EnableKerbAuth")); $LogsWarninStop = intval($sock->GET_INFO("LogsWarninStop")); $SquidUFDBUrgency = intval($sock->GET_INFO("SquidUFDBUrgency")); $IsPortsConverted = intval($sock->GET_INFO("IsPortsConverted")); $SquidCacheFullHideWarn = intval($sock->GET_INFO("SquidCacheFullHideWarn")); $ActiveDirectoryEmergency = intval($sock->GET_INFO("ActiveDirectoryEmergency")); $BasicAuthenticatorEmergency = intval($sock->GET_INFO("BasicAuthenticatorEmergency")); $eCAPClamavEmergency = intval($sock->GET_INFO("eCAPClamavEmergency")); $ParanoidBlockerEmergency = intval($sock->GET_INFO("ParanoidBlockerEmergency")); $EnableeCapClamav = intval($sock->GET_INFO("EnableeCapClamav")); $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\""; $WebFiltering_blocked = null; $CACHES_AVG = round(@file_get_contents("{$GLOBALS["BASEDIR"]}/CACHES_AVG"), 1); $COUNT_DE_BLOCKED = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/COUNT_DE_BLOCKED")); $SquidDebugAcls = intval($sock->GET_INFO("SquidDebugAcls")); $AsTransparent = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/COUNT_DE_TRANSPARENT")); $WATCHDOG_COUNT_EVENTS = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/WATCHDOG_COUNT_EVENTS")); $COUNT_DE_CACHES = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/COUNT_DE_CACHES")); $SUM_FAMILYSITES = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/SUM_FAMILYSITES")); $WindowsUpdateCaching = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/WindowsUpdateCaching")); $TOP_WEBSITE = unserialize(@file_get_contents("{$GLOBALS["BASEDIR"]}/TOP_WEBSITE")); $NOT_CATEGORIZED = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/NOT_CATEGORIZED")); $CACHES_RATES = unserialize(@file_get_contents("{$GLOBALS["BASEDIR"]}/TOTAL_CACHED_ARRAY")); $TOTALS_NOT_CACHED = intval($CACHES_RATES["TOTALS_NOT_CACHED"]); $TOTALS_CACHED = intval($CACHES_RATES["TOTALS_CACHED"]); if ($users->AsProxyMonitor) { if ($EnableKerbAuth == 1) { $ntmlauthenticators = _ntmlauthenticators(); while (list($cpu, $purc) = each($ntmlauthenticators)) { $color = "black"; if ($purc > 95) { $color = "#d32d2d"; } $ntmlauthenticators_array[] = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td style='font-size:18px'>\n\t\t\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"javscript:Loadjs('squid.ntmlauthenticators.php?cpu={$cpu}')\"\n\t\t\t\t\tstyle='text-decoration:underline;color:{$color}'>{ntlm_processes}: CPU#{$cpu} {$purc}%</a></td>\n\t\t\t\t\t</tr>"; } } } $SERVICES_STATUS = SERVICES_STATUS(); if (!is_array($SERVICES_STATUS)) { $CountDeServices = $SERVICES_STATUS; } else { $icon = "disks-128-warn.png"; $err = $SERVICES_STATUS; } $scriptEnd = "LoadAjaxTiny('active-directory-dash-infos','{$page}?active-directory-dash-infos=yes');"; $EnableUfdbGuard = $sock->EnableUfdbGuard(); $realsquidversion = @file_get_contents("/etc/artica-postfix/settings/Daemons/SquidRealVersion"); $sql = "SELECT COUNT(*) as tcount FROM proxy_ports WHERE enabled=1"; $results = $q->QUERY_SQL($sql); $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); if (!$q->ok) { $err[] = proxy_status_warning("MySQL error", $q->mysql_error_html(), "blur()"); } $COUNTDePorts = $ligne["tcount"]; $js_icon_stats = null; $icon_stats = "<div style='float:left;margin-right:10px;margin-top:5px'><img src='img/statistics-24-grey.png'></div>"; $GotoNotCategorized = "GotoNotCategorized()"; $ActiveRequests_js = "Loadjs('squid.active.requests.php')"; $GotoNotCategorized_underline = "underline"; $ActiveRequests_underline = "underline"; $GotoMysQLAllWebsites_underline = "underline"; $GoToCachedStatistics = "GoToCachedStatistics()"; $GotoMysQLAllWebsites = "GotoMysQLAllWebsites()"; $LoadProxyUpdate = "LoadProxyUpdate();"; $LOadUfdbUpdate = "GoToWebfilteringDBstatus();"; if (!$users->AllowViewStatistics) { $GotoNotCategorized = "blur();"; $ActiveRequests_js = "blur()"; $GotoNotCategorized_underline = "none"; $ActiveRequests_underline = "none"; $GoToCachedStatistics = "blur()"; $GotoMysQLAllWebsites = "blur()"; $GotoMysQLAllWebsites_underline = "none"; } if (!$users->AsSquidAdministrator) { $LoadProxyUpdate = "blur()"; $LOadUfdbUpdate = "blur()"; } $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); if ($SquidPerformance < 2) { $prec = round(@file_get_contents("{$GLOBALS["BASEDIR"]}/CACHED_AVG"), 1); $PROXY_REQUESTS_NUMBER = @file_get_contents("{$GLOBALS["BASEDIR"]}/PROXY_REQUESTS_NUMBER"); $PROXY_REQUESTS_NUMBER = FormatNumber($PROXY_REQUESTS_NUMBER); if ($COUNT_DE_CACHES > 0) { $COUNT_DE_CACHES_KB = $COUNT_DE_CACHES * 1024; $COUNT_DE_CACHES_TEXT = FormatBytes($COUNT_DE_CACHES_KB); } $js_icon_stats = "OnMouseOver=\"this.style.cursor='pointer';\"\n\t\tOnMouseOut=\"this.style.cursor='auto'\"\n\t\tOnClick=\"javascript:{$GoToCachedStatistics};\""; if (is_file("{$GLOBALS["BASEDIR"]}/CACHED_ROW_DAY")) { $icon_stats = "<div style='float:left;margin-right:10px;margin-top:5px'>\n\t\t\t\t\t<img src='img/statistics-24.png'></div>"; } if ($SUM_FAMILYSITES > 0) { $SUM_FAMILYSITES = FormatNumber($SUM_FAMILYSITES); $SUM_FAMILYSITES_TEXT = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:20px'>{websites}:\n\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$GotoMysQLAllWebsites};\"\n\t\t\tstyle='text-decoration:{$GotoMysQLAllWebsites_underline}'>{$SUM_FAMILYSITES}</a></td>\n\t\t\t</tr>"; } } $ActiveRequestsR = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/active_requests.inc")); $ActiveRequestsNumber = count($ActiveRequestsR["CON"]); $ActiveRequestsIpaddr = count($ActiveRequestsR["IPS"]); $ActiveRequestsMembers = count($ActiveRequestsR["USERS"]); if ($NOT_CATEGORIZED > 0) { $NOT_CATEGORIZED = FormatNumber($NOT_CATEGORIZED); $NOT_CATEGORIZED_ROW = "<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"{$GotoNotCategorized}\"\n\t\tstyle='text-decoration:{$GotoNotCategorized_underline}'>{websites}: {$NOT_CATEGORIZED} {not_categorized}</a></td>\n\t\t</tr>"; } $TITLE_REQUESTS = "\n\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"{$ActiveRequests_js}\"\n\t\tstyle='text-decoration:{$ActiveRequests_underline}'>{$ActiveRequestsNumber} {active_requests}</a></td>\n\t\t</tr>"; if ($COUNTDePorts == 0) { $err[] = proxy_status_warning("{no_listening_port_defined}", "{no_listening_port_proxydefined_explain}", "GotoSquidPorts()"); } if ($SquidDebugAcls == 1) { $err[] = proxy_status_warning("{debug_acls}", "{debug_acls_explain}", "Loadjs('squid.acls.options.php')"); } if ($SNMP_WALK["ERROR"]) { $err[] = proxy_status_warning("SNMP:{need_to_restart_webconsole}", "{click_to_install}", "Loadjs('php-snmp.progress.php'"); } preg_match("#^([0-9]+)\\.([0-9]+)#", $realsquidversion, $re); $MAJOR = intval($re[1]); $MINOR = intval($re[2]); $INCOMPATIBLE = true; $REV = 0; $BUILD = 0; if ($MAJOR > 2) { if ($MINOR > 4) { $INCOMPATIBLE = false; } } if ($MAJOR == 0) { $INCOMPATIBLE = false; } if ($MAJOR == 4) { $INCOMPATIBLE = false; } if (preg_match("#^([0-9]+)\\.([0-9]+)\\.([0-9]+)#", $realsquidversion, $re)) { $REV = intval($re[3]); } if (preg_match("#^([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)-r([0-9]+)#", $realsquidversion, $re)) { $BUILD = intval($re[4] . $re[5]); } if ($SQUIDEnable == 1) { if ($INCOMPATIBLE) { $incompatible_proxy_version = $tpl->_ENGINE_parse_body("{incompatible_proxy_version}"); $incompatible_proxy_version = str_replace("%s", $realsquidversion, $incompatible_proxy_version); $err[] = proxy_status_warning($incompatible_proxy_version, $incompatible_proxy_version, $LoadProxyUpdate); } $ArticaTechNetSquidRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetSquidRepo"))); $NEWVER = null; while (list($key, $array) = each($ArticaTechNetSquidRepo)) { $AVVERSION = $array["VERSION"]; $XREV = 0; $XBUILD = 0; preg_match("#^([0-9]+)\\.([0-9]+)#", $AVVERSION, $re); $XMAJOR = intval($re[1]); $XMINOR = intval($re[2]); if (preg_match("#^([0-9]+)\\.([0-9]+)\\.([0-9]+)#", $AVVERSION, $re)) { $XREV = intval($re[3]); } if (preg_match("#^([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)-r([0-9]+)#", $AVVERSION, $re)) { $XBUILD = intval($re[4] . $re[5]); } $KEY = intval("{$XMAJOR}{$XMINOR}{$XREV}{$XBUILD}"); if ($MAJOR > $XMAJOR) { continue; } if ($GLOBALS["VERBOSE"]) { echo "<strong> squidver check {$XMAJOR}/{$XMINOR}/{$XREV}/{$XBUILD} - {$MAJOR}/{$MINOR}/{$REV}/{$BUILD}</strong>\n<br>"; } if ($XMAJOR > $MAJOR) { if ($GLOBALS["VERBOSE"]) { echo "<strong> squidver check {$XMAJOR}>{$MAJOR}</strong>\n<br>"; } $NEWVER = $AVVERSION; break; } if ($XMAJOR == $MAJOR) { if ($XMINOR > $MINOR) { $NEWVER = $AVVERSION; break; } } if ($XMAJOR == $MAJOR) { if ($XMINOR == $MINOR) { if ($XREV > $REV) { $NEWVER = $AVVERSION; break; } } } if ($XMAJOR == $MAJOR) { if ($XMINOR == $MINOR) { if ($XREV == $REV) { if ($XBUILD > $BUILD) { $NEWVER = $AVVERSION; break; } } } } } if ($users->AsSquidAdministrator) { if ($NEWVER != null) { $INFOS[] = status_info_event("{SQUID_NEWVERSION} {$NEWVER}", "{SQUID_NEWVERSION_TEXT}", $LoadProxyUpdate); } } } if ($SquidUrgency == 1) { $jsOn = "Loadjs('squid.urgency.php?justbutton=yes')"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $err[] = proxy_status_warning("{proxy_in_emergency_mode}", "{proxy_in_emergency_mode_explain}", $jsOn); $icon = "disks-128-red.png"; //proxy_in_emergency_mode //proxy_in_emergency_mode_explain } if ($SquidSSLUrgency == 1) { $jsOn = "Loadjs('squid.urgency.php?ssl=yes');"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $icon = "disks-128-red.png"; $err[] = proxy_status_warning("{proxy_in_ssl_emergency_mode}", "{proxy_in_ssl_emergency_mode_explain}", $jsOn); } if ($MacToUidUrgency == 1) { $jsOn = "Loadjs('squid.urgency.php?justbutton=yes');"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $icon = "disks-128-red.png"; $err[] = proxy_status_warning("{proxy_in_MacToUid_emergency_mode}", "{proxy_in_MacToUid_emergency_mode_explain}", $jsOn); } if ($SQUIDEnable == 1) { if ($SquidUFDBUrgency == 1) { $jsOn = "Loadjs('squid.urgency.php?ufdb=yes');"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $icon = "disks-128-red.png"; $err[] = proxy_status_warning("{proxy_in_webfiltering_emergency_mode}", "{proxy_in_webfiltering_emergency_mode_explain}", $jsOn); } if ($EnableUfdbGuard == 1) { if ($users->CORP_LICENSE) { $ufdbguard_artica_cloud_version = ufdbguard_artica_cloud_version(); if ($ufdbguard_artica_cloud_version == 0) { $jsOn = "Loadjs('dansguardian2.articadb-progress.php')"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $important_events[] = status_important_event("{update_webfiltering_artica_databases}", "{update_webfiltering_artica_databases_not_updated}", $jsOn); } if ($ufdbguard_artica_cloud_version > 1) { $jsOn = "Loadjs('dansguardian2.articadb-progress.php')"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $important_events[] = status_important_event("{webfiltering_artica_databases_available}", "{webfiltering_artica_databases_available_explain}", $jsOn); } } $ufdbguard_toulouse_cloud_version = ufdbguard_toulouse_cloud_version(); if ($ufdbguard_toulouse_cloud_version == 0) { $jsOn = "Loadjs('dansguardian2.articadb-progress.php')"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $important_events[] = status_important_event("{update_webfiltering_toulouse_databases}", "{update_webfiltering_toulouse_databases_not_updated}", $jsOn); } if ($ufdbguard_toulouse_cloud_version > 1) { $jsOn = "Loadjs('dansguardian2.articadb-progress.php')"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $important_events[] = status_important_event("{webfiltering_toulouse_databases_available}", "{webfiltering_artica_databases_available_explain}", $jsOn); } } } if ($SQUIDEnable == 1) { if ($LogsWarninStop == 1) { $jsOn = "Loadjs('system.log.emergency.php');"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $help = help_icon("{squid_logs_urgency}"); $text = texttooltip("{squid_logs_urgency_section}", "{squid_logs_urgency}", $jsOn); $icon = "disks-128-red.png"; $err[] = proxy_status_warning("{squid_logs_urgency_section}", "{squid_logs_urgency}", $jsOn); } } if ($SQUIDEnable == 1) { if ($IsPortsConverted == 0) { $jsOn = "Loadjs('squid.compile.progress.php');"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $icon = "disks-128-warn.png"; $err[] = proxy_status_warning("{IsPortsConverted_requested}", "{squid_IsPortsConverted_explain}", $jsOn); } else { if ($AsTransparent > 0) { $FireHolConfigured = intval($sock->GET_INFO("FireHolConfigured")); if ($FireHolConfigured == 0) { $icon = "disks-128-warn.png"; $err[] = proxy_status_warning("{transparent_mode_issue}", "{squid_transparent_no_firewall}", $jsOn); } } } } $GoToCategoriesServiceA = "GoToCategoriesServiceA()"; $GotoAdConnection = "GotoAdConnection()"; $LoadMainDashProxy = "LoadMainDashProxy()"; $GoToServices = "GoToServices()"; $GoToUfdb = "GoToUfdb()"; $GoToCaches = "GoToCaches()"; $GoToCaches_underline = "underline"; if (!$users->AsDansGuardianAdministrator) { $GoToCategoriesServiceA = "blur()"; $GoToUfdb = "blur()"; } if (!$users->AsSquidAdministrator) { $GotoAdConnection = "blur()"; $LoadMainDashProxy = "blur()"; $GoToServices = "blur()"; $GoToCaches = "blur()"; $GoToCaches_underline = "none"; } if ($SQUIDEnable == 1) { $catz = new mysql_catz(); if ($catz->UfdbCatEnabled == 1) { $categories = $catz->ufdbcat("google.com"); if (!$catz->ok) { $icon = "disks-128-warn.png"; $err[] = proxy_status_warning("{APP_UFDBCAT}: {connection_error}", $catz->mysql_error, $GoToCategoriesServiceA); } } } if ($SQUIDEnable == 1) { if ($sock->SQUID_IS_EXTERNAL_LDAP()) { $tests = CHECK_SQUID_EXTERNAL_LDAP(); if ($tests != null) { $err[] = proxy_status_warning("{$tests}", "{$tests}", "GotoOpenldap()"); } } } if ($BasicAuthenticatorEmergency == 1) { $jsOn = "Loadjs('squid.urgency.php?justbutton=yes');"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $icon = "disks-128-warn.png"; $err[] = proxy_status_warning("{authentication_emergency_mode}", "{authentication_emergency_mode_explain}", $jsOn); } if ($SQUIDEnable == 1) { if ($EnableKerbAuth == 1) { if ($ActiveDirectoryEmergency == 1) { $jsOn = "Loadjs('squid.urgency.php?activedirectory=yes');"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $icon = "disks-128-warn.png"; $err[] = proxy_status_warning("{activedirectory_emergency_mode}", "{activedirectory_emergency_mode_explain}", $jsOn); } if (!$users->CORP_LICENSE) { $Days = 86400 * 30; $DayToLeft = 30; if (is_file("/usr/share/artica-postfix/ressources/class.pinglic.inc")) { include_once "/usr/share/artica-postfix/ressources/class.pinglic.inc"; $EndTime = $GLOBALS['ADLINK_TIME'] + $Days; $seconds_diff = $EndTime - time(); $DayToLeft = floor($seconds_diff / 3600 / 24); } $MAIN_ERROR = $tpl->_ENGINE_parse_body("{warn_no_license_activedirectory_30days}"); $MAIN_ERROR = str_replace("%s", $DayToLeft, $MAIN_ERROR); $important_events[] = status_important_event($MAIN_ERROR, $MAIN_ERROR, $jsOn); } if ($ActiveDirectoryEmergency == 0) { $IsConnected = IsKerconnected(); if ($IsConnected != "TRUE") { $err[] = proxy_status_warning("{proxy_is_not_configured_ad}", null, $GotoAdConnection); } } $TestLDAPAD = TestLDAPAD(); if ($TestLDAPAD != null) { $err[] = $TestLDAPAD; } $AdminAsSeenNTLMPerfs = intval($sock->GET_INFO("AdminAsSeenNTLMPerfs")); if ($AdminAsSeenNTLMPerfs == 0) { $err[] = proxy_status_warning("{NTLM_PERFORMANCES_NOT_DEFINED}", null, $GotoAdConnection); } } } if ($EnableeCapClamav == 1) { if ($eCAPClamavEmergency == 1) { $jsOn = "Loadjs('squid.urgency.php?eCAPClamavEmergency=yes');"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $icon = "disks-128-warn.png"; $err[] = proxy_status_warning("{eCAPClamav_emergency_mode}", "{activedirectory_emergency_mode_explain}", $jsOn); } } if ($ParanoidBlockerEmergency == 1) { $jsOn = "Loadjs('squid.urgency.php?ParanoidBlockerEmergency=yes');"; if (!$users->AsSquidAdministrator) { $jsOn = "blur()"; } $icon = "disks-128-warn.png"; $err[] = proxy_status_warning("{paranoid_emergency_mode}", "{paranoid_emergency_mode_explain}", $jsOn); } if ($SquidCacheFullHideWarn == 0) { if ($COUNT_DE_CACHES > 0) { if ($CACHES_AVG > 85) { $err[] = proxy_status_warning("{caches_are_full}", "{caches_are_full_explain}", $GoToCaches); } } } if ($COUNT_DE_CACHES > 0) { $COUNT_DE_MEMBERS = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/MEMBERS_COUNT")); if ($COUNT_DE_MEMBERS > 15) { if ($COUNT_DE_CACHES < 20000) { $undersized_proxy_caches_explain = $tpl->_ENGINE_parse_body("{undersized_proxy_caches_explain}"); $COUNT_DE_CACHES_KB = $COUNT_DE_CACHES * 1024; $COUNT_DE_CACHES_TEXT = FormatBytes($COUNT_DE_CACHES_KB); $undersized_proxy_caches_explain = str_replace("%S", $COUNT_DE_CACHES_TEXT, $undersized_proxy_caches_explain); $undersized_proxy_caches_explain = str_replace("%U", $COUNT_DE_MEMBERS, $undersized_proxy_caches_explain); if ($SquidCacheLevel > 0) { $err[] = proxy_status_warning("{undersized_proxy_caches}", $undersized_proxy_caches_explain, $GoToCaches); } } } } if (!$users->AsSquidAdministrator) { $err = array(); } if (count($err) > 0) { $errT[] = "<tr><td style='font-size:32px;color:#d32d2d;vertical-align:middle'>" . count($err) . " {issues}</td></tr>\n\t\t<tr><td colspan=2> </td></tr>\t\n\t\t\t\t"; } $ActiveRequestsR = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/active_requests.inc")); $ActiveRequestsNumber = count($ActiveRequestsR["CON"]); $ActiveRequestsIpaddr = count($ActiveRequestsR["IPS"]); $ActiveRequestsMembers = count($ActiveRequestsR["USERS"]); $GotoParanoidMode = "GotoParanoidMode()"; $GotoParanoidMode_underline = "underline"; $GoToUfdb_underline = "underline"; if (!$users->AsDansGuardianAdministrator) { $GotoParanoidMode = "blur()"; $GoToUfdb = "blur()"; $GotoParanoidMode_underline = "none"; $GoToUfdb_underline = "none"; } $UfdbEnableParanoidMode = intval($sock->GET_INFO("UfdbEnableParanoidMode")); if ($UfdbEnableParanoidMode == 1) { $q = new mysql_squid_builder(); $webfilters_paranoid = $q->COUNT_ROWS("webfilters_paranoid"); if ($webfilters_paranoid > 0) { $webfilters_paranoid_text = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:{$GotoParanoidMode}\"\n\t\tstyle='text-decoration:{$GotoParanoidMode_underline}'>{paranoid_mode}: " . FormatNumber($webfilters_paranoid) . " {rules}</a></td>\n\t\t</tr>"; } } if ($EnableUfdbGuard == 1) { if ($COUNT_DE_BLOCKED > 0) { $WebFiltering_blocked = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:{$GoToUfdb}\"\n\t\tstyle='text-decoration:{$GoToUfdb_underline}'>{blocked_events}: " . FormatNumber($COUNT_DE_BLOCKED) . "</a></td>\n\t\t</tr>"; } } if (intval($ini->_params["SQUID"]["service_disabled"]) == 1) { if ($ini->_params["SQUID"]["running"] == 0) { $icon = "disks-128-red.png"; } } $mgr_client_list_TR = "\n\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:GotoMgrClientList()\"\n\t\t\tstyle='text-decoration:underline'>{active_clients}: " . FormatNumber($SNMP_WALK["CLIENTS_NUMBER"]) . "</a></td>\n\t\t</tr>"; $active_resquests_js = "Loadjs('squid.active.requests.php')"; $active_resquests_underline = "underline"; if (!$users->AsSquidAdministrator) { $active_resquests_js = "blur()"; $active_resquests_underline = "none"; } if ($ActiveRequestsNumber > 1) { $active_resquests = "\n\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:{$active_resquests_js}\"\n\t\t\tstyle='text-decoration:underline'>{active_requests}: {$ActiveRequestsNumber}</a></td>\n\t\t</tr>"; } if (intval($WATCHDOG_COUNT_EVENTS) > 0) { $important_events[] = status_important_event("{$WATCHDOG_COUNT_EVENTS} {important_events_48h}", null, "GotoWatchdog()"); } $CACHES_AVG_COLOR = "black"; if ($CACHES_AVG > 85) { if ($SquidCacheFullHideWarn == 0) { $CACHES_AVG_COLOR = "#d32d2d"; } } if (count($important_events) > 0) { $important_events_text = "<tr><td colspan=2> </td></tr>" . @implode("\n", $important_events); } if ($SQUIDEnable == 0) { $icon = "disks-128-ok-grey.png"; } if (count($INFOS) > 0) { $INFOS[] = "<tr><td><br></td></tr>"; } if ($SquidCacheLevel == 0) { $SNMP_WALK["PERC_CACHE"] = 0; $SNMP_WALK["STORED_OBJECTS"] = 0; } $prec = intval($SNMP_WALK["PERC_CACHE"]); if ($prec > 0) { $perc_cache = "\n\t\t<tr>\n\t\t\t<td style='font-size:18px;vertical-align:middle'>{$prec}% {cache} ({currently})</td>\n\t\t</tr>"; } $REQUESTS = intval($SNMP_WALK["REQUESTS"]); if ($REQUESTS > 0) { $current_req = "<tr>\n\t\t<td style='font-size:18px;vertical-align:middle'>" . FormatNumber($REQUESTS) . " {requests}</td>\n\t\t</tr>"; } if ($SNMP_WALK["CPU"] > 0) { $current_cpu_use = "<tr>\n\t\t<td style='font-size:18px;vertical-align:middle'>{$SNMP_WALK["CPU"]}% {cpu_use}</td>\n\t\t</tr>"; } $windowsUpdate = null; if ($WindowsUpdateCaching == 1) { $cacheFile = "/usr/share/artica-postfix/ressources/logs/web/WindowsUpdate.state"; $ARRAY = unserialize(@file_get_contents($cacheFile)); if (intval($ARRAY["SIZEKB"]) > 4) { $windowsUpdate = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:18px;vertical-align:middle'> \n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:GotoWindowsUpdate()\"\n\t\t\tstyle='text-decoration:underline'>Windows Update:</a> " . FormatBytes($ARRAY["SIZEKB"]) . "</td>\n\t\t\t</tr>"; } } $HTTrack = null; if ($HTTrackInSquid == 1) { $HTTRackSize = $sock->GET_INFO("HTTRackSize"); if ($HTTRackSize > 0) { $HTTrack = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:18px;vertical-align:middle'>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:GotoWebCopy()\"\n\t\t\tstyle='text-decoration:underline'>WebCopy:</a> " . FormatBytes($HTTRackSize / 1024) . "</td>\n\t\t\t</tr>"; } } if ($SNMP_WALK["STORED_OBJECTS"] > 0) { $current_stored_objects = "<tr>\n\t\t<td style='font-size:18px;vertical-align:middle'>" . FormatNumber($SNMP_WALK["STORED_OBJECTS"]) . " {stored_objects}</td>\n\t\t</tr>"; } if ($SquidCacheLevel > 0) { if ($COUNT_DE_CACHES_TEXT != null) { $INFO_STORAGE_CACHE = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"{$GoToCaches}\"\n\t\t\t\t\tstyle='text-decoration:{$GoToCaches_underline};color:{$CACHES_AVG_COLOR}'>\n\t\t\t\t\t\t{storage}: {$CACHES_AVG}% / {$COUNT_DE_CACHES_TEXT}</a>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"; } } $CACHED_DETAILS_TOTAL = null; $NOT_CACHED_DETAILS_TOTAL = null; if ($TOTALS_CACHED > 0) { $CACHED_DETAILS_TOTAL = "\n\t\t<tr>\n\t\t\t<td style='font-size:18px'>\n\t\t\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"{$GoToCaches}\"\n\t\t\t\t\tstyle='text-decoration:{$GoToCaches_underline};color:black'>\n\t\t\t\t\t\t{cached}: " . FormatBytes($TOTALS_CACHED / 1024) . "</a>\n\t\t\t</td>\n\t\t</tr>\n\t"; } if ($TOTALS_NOT_CACHED > 0) { $NOT_CACHED_DETAILS_TOTAL = "\n\t\t<tr>\n\t\t\t<td style='font-size:18px'>\n\t\t\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"{$GoToCaches}\"\n\t\t\t\t\tstyle='text-decoration:{$GoToCaches_underline};color:black'>\n\t\t\t\t\t\t{not_cached}: " . FormatBytes($TOTALS_NOT_CACHED / 1024) . "</a>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t"; } if (!$users->AsSquidAdministrator) { $important_events_text = null; $errT = array(); $windowsUpdate = null; $mgr_client_list_TR = null; } $icon = imgtootltip($icon, "position:right:{configure_your_proxy}", "{$LoadMainDashProxy}"); $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' style='width:128px' >\n\t\t\t{$icon}\n\t\t\t<div id='active-directory-dash-infos'>" . active_directory_infos() . "</div>\t\n\t\t</td>\n\t\t<td>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:30px'>\n\t\t\t\t" . texttooltip("{your_proxy}", "{configure_your_proxy}", "{$LoadMainDashProxy}") . "\n\t\t\t\t <span style='font-size:22px'>[ <a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.infos.php');\"\n\t\t\t\tstyle='text-decoration:underline'>Infos.</a> ]</span>\t\t\n\t\t\t\t\t\t\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<!-- perc_cache -->\n\t\t\t{$perc_cache}\n\t\t\t<!-- TOTALS_CACHED:{$TOTALS_CACHED} -->\n\t\t\t{$CACHED_DETAILS_TOTAL}\n\t\t\t<!-- TOTALS NOT CACHED:{$TOTALS_NOT_CACHED} -->\n\t\t\t{$NOT_CACHED_DETAILS_TOTAL}\n\t\t\t<!-- windowsUpdate -->\n\t\t\t{$windowsUpdate}\n\t\t\t<!-- HTTrack -->\n\t\t\t{$HTTrack}\n\t\t\t<!-- current_req -->\n\t\t\t{$current_req}\n\t\t\t<!-- SUM_FAMILYSITES_TEXT -->\n\t\t\t{$SUM_FAMILYSITES_TEXT}\n\t\t\n\t\t\t{$active_resquests}\n\t\t\t{$mgr_client_list_TR}\n\t\t\t{$rqs}\n\t\t\t\t" . @implode("", $ntmlauthenticators_array) . "\n\t\t\t\n\t\t\t\n\t\t<!-- WebFiltering_blocked -->\n\t\t{$WebFiltering_blocked}\n\t\t<!-- webfilters_paranoid -->\n\t\t{$webfilters_paranoid_text}\t\n\t\t<!-- INFO_STORAGE_CACHE -->\n\t\t{$INFO_STORAGE_CACHE}\n\t\t\n\t\t\n\t\t\n\t<!-- current_stored_objects -->\n\t\t\t{$current_stored_objects}\n\t<!-- TITLE_REQUESTS -->\n\t\t\t{$TITLE_REQUESTS}\n\t<!-- TOP_GRAPHS -->\n\t\t\t" . TOP_GRAPHS() . "\n\t\t\t{$CountDeServices}\n\t\t\t" . @implode("", $INFOS) . "\n\t\t\t" . @implode("", $errT) . "\n\t\t\t" . @implode("", $err) . "\n\t\t\t{$important_events_text}\n\t\t\t\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t</table>\n\t<script>\n\t\tLoadAjaxSilent('proxy_dashboard_counters','{$page}?proxy_dashboard_counters=yes');\n\t</script>\n\t"; $html = $tpl->_ENGINE_parse_body($html); if (!is_dir("/usr/share/artica-postfix/ressources/interface-cache")) { @mkdir("/usr/share/artica-postfix/ressources/interface-cache"); } @file_put_contents($cachefile, $html); return $html; }
function build_ufdb() { $sock = new sockets(); $unix = new unix(); $php = $unix->LOCATE_PHP5_BIN(); $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); if ($EnableUfdbGuard == 1) { build_progress_build("{building} {webfiltering} {enabled} OK", 12); } else { build_progress_build("{building} {webfiltering} {activate} OK", 12); @file_put_contents("/etc/artica-postfix/settings/Daemons/EnableUfdbGuard", 1); @file_put_contents("/etc/artica-postfix/settings/Daemons/UfdbUseArticaClient", 1); } if (!build_IsInSquid()) { build_progress_build("{building} {reconfigure_proxy_service}...", 14); @file_put_contents("/etc/artica-postfix/settings/Daemons/UfdbUseArticaClient", 1); system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force"); build_progress_build("{building} {reconfigure_proxy_service} {done}", 16); } build_progress_build("{building} {webfiltering} {done}", 18); }
function start($aspid = false) { $unix = new unix(); $sock = new sockets(); $Masterbin = $unix->find_program("ufdbguardd"); if (!is_file($Masterbin)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, ufdbguardd not installed\n"; } return; } if (!$aspid) { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $time = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n"; } return; } @file_put_contents($pidfile, getmypid()); } $pid = PID_NUM(); $EnableUfdbGuard = $sock->EnableUfdbGuard(); $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance"); if (!is_numeric($EnableRemoteStatisticsAppliance)) { $EnableRemoteStatisticsAppliance = 0; } $UseRemoteUfdbguardService = $sock->GET_INFO("UseRemoteUfdbguardService"); if (!is_numeric($UseRemoteUfdbguardService)) { $UseRemoteUfdbguardService = 0; } if ($EnableRemoteStatisticsAppliance == 1) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled (see EnableRemoteStatisticsAppliance)\n"; } if ($unix->process_exists($pid)) { stop(true); } return; } if ($UseRemoteUfdbguardService == 1) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled (see UseRemoteUfdbguardService)\n"; } if ($unix->process_exists($pid)) { stop(true); } return; } if ($EnableUfdbGuard == 0) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled (see EnableUfdbGuard)\n"; } if ($unix->process_exists($pid)) { stop(true); } return; } if ($unix->process_exists($pid)) { $timepid = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Service already started {$pid} since {$timepid}Mn...\n"; } return; } $php5 = $unix->LOCATE_PHP5_BIN(); $sysctl = $unix->find_program("sysctl"); $echo = $unix->find_program("echo"); $nohup = $unix->find_program("nohup"); $tail = $unix->find_program("tail"); if (!is_file("/var/log/squid/ufdbguardd.log")) { for ($i = 1; $i < 5; $i++) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} waiting for ufdbguardd.log {$i}/5\n"; } sleep(1); if (is_file("/var/log/squid/ufdbguardd.log")) { break; } } } STOP_TAIL_INSTANCES(); $cmd = "{$tail} -f -n 0 /var/log/squid/ufdbguardd.log|{$php5} /usr/share/artica-postfix/exec.ufdbguard-tail.php >/dev/null 2>&1 &"; if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service\n"; } shell_exec($cmd); for ($i = 1; $i < 11; $i++) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} waiting {$i}/5\n"; } sleep(1); $pid = PID_NUM(); if ($unix->process_exists($pid)) { break; } } $pid = PID_NUM(); if ($unix->process_exists($pid)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Success PID {$pid}\n"; } } else { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Failed\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} {$cmd}\n"; } } }
function start($aspid = false) { $unix = new unix(); $sock = new sockets(); $Masterbin = $unix->find_program("lighttpd"); if (!is_file($Masterbin)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, not installed\n"; } return; } if (!$aspid) { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $time = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n"; } return; } @file_put_contents($pidfile, getmypid()); } $pid = PID_NUM(); if ($unix->process_exists($pid)) { $timepid = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Service already started {$pid} since {$timepid}Mn...\n"; } return; } $EnableSquidGuardHTTPService = $sock->GET_INFO("EnableSquidGuardHTTPService"); $EnableSquidGuardHTTPToArtica = intval($sock->GET_INFO("EnableSquidGuardHTTPToArtica")); $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); if ($GLOBALS["VERBOSE"]) { echo "* * * EnableUfdbGuard = {$EnableUfdbGuard} * * *\n"; } $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); $SQUIDEnable = $sock->GET_INFO("SQUIDEnable"); if (!is_numeric($SQUIDEnable)) { $SQUIDEnable = 1; } $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if (!is_numeric($EnableSquidGuardHTTPService)) { $EnableSquidGuardHTTPService = 1; } if (!is_numeric($EnableUfdbGuard)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: disabled {$EnableUfdbGuard}=0\n"; } if ($GLOBALS["VERBOSE"]) { echo "* * * EnableUfdbGuard NOT A NUMERIC => 0 * * *\n"; } $EnableUfdbGuard = 0; } if ($EnableUfdbGuard == 0) { $EnableSquidGuardHTTPService = 0; if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: disabled because EnableUfdbGuard={$EnableUfdbGuard}\n"; } } if ($SQUIDEnable == 0) { $SQUIDEnable = 0; } if ($EnableWebProxyStatsAppliance == 1) { $EnableSquidGuardHTTPService = 1; } if ($SquidPerformance > 2) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: disabled because EnableSquidGuardHTTPService={$EnableSquidGuardHTTPService}\n"; } $EnableSquidGuardHTTPService = 0; } if ($EnableSquidGuardHTTPToArtica == 1) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: disabled because EnableSquidGuardHTTPService={$EnableSquidGuardHTTPService}\n"; } $EnableSquidGuardHTTPService = 0; } if ($EnableSquidGuardHTTPService == 0) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} EnableUfdbGuard = {$EnableUfdbGuard}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} EnableWebProxyStatsAppliance = {$EnableWebProxyStatsAppliance}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} SQUIDEnable = {$SQUIDEnable}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} EnableSquidGuardHTTPToArtica = {$EnableSquidGuardHTTPToArtica}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} SquidPerformance = {$SquidPerformance}\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled\n"; } return; } $php5 = $unix->LOCATE_PHP5_BIN(); $sysctl = $unix->find_program("sysctl"); $echo = $unix->find_program("echo"); $nohup = $unix->find_program("nohup"); build(); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service\n"; } $TMPFILE = "/var/log/lighttpd/squidguard-lighttpd.start"; $CMDS[] = "{$nohup}"; $CMDS[] = $unix->find_program("lighttpd"); $CMDS[] = "-f /etc/artica-postfix/squidguard-lighttpd.conf"; $CMDS[] = "> {$TMPFILE} 2>&1 &"; $cmd = @implode(" ", $CMDS); shell_exec($cmd); for ($i = 1; $i < 6; $i++) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} waiting {$i}/5\n"; } sleep(1); $pid = PID_NUM(); if ($unix->process_exists($pid)) { break; } } $pid = PID_NUM(); if ($unix->process_exists($pid)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Success PID {$pid}\n"; } } else { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Failed\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} {$cmd}\n"; } $f = explode("\n", @file_get_contents($TMPFILE)); while (list($index, $line) = each($f)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [DEBUG]:1] {$line}\n"; } } $f = explode("\n", @file_get_contents("/var/log/lighttpd/squidguard-lighttpd-error.log")); while (list($index, $line) = each($f)) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [DEBUG]:2] {$line}\n"; } } } }
function main_rules_mainsettings() { $users = new usersMenus(); if ($_GET["hostname"] == null) { $hostname = $users->hostname; } else { $hostname = $_GET["hostname"]; } $rule_main = $_GET["rule_main"]; $dans = new dansguardian_rules($_GET["hostname"], $rule_main); $dansg = new dansguardian($_GET["hostname"]); $rulename = strip_rulename($dansg->Master_rules_index[$rule_main]); $page = CurrentPageName(); $groupmode = array('0' => "{groupmode_0}", '1' => "{groupmode_1}", '2' => "{groupmode_2}"); $sock = new sockets(); $dansguardian_enabled = $sock->GET_INFO("DansGuardianEnabled"); if ($dansguardian_enabled == null) { $dansguardian_enabled = 0; $sock->SET_INFO("DansGuardianEnabled", 0); } $squidGuardEnabled = $sock->GET_INFO("squidGuardEnabled"); if ($squidGuardEnabled == null) { $squidGuardEnabled = 0; $sock->SET_INFO("squidGuardEnabled", 0); } $EnableUfdbGuard = intval($sock->EnableUfdbGuard()); if ($EnableUfdbGuard == null) { $EnableUfdbGuard = 0; $sock->SET_INFO("EnableUfdbGuard", 0); } $dansguardian_part = "\t\n\t<tr>\n\t<td align='right' nowrap valign='top' class=legend>{groupmode}:</strong></td>\n\t<td valign='top'>" . Field_array_Hash($groupmode, 'groupmode', $dans->Main_array["groupmode"], null, null, 1, "font-size:13px;padding:3px") . "</td>\n\t<td valign='top'>" . help_icon('{groupmode_text}') . "</td>\n\t</tr>\t\t\n\t\n\t<td align='right' nowrap valign='top' class=legend>{naughtynesslimit}:</strong></td>\n\t<td valign='top'>" . Field_text('naughtynesslimit', $dans->Main_array["naughtynesslimit"], 'width:50px;font-size:13px;padding:3px') . "</td>\n\t<td valign='top'>" . help_icon('{naughtynesslimit_text}') . "</td>\n\t</tr>\n\t<tr>\n\t<td align='right' nowrap valign='top' class=legend>{categorydisplaythreshold}:</strong></td>\n\t<td valign='top'>" . Field_text('categorydisplaythreshold', $dans->Main_array["categorydisplaythreshold"], 'width:50px;font-size:13px;padding:3px') . "</td>\n\t<td valign='top'>" . help_icon('{categorydisplaythreshold_text}') . "</td>\n\t</tr>\n\t\n\t<tr>\n\t<td align='right' nowrap valign='top' class=legend>{embeddedurlweight}:</strong></td>\n\t<td valign='top'>" . Field_text('embeddedurlweight', $dans->Main_array["embeddedurlweight"], 'width:50px;font-size:13px;padding:3px') . "</td>\n\t<td valign='top'>" . help_icon('{embeddedurlweight_text}') . "</td>\n\t</tr>\t\t\n\t\n\t\n\t<tr>\n\t<td align='right' nowrap valign='top' class=legend>{deepurlanalysis}:</strong></td>\n\t<td valign='top'>" . Field_checkbox('deepurlanalysis', 'on', $dans->Main_array["deepurlanalysis"]) . "</td>\n\t<td valign='top'>" . help_icon('{deepurlanalysis_text}') . "</td>\n\t</tr>\t"; $users = new usersMenus(); if (!$users->DANSGUARDIAN_INSTALLED) { $dansguardian_part = null; } if ($squidGuardEnabled == 1) { $dansguardian_part = null; } if ($EnableUfdbGuard == 1) { $dansguardian_part = null; } $style = "style='padding:3px;border-bottom:1px dotted #CCCCCC'"; $html = "\n\t<div id='main_rules_mainsettings_id'>\n\t<input type='hidden' name='RulesSaveGeneralSettings' value='yes'>\n\t<input type='hidden' name='rule_main' value='{$rule_main}'>\n\t<table style='width:100%'>\n\n\t<tr>\n\t<td align='right' nowrap valign='middle' class=legend>{groupname}:</strong></td>\n\t<td valign='top'>" . Field_text('groupname', $dans->Main_array["groupname"], 'width:220px;font-size:13px;padding:3px') . "</td>\n\t<td valign='top'>" . help_icon('{groupname_text}') . "</td>\n\t</tr>\t\n\t{$dansguardian_part}\n\t\n\t<td {$style} colspan=3 align='right' valign='top'>\n\t<hr>\n\t\t" . button("{save}", "main_rules_mainsettings_save();") . "\n\t</tr>\n\n\t</table>\n\t<br>{$table}\n\t</div>\n\t\n\t<script>\n\t \n\tvar x_main_rules_mainsettings_save= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\n\t\t\tYahooWin2Hide();\n\t\t}\t\n\t\n\t\n\t\n\t\n\t\tfunction main_rules_mainsettings_save(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('RulesSaveGeneralSettings','yes');\n\t\t\tXHR.appendData('rule_main','{$rule_main}');\n\t\t\tXHR.appendData('groupname',document.getElementById('groupname').value);\n\t\t\tif(document.getElementById('groupmode')){\n\t\t\t\tXHR.appendData('groupmode',document.getElementById('groupmode').value);\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('naughtynesslimit')){\n\t\t\t\tXHR.appendData('naughtynesslimit',document.getElementById('naughtynesslimit').value);\n\t\t\t}\t\n\n\t\t\t\n\t\t\tif(document.getElementById('categorydisplaythreshold')){\n\t\t\t\tXHR.appendData('categorydisplaythreshold',document.getElementById('categorydisplaythreshold').value);\n\t\t\t}\t\t\n\n\t\t\tif(document.getElementById('embeddedurlweight')){\n\t\t\t\tXHR.appendData('embeddedurlweight',document.getElementById('embeddedurlweight').value);\n\t\t\t}\t\t\t\t\n\t\t\tif(document.getElementById('deepurlanalysis')){\n\t\t\t\tif(document.getElementById('deepurlanalysis').checked){\n\t\t\t\t\tXHR.appendData('deepurlanalysis','on');\n\t\t\t\t}else{\n\t\t\t\t\tXHR.appendData('deepurlanalysis','off');\n\t\t\t\t}\n\t\t\t}\n\t\tdocument.getElementById('main_rules_mainsettings_id').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_main_rules_mainsettings_save);\t}\n\t\t\n\t\t\n\t</script>"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html, 'squid.index.php'); }
function page() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $q = new mysql_squid_builder(); if ($sock->EnableUfdbGuard() == 0) { if ($q->COUNT_ROWS("webfilter_rules") == 0) { echo $tpl->_ENGINE_parse_body("<center style='margin:90px'>" . button("{activate_the_webfiltering_engine_wizard}", "Loadjs('dansguardian2.wizard.rule.php')", 40) . "</center>"); return; } echo $tpl->_ENGINE_parse_body("<center style='margin:90px'>\n\t\t\t\t<p style='font-size:20px'>{warn_ufdbguard_not_activated_explain}</p>\n\t\t\t\t\n\t\t\t\t" . button("{activate_webfilter_engine}", "Loadjs('ufdbguard.enable.progress.php')", 40) . "</center>"); return; } $t = time(); $WEBFILTERING_TOP_MENU = WEBFILTERING_TOP_MENU(); $html = "\n\t<div style='font-size:30px;margin-bottom:20px'>{$WEBFILTERING_TOP_MENU}</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:top;width:390px'><div id='service-status-{$t}'></div></td>\n\t\t<td style='vertical-align:top;width:99%;padding-left:20px'>\n\t\t\t\t<center id='rules-toolbox' style='margin:bottom:15px'></center>\n\t\t\t\t<div id='main-status-{$t}'></div>\n\t\t</td>\n\t</tr>\n\t</table>\n\t</div>\n\t\n\t<script>\n\t\tLoadAjax('service-status-{$t}','{$page}?service-status=yes&t={$t}');\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function features() { $sock = new sockets(); $users = new usersMenus(); $check = "42-green.png"; $uncheck = "42-red.png"; $squid = new squidbee(); $INTEGER[0] = $uncheck; $INTEGER[1] = $check; $INTEGER[-1] = "42-green-grey.png"; $tpl = new templates(); $DisableAnyCache = $sock->GET_INFO("DisableAnyCache"); if (!is_numeric($DisableAnyCache)) { $DisableAnyCache = 0; } $hasProxyTransparent = $sock->GET_INFO("hasProxyTransparent"); if (!is_numeric($hasProxyTransparent)) { $hasProxyTransparent = 0; } $SquidCacheLevel = $sock->GET_INFO("SquidCacheLevel"); if (!is_numeric($SquidCacheLevel)) { $SquidCacheLevel = 4; } if ($SquidCacheLevel == 0) { $DisableAnyCache = 1; } $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance"); if (!is_numeric($EnableRemoteStatisticsAppliance)) { $EnableRemoteStatisticsAppliance = 0; } $SquidGuardIPWeb = trim($sock->GET_INFO("SquidGuardIPWeb")); $SquidGuardServerName = $sock->GET_INFO("SquidGuardServerName"); $SquidDisableAllFilters = $sock->GET_INFO("SquidDisableAllFilters"); $SquideCapAVEnabled = $sock->GET_INFO("SquideCapAVEnabled"); $kavicapserverEnabled = $sock->GET_INFO("kavicapserverEnabled"); $EnableSplashScreen = $sock->GET_INFO("EnableSplashScreen"); $PdnsHotSpot = $sock->GET_INFO("EnableSplashScreen"); $EnableMalwarePatrol = $sock->GET_INFO("EnableMalwarePatrol"); $AsSquidLoadBalancer = $sock->GET_INFO("AsSquidLoadBalancer"); $SquidActHasReverse = $sock->GET_INFO("SquidActHasReverse"); if ($squid->isNGnx()) { $SquidActHasReverse = 0; } $UfdbEnabledCentral = $sock->GET_INFO('UfdbEnabledCentral'); $AntivirusEnabledCentral = $sock->GET_INFO('AntivirusEnabledCentral'); $EnableKerbAuthCentral = $sock->GET_INFO('EnableKerbAuthCentral'); $EnableUfdbGuard = $sock->EnableUfdbGuard(); $DnsFilterCentral = $sock->GET_INFO('DnsFilterCentral'); $SquidBubbleMode = $sock->GET_INFO('SquidBubbleMode'); $EnableITChart = $sock->GET_INFO('EnableITChart'); $CicapEnabled = $sock->GET_INFO("CicapEnabled"); $EnableFTPProxy = $sock->GET_INFO('EnableFTPProxy'); $MonitConfig = unserialize(base64_decode($sock->GET_INFO("SquidWatchdogMonitConfig"))); $Watchdog = $MonitConfig["watchdog"]; $UnlockWebStats = $sock->GET_INFO("UnlockWebStats"); if (!is_numeric($UnlockWebStats)) { $UnlockWebStats = 0; } if ($UnlockWebStats == 1) { $EnableRemoteStatisticsAppliance = 0; } $EnableHaarp = $sock->GET_INFO("EnableHaarp"); if (!is_numeric($EnableHaarp)) { $EnableHaarp = 0; } // APP_HAARP $EnableHaarp if (!is_numeric($EnableFTPProxy)) { $EnableFTPProxy = 0; } $PDSNInUfdb = $sock->GET_INFO("PDSNInUfdb"); $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth"); $EnableCNTLM = $sock->GET_INFO("EnableCNTLM"); if (!is_numeric($EnableKerbAuth)) { $EnableKerbAuth = 0; } if (!is_numeric($EnableUfdbGuard)) { $EnableUfdbGuard = 0; } if (!is_numeric($SquideCapAVEnabled)) { $SquideCapAVEnabled = 0; } if (!is_numeric($EnableMalwarePatrol)) { $EnableMalwarePatrol = 0; } if (!is_numeric($SquidDisableAllFilters)) { $SquidDisableAllFilters = 0; } if (!is_numeric($EnableSplashScreen)) { $EnableSplashScreen = 0; } if (!is_numeric($PdnsHotSpot)) { $PdnsHotSpot = 0; } if (!is_numeric($AsSquidLoadBalancer)) { $AsSquidLoadBalancer = 0; } if (!is_numeric($SquidActHasReverse)) { $SquidActHasReverse = 0; } if (!is_numeric($kavicapserverEnabled)) { $kavicapserverEnabled = 0; } if (!is_numeric($SquidBubbleMode)) { $SquidBubbleMode = 0; } if (!is_numeric($EnableITChart)) { $EnableITChart = 0; } if (!is_numeric($EnableHaarp)) { $EnableHaarp = 0; } if (!is_numeric($CicapEnabled)) { $CicapEnabled = 0; } if (!is_numeric($EnableCNTLM)) { $EnableCNTLM = 0; } if (!is_numeric($EnableKerbAuth)) { $EnableKerbAuth = 0; } if ($EnableKerbAuth == 0) { $EnableCNTLM = 0; } $isNGnx = 0; if (!$users->CNTLM_INSTALLED) { $EnableCNTLM = -1; } if (!$users->APP_FTP_PROXY) { $EnableFTPProxy = -1; } if (!$users->SAMBA_INSTALLED) { $EnableKerbAuth = -1; } if (!$users->APP_UFDBGUARD_INSTALLED) { $EnableUfdbGuard = -1; } if (!$users->KAV4PROXY_INSTALLED) { $kavicapserverEnabled = -1; } if (!$users->HAARP_INSTALLED) { $EnableHaarp = -1; } if ($squid->isNGnx()) { $isNGnx = 1; } if (!$users->NGINX_INSTALLED) { $isNGnx = -1; } if ($users->C_ICAP_INSTALLED) { $CicapEnabled = -1; } $LICENSE = 0; if ($users->CORP_LICENSE) { $LICENSE = 1; } $ARRAY["CORP_LICENSE"]["TITLE"] = "{artica_license}"; $ARRAY["CORP_LICENSE"]["EXPL"] = "{license_proxy_benefits}"; $ARRAY["CORP_LICENSE"]["ICON"] = $INTEGER[$LICENSE]; $ARRAY["transparent"]["TITLE"] = "Active Directory"; $ARRAY["transparent"]["EXPL"] = "{squid_ad_benefits}"; $ARRAY["transparent"]["ICON"] = $INTEGER[$EnableKerbAuth]; $ARRAY["EnableCNTLM"]["TITLE"] = "{APP_CNTLM}"; $ARRAY["EnableCNTLM"]["EXPL"] = "{APP_CNTLM_EXPLAIN}"; $ARRAY["EnableCNTLM"]["ICON"] = $INTEGER[$EnableCNTLM]; $ARRAY["DisableAnyCache"]["TITLE"] = "{caches} {disk}"; $ARRAY["DisableAnyCache"]["EXPL"] = "{DisableAnyCache_explain2}"; $ARRAY["DisableAnyCache"]["ICON"] = $INTEGER[$DisableAnyCache]; $ARRAY["SquidBubbleMode"]["TITLE"] = "Bubble"; $ARRAY["SquidBubbleMode"]["EXPL"] = "{bubble_mode_explain}"; $ARRAY["SquidBubbleMode"]["ICON"] = $INTEGER[$SquidBubbleMode]; $ARRAY["EnableHaarp"]["TITLE"] = "{APP_HAARP}"; $ARRAY["EnableHaarp"]["EXPL"] = "{APP_HAARP_EXPLAIN}"; $ARRAY["EnableHaarp"]["ICON"] = $INTEGER[$EnableHaarp]; $ARRAY["SquidBubbleMode"]["TITLE"] = "{IT_charter}"; $ARRAY["SquidBubbleMode"]["EXPL"] = "{IT_charter_explain}"; $ARRAY["SquidBubbleMode"]["ICON"] = $INTEGER[$EnableITChart]; $ARRAY["isNGnx"]["TITLE"] = "{squid_reverse_proxy}"; $ARRAY["isNGnx"]["EXPL"] = "{nginx_benefits}"; $ARRAY["isNGnx"]["ICON"] = $INTEGER[$isNGnx]; $ARRAY["EnableRemoteStatisticsAppliance"]["TITLE"] = "{use_stats_appliance}"; $ARRAY["EnableRemoteStatisticsAppliance"]["EXPL"] = "{STATISTICS_APPLIANCE_EXPLAIN}"; $ARRAY["EnableRemoteStatisticsAppliance"]["ICON"] = $INTEGER[$EnableRemoteStatisticsAppliance]; $ARRAY["EnableFTPProxy"]["TITLE"] = "FTP Proxy"; $ARRAY["EnableFTPProxy"]["EXPL"] = "{FTP_PROXY_EXPLAIN}"; $ARRAY["EnableFTPProxy"]["ICON"] = $INTEGER[$EnableFTPProxy]; $ARRAY["EnableFTPProxy"]["TITLE"] = "FTP Proxy"; $ARRAY["EnableFTPProxy"]["EXPL"] = "{FTP_PROXY_EXPLAIN}"; $ARRAY["EnableFTPProxy"]["ICON"] = $INTEGER[$EnableFTPProxy]; $ARRAY["EnableUfdbGuard"]["TITLE"] = "{webfilter_engine}"; $ARRAY["EnableUfdbGuard"]["EXPL"] = "{webfilter_engine_benefits}"; $ARRAY["EnableUfdbGuard"]["ICON"] = $INTEGER[$EnableUfdbGuard]; $ARRAY["kavicapserverEnabled"]["TITLE"] = "Kaspersky For Proxy server"; $ARRAY["kavicapserverEnabled"]["EXPL"] = "{kav4proxy_about}"; $ARRAY["kavicapserverEnabled"]["ICON"] = $INTEGER[$kavicapserverEnabled]; $ARRAY["CicapEnabled"]["TITLE"] = "{cicap_title}"; $ARRAY["CicapEnabled"]["EXPL"] = "{enable_c_icap_text}"; $ARRAY["CicapEnabled"]["ICON"] = $INTEGER[$CicapEnabled]; while (list($day, $array) = each($ARRAY)) { $title = $tpl->_ENGINE_parse_body($array["TITLE"]); $explain = $tpl->_ENGINE_parse_body($array["EXPL"]); $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td {$link} nowrap style='font-size:16px;font-weight:bolder'><i class='icon-info-sign'></i> {$title}</a></td>\n\t\t<td {$link}>{$explain}</td>\n\t\t<td {$link}><img src='img/{$array["ICON"]}'></td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{feature}</th>\n\t\t\t\t\t<th>{explain}</th>\n\t\t\t\t\t<th>{status}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function SquidReloadInpublicAlias() { SquidReloadInpublicAlias_progress("{reloading_proxy_service}", 15); squid_admin_mysql(1, "Proxy was reloaded by the Quick Alias reload", null, __FILE__, __LINE__); $unix = new unix(); $squidbin = $unix->LOCATE_SQUID_BIN(); system("{$squidbin} -f /etc/squid3/squid.conf -k reconfigure"); $sock = new sockets(); if ($sock->EnableUfdbGuard() == 1) { SquidReloadInpublicAlias_progress("{reloading_webfilter_service}", 50); system("/etc/init.d/ufdb reload --force"); } SquidReloadInpublicAlias_progress("{done}", 100); }