示例#1
0
function reconf_squid()
{
    $tpl = new templates();
    $hostid = $_POST["reconf-squid"];
    $q = new blackboxes($hostid);
    if (!$q->reconfigure_squid()) {
        $tpl->javascript_parse_text("{failed}: {$q->ipaddress}");
        return;
    }
    echo $tpl->javascript_parse_text("{success}: {$q->ipaddress}");
}
function SaveBooster()
{
    $blackboxes = new blackboxes($_POST["uuid"]);
    $blackboxes->SET_SQUID_POST_INFO($_POST);
    $blackboxes->reconfigure_squid();
}
示例#3
0
function reboot_node_perform()
{
    $q = new blackboxes($_POST["reboot-node"]);
    $q->reboot();
}
示例#4
0
function update_zoom()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadString(@file_get_contents(dirname(__FILE__) . '/ressources/index.ini'));
    $users = new usersMenus();
    $ArchStruct = $users->ArchStruct;
    if ($ArchStruct == "32") {
        $ArchStruct = "i386";
    }
    if ($ArchStruct == "64") {
        $ArchStruct = "x64";
    }
    $GlobalApplicationsStatus = $sock->APC_GET("GlobalApplicationsStatus", 2);
    if ($GlobalApplicationsStatus == null) {
        $GlobalApplicationsStatus = base64_decode($sock->getFrameWork('cmd.php?Global-Applications-Status=yes'));
        $sock->APC_SAVE("GlobalApplicationsStatus", $GlobalApplicationsStatus);
        $GLOBALS["GlobalApplicationsStatus"] = $GlobalApplicationsStatus;
    }
    $squid_version = ParseAppli($GlobalApplicationsStatus, "APP_SQUID");
    $availableversion32 = $ini->_params["NEXT"]["squid32-i386"];
    $availableversion64 = $ini->_params["NEXT"]["squid32-x64"];
    $availableversion_ufdbguard = $ini->_params["NEXT"]["ufdbGuard"];
    $actualversion_ufdbguard = $sock->getFrameWork("squid.php?full-ufdbg-version=yes");
    if ($actualversion_ufdbguard == null) {
        $actualversion_ufdbguard = "0.0.0";
    }
    $availableversion_kav4proxy = $ini->_params["NEXT"]["kav4proxy"];
    $actualversion_kav4proxy = ParseAppli($GlobalApplicationsStatus, "APP_KAV4PROXY");
    if ($actualversion_kav4proxy == null) {
        $actualversion_kav4proxy = "0.0.0";
    }
    $q = new blackboxes();
    $availableversion32 = $q->last_available_squidx32_version();
    $availableversion64 = $q->last_available_squidx64_version();
    $html = "\n<div style='width:100%;height:650px;overflow:auto'>\n\n<table style='width:100%;margin-top:15px'>\n<tbody>\n<tr>\n\t<td valign='top' width=1%><img src='img/artica-350px.png'>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available_software}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{APP_ARTICA_AGENT}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available} 32/64bits:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>" . $q->last_available_version() . "</td>\n\t\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\n\t</td>\n\t<td valign='top'>\n\n\t\t\t<div style='font-size:12px'>{APP_ARTICA_AGENT_TEXT}</div>\n\t\t\t<p>&nbsp;</p>\n\t\t\t<center style='margin:10px'>" . button("{install_upgrade}", "Loadjs('setup.index.progress.php?product=APP_ARTICA_AGENT&start-install=yes')", 14) . "</center>\n\t</td>\n</tr>\n\n\n<table style='width:100%;margin-top:15px'>\n<tbody>\n<tr>\n\t<td valign='top' width=1%><img src='img/bg_squid.jpg'>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available_software}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{APP_SQUID2}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available} 32bits:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$availableversion32}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available} 64bits:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$availableversion64}</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\n\t</td>\n\t<td valign='top'>\n\n\t\t\t<div style='font-size:12px'>{APP_SQUID_TEXT}</div>\n\t\t\t<p>&nbsp;</p>\n\t\t\t<center style='margin:10px'>" . button("{install_upgrade}", "Loadjs('setup.index.progress.php?product=APP_SQUID32_REPOS&start-install=yes')", 14) . "</center>\n\t</td>\n</tr>\n\n<tr>\n\t<td colspan=2><hr></td>\n</tr>\n<tr>\n\t<td valign='top' width=1%><img src='img/bg_kav4proxy.jpg'>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available_software}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{APP_KAV4PROXY}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$availableversion_kav4proxy}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{current}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$actualversion_kav4proxy}</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t</tbody>\n\t\t\t\t\n\t\t\t</table>\n\t\n\t</td>\n\t<td valign='top'>\n\n\t\t\t<div style='font-size:12px'>{APP_KAV4PROXY_TEXT}</div>\n\t\t\t<p>&nbsp;</p>\n\t\t\t<span id='kav4proxy-install-status'></span>\n\t\t\t<div style='text-align:right;width:100%'>" . imgtootltip("refresh-24.png", "{refresh}", "kav4proxy_install_status()") . "</div>\n\t</td>\n</tr>\n<tr>\n\t<td colspan=2><hr></td>\n</tr>\n<tr>\n\t<td colspan=2><hr></td>\n</tr>\n\n<tr>\n\t<td valign='top' width=1%><img src='img/bg_ufdbguard.png'>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available_software}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{APP_UFDBGUARD}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{available}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$availableversion_ufdbguard}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:13px'>{current}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$actualversion_ufdbguard}</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\n\t</td>\n\t<td valign='top'>\n\n\t\t\t<div style='font-size:12px'>{ufdbguard_simple_intro}</div>\n\t\t\t<p>&nbsp;</p>\n\t\t\t<span id='ufdbguard-install-status'></span>\n\t\t\t<div style='text-align:right;width:100%'>" . imgtootltip("refresh-24.png", "{refresh}", "ufdbguard_install_status()") . "</div>\n\t</td>\n</tr>\n\n\n\n</tbody>\n</table>\n</div>\n<script>\n\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
示例#5
0
function verify_caches()
{
    $blk = new blackboxes();
    $blk->NotifyAll("VERIFY_CACHE");
    $tpl = new templates();
    echo $tpl->javascript_parse_text("{all_nodes_has_been_notified}");
}
function RefreshNode(){
	$node=new blackboxes($_POST["refresh-node"]);
	if(!$node->chock()){
		$tpl=new templates();
		echo $tpl->javascript_parse_text($node->last_error);
	}
	
	
}
示例#7
0
function SambeReconnectAD()
{
    $sock = new sockets();
    $users = new usersMenus();
    $sock->getFrameWork("services.php?kerbauth=yes");
    $sock->getFrameWork("services.php?nsswitch=yes");
    $sock->getFrameWork("cmd.php?samba-reconfigure=yes");
    $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
    $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
    if (!is_numeric($EnableWebProxyStatsAppliance)) {
        $EnableWebProxyStatsAppliance = 0;
    }
    if ($users->WEBSTATS_APPLIANCE) {
        $EnableWebProxyStatsAppliance = 1;
    }
    if ($EnableWebProxyStatsAppliance == 1) {
        include_once "ressources/class.blackboxes.inc";
        $blk = new blackboxes();
        $blk->NotifyAll("WINBIND_RECONFIGURE");
    }
}
function active_directory_save()
{
    $sock = new sockets();
    $users = new usersMenus();
    include_once dirname(__FILE__) . "/class.html.tools.inc";
    $_POST["WINDOWS_SERVER_PASS"] = url_decode_special_tool($_POST["WINDOWS_SERVER_PASS"]);
    unset($_SESSION["EnableKerbAuth"]);
    $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
    $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
    if (!is_numeric($EnableWebProxyStatsAppliance)) {
        $EnableWebProxyStatsAppliance = 0;
    }
    if ($users->WEBSTATS_APPLIANCE) {
        $EnableWebProxyStatsAppliance = 1;
    }
    //CNTLM
    $sock->SET_INFO("EnableCNTLM", $_POST["EnableCNTLM"]);
    $sock->SET_INFO("CnTLMPORT", $_POST["CnTLMPORT"]);
    $sock->getFrameWork("squid.php?cntlm-restart=yes");
    $_POST["WINDOWS_DNS_SUFFIX"] = trim(strtolower($_POST["WINDOWS_DNS_SUFFIX"]));
    $Myhostname = $sock->getFrameWork("cmd.php?full-hostname=yes");
    $MyhostnameTR = explode(".", $Myhostname);
    unset($MyhostnameTR[0]);
    $MyDomain = strtolower(@implode(".", $MyhostnameTR));
    if ($MyDomain != $_POST["WINDOWS_DNS_SUFFIX"]) {
        $tpl = new templates();
        if ($EnableWebProxyStatsAppliance == 0) {
            $sock->SET_INFO("EnableKerbAuth", 0);
        }
        $sock->SET_INFO("EnableKerberosAuthentication", 0);
        $sock->SaveConfigFile(base64_encode(serialize($_POST)), "KerbAuthInfos");
        echo $tpl->javascript_parse_text("{error}: {WINDOWS_DNS_SUFFIX} {$_POST["WINDOWS_DNS_SUFFIX"]}\n{is_not_a_part_of} {$Myhostname} ({$MyDomain})", 1);
        return;
    }
    $adhost = "{$_POST["WINDOWS_SERVER_NETBIOSNAME"]}.{$_POST["WINDOWS_DNS_SUFFIX"]}";
    $resolved = gethostbyname($adhost);
    if (!preg_match("#^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+#", $resolved)) {
        $tpl = new templates();
        if ($EnableWebProxyStatsAppliance == 0) {
            $sock->SET_INFO("EnableKerbAuth", 0);
        }
        $sock->SET_INFO("EnableKerberosAuthentication", 0);
        $sock->SaveConfigFile(base64_encode(serialize($_POST)), "KerbAuthInfos");
        echo $tpl->javascript_parse_text("{error}: {unable_to_resolve} {$adhost}", 1);
        return;
    }
    $sock->SET_INFO("KerbAuthDisableNormalizeName", $_POST["KerbAuthDisableNormalizeName"]);
    $sock->SET_INFO("EnableKerberosAuthentication", $_POST["EnableKerberosAuthentication"]);
    $sock->SET_INFO("KerbAuthDisableNsswitch", $_POST["KerbAuthDisableNsswitch"]);
    $sock->SET_INFO("KerbAuthDisableGroupListing", $_POST["KerbAuthDisableGroupListing"]);
    $sock->SET_INFO("KerbAuthTrusted", $_POST["KerbAuthTrusted"]);
    $sock->SET_INFO("KerbAuthMapUntrustedDomain", $_POST["KerbAuthMapUntrustedDomain"]);
    $sock->SET_INFO("NtpdateAD", $_POST["NtpdateAD"]);
    $sock->SET_INFO("KerbAuthMethod", $_POST["KerbAuthMethod"]);
    $sock->SET_INFO("SquidNTLMKeepAlive", $_POST["SquidNTLMKeepAlive"]);
    if ($_POST["EnableKerberosAuthentication"] == 1) {
        $sock->SET_INFO("EnableKerbAuth", 0);
    }
    $ArrayKerbAuthInfos = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos")));
    while (list($num, $ligne) = each($_POST)) {
        $ArrayKerbAuthInfos[$num] = $ligne;
    }
    $sock->SaveConfigFile(base64_encode(serialize($ArrayKerbAuthInfos)), "KerbAuthInfos");
    if (strpos($_POST["ADNETBIOSDOMAIN"], ".") > 0) {
        echo "The netbios domain \"{$_POST["ADNETBIOSDOMAIN"]}\" is invalid.\n";
        $sock->SET_INFO("EnableKerbAuth", 0);
        return;
    }
    if ($_POST["ADNETIPADDR"] != null) {
        $ipaddrZ = explode(".", $_POST["ADNETIPADDR"]);
        while (list($num, $a) = each($ipaddrZ)) {
            $ipaddrZ[$num] = intval($a);
        }
        $_POST["ADNETIPADDR"] = @implode(".", $ipaddrZ);
    }
    $sock->SET_INFO("EnableKerbAuth", $_POST["EnableKerbAuth"]);
    $sock->SET_INFO("DynamicGroupsAclsTTL", $_POST["DynamicGroupsAclsTTL"]);
    $_POST["LDAP_PASSWORD"] = url_decode_special_tool($_POST["LDAP_PASSWORD"]);
    $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
    if (!is_numeric($EnableWebProxyStatsAppliance)) {
        $EnableWebProxyStatsAppliance = 0;
    }
    if ($_POST["UseDynamicGroupsAcls"] == 1) {
        if ($_POST["LDAP_SERVER"] == null) {
            echo $tpl->javascript_parse_text("LDAP: {hostname} Not set\n");
            return;
        }
        if (!is_numeric($_POST["LDAP_PORT"])) {
            echo $tpl->javascript_parse_text("LDAP: {ldap_port} Not set\n");
            return;
        }
        if ($_POST["LDAP_SUFFIX"] == null) {
            echo $tpl->javascript_parse_text("LDAP: {suffix} Not set\n");
            return;
        }
        if ($_POST["LDAP_DN"] == null) {
            echo $tpl->javascript_parse_text("LDAP: {bind_dn} Not set\n");
            return;
        }
        if ($_POST["LDAP_PASSWORD"] == null) {
            echo $tpl->javascript_parse_text("LDAP: {password} Not set\n");
            return;
        }
    }
    $sock->SET_INFO("UseDynamicGroupsAcls", $_POST["UseDynamicGroupsAcls"]);
    $array = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos")));
    while (list($num, $ligne) = each($_POST)) {
        $array[$num] = $ligne;
    }
    $sock->SaveConfigFile(base64_encode(serialize($array)), "KerbAuthInfos");
    $ldap_connection = @ldap_connect($_POST["LDAP_SERVER"], $_POST["LDAP_PORT"]);
    if (!$ldap_connection) {
        echo "Connection Failed to connect to DC ldap://{$_POST["LDAP_SERVER"]}:{$_POST["LDAP_PORT"]}";
        if (@ldap_get_option($ldap_connection, LDAP_OPT_DIAGNOSTIC_MESSAGE, $extended_error)) {
            $error = $error . "\n{$extended_error}";
        }
        @ldap_close();
        return false;
    }
    ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3);
    ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, 0);
    $bind = ldap_bind($ldap_connection, $_POST["LDAP_DN"], $_POST["LDAP_PASSWORD"]);
    if (!$bind) {
        $error = ldap_err2str(ldap_errno($ldap_connection));
        if (@ldap_get_option($ldap_connection, LDAP_OPT_DIAGNOSTIC_MESSAGE, $extended_error)) {
            $error = $error . "\n{$extended_error}";
        }
        echo "Failed to login to DC {$_POST["LDAP_SERVER"]} - {$_POST["LDAP_DN"]} \n`{$error}`";
        return false;
    }
    if ($EnableWebProxyStatsAppliance == 1) {
        include_once "ressources/class.blackboxes.inc";
        $blk = new blackboxes();
        $blk->NotifyAll("BUILDCONF");
        return;
    }
    $sock->getFrameWork("squid.php?squid-reconfigure=yes");
}
示例#9
0
function LATEST_SQUID_VERSION()
{
    $ARCH = $_POST["ARCH"];
    $f = new blackboxes();
    if ($ARCH == 32) {
        $ver = $f->last_available_squidx32_version();
    }
    if ($ARCH == 64) {
        $ver = $f->last_available_squidx64_version();
    }
    if ($ARCH == "i386") {
        $ver = $f->last_available_squidx32_version();
    }
    if ($ARCH == "x64") {
        $ver = $f->last_available_squidx64_version();
    }
    writelogs("Arch:{$ARCH}; Version: {$ver}", __FUNCTION__, __FILE__, __LINE__);
    echo "<SUCCESS>" . $f->last_available_squidx64_version() . "</SUCCESS>";
    return;
}
function notifyRemoteProxy()
{
    $sock = new sockets();
    $users = new usersMenus();
    $q = new mysql_squid_builder();
    $q->QUERY_SQL("DELETE FROM webfilter_aclsdynlogs WHERE zDate<DATE_SUB(NOW(),INTERVAL 15 DAY)");
    $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
    if (!is_numeric($EnableWebProxyStatsAppliance)) {
        $EnableWebProxyStatsAppliance = 0;
    }
    if ($users->WEBSTATS_APPLIANCE) {
        $EnableWebProxyStatsAppliance = 1;
    }
    if ($EnableWebProxyStatsAppliance == 0) {
        return;
    }
    include_once dirname(__FILE__) . "/ressources/class.blackboxes.inc";
    $black = new blackboxes();
    $black->NotifyAll("ACLSDYN");
}
示例#11
0
function notify_remote_proxys($COMMANDS = null)
{
    $unix = new unix();
    include_once dirname(__FILE__) . "/ressources/class.blackboxes.inc";
    $EXEC_PID_FILE = "/etc/artica-postfix/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $EXEC_PID_TIME = "/etc/artica-postfix/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pid = @file_get_contents($EXEC_PID_FILE);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $timefile = $unix->file_time_min($EXEC_PID_FILE);
        if ($timefile < 15) {
            $unix->events("Skipping, Already executed pid {$pid} {$timefile}Mn", "/var/log/stats-appliance.log");
            ufdbguard_admin_events("Skipping, Already executed pid {$pid} {$timefile}Mn...", __FUNCTION__, __FILE__, __LINE__, "communicate");
            return;
        }
        $kill = $unix->find_program("kill");
        unix_system_kill_force($pid);
    }
    @file_put_contents($EXEC_PID_FILE, getmypid());
    if ($COMMANDS == null) {
        $COMMANDS = "BUILDCONF";
    }
    if ($COMMANDS == "PING") {
        $time = $unix->file_time_min($EXEC_PID_TIME);
        if (!$GLOBALS["VERBOSE"]) {
            if ($time < 5) {
                return;
            }
        }
        @unlink($EXEC_PID_TIME);
        @file_put_contents($EXEC_PID_TIME, time());
        $bb = new blackboxes();
        $bb->NotifyAll("PING");
        return;
    }
    $t = time();
    $f = new squid_stats_appliance();
    $f->export_tables();
    $took = $unix->distanceOfTimeInWords($t, time(), true);
    ufdbguard_admin_events("Exporting MySQL datas done... took:{$took}", __FUNCTION__, __FILE__, __LINE__, "communicate");
    $unix->events("Exporting MySQL datas done... took:{$took}", "/var/log/stats-appliance.log");
    include_once dirname(__FILE__) . "/ressources/class.blackboxes.inc";
    $unix->events("Send order to appliance(s)", "/var/log/stats-appliance.log");
    $bb = new blackboxes();
    $bb->NotifyAll("BUILDCONF");
}
示例#12
0
function filters_for_node_save()
{
    $uuid = $_POST["uuid"];
    unset($_POST["uuid"]);
    unset($_POST["filters"]);
    $blackbox = new blackboxes($uuid);
    $blackbox->SET_SQUID_POST_INFO($_POST);
}