Beispiel #1
0
function install_main()
{
    $installcomp['mail'] = array("vpopmail", "courier-imap-toaster", "courier-authlib-toaster", "qmail", "safecat", "httpd", "spamassassin", "ezmlm-toaster", "autorespond-toaster");
    $installcomp['web'] = array("httpd", "pure-ftpd");
    $installcomp['dns'] = array("bind", "bind-chroot");
    $installcomp['database'] = array("mysql");
    global $argv;
    $comp = array("web", "mail", "dns", "database");
    $serverlist = $comp;
    foreach ($comp as $c) {
        flush();
        if (array_search($c, $serverlist) !== false) {
            print "Installing {$c} Components....";
            $req = $installcomp[$c];
            $func = "installcomp_{$c}";
            if (function_exists($func)) {
                $func();
            }
            install_general_mine($req);
            print "\n";
        }
    }
    $options_file = "/var/named/chroot/etc/global.options.named.conf";
    $example_options = "acl \"lxcenter\" {\n";
    $example_options .= "\tlocalhost;\n";
    $example_options .= "};\n\n";
    $example_options .= "options {\n";
    $example_options .= "\tmax-transfer-time-in 60;\n";
    $example_options .= "\ttransfer-format many-answers;\n";
    $example_options .= "\ttransfers-in 60;\n";
    $example_options .= "\tauth-nxdomain yes;\n";
    $example_options .= "\tallow-transfer { \"lxcenter\"; };\n";
    $example_options .= "\tallow-recursion { \"lxcenter\"; };\n";
    $example_options .= "\trecursion no;\n";
    $example_options .= "\tversion \"LxCenter-1.0\";\n";
    $example_options .= "};\n\n";
    $example_options .= "# Remove # to see all DNS queries\n";
    $example_options .= "# logging {\n";
    $example_options .= "#\t channel query_logging {\n";
    $example_options .= "#\t\t file \"/var/log/named_query.log\";\n";
    $example_options .= "#\t\t versions 3 size 100M;\n";
    $example_options .= "#\t\t print-time yes;\n";
    $example_options .= "#\t };\n\n";
    $example_options .= "#\t category queries {\n";
    $example_options .= "#\t\t query_logging;\n";
    $example_options .= "#\t };\n";
    $example_options .= "# };\n";
    if (!file_exists($options_file)) {
        touch($options_file);
        chown($options_file, "named");
    }
    $cont = file_get_contents($options_file);
    $pattern = "options";
    if (!preg_match("+{$pattern}+i", $cont)) {
        file_put_contents($options_file, "{$example_options}\n");
    }
    $pattern = 'include "/etc/kloxo.named.conf";';
    $file = "/var/named/chroot/etc/named.conf";
    $comment = "//Kloxo";
    addLineIfNotExist($file, $pattern, $comment);
    touch("/var/named/chroot/etc/kloxo.named.conf");
    chown("/var/named/chroot/etc/kloxo.named.conf", "named");
}
Beispiel #2
0
function install_main()
{
    global $installcomp;
    global $argv;
    $comp = array("web", "mail", "dns", "database");
    $list = parse_opt($argv);
    if ($list['server-list']) {
        $serverlist = implode(",", $list['server-list']);
    } else {
        $serverlist = $comp;
    }
    foreach ($comp as $c) {
        flush();
        if (array_search($c, $serverlist) !== false) {
            print "Installing {$c} Components....";
            $req = $installcomp[$c];
            $func = "installcomp_{$c}";
            if (function_exists($func)) {
                $func();
            }
            install_general_mine($req);
            print "\n";
        }
    }
    $pattern = "Include /etc/httpd/conf/kloxo/kloxo.conf";
    $file = "/etc/httpd/conf/httpd.conf";
    $comment = "#Kloxo";
    addLineIfNotExist($file, $pattern, $comment);
    mkdir("/etc/httpd/conf/kloxo/");
    $dir_path = dirname(__FILE__);
    copy("{$dir_path}/kloxo.conf", "/etc/httpd/conf/kloxo/kloxo.conf");
    touch("/etc/httpd/conf/kloxo/virtualhost.conf");
    touch("/etc/httpd/conf/kloxo/webmail.conf");
    touch("/etc/httpd/conf/kloxo/init.conf");
    mkdir("/etc/httpd/conf/kloxo/forward/");
    touch("/etc/httpd/conf/kloxo/forward/forwardhost.conf");
    $options_file = "/var/named/chroot/etc/global.options.named.conf";
    $example_options = "acl \"lxcenter\" {\n";
    $example_options .= " localhost;\n";
    $example_options .= "};\n\n";
    $example_options .= "options {\n";
    $example_options .= " max-transfer-time-in 60;\n";
    $example_options .= " transfer-format many-answers;\n";
    $example_options .= " transfers-in 60;\n";
    $example_options .= " auth-nxdomain yes;\n";
    $example_options .= " allow-transfer { \"lxcenter\"; };\n";
    $example_options .= " allow-recursion { \"lxcenter\"; };\n";
    $example_options .= " recursion no;\n";
    $example_options .= " version \"LxCenter-1.0\";\n";
    $example_options .= "};\n\n";
    $example_options .= "# Remove # to see all DNS queries\n";
    $example_options .= "#logging {\n";
    $example_options .= "# channel query_logging {\n";
    $example_options .= "# file \"/var/log/named_query.log\";\n";
    $example_options .= "# versions 3 size 100M;\n";
    $example_options .= "# print-time yes;\n";
    $example_options .= "# };\n\n";
    $example_options .= "# category queries {\n";
    $example_options .= "# query_logging;\n";
    $example_options .= "# };\n";
    $example_options .= "#};\n";
    if (!lfile_exists($options_file)) {
        touch($options_file);
        chown($options_file, "named");
    }
    $cont = lfile_get_contents($options_file);
    $pattern = "options";
    if (!preg_match("+{$pattern}+i", $cont)) {
        file_put_contents($options_file, "{$example_options}\n");
    }
    $pattern = 'include "/etc/kloxo.named.conf";';
    $file = "/var/named/chroot/etc/named.conf";
    $comment = "//Kloxo";
    addLineIfNotExist($file, $pattern, $comment);
    touch("/var/named/chroot/etc/kloxo.named.conf");
    chown("/var/named/chroot/etc/kloxo.named.conf", "named");
}