示例#1
0
function doUpdateExtraStuff()
{
    global $gbl, $sgbl, $login, $ghtml;
    lxfile_mkdir("__path_program_etc/flag");
    convertIpaddressToComa();
    print "Fix extra database\n";
    fixExtraDB();
    print "Set some defaults\n";
    db_set_default('vps', 'ttype', 'openvz');
    db_set_default('pserver', 'coma_psrole_a', 'vps');
    db_set_default("vps", "swapdiskname", "vm.swap", "ttype = 'xen'");
    db_set_default("vps", "maindiskname", "root.img", "ttype = 'xen'");
    db_set_default('vps', 'corerootdir', '/vz/private', "ttype = 'openvz'");
    db_set_default("vps", "corerootdir", "/home/xen", "ttype = 'xen'");
    print "Fixing database passwords\n";
    $a = null;
    fix_mysql_root_password('localhost');
    $dbadmin = new Dbadmin(null, 'localhost', "mysql___localhost");
    $dbadmin->get();
    $pass = $dbadmin->dbpassword;
    $a['mysql']['dbpassword'] = $pass;
    slave_save_db("dbadmin", $a);
    print "Fixing OS template permissions\n";
    lxfile_unix_chmod_rec("/vz/template/cache/", "0755");
    lxfile_unix_chmod_rec("/home/hypervm/xen/template/", "0755");
    call_with_flag("dofixParentClname");
    print "Check License\n";
    passthru("{$sgbl->__path_php_path} htmllib/lbin/getlicense.php");
    print "Fix OpenVZ resources\n";
    fixOpenVZResource();
    print "Move clients to client of needed\n";
    move_clients_to_client();
    print "create backup dirs\n";
    add_vps_backup_dir();
    print "Parse SQL Data\n";
    parse_sql_data();
    print "Fix IP POOL\n";
    lxshell_return("__path_php_path", "../bin/fix/fixippool.php");
    print "Fix IP adresses in database\n";
    fix_ipaddress_column_type();
    fix_vmipaddress();
    print "Checking HIB template\n";
    get_kloxo_ostemplate();
    print "Set admin email\n";
    save_admin_email();
    print "Checking Skin Images\n";
    copy_image();
    system("mysql -u hypervm -p`cat ../etc/conf/hypervm.pass` hypervm1_0 < ../file/interface/interface_template.dump");
    if (lxfile_exists("/etc/init.d/libvirtd")) {
        print "Make sure libvirtd is not started after reboot\n";
        system("chkconfig libvirtd off 2>/dev/null");
    }
    if (is_openvz()) {
        print "Fixing Base OS templates\n";
        if (!lxfile_real("/vz/template/cache/centos-5-i386-afull.tar.gz")) {
            system("mkdir -p /vz/template/cache/ ; cd /vz/template/cache/ ; rm centos-5-i386-afull.tar.gz; wget download.lxcenter.org/download/openvztemplates/base/centos-5-i386-afull.tar.gz ");
            system("rm /vz/template/cache/index.html* 2>/dev/null");
        }
    } else {
        if (!lxfile_real("/home/hypervm/xen/template/centos-5-i386-afull.tar.gz")) {
            system("mkdir -p /home/hypervm/xen/template ; cd /home/hypervm/xen/template/ ; rm centos-5-i386-afull.tar.gz;  wget download.lxcenter.org/download/xentemplates/base/centos-5-i386-afull.tar.gz ");
            system("rm /home/hypervm/xen/template/index.html* 2>/dev/null");
        }
    }
    print "Fix SSL\n";
    fix_self_ssl();
    print "Fix database password\n";
    critical_change_db_pass();
    print "Delete old repo's\n";
    if (lxfile_exists("/etc/yum.repos.d/lxlabs.repo")) {
        lxfile_mv("/etc/yum.repos.d/lxlabs.repo", "/etc/yum.repos.d/lxlabs.repo.lxsave");
        system("rm -f /etc/yum.repos.d/lxlabs.repo");
        print "Removed lxlabs.repo\n";
    }
}
示例#2
0
function doUpdates()
{
    global $gbl, $sgbl, $login, $ghtml;
    createFlagDir();
    fixIpAddress();
    fixservice();
    add_domain_backup_dir();
    createOSUserAdmin();
    call_with_flag("fix_phpini");
    call_with_flag("fix_awstats");
    call_with_flag("fix_domainkey");
    setWatchdogDefaults();
    fixMySQLRootPassword();
    save_admin_email();
    getKloxoLicenseInfo();
    createDatabaseInterfaceTemplate();
    fix_self_ssl();
}
示例#3
0
function doUpdateExtraStuff()
{
    global $gbl, $sgbl, $login, $ghtml;
    lxfile_mkdir("__path_program_etc/flag");
    print "Check database password\n";
    $a = null;
    fix_mysql_root_password('localhost');
    $dbadmin = new Dbadmin(null, 'localhost', "mysql___localhost");
    $dbadmin->get();
    $pass = $dbadmin->dbpassword;
    $a['mysql']['dbpassword'] = $pass;
    slave_save_db("dbadmin", $a);
    print "Check the core database\n";
    parse_sql_data();
    if (call_with_flag("convertIpaddressToComa")) {
        print "Converted IP addresses in database\n";
    }
    if (call_with_flag("fixExtraDB")) {
        print "- Fixed\n";
    }
    print "Set OS template permissions\n";
    if (is_openvz()) {
        lxfile_unix_chmod_rec("/vz/template/cache/", "0755");
    } else {
        lxfile_unix_chmod_rec("/home/hypervm/xen/template/", "0755");
    }
    call_with_flag("dofixParentClname");
    print "Get License\n";
    // ToDo: Why is this called this way....
    passthru("{$sgbl->__path_php_path} htmllib/lbin/getlicense.php");
    if (is_openvz()) {
        print "Check OpenVZ resources\n";
        if (call_with_flag("fixOpenVZResource")) {
            print "- Fixed\n";
        }
    }
    if (move_clients_to_client()) {
        print "Renamed clients directory to client.\n";
    }
    print "Checking backup dirs\n";
    if (!add_vps_backup_dir()) {
        print "- Everything is fine.\n";
    }
    print "Fix IP POOL\n";
    lxshell_return("__path_php_path", "../bin/fix/fixippool.php");
    if (call_with_flag("fix_ipaddress_column_type")) {
        print "Fixed IP address column in database\n";
    }
    if (call_with_flag("fix_vmipaddress")) {
        print "Fixed VM IP addresses in database\n";
    }
    print "Checking HIB template\n";
    get_kloxo_ostemplate();
    if (db_get_value("client", "admin", "contactemail")) {
        print "Set admin email\n";
        save_admin_email();
    }
    // Unknown usage within HyperVM, anyone can tell what this is doing?
    $file = "__path_program_root/etc/fixed_interface_template_sql";
    if (lxfile_exists($file)) {
        lxfile_touch($file);
        print "Check Interface Template (database)\n";
        system("mysql -u hypervm -p`cat ../etc/conf/hypervm.pass` hypervm1_0 < ../file/interface/interface_template.sql");
    }
    if (lxfile_exists("/etc/init.d/libvirtd")) {
        print "Make sure libvirtd is not started after reboot\n";
        system("chkconfig libvirtd off 2>/dev/null");
    }
    if (is_openvz()) {
        print "Checking for Base default OS template\n";
        $OSTemplateDir = "/vz/template/cache";
        $defaultOSTemplate = "centos-6-x86.tar.gz";
        $defaultOSTemplateName = "centos-6-x86";
        if (!lxfile_exists($OSTemplateDir)) {
            lxfile_mkdir($OSTemplateDir);
        }
        if (!lxfile_real("{$OSTemplateDir}/{$defaultOSTemplate}")) {
            lxfile_rm("{$OSTemplateDir}/{$defaultOSTemplate}");
            system("cd {$OSTemplateDir}/ ; wget http://download.hypervm-ng.org/download/openvztemplates/base/{$defaultOSTemplate}");
            system("rm {$OSTemplateDir}/index.html* 2>/dev/null");
            system("rm {$OSTemplateDir}/robots.txt* 2>/dev/null");
        }
        // Added in HyperVM 2.1.0
        if (lxfile_exists("/usr/sbin/vztmpl-dl")) {
            print "Checking for latest version of {$defaultOSTemplateName} at OpenVZ.org website\n";
            $res = system("/usr/sbin/vztmpl-dl --update {$defaultOSTemplateName} 2>/dev/null");
            dprint("res: {$res}\n");
        }
    } else {
        if (!lxfile_real("/home/hypervm/xen/template/centos-6-x86-pygrub-sda-latest.tar.gz")) {
            system("mkdir -p /home/hypervm/xen/template ; cd /home/hypervm/xen/template/ ; rm centos-6-i386.tar.gz; rm centos-5-i386.tar.gz; rm centos-5-i386-afull.tar.gz; rm centos-6-x86-pygrub-sda-latest.tar.gz; wget http://download.hypervm-ng.org/download/xentemplates/base/centos-6-x86-pygrub-sda-latest.tar.gz");
            system("rm /home/hypervm/xen/template/index.html* 2>/dev/null");
            system("rm /home/hypervm/xen/template/robots.txt* 2>/dev/null");
        }
    }
    print "Check for old critical database password bug\n";
    if (critical_change_db_pass()) {
        print "- Fixed critical database password bug!!!\n";
    } else {
        print "- Good! Already bug free :-)\n";
    }
    if (lxfile_exists("/etc/yum.repos.d/lxlabs.repo")) {
        print "Delete old repo's\n";
        lxfile_mv("/etc/yum.repos.d/lxlabs.repo", "/etc/yum.repos.d/lxlabs.repo.lxsave");
        system("rm -f /etc/yum.repos.d/lxlabs.repo");
        print "Removed lxlabs.repo\n";
    }
}
示例#4
0
文件: lib.php 项目: zseand/kloxo
function updatecleanup()
{
    setPrepareKloxo();
    // Fixes #303 and #304
    installThirdparty();
    install_gd();
    install_bogofilter();
    setInitialPhpMyAdmin();
    setInitialAdminAccount();
    setInitialKloxoPhp();
    installWebmail();
    installAwstats();
    setRemoveOldDirs();
    setInitialBinary();
    log_cleanup("Remove lighttpd errorlog");
    log_cleanup("- Remove process");
    remove_lighttpd_error_log();
    log_cleanup("Fix the secure logfile");
    log_cleanup("- Fix process");
    call_with_flag("fix_secure_log");
    log_cleanup("Clean hosts.deny");
    log_cleanup("- Clean process");
    call_with_flag("remove_host_deny");
    log_cleanup("Turn off mouse daemon");
    log_cleanup("- Turn off process");
    system("chkconfig gpm off");
    if (lxfile_exists("phpinfo.php")) {
        log_cleanup("Remove phpinfo.php");
        log_cleanup("- Remove process");
        lxfile_rm("phpinfo.php");
    }
    setInitialBind();
    log_cleanup("Killing gettraffic system process");
    log_cleanup("- Killing process");
    lxshell_return("pkill", "-f", "gettraffic");
    setCheckPackages();
    copy_script();
    install_xcache();
    log_cleanup("Install Kloxo service");
    log_cleanup("- Install process");
    lxfile_unix_chmod("/etc/init.d/kloxo", "0755");
    system("chkconfig kloxo on");
    setJailshellSystem();
    log_cleanup("Set /home permission to 0755");
    log_cleanup("- Set process");
    lxfile_unix_chmod("/home", "0755");
    setExecuteCentos5Script();
    fix_rhn_sources_file();
    setInitialApacheConfig();
    setInitialPureftpConfig();
    setInstallMailserver();
    log_cleanup("Enable xinetd service");
    log_cleanup("- Enable process");
    call_with_flag("enable_xinetd");
    fix_suexec();
    if (!lxfile_exists("/usr/bin/php-cgi")) {
        log_cleanup("Initialize php-cgi binary");
        log_cleanup("- Initialize process");
        lxfile_cp("/usr/bin/php", "/usr/bin/php-cgi");
    }
    setSomePermissions();
    setInitialLighttpdConfig();
    setInitialNobodyScript();
    setSomeScript();
    log_cleanup("Install /etc/init.d/djbdns service file");
    log_cleanup("- Install process");
    lxfile_cp("../file/djbdns.init", "/etc/init.d/djbdns");
    removeOtherDrivers();
    log_cleanup("Remove cache dir");
    log_cleanup("- Remove process");
    lxfile_rm_rec("__path_program_root/cache");
    log_cleanup("Restart syslog service");
    log_cleanup("- Restart process");
    createRestartFile('syslog');
    log_cleanup("Initialize awstats dirdata");
    log_cleanup("- Initialize process");
    lxfile_mkdir("/home/kloxo/httpd/awstats/dirdata");
    setInitialLogrotate();
    installRoundCube();
    installHorde();
    installChooser();
    log_cleanup("Remove old lxlabs ssh key");
    log_cleanup("- Remove process");
    remove_ssh_self_host_key();
    setInitialServer();
    setDefaultPages();
    installInstallApp();
    setFreshClam();
    changeMailSoftlimit();
}