function firewall_status() { $icon = "firewall-128-grey.png"; $sock = new sockets(); $users = new usersMenus(); if (!$users->AsSystemAdministrator) { return notadmin_status(); } $q = new mysql(); $EnableArticaHotSpot = intval($sock->GET_INFO("EnableArticaHotSpot")); $EnableSuricata = intval($sock->GET_INFO("EnableSuricata")); $SuricataInstalled = intval($sock->GET_INFO("SuricataInstalled")); $STATS_APPLIANCE = false; if (is_file("/etc/artica-postfix/STATS_APPLIANCE")) { $STATS_APPLIANCE = true; } if ($SuricataInstalled == 0) { $EnableSuricata = 0; } if ($EnableArticaHotSpot == 1) { return wifidog_status(); } $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\""; $js = "GotoFirewall()"; $OK = true; $INSTALLED = true; if (intval($sock->getFrameWork("firehol.php?is-installed=yes")) == 0) { $js = "Loadjs('system.firewall.php?FireHolInstall-js=yes');"; $icon = "firewall-128-grey-install.png"; $text = "{not_installed}"; $OK = false; $INSTALLED = false; } else { $FireHolConfigured = intval($sock->GET_INFO("FireHolConfigured")); if ($FireHolConfigured == 0) { $js = "Loadjs('system.firewall.php?FireHolInstall-wizard-js=yes');"; $icon = "firewall-128-grey.png"; $text = "{not_configured}"; $OK = false; } } if ($OK) { $FireHolEnable = intval($sock->GET_INFO("FireHolEnable")); if ($FireHolEnable == 0) { $js = "Loadjs('firehol.wizard.enable.progress.php');"; $icon = "firewall-128-disabled.png"; $text = "{firewall_is_disabled}"; $OK = false; } } if (!$users->AsSystemAdministrator) { $js = "blur()"; } $rules = null; if ($OK) { $icon = "firewall-128.png"; $q = new mysql(); $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(*) as tcount FROM iptables_main", "artica_backup")); $items = $ligne2["tcount"]; if ($users->AsSystemAdministrator) { $rules = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:30px;text-decoration:underline' \t\t\n\t\t\tOnClick=\"javascript:GotoFireholeRules()\" {$curs}><strong>{$items}</strong> {rules}</td>\t\t\n\t\t\t</tr>"; } } if ($INSTALLED) { $q = new mysql(); $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(Interface) as tcount FROM `nics` WHERE `FireQOS`=1", "artica_backup")); if ($ligne2["tcount"] > 0) { $QOS_ROW = "\n\t\t<tr>\n\t\t<td style='font-size:16px;text-decoration:underline;padding-top:20px'\n\t\tOnClick=\"javascript:GotoQOS()\" {$curs}>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' style='width:25px'><img src='img/24-green.png'></td>\n\t\t\t\t<td style='font-size:16px;text-decoration:underline'><strong>{Q.O.S}</strong> {enabled}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>"; } else { $QOS_ROW = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:16px;text-decoration:none;padding-top:20px'\n\t\t\t>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td valign='middle' style='width:25px;color:#898989'><img src='img/ok24-grey.png'></td>\n\t\t\t<td style='font-size:16px;text-decoration:none;color:#898989'><strong>{Q.O.S}</strong> {disabled}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td>\n\t\t\t</tr>"; } } else { $QOS_ROW = "\n\t\t<tr>\n\t\t<td style='font-size:16px;text-decoration:none;padding-top:20px'\n\t\t>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='middle' style='width:25px;color:#898989'><img src='img/ok24-none.png'></td>\n\t\t<td style='font-size:16px;text-decoration:none;color:#898989'><strong>{Q.O.S}</strong> {not_installed}</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t</tr>"; } $IDS_ROW = null; $GLOBALS["BASEDIR"] = "/usr/share/artica-postfix/ressources/interface-cache"; if ($STATS_APPLIANCE) { $EnableSuricata = 1; } if ($EnableSuricata == 1) { if (is_file("{$GLOBALS["BASEDIR"]}/suricata.dashboard")) { $IDS_SEVERITIES = unserialize(@file_get_contents("{$GLOBALS["BASEDIR"]}/suricata.dashboard")); if (isset($IDS_SEVERITIES["SEVERITIES"][1])) { if ($IDS_SEVERITIES["SEVERITIES"][1] > 0) { $IDS_ROW = "\n\t\t\t\t<tr>\n\t\t\t\t<td style='font-size:16px;text-decoration:underline'\n\t\t\t\t\t\tOnClick=\"javascript:GotoSuricataEvents()\" {$curs}>\n\t\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr><td valign='middle' style='width:25px'><img src='img/warn-red-24.png'></td>\n\t\t\t\t\t\t<td style='font-size:16px;text-decoration:underline'><strong>{$IDS_SEVERITIES["SEVERITIES"][1]}</strong> IDS {detected_rules}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t</tr>"; } } } } $icon = imgtootltip($icon, "{administrate_your_firewall}", $js); $text_suricata = "<span style='font-size:14px'>( {not_installed} )</span>"; $js_suricata = "GotoSuricataUpdates()"; $icon_suricata = "ok24-none.png"; $color_suricata = "#898989"; if ($SuricataInstalled == 1) { $icon_suricata = "ok24.png"; $js_suricata = "GotoSuricata()"; $SuricataVersion = $sock->GET_INFO("SuricataVersion"); if ($EnableSuricata == 0) { $icon_suricata = "ok24-grey.png"; $text_suricata = "<span style='font-size:14px'>( {disabled} )</span>"; } else { $text_suricata = null; $color_suricata = "black"; } if ($SuricataVersion != null) { $SuricataVersion = "{version} {$SuricataVersion}"; } } $SURICATA = "\n\t\t<tr>\n\t\t<td style='font-size:18px;text-decoration:underline;padding-top:20px;color:{$color_suricata}'\n\t\t\t\tOnClick=\"javascript:{$js_suricata}\" {$curs}><strong>{IDS}</strong>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='middle' style='width:25px'><img src='img/{$icon_suricata}'></td>\n\t\t\t\t\t\t<td style='font-size:16px;text-decoration:underline'><strong style='color:{$color_suricata}'>{$SuricataVersion} {$text_suricata}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t</tr>{$IDS_ROW}"; $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</td>\n\t<td style='width:99%'>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td style='font-size:30px'>{firewall}</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td style='font-size:30px;text-decoration:underline' \n\t\t\tOnClick=\"javascript:{$js}\" {$curs}>{$text}</td>\n\t\t</tr>\n\t\t{$rules}\n\t\t{$QOS_ROW}\n\t\t{$SURICATA}\n\t\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }
function firewall_status() { $icon = "firewall-128-grey.png"; $sock = new sockets(); $users = new usersMenus(); $EnableArticaHotSpot = intval($sock->GET_INFO("EnableArticaHotSpot")); if ($EnableArticaHotSpot == 1) { return wifidog_status(); } $js = "GotoFirewall()"; $OK = true; if (intval($sock->getFrameWork("firehol.php?is-installed=yes")) == 0) { $js = "Loadjs('system.firewall.php?FireHolInstall-js=yes');"; $icon = "firewall-128-grey-install.png"; $text = "{not_installed}"; $OK = false; } else { $FireHolConfigured = intval($sock->GET_INFO("FireHolConfigured")); if ($FireHolConfigured == 0) { $js = "Loadjs('system.firewall.php?FireHolInstall-wizard-js=yes');"; $icon = "firewall-128-grey.png"; $text = "{not_configured}"; $OK = false; } } if ($OK) { $FireHolEnable = intval($sock->GET_INFO("FireHolEnable")); if ($FireHolEnable == 0) { $js = "Loadjs('firehol.wizard.enable.progress.php');"; $icon = "firewall-128-disabled.png"; $text = "{firewall_is_disabled}"; $OK = false; } } if (!$users->AsSystemAdministrator) { $js = "blur()"; } if ($OK) { $icon = "firewall-128.png"; } $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\""; $icon = imgtootltip($icon, "{administrate_your_firewall}", $js); $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</td>\n\t<td style='width:99%'>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td style='font-size:30px'>{firewall}</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td style='font-size:30px;text-decoration:underline' \n\t\t\tOnClick=\"javascript:{$js}\" {$curs}>{$text}</td>\n\t\t</tr>\n\t\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }