Exemplo n.º 1
0
 static function collect_lxguard()
 {
     $sq = new Sqlite(null, "lxguardhit");
     $ddate = time();
     $ddate -= 24 * 3600 * 30 * 3;
     $sq->rawQuery("delete from lxguardhit where (ddate + 0) < {$ddate}");
     $list = get_all_pserver();
     foreach ($list as $l) {
         try {
             lxguardhitdisplay::getDataFromServer($l);
             self::save_current_hitlist($l);
         } catch (exception $e) {
         }
     }
 }
Exemplo n.º 2
0
function scavenge_main()
{
    global $gbl, $sgbl, $login, $ghtml;
    log_scavenge("Fix log dir");
    passthru("{$sgbl->__path_php_path} ../bin/common/fixlogdir.php");
    log_scavenge("### Starting Scavenge");
    initProgramlib('admin');
    uploadStatsLxCenter();
    if (lxfile_exists("../etc/conf/scavenge_time.conf")) {
        log_scavenge("Found scavenge_time.conf");
    }
    log_scavenge("Collect Traffic");
    passthru("{$sgbl->__path_php_path} ../bin/gettraffic.php");
    log_scavenge("Collect Quota");
    passthru("{$sgbl->__path_php_path} ../bin/collectquota.php");
    log_scavenge("Schedule backups");
    passthru("{$sgbl->__path_php_path} ../bin/common/schedulebackup.php");
    log_scavenge("Clear Sessions");
    passthru("{$sgbl->__path_php_path} ../bin/common/clearsession.php");
    log_scavenge("Self backup");
    passthru("{$sgbl->__path_php_path} ../bin/common/mebackup.php");
    log_scavenge("Check Cluster Disk Quota");
    checkClusterDiskQuota();
    $driverapp = $gbl->getSyncClass(null, 'localhost', 'web');
    if ($driverapp === 'lighttpd') {
        log_scavenge("Restarting lighttpd");
        system("service lighttpd restart");
    }
    log_scavenge("InstallApp update");
    passthru("{$sgbl->__path_php_path} ../bin/installapp-update.phps");
    log_scavenge("Watchdog checks");
    $rs = get_all_pserver();
    foreach ($rs as $r) {
        watchdog::addDefaultWatchdog($r);
    }
    log_scavenge("Collect LxGuard info");
    lxguard::collect_lxguard();
    log_scavenge("Fix MySQL root password");
    fix_all_mysql_root_password();
    log_scavenge("Auto update Kloxo");
    auto_update();
    log_scavenge("### End Scavenge");
    // Wait at least 60 seconds before ending the scavenge
    sleep(60);
}
Exemplo n.º 3
0
 function updateform($subaction, $param)
 {
     if (csa($subaction, "ssl_")) {
         $this->slave_id = "localhost";
         $vlist['slave_id'] = array('s', get_all_pserver());
         return $vlist;
     }
     if ($this->isOn('upload_status')) {
         $string = null;
         $res = openssl_x509_read($this->text_crt_content);
         $ar = openssl_x509_parse($res);
         $string .= "{$ar['name']} {$ar['subject']['CN']}";
         $vlist['upload'] = array('M', $string);
         $vlist['text_crt_content'] = null;
         $vlist['text_key_content'] = null;
         $vlist['text_ca_content'] = null;
     } else {
         $vlist['nname'] = array('M', $this->certname);
         $vlist["ssl_data_b_s_commonName_r"] = null;
         $vlist["ssl_data_b_s_countryName_r"] = null;
         $vlist["ssl_data_b_s_stateOrProvinceName_r"] = null;
         $vlist["ssl_data_b_s_localityName_r"] = null;
         $vlist["ssl_data_b_s_organizationName_r"] = null;
         $vlist["ssl_data_b_s_organizationalUnitName_r"] = null;
         $vlist["ssl_data_b_s_emailAddress_r"] = null;
         $this->convertToUnmodifiable($vlist);
         $vlist['text_csr_content'] = null;
         $vlist['text_crt_content'] = null;
         $vlist['text_key_content'] = null;
     }
     /*
     	if ($this->getParentO()->isAdmin()) {
     		$vlist['__m_message_pre'] = 'sslcert_updateform_update_pre_admin';
     	} else {
     		$vlist['__m_message_pre'] = 'sslcert_updateform_update_pre_client';
     	}
     */
     $vlist['__v_button'] = array();
     return $vlist;
 }
Exemplo n.º 4
0
function scavenge_main()
{
    global $gbl, $sgbl, $login, $ghtml;
    log_shell("Scavenge: Start");
    initProgramlib('admin');
    log_shell("Scavenge: Collect Traffic");
    passthru("{$sgbl->__path_php_path} ../bin/gettraffic.php");
    log_shell("Scavenge: Collect Quota");
    passthru("{$sgbl->__path_php_path} ../bin/collectquota.php");
    log_shell("Scavenge: Schedule backups");
    passthru("{$sgbl->__path_php_path} ../bin/common/schedulebackup.php");
    log_shell("Scavenge: Clear Sessions");
    passthru("{$sgbl->__path_php_path} ../bin/common/clearsession.php");
    log_shell("Scavenge: Self backup");
    passthru("{$sgbl->__path_php_path} ../bin/common/mebackup.php");
    log_shell("Scavenge: Check Cluster Disk Quota");
    checkClusterDiskQuota();
    $driverapp = $gbl->getSyncClass(null, 'localhost', 'web');
    if ($driverapp === 'lighttpd') {
        log_shell("Scavenge: Restarting lighttpd");
        system("service lighttpd restart");
    }
    log_shell("Scavenge: Fix log dir");
    passthru("{$sgbl->__path_php_path} ../bin/common/fixlogdir.php");
    log_shell("Scavenge: InstallApp update");
    passthru("{$sgbl->__path_php_path} ../bin/installapp-update.phps");
    log_shell("Scavenge: Watchdog checks");
    $rs = get_all_pserver();
    foreach ($rs as $r) {
        watchdog::addDefaultWatchdog($r);
    }
    log_shell("Scavenge: Collect LxGuard info");
    lxguard::collect_lxguard();
    log_shell("Scavenge: Fix MySQL root password");
    fix_all_mysql_root_password();
    log_shell("Scavenge: Auto update Kloxo");
    auto_update();
}
Exemplo n.º 5
0
function findtraffic($oldtime, $newtime)
{
    global $global_dontlogshell;
    $global_dontlogshell = true;
    $list = get_all_pserver();
    foreach ($list as $l) {
        lxshell_return("__path_php_path", "../bin/trafficperslave.php", $l, $oldtime, $newtime);
    }
}
Exemplo n.º 6
0
function fix_all_mysql_root_password()
{
    $rs = get_all_pserver();
    foreach ($rs as $r) {
        fix_mysql_root_password($r);
    }
}
Exemplo n.º 7
0
function fix_all_mysql_root_password()
{
    global $gbl, $sgbl, $login, $ghtml;
    // Function is Called from scavenge.php
    $rs = get_all_pserver();
    foreach ($rs as $r) {
        log_scavenge("- " . $r);
        fix_mysql_root_password($r);
    }
}
Exemplo n.º 8
0
<?php

include_once "htmllib/lib/include.php";
if (!os_isSelfSystemUser()) {
    print "Not enough privileges\n";
    exit;
}
//initProgram('admin');
$list = get_all_pserver();
foreach ($list as $l) {
    try {
        $res = rl_exec_get(null, $l, "exec_with_all_closed_output", $argv[1]);
        print "Got this from server {$l}\n";
        print_r($res);
        print "\n-----------------\n";
    } catch (Exception $e) {
        print "Got error from {$l} {$e->__full_message}\n";
    }
}