コード例 #1
0
function xstart()
{
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();
    $tar = $unix->find_program("tar");
    build_progress("{downloading} roundcubeemail-1.1.2.tar.gz", 20);
    $tmpfile = $unix->FILE_TEMP();
    $curl = new ccurl("http://articatech.net/download/postfix-debian7/roundcubeemail-1.1.2.tar.gz");
    if (!$curl->GetFile($tmpfile)) {
        echo "Failed: " . $curl->error . "\n";
        @unlink($tmpfile);
        build_progress("{failed} roundcubeemail-1.1.2.tar.gz", 110);
        return;
    }
    build_progress("{uncompressing} roundcubeemail-1.1.2.tar.gz", 50);
    system("{$tar} xf {$tmpfile} -C /");
    @unlink($tmpfile);
    if (!is_file("/usr/share/roundcube/index.php")) {
        build_progress("{uncompressing} roundcubeemail-1.1.2.tar.gz {failed}", 110);
        return;
    }
    build_progress("{verify_database}", 60);
    system("{$php} /usr/share/artica-postfix/exec.roundcube.php --database");
    build_progress("{restarting_service}", 70);
    system("{$php} /usr/share/artica-postfix/exec.roundcube.php --restart");
    system("/etc/init.d/artica-status restart");
    build_progress("{installing} roundcubeemail-1.1.2.tar.gz {success}", 100);
}
コード例 #2
0
function Import()
{
    $curl = new ccurl("http://www.privacyonline.org.uk/downloads/privacyonline-btl.tpl");
    $curl->NoHTTP_POST = true;
    $curl->GetFile("/tmp/privacyonline-btl.tpl");
    $f = file("/tmp/privacyonline-btl.tpl");
    @unlink("/tmp/privacyonline-btl.tpl");
    while (list($indx, $line) = each($f)) {
        $line = trim($line);
        $line = str_replace("\n", "", $line);
        $line = str_replace("\r", "", $line);
        if (!preg_match("#^\\-d\\s+(.+)#", $line, $re)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "SKIP \"{$line}\"\n";
            }
            continue;
        }
        $line = $re[1];
        if (strpos($line, " ") > 0) {
            if ($GLOBALS["VERBOSE"]) {
                echo "SKIP \"{$line}\"\n";
            }
            continue;
        }
        if (strpos($line, "/") > 0) {
            if ($GLOBALS["VERBOSE"]) {
                echo "SKIP \"{$line}\"\n";
            }
            continue;
        }
        $domain[$line] = $line;
    }
    return $domain;
}
コード例 #3
0
function Connect($server, $port, $user, $pass)
{
    writelogs("synchronize {$server}:{$port}", __FUNCTION__, __FILE__, __LINE__);
    $sync = new articaSMTPSync();
    $ldap = new clladp();
    $http = new httpd();
    $array = $sync->GetUsers();
    $field = base64_encode(serialize($array));
    $cred["user"] = $user;
    $cred["pass"] = $pass;
    $curl = new ccurl("https://{$server}:{$port}/exec.smtp.export.users.php");
    $curl->parms["credentials"] = base64_encode(serialize($cred));
    $curl->parms["users"] = $field;
    $curl->parms["local_port"] = $http->https_port;
    $curl->parms["mycred"] = base64_encode(serialize(array($ldap->ldap_admin, $ldap->ldap_password)));
    if (!$curl->get()) {
        writelogs("synchronize {$server}:{$port} failed", __FUNCTION__, __FILE__, __LINE__);
    }
    if (preg_match("#<datas>(.+?)</datas>#is", $curl->data, $re)) {
        $array = unserialize(base64_decode($re[1]));
        $sync->import($array, "{$server}:{$port}");
        $sock = new sockets();
        $sock->getFrameWork("cmd.php?postfix-transport-maps=yes");
    }
}
コード例 #4
0
ファイル: exec.iptables.php プロジェクト: BillTheBest/1.6.x
function iprulesDNS()
{
    $unix = new unix();
    $IPCHAIN = "dnsfilter";
    $pidfile = "/etc/artica-postfix/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if ($unix->process_exists(@file_get_contents($pidfile), basename(__FILE__))) {
        echo "Starting......: " . date("H:i:s") . " iptables configurator already executed PID " . @file_get_contents($pidfile) . "\n";
        die;
    }
    $pid = getmypid();
    file_put_contents($pidfile, $pid);
    $sock = new sockets();
    $EnableIptablesDNS = $sock->GET_INFO("EnableIptablesDNS");
    if (!is_numeric($EnableIptablesDNS)) {
        $EnableIptablesDNS = 1;
    }
    if ($EnableIptablesDNS == 0) {
        $ip = new iptables_exec();
        if ($ip->is_chain_exists($IPCHAIN)) {
            shell_exec("{$GLOBALS["iptables"]} -F {$IPCHAIN}");
            shell_exec("{$GLOBALS["iptables"]} -X {$IPCHAIN}");
        }
        return;
    }
    $tmpfile = $unix->FILE_TEMP();
    $curl = new ccurl("https://raw.github.com/smurfmonitor/dns-iptables-rules/master/domain-blacklist.txt");
    $curl->NoHTTP_POST = true;
    if ($curl->GetFile($tmpfile)) {
        $size = @filesize($tmpfile);
        if ($size < 100) {
            $tmpfile = "/usr/share/artica-postfix/bin/install/iptables_defaults.txt";
        }
    }
    $ip = new iptables_exec();
    if (!$ip->is_chain_exists($IPCHAIN)) {
        echo "Adding chain {$IPCHAIN}\n";
        shell_exec("{$GLOBALS["iptables"]} -N {$IPCHAIN}");
        shell_exec("{$GLOBALS["iptables"]} -I INPUT -p udp --dport 53 -j {$IPCHAIN}");
    } else {
        echo "chain {$IPCHAIN} exists...\n";
    }
    shell_exec("{$GLOBALS["iptables"]} -F {$IPCHAIN}");
    shell_exec("{$GLOBALS["iptables"]} -A {$IPCHAIN} -j RETURN");
    $f = explode("\n", @file_get_contents($tmpfile));
    while (list($num, $ligne) = each($f)) {
        $ligne = trim($ligne);
        if ($ligne == null) {
            continue;
        }
        $ligne = str_replace("INPUT", $IPCHAIN, $ligne);
        $ligne = str_replace("iptables", $GLOBALS["iptables"], $ligne);
        $results = array();
        exec($ligne, $results);
        echo "{$ligne}\n";
        while (list($a, $b) = each($results)) {
            echo "{$b}\n";
        }
    }
}
コード例 #5
0
function GetDomains($i)
{
    $unix = new unix();
    $tmpfile = $unix->FILE_TEMP();
    $curl = new ccurl("http://0675.com.cn/newwebsite_20120101_list._page0.html");
    $curl->NoHTTP_POST = true;
    echo "Get page {$i}\n";
    if (!$curl->GetFile($tmpfile)) {
        echo "http://0675.com.cn/newwebsite_20120101_list._page{$i}.html -> error: \n" . $curl->error . "\n";
        return;
    }
    $datas = @file($tmpfile);
    $size = strlen(@implode("", $datas)) / 1024;
    echo "Page[{$i}]:: {$tmpfile} Size: {$size} Ko\n";
    while (list($num, $ligne) = each($datas)) {
        if (preg_match("#<div class=.*?newdomain.*?>(.*)#", $ligne)) {
            echo "Sure line {$num}";
            $newdata = str_replace("</li>", "", $ligne);
            $newdata = str_replace("</div>", "", $newdata);
            $f = explode("<li>", $newdata);
        }
    }
    $q = new mysql_squid_builder();
    while (list($num, $www) = each($f)) {
        if (preg_match("#^\\.(.+)#", $www, $re)) {
            $www = $re[1];
        }
        if (strpos($www, ",") > 0) {
            continue;
        }
        if (strpos($www, " ") > 0) {
            continue;
        }
        if (strpos($www, ":") > 0) {
            continue;
        }
        if (strpos($www, "%") > 0) {
            continue;
        }
        if (strpos($www, ">") > 0) {
            continue;
        }
        if (strpos($www, "<") > 0) {
            continue;
        }
        if (preg_match("#^www\\.(.+)#", $www, $re)) {
            $www = $re[1];
        }
        $articacats = trim($q->GET_CATEGORIES($www, true, false));
        if ($articacats != null) {
            echo "\"{$www}\" SUCCESS - {$articacats} -\n";
            continue;
        }
        echo "\"{$www}\" FAILED\n";
    }
}
コード例 #6
0
function download()
{
    $unix = new unix();
    build_progress("{downloading}", 10);
    $URI = "http://wordpress.org/latest.tar.gz";
    $TMP_FILE = $unix->FILE_TEMP() . ".gz";
    $TMP_DIR = $unix->TEMP_DIR();
    echo "Downloading {$URI}\n";
    $curl = new ccurl($URI);
    $curl->WriteProgress = true;
    $curl->ProgressFunction = "download_progress";
    if (!$curl->GetFile($TMP_FILE)) {
        build_progress("{downloading} {failed}", 110);
        echo $curl->error;
        return;
    }
    echo "Extracting {$TMP_FILE} in {$TMP_DIR}\n";
    $tar = $unix->find_program("tar");
    $cmd = "{$tar} xf {$TMP_FILE} -C {$TMP_DIR}/";
    build_progress("{uncompress}", 50);
    shell_exec("{$tar} xf {$TMP_FILE} -C {$TMP_DIR}/");
    @unlink($TMP_FILE);
    $dirs = $unix->dirdir($TMP_DIR);
    $WDP_DIR = null;
    while (list($num, $ligne) = each($dirs)) {
        if (!is_file("{$ligne}/wp-admin/install.php")) {
            continue;
        }
        $WDP_DIR = $ligne;
        break;
        echo "Find Directory {$ligne}\n";
    }
    if (!is_dir($WDP_DIR)) {
        build_progress("Find directory failed", 110);
        echo "Find directory failed\n";
        return;
    }
    build_progress("{installing}", 80);
    @mkdir("/usr/share/wordpress-src", 0755, true);
    $cp = $unix->find_program("cp");
    $rm = $unix->find_program("rm");
    shell_exec("cp -rfv {$WDP_DIR}/* /usr/share/wordpress-src/");
    if (is_dir($WDP_DIR)) {
        echo "Removing {$WDP_DIR}\n";
        shell_exec("{$rm} -rf {$WDP_DIR}");
    }
    $sock = new sockets();
    $sock->SET_INFO("EnableFreeWeb", 1);
    @file_put_contents("/etc/artica-postfix/settings/Daemons/WordPressInstalled", 1);
    system("/etc/init.d/artica-status restart --force");
    build_progress("{success}", 100);
    $nohup = $unix->find_program("nohup");
    $sock = new sockets();
    shell_exec("{$nohup} /usr/share/artica-postfix/bin/process1 --verbose 654646 >/dev/null 2>&1 &");
}
コード例 #7
0
function subdomains()
{
    $subdomains = "https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt";
    $MAIN = unserialize(@file_get_contents("/root/ransomwaretracker.db"));
    $curl = new ccurl($subdomains);
    if ($curl->GetFile("/root/RW_DOMBL.txt")) {
        $f = explode("\n", @file_get_contents("/root/RW_DOMBL.txt"));
        while (list($index, $line) = each($f)) {
            $line = trim($line);
            if (substr($line, 0, 1) == "#") {
                continue;
            }
            $MAIN["DOMAINS"][$line] = true;
        }
    } else {
        echo "{$subdomains} failed\n";
    }
    $ips = "https://ransomwaretracker.abuse.ch/downloads/RW_IPBL.txt";
    $curl = new ccurl($ips);
    if ($curl->GetFile("/root/RW_IPBL.txt")) {
        $f = explode("\n", @file_get_contents("/root/RW_IPBL.txt"));
        while (list($index, $line) = each($f)) {
            $line = trim($line);
            if (substr($line, 0, 1) == "#") {
                continue;
            }
            $MAIN["IPS"][$line] = true;
        }
    } else {
        echo "{$ips} failed\n";
    }
    $uris = "https://ransomwaretracker.abuse.ch/downloads/RW_URLBL.txt";
    $curl = new ccurl($uris);
    if ($curl->GetFile("/root/RW_URLBL.txt")) {
        $f = explode("\n", @file_get_contents("/root/RW_URLBL.txt"));
        while (list($index, $line) = each($f)) {
            $line = trim($line);
            if (substr($line, 0, 1) == "#") {
                continue;
            }
            $MAIN["URIS"][$line] = true;
        }
    } else {
        echo "{$uris} failed\n";
    }
    $MAIN2["TIME"] = time();
    $MAIN2["MD5"] = md5(serialize($MAIN));
    @file_put_contents("/root/ransomwaretracker.db", serialize($MAIN));
    @file_put_contents("/root/ransomwaretracker.txt", serialize($MAIN2));
    $unix = new unix();
    $unix->compress("/root/ransomwaretracker.db", "/root/ransomwaretracker.gz");
    PushToRepo("/root/ransomwaretracker.txt");
    PushToRepo("/root/ransomwaretracker.gz");
}
コード例 #8
0
ファイル: exec.ipblock.php プロジェクト: articatech/artica
function update()
{
    if (system_is_overloaded()) {
        return;
    }
    $unix = new unix();
    $sock = new sockets();
    $pidfile = "/etc/artica-postfix/pids/exec.ipblock.php.update.pid";
    $pidtime = "/etc/artica-postfix/pids/exec.ipblock.php.update.time";
    $pid = @file_get_contents($pidfile);
    if (!$GLOBALS["FORCE"]) {
        if ($unix->process_exists($pid)) {
            echo "Already running pid {$pid}\n";
            return;
        }
    }
    include_once dirname(__FILE__) . '/ressources/class.ccurl.inc';
    if (!is_file($pidtime)) {
        @file_put_contents($pidtime, time());
    }
    if (!$GLOBALS["FORCE"]) {
        if ($unix->file_time_min($pidtime) > 720) {
            @unlink($pidtime);
            @file_put_contents($pidtime, time());
            return;
        }
    }
    @file_put_contents($pidfile, getmypid());
    $EnableIpBlocks = intval($sock->GET_INFO("EnableIpBlocks"));
    if ($EnableIpBlocks == 0) {
        return;
    }
    $DIR_TEMP = $unix->TEMP_DIR();
    $curl = new ccurl("http://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz");
    if (!$curl->GetFile("{$DIR_TEMP}/all-zones.tar.gz")) {
        system_admin_events(0, "Fatal, Unable to download all-zones.tar.gz from ipdeny.com", __FILE__, __LINE__);
        return;
    }
    $OldMd5 = $sock->GET_INFO("IpBlocksMD5");
    $md5File = md5_file("{$DIR_TEMP}/all-zones.tar.gz");
    if ($md5File == $OldMd5) {
        ipblocks();
        return;
    }
    $tar = $unix->find_program("tar");
    @mkdir("/home/artica/ipblocks", 0755, true);
    shell_exec("{$tar} xf {$DIR_TEMP}/all-zones.tar.gz -C  /home/artica/ipblocks/");
    if (ipblocks()) {
        $sock->SET_INFO("IpBlocksMD5", "{$md5File}");
        system_admin_events(0, "Restarting Firewall in order to refresh countries blocking");
    }
}
コード例 #9
0
function download_install($key)
{
    $GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/squid.install.progress";
    $GLOBALS["LOG_FILE"] = "/usr/share/artica-postfix/ressources/logs/web/squid.install.progress.txt";
    $sock = new sockets();
    $ArticaTechNetSquidRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetSquidRepo")));
    $array = $ArticaTechNetSquidRepo[$key];
    $URL = $array["URL"];
    $VERSION = $array["VERSION"];
    $FILESIZE = $array["FILESIZE"];
    $FILENAME = $array["FILENAME"];
    $MD5 = $array["MD5"];
    $tarballs_file = "/usr/share/artica-postfix/ressources/conf/upload/{$FILENAME}";
    echo "Url......................: {$URL}\n";
    echo "Version..................: {$VERSION}\n";
    echo "File size................: {$FILESIZE}\n";
    echo "Filename.................: {$FILENAME}\n";
    echo "MD5......................: {$MD5}\n";
    if ($URL == null) {
        build_progress("{downloading} {$FILENAME} {failed}...", 110);
        die;
    }
    build_progress("{downloading} {$FILENAME} {please_wait}...", 5);
    $curl = new ccurl($URL);
    $curl->WriteProgress = true;
    $curl->ProgressFunction = "download_progress";
    if (!$curl->GetFile($tarballs_file)) {
        build_progress("{downloading} {$FILENAME} {failed}...", 110);
        @unlink($tarballs_file);
        echo $curl->error;
        die;
    }
    build_progress("{checking} {$FILENAME} {please_wait}...", 9);
    $filesize = @filesize($tarballs_file);
    $md5file = md5_file($tarballs_file);
    echo "File size................: {$filesize}\n";
    echo "MD5......................: {$md5file}\n";
    if ($filesize < 50) {
        print_r($curl->CURL_ALL_INFOS);
        echo @file_get_contents($tarballs_file);
    }
    if ($md5file != $MD5) {
        @unlink($tarballs_file);
        echo "Md5 failed, corrupted file...\n";
        build_progress("{checking} {$FILENAME} {failed}...", 110);
        die;
    }
    install($FILENAME);
}
コード例 #10
0
function GetCategory($source, $dest)
{
    for ($i = 1; $i < 13; $i++) {
        echo "Checking page number {$i}\n";
        $curl = new ccurl("http://cacaweb.com/category/{$source}/page/{$i}");
        $curl->NoHTTP_POST = true;
        $curl->UserAgent = "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0";
        $curl->FollowLocation = true;
        if (!$curl->get()) {
            echo $curl->error . "\n";
            return;
        }
        CheckWebsites($curl->data, $dest);
    }
}
コード例 #11
0
function xinstall()
{
    $unix = new unix();
    $curl = new ccurl();
    $tmpfile = $unix->FILE_TEMP();
    $tmpdir = $unix->TEMP_DIR();
    build_progress("{downloading} v3.1.0-25", 15);
    $curl = new ccurl("http://articatech.net/download/UpdateUtility/updateutility-3.1.0-25.tar.gz");
    if (!$curl->GetFile($tmpfile)) {
        @unlink($tmpfile);
        build_progress("{downloading} {failed}", 110);
        return;
    }
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    @mkdir("{$tmpdir}/updateutility", 0755);
    build_progress("{uncompress}", 20);
    shell_exec("{$tar} -xf {$tmpfile} -C {$tmpdir}/updateutility/");
    build_progress("{find_source_directory}", 25);
    $dirs = $unix->dirdir("{$tmpdir}/updateutility");
    $SOURCE_DIRECTORY = null;
    while (list($num, $ligne) = each($dirs)) {
        build_progress("{scanning} {$ligne}", 25);
        if (is_file("{$ligne}/UpdateUtility-Console")) {
            $SOURCE_DIRECTORY = $ligne;
            break;
        }
    }
    if ($SOURCE_DIRECTORY == null) {
        echo "Unable to find source directory\n";
        build_progress("{installing} {failed}", 110);
        shell_exec("{$rm} -rf {$tmpdir}/updateutility");
        return;
    }
    echo "Using directory {$SOURCE_DIRECTORY}\n";
    build_progress("{installing}...", 80);
    $cp = $unix->find_program("cp");
    @mkdir("/etc/UpdateUtility", 0755, true);
    shell_exec("{$cp} -rfv {$SOURCE_DIRECTORY}/* /etc/UpdateUtility/");
    shell_exec("{$rm} -rf {$tmpdir}/updateutility");
    if (!is_file("/etc/UpdateUtility/UpdateUtility-Console")) {
        echo "/etc/UpdateUtility/UpdateUtility-Console no such binary\n";
        build_progress("{installing} {failed}", 110);
    }
    build_progress("{installing} {success}", 100);
}
コード例 #12
0
ファイル: exec.blackbox.php プロジェクト: BillTheBest/1.6.x
function ping($hostid)
{
    $mefile = basename(__FILE__);
    $GLOBALS["CLASS_UNIX"] = new unix();
    $GLOBALS["CLASS_UNIX"]->events("{$mefile}:: blackboxes({$hostid})", "/var/log/stats-appliance.log");
    $black = new blackboxes($hostid);
    $ssluri = $black->ssluri . "/nodes.listener.php";
    $nossluri = $black->sslnouri . "/nodes.listener.php";
    if ($GLOBALS["VERBOSE"]) {
        echo "Try {$ssluri}\n";
    }
    $GLOBALS["CLASS_UNIX"]->events("{$mefile}:: {$ssluri}", "/var/log/stats-appliance.log");
    $curl = new ccurl($ssluri);
    $curl->parms["PING-ORDERS"] = true;
    if ($GLOBALS["VERBOSE"]) {
        $curl->parms["VERBOSE"] = true;
    }
    $curl->noproxyload = true;
    if ($GLOBALS["VERBOSE"]) {
        echo "Sending PING-ORDERS\n";
    }
    if (!$curl->get()) {
        $ssluri = $nossluri;
        $GLOBALS["CLASS_UNIX"]->events("{$mefile}:: {$ssluri}", "/var/log/stats-appliance.log");
        if ($GLOBALS["VERBOSE"]) {
            echo "error `{$ssluri}` {$curl->error}, trying http\n";
        }
        $curl = new ccurl($nossluri);
        $curl->noproxyload = true;
        $curl->parms["PING-ORDERS"] = true;
        if (!$curl->get()) {
            ufdbguard_admin_events("{$mefile}:: Failed to send ping to {$black->hostname} with Error:`{$curl->error}`", __FUNCTION__, __FILE__, __LINE__, "communicate");
            return;
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        echo $curl->data;
    }
    if (preg_match("#SUCCESS<#s", $curl->data)) {
        $GLOBALS["CLASS_UNIX"]->events("Success to send ping to {$black->hostname}", "/var/log/stats-appliance.log");
        ufdbguard_admin_events("{$mefile}:: Success to send ping to {$black->hostname}", __FUNCTION__, __FILE__, __LINE__, "communicate");
    }
}
コード例 #13
0
function ImportNets()
{
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadString($sock->GET_INFO("ComputersImportArtica"));
    if (!is_array($ini->_params)) {
        writelogs("No artica masters defined", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    if (count($ini->_params) == 0) {
        writelogs("No artica masters defined", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    while (list($ip, $array) = each($ini->_params)) {
        if (trim($ip) == null) {
            continue;
        }
        $curl = new ccurl("https://{$ip}:{$array["port"]}/exec.import-networks.php");
        while (list($key, $value) = each($array)) {
            $curl->parms[$key] = $value;
        }
        $curl->get();
        $datas = $curl->data;
        if (trim($datas) == null) {
            continue;
        }
        $md5 = md5($datas);
        import_vpn_remotes_sites($datas);
        if (!$GLOBALS["FORCE"]) {
            if ($array["md5"] != $md5) {
                ImportDatas($datas);
            }
        } else {
            ImportDatas($datas);
        }
        $ini->_params[$ip]["md5"] = $md5;
    }
    reset($ini->_params);
    $ini->saveFile("/etc/artica-postfix/settings/Daemons/ComputersImportArtica");
}
コード例 #14
0
function Save()
{
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $sock = new sockets();
    $tpl = new templates();
    $curl = new ccurl();
    $proto = "http";
    $StatsServervame = $_POST["StatsServervame"];
    $StatsServerPort = $_POST["StatsServerPort"];
    $StatsServerSSL = $_POST["StatsServerSSL"];
    if ($StatsServerSSL == 1) {
        $proto = "https";
    }
    $EnableRemoteSyslogStatsAppliance = $_POST["EnableRemoteSyslogStatsAppliance"];
    $uri = "{$proto}://{$StatsServervame}:{$StatsServerPort}/nodes.listener.php";
    if ($EnableRemoteSyslogStatsAppliance == 1) {
        writelogs("{$uri}", __FUNCTION__, __FILE__, __LINE__);
        $curl = new ccurl($uri);
        $curl->parms["OPENSYSLOG"] = 1;
        if (!$curl->get()) {
            echo "Error " . $tpl->_ENGINE_parse_body($curl->error);
            return;
        }
        if (strpos($curl->data, "<RESULTS>OK</RESULTS>") == 0) {
            echo "Error Protocol error or bad version on remote server\n";
            return;
        }
    }
    $sock->SET_INFO("EnableRemoteSyslogStatsAppliance", $EnableRemoteSyslogStatsAppliance);
    $RemoteSyslogAppliance["SSL"] = $_POST["StatsServerSSL"];
    $RemoteSyslogAppliance["PORT"] = $_POST["StatsServerPort"];
    $RemoteSyslogAppliance["SERVER"] = $_POST["StatsServervame"];
    $sock->SaveConfigFile(base64_encode(serialize($RemoteSyslogAppliance)), "RemoteSyslogAppliance");
    $sock->getFrameWork("cmd.php?syslog-client-mode=yes");
    $sock->getFrameWork("squid.php?compile-schedules-reste=yes");
    $sock->getFrameWork("squid.php?squid-reconfigure=yes");
}
コード例 #15
0
function compile_ufdbcat()
{
    $unix = new unix();
    $uri = "http://www.articatech.net/download/ufdbGuard-1.31.tar.gz";
    $curl = new ccurl("http://www.articatech.net/download/ufdbGuard-1.31.tar.gz");
    echo "Downloading {$uri}\n";
    $tempdir = $unix->TEMP_DIR() . "/ufdb";
    $tempfile = "{$tempdir}/ufdbGuard-1.31.tar.gz";
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $cp = $unix->find_program("cp");
    if (is_dir($tempdir)) {
        shell_exec("{$rm} -rf {$tempdir}");
    }
    @mkdir($tempdir, 0755, true);
    if (is_file($tempfile)) {
        @unlink($tempfile);
    }
    if (!$curl->GetFile($tempfile)) {
        echo "Fatal, unable to download {$uri}\n";
        meta_admin_mysql(0, "Fatal, unable to download {$uri}", @implode("\n", $curl->errors), __FILE__, __LINE__);
        return;
    }
    if (is_dir("{$tempdir}/ufdbcompile")) {
        shell_exec("{$rm} -rf {$tempdir}/ufdbcompile");
    }
    echo "Uncompressing {$tempdir}/ufdbGuard-1.31.tar.gz to {$tempdir}/\n";
    shell_exec("{$tar} -xf {$tempdir}/ufdbGuard-1.31.tar.gz -C {$tempdir}/");
    $dirs = $unix->dirdir($tempdir);
    while (list($directory, $value) = each($dirs)) {
        echo "Found directory {$directory}\n";
        if (is_file("{$directory}/src/mtserver/ufdbguardd.c")) {
            $WORKDIR = "{$directory}";
            break;
        }
    }
    if (!is_dir($WORKDIR)) {
        echo "Fatal, unable to download {$uri}\n";
        meta_admin_mysql(0, "Fatal, unable to locate working directory", __FILE__, __LINE__);
        if (is_dir($tempdir)) {
            shell_exec("{$rm} -rf {$tempdir}");
        }
        return;
    }
    echo "Patching mtserver/ufdbguardd.c\n";
    $C = explode("\n", @file_get_contents("{$directory}/src/mtserver/ufdbguardd.c"));
    while (list($index, $line) = each($C)) {
        if (strpos($line, "/tmp/ufdbguardd-") > 0) {
            echo "Patching mtserver/ufdbguardd.c line {$index}\n";
            $C[$index] = str_replace("/tmp/ufdbguardd-", "/var/run/ufdbcat-", $line);
        }
    }
    @file_put_contents("{$directory}/src/mtserver/ufdbguardd.c", @implode("\n", $C));
    chdir($WORKDIR);
    if (is_dir("/opt/ufdbcat")) {
        shell_exec("{$rm} -rf /opt/ufdbcat");
    }
    echo "Configure\n";
    $f[] = "./configure";
    $f[] = "--prefix=/opt/ufdbcat";
    $f[] = "--includedir=\"\\\${prefix}/include\"";
    $f[] = "--mandir=\"\\\${prefix}/share/man\"";
    $f[] = "--infodir=\"\\\${prefix}/share/info\"";
    $f[] = "--sysconfdir=/etc/ufdbcat";
    $f[] = "--localstatedir=/opt/ufdbcat";
    $f[] = "--with-ufdb-logdir=/var/log/ufdbcat";
    $f[] = "--with-ufdb-dbhome=/home/ufdbcat";
    $f[] = "--with-ufdb-user=root";
    $f[] = "--with-ufdb-config=/etc/ufdbcat";
    $f[] = "--with-ufdb-logdir=/var/log/ufdbcat";
    $f[] = "--with-ufdb-config=/etc/ufdbcat";
    $f[] = "--with-ufdb-piddir=/var/run/ufdbcat";
    $cmd = @implode(" ", $f);
    system($cmd);
    echo "Make\n";
    system("make");
    echo "Install\n";
    system("make install");
    if (!is_file("/opt/ufdbcat/bin/ufdbguardd")) {
        echo "Fatal, unable to compile ufdbcat\n";
        meta_admin_mysql(0, "Fatal, unable to compile ufdbcat", __FILE__, __LINE__);
        if (is_dir($tempdir)) {
            shell_exec("{$rm} -rf {$tempdir}");
        }
        return;
    }
    @copy("/opt/ufdbcat/bin/ufdbguardd", "/opt/ufdbcat/bin/ufdbcatdd");
    @unlink("/opt/ufdbcat/bin/ufdbguardd");
    @chmod("/opt/ufdbcat/bin/ufdbcatdd", 0755);
    $ufdbcatVersion = ufdbcatVersion();
    $Architecture = Architecture();
    $DebianVersion = DebianVersion();
    $base = "/root/ufdbcat-compile";
    if (is_dir($base)) {
        shell_exec("{$rm} -rf {$base}");
    }
    @mkdir("{$base}/opt/ufdbcat", 0755, true);
    shell_exec("{$cp} -rfp /opt/ufdbcat/* {$base}/opt/ufdbcat/");
    $filename = "ufdbcat-debian{$DebianVersion}-{$Architecture}-{$ufdbcatVersion}.tar.gz";
    chdir($base);
    @unlink("/root/{$filename}");
    shell_exec("/bin/tar -czf /root/{$filename} *");
    echo "/root/{$filename} done\n\n";
}
コード例 #16
0
ファイル: exec.wordpress.php プロジェクト: brucewu16899/1.6.x
function config($servername)
{
    $GLOBALS["SERVICE_NAME"] = "Wordpress {$servername}";
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$servername}.pid";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        build_progress("{$servername} Already executed", 110);
        die;
    }
    @file_put_contents($pidfile, getmypid());
    $q = new mysql();
    $cp = $unix->find_program("cp");
    $sock = new sockets();
    $Salts = null;
    $DB_HOST = $q->mysql_server;
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: MySQL host: {$DB_HOST}\n";
    }
    if ($q->mysql_server == "127.0.0.1" or $q->mysql_server == "localhost" or $q->mysql_server == "localhost:") {
        if ($q->SocketPath == null) {
            $q->SocketPath = "/var/run/mysqld/mysqld.sock";
        }
        $DB_HOST = "localhost:{$q->SocketPath}";
    }
    if (!is_file("/usr/share/artica-postfix/bin/wp-cli.phar")) {
        build_progress("wp-cli.phar: no such binary", 110);
        return;
    }
    @chmod("/usr/share/artica-postfix/bin/wp-cli.phar", 0755);
    build_progress("{$servername}: {testing_configuration}", 40);
    $free = new freeweb($servername);
    $WORKING_DIRECTORY = $free->www_dir;
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: Directory: {$WORKING_DIRECTORY}\n";
    }
    @unlink("{$WORKING_DIRECTORY}/wp-config.php");
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: Duplicate: {$free->groupware_duplicate}\n";
    }
    if ($free->groupware_duplicate != null) {
        build_progress("{$servername}: {duplicate} {from} {$free->groupware_duplicate}", 40);
        if (!duplicate_wordpress($servername)) {
            build_progress("{$servername}: {installing} {failed}...", 110);
            apache_admin_mysql(0, "Failed to duplicate {$servername} from {$free->groupware_duplicate}", null, __FILE__, __LINE__);
            return;
        }
        apache_admin_mysql(2, "Success duplicate {$servername} from {$free->groupware_duplicate}", null, __FILE__, __LINE__);
        $free = new freeweb($servername);
    } else {
        if (!scan($WORKING_DIRECTORY)) {
            build_progress("{$servername}: {installing}...", 42);
            @mkdir($WORKING_DIRECTORY);
            shell_exec("{$cp} -rf /usr/share/wordpress-src/* {$WORKING_DIRECTORY}/");
            if (!scan($WORKING_DIRECTORY)) {
                apache_admin_mysql(0, "Failed to install {$servername} from /usr/share/wordpress-src", null, __FILE__, __LINE__);
                build_progress("{$servername}: {installing} {failed}...", 110);
                return;
            }
            apache_admin_mysql(2, "Success to install {$servername} from /usr/share/wordpress-src", null, __FILE__, __LINE__);
        }
    }
    $wordpressDB = $free->mysql_database;
    if ($wordpressDB == null) {
        $wordpressDB = $free->CreateDatabaseName();
        $free->mysql_database = $wordpressDB;
        $free->CreateSite(true);
    }
    $WordPressDBPass = $free->mysql_password;
    $DB_USER = $free->mysql_username;
    if ($DB_USER == "wordpress") {
        $DB_USER = null;
    }
    if ($DB_USER == null) {
        $DB_USER = "******" . time();
        $free->mysql_username = $DB_USER;
        $free->CreateSite(true);
    }
    if ($WordPressDBPass == null) {
        $WordPressDBPass = md5(time());
        $free->mysql_password = $WordPressDBPass;
        $free->CreateSite(true);
    }
    $DB_PASSWORD = $WordPressDBPass;
    if (is_file("{$WORKING_DIRECTORY}/salts.php")) {
        $Salts = @file_get_contents("{$WORKING_DIRECTORY}/salts.php");
    }
    if ($Salts == null) {
        $TMP = $unix->FILE_TEMP();
        build_progress("{$servername}: Acquiring Salts...", 44);
        $curl = new ccurl("https://api.wordpress.org/secret-key/1.1/salt/");
        if (!$curl->GetFile("{$TMP}")) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: Unable to download salts !!\n";
            }
            build_progress("{$servername}: Acquiring Salts {failed}...", 110);
            return;
        }
        $ASASLT = false;
        $fa = explode("\n", @file_get_contents($TMP));
        @unlink($TMP);
        while (list($num, $ligne) = each($fa)) {
            if (preg_match("#define\\(#", $ligne)) {
                $ASASLT = true;
                break;
            }
        }
        if (!$ASASLT) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: Unable to download salts !!\n";
            }
            build_progress("{$servername}: Acquiring Salts {failed}...", 110);
            return;
        }
        @file_put_contents("{$WORKING_DIRECTORY}/salts.php", @implode("\n", $fa));
    }
    build_progress("{$servername}: checking...", 48);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: MySQL host...........: \"{$DB_HOST}\"\n";
    }
    if (!$q->DATABASE_EXISTS($wordpressDB)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: Create MySQL database: \"{$wordpressDB}\"\n";
        }
        $q->CREATE_DATABASE($wordpressDB);
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: MySQL database.......: \"{$wordpressDB}\"\n";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: MySQL user...........: \"{$DB_USER}\"\n";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: MySQL Password.......: \"{$DB_PASSWORD}\"\n";
    }
    $q->PRIVILEGES($DB_USER, $WordPressDBPass, $wordpressDB);
    $f[] = "<?php";
    $f[] = $Salts;
    $f[] = "/**";
    $f[] = " * The base configurations of the WordPress.";
    $f[] = " *";
    $f[] = " * This file has the following configurations: MySQL settings, Table Prefix,";
    $f[] = " * Secret Keys, WordPress Language, and ABSPATH. You can find more information";
    $f[] = " * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing";
    $f[] = " * wp-config.php} Codex page. You can get the MySQL settings from your web host.";
    $f[] = " *";
    $f[] = " * This file is used by the wp-config.php creation script during the";
    $f[] = " * installation. You don't have to use the web site, you can just copy this file";
    $f[] = " * to \"wp-config.php\" and fill in the values.";
    $f[] = " *";
    $f[] = " * @package WordPress";
    $f[] = " */";
    $f[] = "";
    $f[] = "// ** MySQL settings - You can get this info from your web host ** //";
    $f[] = "/** The name of the database for WordPress */";
    $f[] = "define('DB_NAME', '{$wordpressDB}');";
    $f[] = "";
    $f[] = "/** MySQL database username */";
    $f[] = "define('DB_USER', '{$DB_USER}');";
    $f[] = "";
    $f[] = "/** MySQL database password */";
    $f[] = "define('DB_PASSWORD', '{$DB_PASSWORD}');";
    $f[] = "";
    $f[] = "/** MySQL hostname */";
    $f[] = "define('DB_HOST', '{$DB_HOST}');";
    $f[] = "";
    $f[] = "/** Database Charset to use in creating database tables. */";
    $f[] = "define('DB_CHARSET', 'utf8');";
    $f[] = "";
    $f[] = "/** The Database Collate type. Don't change this if in doubt. */";
    $f[] = "define('DB_COLLATE', '');";
    $f[] = "";
    $f[] = "/**#@+";
    $f[] = " * Authentication Unique Keys and Salts.";
    $f[] = " *";
    $f[] = " * Change these to different unique phrases!";
    $f[] = " * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}";
    $f[] = " * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.";
    $f[] = " *";
    $f[] = " * @since 2.6.0";
    $f[] = " */";
    $f[] = "";
    $f[] = "/**#@-*/";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * WordPress Database Table prefix.";
    $f[] = " *";
    $f[] = " * You can have multiple installations in one database if you give each a unique";
    $f[] = " * prefix. Only numbers, letters, and underscores please!";
    $f[] = " */";
    $f[] = "\$table_prefix  = 'wp_';";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * WordPress Localized Language, defaults to English.";
    $f[] = " *";
    $f[] = " * Change this to localize WordPress. A corresponding MO file for the chosen";
    $f[] = " * language must be installed to wp-content/languages. For example, install";
    $f[] = " * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German";
    $f[] = " * language support.";
    $f[] = " */";
    $f[] = "define('WPLANG', '');";
    $f[] = "";
    $f[] = "/**";
    $f[] = " * For developers: WordPress debugging mode.";
    $f[] = " *";
    $f[] = " * Change this to true to enable the display of notices during development.";
    $f[] = " * It is strongly recommended that plugin and theme developers use WP_DEBUG";
    $f[] = " * in their development environments.";
    $f[] = " */";
    $f[] = "define('WP_DEBUG', false);";
    $f[] = "";
    $f[] = "/* That's all, stop editing! Happy blogging. */";
    $f[] = "";
    $f[] = "/** Absolute path to the WordPress directory. */";
    $f[] = "if ( !defined('ABSPATH') )";
    $f[] = "\tdefine('ABSPATH', dirname(__FILE__) . '/');";
    $f[] = "";
    $f[] = "/** Sets up WordPress vars and included files. */";
    $f[] = "require_once(ABSPATH . 'wp-settings.php');";
    $f[] = "?>";
    @file_put_contents("{$WORKING_DIRECTORY}/wp-config.php", @implode("\n", $f));
    build_progress("{$servername}: wp-config.php {done}...", 50);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: {$WORKING_DIRECTORY}/wp-config.php done...\n";
    }
    $f = array();
    $f[] = "<?php";
    $f[] = "/*";
    $f[] = "WP-Cache Config Sample File";
    $f[] = "";
    $f[] = "See wp-cache.php for author details.";
    $f[] = "*/";
    $f[] = "";
    $f[] = "if ( ! defined('WPCACHEHOME') )";
    $f[] = "\tdefine( 'WPCACHEHOME', WP_PLUGIN_DIR . '/wp-super-cache/' );";
    $f[] = "";
    $f[] = "\$cache_compression = 0; // Super cache compression";
    $f[] = "\$cache_enabled = false;";
    $f[] = "\$super_cache_enabled = false;";
    $f[] = "\$cache_max_time = 3600; //in seconds";
    $f[] = "//\$use_flock = true; // Set it true or false if you know what to use";
    $f[] = "\$cache_path = WP_CONTENT_DIR . '/cache/';";
    $f[] = "\$file_prefix = 'wp-cache-';";
    $f[] = "\$ossdlcdn = 0;";
    $f[] = "";
    $f[] = "// Array of files that have 'wp-' but should still be cached";
    $f[] = "\$cache_acceptable_files = array( 'wp-comments-popup.php', 'wp-links-opml.php', 'wp-locations.php' );";
    $f[] = "";
    $f[] = "\$cache_rejected_uri = array('wp-.*\\.php', 'index\\.php');";
    $f[] = "\$cache_rejected_user_agent = array ( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp', 3 => 'crawl', 4 => 'spider', 5 => 'Yandex' );";
    $f[] = "";
    $f[] = "\$cache_rebuild_files = 1;";
    $f[] = "";
    $f[] = "// Disable the file locking system.";
    $f[] = "// If you are experiencing problems with clearing or creating cache files";
    $f[] = "// uncommenting this may help.";
    $f[] = "\$wp_cache_mutex_disabled = 1;";
    $f[] = "";
    $f[] = "// Just modify it if you have conflicts with semaphores";
    $f[] = "\$sem_id = 5419;";
    $f[] = "";
    $f[] = "if ( '/' != substr(\$cache_path, -1)) {";
    $f[] = "\t\$cache_path .= '/';";
    $f[] = "}";
    $f[] = "";
    $f[] = "\$wp_cache_mobile = 0;";
    $f[] = "\$wp_cache_mobile_whitelist = 'Stand Alone/QNws';";
    $f[] = "\$wp_cache_mobile_browsers = 'Android, 2.0 MMP, 240x320, AvantGo, BlackBerry, Blazer, Cellphone, Danger, DoCoMo, Elaine/3.0, EudoraWeb, hiptop, IEMobile, iPhone, iPod, KYOCERA/WX310K, LG/U990, MIDP-2.0, MMEF20, MOT-V, NetFront, Newt, Nintendo Wii, Nitro, Nokia, Opera Mini, Palm, Playstation Portable, portalmmm, Proxinet, ProxiNet, SHARP-TQ-GX10, Small, SonyEricsson, Symbian OS, SymbianOS, TS21i-10, UP.Browser, UP.Link, Windows CE, WinWAP';";
    $f[] = "";
    $f[] = "// change to relocate the supercache plugins directory";
    $f[] = "\$wp_cache_plugins_dir = WPCACHEHOME . 'plugins';";
    $f[] = "// set to 1 to do garbage collection during normal process shutdown instead of wp-cron";
    $f[] = "\$wp_cache_shutdown_gc = 0;";
    $f[] = "\$wp_super_cache_late_init = 0;";
    $f[] = "";
    $f[] = "// uncomment the next line to enable advanced debugging features";
    $f[] = "\$wp_super_cache_advanced_debug = 0;";
    $f[] = "\$wp_super_cache_front_page_text = '';";
    $f[] = "\$wp_super_cache_front_page_clear = 0;";
    $f[] = "\$wp_super_cache_front_page_check = 0;";
    $f[] = "\$wp_super_cache_front_page_notification = '0';";
    $f[] = "";
    $f[] = "\$wp_cache_object_cache = 0;";
    $f[] = "\$wp_cache_anon_only = 0;";
    $f[] = "\$wp_supercache_cache_list = 0;";
    $f[] = "\$wp_cache_debug_to_file = 0;";
    $f[] = "\$wp_super_cache_debug = 0;";
    $f[] = "\$wp_cache_debug_level = 5;";
    $f[] = "\$wp_cache_debug_ip = '';";
    $f[] = "\$wp_cache_debug_log = '';";
    $f[] = "\$wp_cache_debug_email = '';";
    $f[] = "\$wp_cache_pages[ \"search\" ] = 0;";
    $f[] = "\$wp_cache_pages[ \"feed\" ] = 0;";
    $f[] = "\$wp_cache_pages[ \"category\" ] = 0;";
    $f[] = "\$wp_cache_pages[ \"home\" ] = 0;";
    $f[] = "\$wp_cache_pages[ \"frontpage\" ] = 0;";
    $f[] = "\$wp_cache_pages[ \"tag\" ] = 0;";
    $f[] = "\$wp_cache_pages[ \"archives\" ] = 0;";
    $f[] = "\$wp_cache_pages[ \"pages\" ] = 0;";
    $f[] = "\$wp_cache_pages[ \"single\" ] = 0;";
    $f[] = "\$wp_cache_pages[ \"author\" ] = 0;";
    $f[] = "\$wp_cache_hide_donation = 0;";
    $f[] = "\$wp_cache_not_logged_in = 0;";
    $f[] = "\$wp_cache_clear_on_post_edit = 0;";
    $f[] = "\$wp_cache_hello_world = 0;";
    $f[] = "\$wp_cache_mobile_enabled = 0;";
    $f[] = "\$wp_cache_cron_check = 0;";
    $f[] = "?>";
    if (is_file("{$WORKING_DIRECTORY}/wp-content/plugins/wp-super-cache/wp-cache-config-sample.php")) {
        @file_put_contents("{$WORKING_DIRECTORY}/wp-content/plugins/wp-super-cache/wp-cache-config.php", @implode("\n", $f));
    }
    @file_put_contents("{$WORKING_DIRECTORY}/wp-config.php", @implode("\n", $f));
    build_progress("{$servername}: wp-config.php {done}...", 50);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: {$WORKING_DIRECTORY}/wp-config.php done...\n";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: Testing configuration...\n";
    }
    if ($free->groupware_admin == null) {
        $ldap = new clladp();
        $free->groupware_admin = $ldap->ldap_admin;
        $free->groupware_password = $ldap->ldap_password;
    }
    $admin = $unix->shellEscapeChars($free->groupware_admin);
    $password = $unix->shellEscapeChars($free->groupware_password);
    $WORKING_DIRECTORY_CMDLINE = $unix->shellEscapeChars($WORKING_DIRECTORY);
    $cmd = array();
    $cmd[] = "/usr/share/artica-postfix/bin/wp-cli.phar core install";
    $cmd[] = "--url=\"{$servername}\"";
    $cmd[] = "--title=\"{$servername}\"";
    $cmd[] = "--admin_user={$admin}";
    $cmd[] = "--admin_password={$password}";
    $cmd[] = "--admin_email={$admin}@{$servername}";
    $cmd[] = "--path={$WORKING_DIRECTORY_CMDLINE}";
    $cmd[] = "--allow-root --debug --no-color 2>&1";
    $cmdline = @implode(" ", $cmd);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: {$cmdline}\n";
    }
    build_progress("{$servername}: {install_wordpress} {please_wait} !...", 51);
    exec($cmdline, $results1);
    while (list($num, $ligne) = each($results1)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: {$ligne}\n";
        }
    }
    build_progress("{$servername}: {enforce_security}", 52);
    secure_wp($WORKING_DIRECTORY);
    build_progress("{$servername}: {directory_size}", 53);
    $size = $unix->DIRSIZE_BYTES($free->WORKING_DIRECTORY);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$servername}: {$free->WORKING_DIRECTORY} {$size}Bytes\n";
    }
    $q->QUERY_SQL("UPDATE freeweb SET DirectorySize={$size} WHERE servername='{$servername}'", "artica_backup");
    if (!$q->ok) {
        system_admin_events("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "freewebs");
    }
}
コード例 #17
0
function update()
{
    $unix = new unix();
    $sock = new sockets();
    $filetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if ($GLOBALS["VERBOSE"]) {
        echo "filetime = {$filetime}\n";
        echo "pidfile = {$pidfile}\n";
    }
    $EnableSpamhausDROPList = $sock->GET_INFO("EnableSpamhausDROPList");
    if (!is_numeric($EnableSpamhausDROPList)) {
        $EnableSpamhausDROPList = 0;
    }
    if (!$GLOBALS["FORCE"]) {
        if (!$GLOBALS["VERBOSE"]) {
            $pid = $unix->get_pid_from_file($pidfile);
            if ($unix->process_exists($pid)) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "{$pid} already running !!!\n";
                }
                return;
            }
        }
    }
    @file_put_contents($pidfile, getmypid());
    if (!$GLOBALS["FORCE"]) {
        $time = $unix->file_time_min($filetime);
        if ($time < 1440) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$time}Mn !!!\n";
            }
            return;
        }
        @unlink($filetime);
        @file_put_contents($filetime, time());
    }
    $iptables = new iptables_chains();
    $curl = new ccurl("http://www.spamhaus.org/drop/drop.lasso");
    $curl->NoHTTP_POST = true;
    $tmpdir = $unix->TEMP_DIR();
    $destination = "{$tmpdir}/drop.lasso";
    if (!$curl->get()) {
        system_admin_events("Spamhaus DROP List failed {$curl->error}");
        return;
    }
    $drop = explode("\n", $curl->data);
    foreach ($drop as $line) {
        $line = trim($line);
        if (!empty($line) && substr($line, 0, 1) !== ';') {
            list($cidr, $sbl) = explode(" ; ", $line);
            $cidr = trim($cidr);
            $sbl = trim($sbl);
            //echo "iptables -A input -s $cidr -d 0/0 -j REJECT\n";
            //echo "iptables -A output -s 0/0 -d $cidr -j REJECT\n";
            $array[$cidr] = $sbl;
        }
    }
    $q = new mysql();
    $prefix = "INSERT IGNORE INTO iptables(\n\tservice,\n\tservername,\n\tserverip,\n\tlocal_port,\n\tdisable,\n\tevents_number,\n\trule_string,\n\trulemd5,\n\tflux,\n\tevents_block,\n\tdate_created,\n\tmultiples_ports,allow ) VALUES ";
    $date = date("Y-m-d H:i:s");
    while (list($cidr, $sbl) = each($array)) {
        $rulemd5 = md5("{$cidr}{$sbl}");
        $f[] = "('SpamHaus',\n\t\t'{$cidr}',\n\t\t'{$cidr}',\n\t\t'0',\n\t\t'0',\n\t\t'0',\n\t\t'iptables -A input -s {$cidr} -d 0/0 -j REJECT',\n\t\t'{$rulemd5}','INPUT',\n\t\t'Spamhaus DROP List',\n\t\t'{$date}',\n\t\t'0',0)";
    }
    if (count($f) > 0) {
        echo count($f) . " rules added";
        $q->QUERY_SQL("DELETE FROM iptables WHERE `service`='SpamHaus' AND `allow`=0", "artica_backup");
        $q->QUERY_SQL($prefix . @implode($f, ","), "artica_backup");
    }
    $php = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    $cmd = "{$nohup} {$php} /usr/share/artica-postfix/exec.postfix.iptables.php --spamhaus >/dev/null 2>&1 &";
    echo $cmd . "\n";
    shell_exec($cmd);
}
コード例 #18
0
ファイル: exec.squidguard.php プロジェクト: BillTheBest/1.6.x
function notify_remote_proxys()
{
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $q = new mysql_squid_builder();
    $sql = "SELECT * FROM squidservers";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $server = $ligne["ipaddr"];
        $port = $ligne["port"];
        if (!is_numeric($port)) {
            continue;
        }
        $refix = "https";
        $uri = "{$refix}://{$server}:{$port}/squid.stats.listener.php";
        writelogs($uri, __FUNCTION__, __FILE__, __LINE__);
        $curl = new ccurl($uri, true);
        $curl->parms["CHANGE_CONFIG"] = "FILTERS";
        if (!$curl->get()) {
            squidstatsApplianceEvents("{$server}:{$port}", "FAILED Notify change it`s configuration {$curl->error}");
            continue;
        }
        if (preg_match("#<ANSWER>OK</ANSWER>#is", $curl->data)) {
            squidstatsApplianceEvents("{$server}:{$port}", "SUCCESS to notify change it`s configuration");
            continue;
        }
        squidstatsApplianceEvents("{$server}:{$port}", "FAILED Notify change it`s configuration {$curl->data}");
    }
}
コード例 #19
0
function vxvault()
{
    $unix = new unix();
    $q = new mysql_squid_builder();
    $curl = new ccurl("http://vxvault.net/URL_List.php");
    $targetpath = $unix->FILE_TEMP();
    if (!$curl->GetFile($targetpath)) {
        if ($GLOBALS["VERBOSE"]) {
            echo "DOWNLOAD FAILED {$targetpath}\n";
        }
        @unlink($targetpath);
        return false;
    }
    $lastmd5 = @file_get_contents("/etc/artica-postfix/settings/Daemons/vxvault.md5");
    $Currentmd5 = md5_file($targetpath);
    if (!$GLOBALS["FORCE"]) {
        if ($lastmd5 == $Currentmd5) {
            return;
        }
    }
    $fp = @fopen($targetpath, "r");
    if (!$fp) {
        if ($GLOBALS["DEBUG_GREP"]) {
            echo "{$targetpath} BAD FD\n";
        }
        @unlink($targetpath);
        return array();
    }
    $c = 0;
    $t = array();
    while (!feof($fp)) {
        $line = trim(fgets($fp));
        $line = str_replace("\r\n", "", $line);
        $line = str_replace("\n", "", $line);
        $line = str_replace("\r", "", $line);
        $line = str_replace("\\", "/", $line);
        if (!preg_match("#^http#", $line)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "SKIP {$line}\n";
            }
            continue;
        }
        if (preg_match("#http:\\/\\/(.+?)#", $line, $re)) {
            $line = $re[1];
        }
        if (preg_match("#https:\\/\\/(.+?)#", $line, $re)) {
            $line = $re[1];
        }
        $md5 = md5($line);
        $SQLZ[] = "('{$md5}',NOW(),'{$line}',1)";
        if (count($SQLZ) > 500) {
            $q->QUERY_SQL($GLOBALS["PREFIX"] . @implode(",", $SQLZ));
            if (!$q->ok) {
                echo $q->mysql_error;
                @fclose($fp);
                @unlink($targetpath);
                return;
            }
        }
    }
    @fclose($fp);
    @unlink($targetpath);
    if (count($SQLZ) > 0) {
        $q->QUERY_SQL($GLOBALS["PREFIX"] . @implode(",", $SQLZ));
        if (!$q->ok) {
            echo $q->mysql_error;
            return;
        }
    }
    @file_put_contents("/etc/artica-postfix/settings/Daemons/vxvault.md5", $Currentmd5);
}
コード例 #20
0
ファイル: squid.webalyzer.php プロジェクト: BillTheBest/1.6.x
function analyze()
{
    if ($GLOBALS["VERBOSE"]) {
        echo "analyze<br>\n";
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $uri = $_GET["uri"];
    $curl = new ccurl($uri);
    if ($GLOBALS["VERBOSE"]) {
        echo "{$uri}<br>\n";
    }
    $filename = md5($uri);
    if (!$curl->GetFile("ressources/logs/web/{$filename}")) {
        echo "<H2>" . $curl->error . "</H2>";
        return;
    }
    $ARRY = array();
    if ($GLOBALS["VERBOSE"]) {
        echo "Open ressources/logs/web/{$filename}<br>\n";
    }
    $datas = @file_get_contents("ressources/logs/web/{$filename}");
    $tb = explode("\n", $datas);
    @unlink("ressources/logs/web/{$filename}");
    if (preg_match("#google\\..+?#", $uri)) {
        if (preg_match_all('#<h3 class="r"><a href="(.+?)"#', $datas, $re)) {
            while (list($num, $uri) = each($re[1])) {
                if (preg_match("#^(?:[^/]+://)?([^/:]+)#", $uri, $ri)) {
                    $sitename = $ri[1];
                    if (substr($sitename, 0, 1) == "#") {
                        continue;
                    }
                    if (preg_match("#^www\\.(.+)#", $sitename, $ri)) {
                        $sitename = $ri[1];
                    }
                    if (preg_match("#\\.php\\?#", $sitename)) {
                        continue;
                    }
                    if (preg_match("#\\.php\$#", $sitename)) {
                        continue;
                    }
                    $ARRY[$sitename] = $sitename;
                }
            }
        }
    }
    while (list($num, $line) = each($tb)) {
        if (preg_match("#<a\\s+href=(.*)\\.([a-z]+)#i", $line, $re)) {
            $uri = trim($re[1] . "." . $re[2]);
            $uri = str_replace("\"", "", $uri);
            $uri = str_replace("'", "", $uri);
            if (strpos($uri, ">") > 0) {
                $uri = substr($uri, 0, strpos($uri, ">"));
            }
            if (preg_match("#^(?:[^/]+://)?([^/:]+)#", $uri, $re)) {
                $sitename = $re[1];
                if (substr($sitename, 0, 1) == "#") {
                    continue;
                }
                if (preg_match("#^www\\.(.+)#", $sitename, $ri)) {
                    $sitename = $ri[1];
                }
                if (preg_match("#\\.php\\?#", $sitename)) {
                    continue;
                }
                if (preg_match("#\\.php\\s+[a-z]#", $sitename)) {
                    continue;
                }
                if (preg_match("#\\.php\$#", $sitename)) {
                    continue;
                }
                if (strpos($sitename, ".") == 0) {
                    continue;
                }
                if (strpos($sitename, "{") > 0) {
                    continue;
                }
                if (strpos($sitename, "}") > 0) {
                    continue;
                }
                if (strpos($sitename, "\$") > 0) {
                    continue;
                }
                $ARRY[trim(strtolower($sitename))] = trim(strtolower($sitename));
            }
        }
    }
    $html = "\n\t";
    $f = 0;
    $s = 0;
    $t = 0;
    while (list($num, $line) = each($ARRY)) {
        if (strlen($num) < 3) {
            continue;
        }
        if ($num == "javascript") {
            continue;
        }
        if (strpos($num, ".") == 0) {
            continue;
        }
        if (strpos($num, "{") > 0) {
            continue;
        }
        if (strpos($num, " ") > 0) {
            continue;
        }
        if (strpos($num, "}") > 0) {
            continue;
        }
        if (strpos($num, "\$") > 0) {
            continue;
        }
        $tz = explode(".", $num);
        if ($tz[count($tz) - 1] == "php") {
            continue;
        }
        if ($tz[count($tz) - 1] == "html") {
            continue;
        }
        if ($tz[count($tz) - 1] == "htm") {
            continue;
        }
        if (preg_match("#\\.php\\?#", $num)) {
            continue;
        }
        if (preg_match("#\\.php\$#", $num)) {
            continue;
        }
        $t++;
        if ($t > 200) {
            break;
        }
        $cats = $q->GET_CATEGORIES($num);
        $mustcat = "&nbsp;";
        $color = "black";
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        if ($cats == null) {
            $tt = explode(".", $num);
            $familysite = $tt[count($tt) - 2] . "." . $tt[count($tt) - 1];
            $q->QUERY_SQL("INSERT IGNORE INTO visited_sites (sitename,familysite) VALUES ('{$num}','{$familysite}')");
            $f++;
            $cats = "&nbsp;";
            $mustcat = imgtootltip("add-database-32.png", "{categorize}", "Loadjs('squid.categorize.php?www={$num}')");
            $color = "#CC0A0A";
        } else {
            $s++;
        }
        $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t<td style='font-size:14px;color:{$color}'>{$num}</td>\n\t\t<td style='font-size:14px'>{$cats}</td>\n\t\t<td width=1%>{$mustcat}</td>\n\t\t</tr>\n\t\t";
    }
    //javascript:Loadjs('squid.categorize.php?www=api161.thefilter.com&day=&week=');
    $purc = round($s / $t * 100, 2);
    $html = "<center><table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n\t<thead class='thead'>\n\t<tr>\n\t<th>{$t} {websites} {$f} {failed} {$s} {success} {$purc}%</th>\n\t<th>{category}</th>\n\t<th>&nbsp;</th>\n\t</tr>\n</thead>\n<tbody>{$html}</tbody></table><span id='webalyzer-lock'></span>";
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #21
0
function inject_array_remote($array)
{
    $sock = new sockets();
    $ArticaHttpsPort = $sock->GET_INFO("ArticaHttpsPort");
    if (!is_numeric($ArticaHttpsPort)) {
        $ArticaHttpsPort = 9000;
    }
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    if ($GLOBALS["REMOTE_SSL"] == 1) {
        $refix = "https";
    } else {
        $refix = "http";
    }
    $uri = "{$refix}://{$GLOBALS["REMOTE_SSERVER"]}:{$GLOBALS["REMOTE_SPORT"]}/squid.stats.listener.php";
    events("Injecting -> {$uri} on line:" . __LINE__);
    $curl = new ccurl($uri, true);
    $f = base64_encode(serialize($array));
    $curl->parms["STATS_LINE"] = $f;
    $curl->parms["MYSSLPORT"] = $ArticaHttpsPort;
    if (!$curl->get()) {
        inject_failed($array);
        events("Injecting -> FAILED " . $curl->error . " on line:" . __LINE__);
        echo "FAILED " . $curl->error . "\n";
        return;
    }
    if (preg_match("#<ANSWER>OK</ANSWER>#is", $curl->data)) {
        return true;
    }
    events("Injecting -> FAILED " . $curl->data . " on line:" . __LINE__);
    echo "FAILED " . $curl->data . "\n";
    inject_failed($array);
}
コード例 #22
0
function BlockIPs()
{
    $ipClass = new IP();
    $unix = new unix();
    $tmpdir = $unix->TEMP_DIR();
    $curl = new ccurl("https://rules.emergingthreatspro.com/fwrules/emerging-Block-IPs.txt");
    $targetpath = "{$tmpdir}/emerging-Block-IPs.txt";
    if (!$curl->GetFile($targetpath)) {
        echo "{$targetpath} failed\n";
        artica_update_event(0, "Unable to download emerging-Block-IPs.txt", $curl->errors, __FILE__, __LINE__);
        return;
    }
    $f = explode("\n", @file_get_contents($targetpath));
    $proxyname = $unix->hostname_g();
    $q = new postgres_sql();
    $q->suricata_tables();
    $tr = array();
    while (list($num, $ligne) = each($f)) {
        $ligne = trim($ligne);
        if ($ligne == null) {
            continue;
        }
        if (strpos(" {$ligne}", "#") > 0) {
            continue;
        }
        if (!$ipClass->isIPAddressOrRange($ligne)) {
            continue;
        }
        $zdate = date("Y-m-d H:i:s");
        $proto = "TCP";
        $dest_port = 0;
        $src_ip = $ligne;
        $uduniq = md5("0,{$src_ip},{$dest_port},{$proto}");
        if ($GLOBALS["VERBOSE"]) {
            echo "0,{$src_ip},{$dest_port},{$proto}\n";
        }
        $tr[] = "('{$zdate}','{$uduniq}','0','{$src_ip}','{$dest_port}','{$proto}','{$proxyname}',1)";
    }
    if (count($tr) > 0) {
        $q->QUERY_SQL("DELETE FROM suricata_firewall WHERE xauto=1");
    }
    $content = @implode(",", $tr);
    $prefix = "INSERT INTO suricata_firewall (zdate,uduniq,signature,src_ip,dst_port,proto,proxyname,xauto) VALUES ";
    $q->QUERY_SQL("{$prefix} {$content} ON CONFLICT DO NOTHING");
    if (!$q->ok) {
        echo $q->mysql_error . "\n";
        return;
    }
    $php = $unix->LOCATE_PHP5_BIN();
    shell_exec("{$php} /usr/share/artica-postfix/exec.suricata-fw.php --run");
}
コード例 #23
0
function install($filekey = 0, $OS)
{
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $unix = new unix();
    $filename = null;
    $MD5 = null;
    $DebianVersion = DebianVersion();
    if ($OS != $DebianVersion) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, influxdb Debian version incompatible!\n";
        }
        build_progress_idb("Incompatible system {$OS}<>{$DebianVersion}!", 110);
        die;
    }
    if ($filekey != 0) {
        $sock = new sockets();
        $ArticaTechNetHaProxyRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetHaProxyRepo")));
        $version = $ArticaTechNetHaProxyRepo[$filekey][$OS]["VERSION"];
        $filename = $ArticaTechNetHaProxyRepo[$filekey][$OS]["FILENAME"];
        $MD5 = $ArticaTechNetHaProxyRepo[$filekey][$OS]["MD5"];
        $URL = $ArticaTechNetHaProxyRepo[$filekey][$OS]["URL"];
    }
    $rmmod = $unix->find_program("rmmod");
    $depmod = $unix->find_program("depmod");
    $modprobe = $unix->find_program("modprobe");
    $ldconfig = $unix->find_program("ldconfig");
    echo "Downloading {$URL}\n";
    $curl = new ccurl($URL);
    $tmpdir = $unix->TEMP_DIR();
    $php = $unix->LOCATE_PHP5_BIN();
    build_progress_idb("{downloading}", 1);
    $curl->WriteProgress = true;
    $curl->ProgressFunction = "download_progress";
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: Downloading {$filename}\n";
    }
    if (!$curl->GetFile("{$tmpdir}/{$filename}")) {
        build_progress_idb("{$curl->error}", 110);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$curl->error}\n";
        }
        while (list($key, $value) = each($curl->errors)) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$value}\n";
            }
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, HaProxy unable to install....\n";
        }
        @unlink("{$tmpdir}/{$filename}");
        return;
    }
    if ($MD5 != null) {
        $DESTMD5 = md5_file("{$tmpdir}/{$filename}");
        if ($DESTMD5 != $MD5) {
            echo "{$DESTMD5}<>{$MD5}\n";
            @unlink("{$tmpdir}/{$filename}");
            build_progress_idb("{install_failed} {corrupted_package}", 110);
            return;
        }
    }
    build_progress_idb("{stopping_service}", 95);
    if (!is_file("/etc/init.d/haproxy")) {
        system("{$php} /usr/share/artica-postfix/exec.initslapd.php --haproxy");
    }
    system("/etc/init.d/firehol stop");
    system("/etc/init.d/haproxy stop");
    build_progress_idb("{extracting}", 96);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, extracting....\n";
    }
    $tar = $unix->find_program("tar");
    shell_exec("{$tar} xvf {$tmpdir}/{$filename} -C /");
    build_progress_idb("{installing} 1/1", 96);
    system("{$ldconfig}");
    if ($GLOBALS["PROGRESS"]) {
        build_progress_idb("{restarting_service}", 97);
        system("{$php} /usr/share/artica-postfix/exec.status.php --haproxy >/dev/null");
        system("/etc/init.d/artica-status restart --force");
        build_progress_idb("{restarting_service} 1/2", 98);
        system("/etc/init.d/haproxy restart");
        build_progress_idb("{restarting_service} 2/2", 98);
        system("/etc/init.d/firehol restart");
    }
    build_progress_idb("{refresh_status}", 98);
    build_progress_idb("{done}", 100);
}
コード例 #24
0
ファイル: exec.nightly.php プロジェクト: brucewu16899/1.6.x
function nightly()
{
    @mkdir("/var/log/artica-postfix", 0755, true);
    $GLOBALS["MasterIndexFile"] = "/usr/share/artica-postfix/ressources/index.ini";
    $unix = new unix();
    $sock = new sockets();
    $autoinstall = true;
    $timefile = "/etc/artica-postfix/croned.1/nightly";
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $pid = @file_get_contents($pidfile);
    $kill = $unix->find_program("kill");
    $tmpdir = $unix->TEMP_DIR();
    $php5 = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        echo "Starting......: " . date("H:i:s") . " nightly build already executed PID: {$pid} since {$time}Mn\n";
        system_admin_events("nightly build already executed PID: {$pid} since {$time}Mn", __FUNCTION__, __FILE__, __LINE__, "artica-update");
        if ($time < 120) {
            if (!$GLOBALS["FORCE"]) {
                die;
            }
        }
        unix_system_kill_force($pid);
    }
    $mypid = getmypid();
    @file_put_contents($pidfile, $mypid);
    $EnableScheduleUpdates = $sock->GET_INFO("EnableScheduleUpdates");
    if (!is_numeric($EnableScheduleUpdates)) {
        $EnableScheduleUpdates = 0;
    }
    if ($GLOBALS["FORCE"]) {
        _artica_update_event(1, "Update task pid {$mypid} is forced by an human.", null, __FILE__, __LINE__);
    }
    if ($EnableScheduleUpdates == 1) {
        if (!$GLOBALS["FORCE"]) {
            if (!$GLOBALS["BYCRON"]) {
                _artica_update_event(2, "Operation must be only executed by scheduler ( use --force to by pass)", null, __FILE__, __LINE__);
                @file_put_contents("/usr/share/artica-postfix/download_progress", 100);
                return;
            }
        }
    }
    $ini = new iniFrameWork();
    $ini->loadFile('/etc/artica-postfix/artica-update.conf');
    if (!isset($ini->_params["AUTOUPDATE"]["enabled"])) {
        $ini->_params["AUTOUPDATE"]["enabled"] = "yes";
    }
    if (trim($ini->_params["AUTOUPDATE"]["enabled"]) == null) {
        $ini->_params["AUTOUPDATE"]["enabled"] = "yes";
    }
    if ($ini->_params["AUTOUPDATE"]["enabled"] == null) {
        $ini->_params["AUTOUPDATE"]["enabled"] = "yes";
    }
    if (trim($ini->_params["AUTOUPDATE"]["uri"]) == null) {
        $ini->_params["AUTOUPDATE"]["uri"] = "http://www.articatech.net/auto.update.php";
    }
    if ($ini->_params["AUTOUPDATE"]["enabled"] == 1) {
        $ini->_params["AUTOUPDATE"]["enabled"] = 'yes';
    }
    if (!is_numeric(trim($ini->_params["AUTOUPDATE"]["CheckEveryMinutes"]))) {
        $ini->_params["AUTOUPDATE"]["CheckEveryMinutes"] = 60;
    }
    if ($ini->_params["AUTOUPDATE"]["enabled"] != 'yes') {
        echo "Starting......: " . date("H:i:s") . " Artica Update feature is disabled (enabled = {$ini->_params["AUTOUPDATE"]["enabled"]} )\n";
        return;
    }
    $CheckEveryMinutes = $ini->_params["AUTOUPDATE"]["CheckEveryMinutes"];
    $uri = $ini->_params["AUTOUPDATE"]["uri"];
    $arrayURI = parse_url($uri);
    $MAIN_URI = "{$arrayURI["scheme"]}://{$arrayURI["host"]}";
    $MAIN_URI = str_replace("www.artica.fr", "www.articatech.net", $MAIN_URI);
    if (!$GLOBALS["FORCE"]) {
        if ($EnableScheduleUpdates == 0) {
            if ($unix->file_time_min($timefile) < $CheckEveryMinutes) {
                echo "Starting......: " . date("H:i:s") . " update feature (too short time, require {$CheckEveryMinutes}mn)\n";
                @file_put_contents("/usr/share/artica-postfix/download_progress", 100);
                return;
            }
        }
    }
    @unlink($timefile);
    @file_put_contents($timefile, time());
    if ($GLOBALS["FORCE"]) {
        if (is_file("/root/artica-latest.tgz")) {
            echo "Starting......: " . date("H:i:s") . " Installing old downloaded package\n";
            if (install_package("/root/artica-latest.tgz")) {
                return;
            }
        }
    }
    // ----------------------- LANCEMENT ------------------------------------------------------------------------------
    $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient"));
    if ($EnableArticaMetaClient == 1) {
        echo "Starting......: " . date("H:i:s") . " Nightly builds using Artica Meta console\n";
        system("{$nohup} {$php5} /usr/share/artica-postfix/exec.artica-meta-client.php --artica-updates >/dev/null 2>&1 &");
        die;
    }
    echo "Starting......: " . date("H:i:s") . " Nightly builds checking an official release first\n";
    if (update_release()) {
        return;
    }
    $nightly = trim(strtolower($ini->_params["AUTOUPDATE"]["nightlybuild"]));
    if ($nightly == 1) {
        $nightly = "yes";
    }
    if ($GLOBALS["FORCE"]) {
        $nightly = "yes";
    }
    if ($GLOBALS["FORCE_NIGHTLY"]) {
        $nightly = "yes";
    }
    if ($nightly != 'yes') {
        echo "Starting......: " . date("H:i:s") . " Nightly builds feature is disabled [{$nightly}]\n";
        @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/download_progress", 100);
        return;
    }
    if ($ini->_params["AUTOUPDATE"]["autoinstall"] == 1) {
        $ini->_params["AUTOUPDATE"]["autoinstall"] = "yes";
    }
    if (trim($ini->_params["AUTOUPDATE"]["autoinstall"]) == null) {
        $ini->_params["AUTOUPDATE"]["autoinstall"] = "yes";
    }
    if ($ini->_params["AUTOUPDATE"]["autoinstall"] != "yes") {
        $autoinstall = false;
    }
    @file_put_contents("/usr/share/artica-postfix/download_progress", 0);
    $MyCurrentVersion = GetCurrentVersion();
    echo "Starting......: " . date("H:i:s") . " Current version: {$MyCurrentVersion}\n";
    $Lastest = trim(strtolower($GLOBALS["lastest-nightly"]));
    echo "Starting......: " . date("H:i:s") . " Nightly builds version \"{$Lastest}\" on repository\n";
    $MyNextVersion = intval(str_replace(".", "", $Lastest));
    echo "Starting......: " . date("H:i:s") . " nightly builds Cur:{$MyCurrentVersion}, Next:{$MyNextVersion}\n";
    if ($MyNextVersion == $MyCurrentVersion) {
        echo "Starting......: " . date("H:i:s") . " nightly builds {$MyCurrentVersion}/{$MyNextVersion} \"Up to date - Same version\"\n";
        @file_put_contents("/usr/share/artica-postfix/download_progress", 100);
        return;
    }
    if ($MyCurrentVersion > $MyNextVersion) {
        echo "Starting......: " . date("H:i:s") . " nightly builds {$MyCurrentVersion}/{$MyNextVersion} \"Up to date - Most updated\"\n";
        @file_put_contents("/usr/share/artica-postfix/download_progress", 100);
        return;
    }
    $t1 = time();
    _artica_update_event(2, "nightly builds Downloading new version {$Lastest}", null, __FILE__, __LINE__);
    echo "Starting......: " . date("H:i:s") . " nightly builds Downloading new version {$Lastest}, please wait\n";
    events("Downloading new version {$Lastest}");
    $uri = "{$MAIN_URI}/nightbuilds/artica-{$Lastest}.tgz";
    $ArticaFileTemp = "{$tmpdir}/{$Lastest}/artica-{$Lastest}.tgz";
    @mkdir("{$tmpdir}/{$Lastest}", 0755, true);
    $curl = new ccurl($uri);
    $curl->Timeout = 2400;
    $curl->WriteProgress = true;
    $curl->ProgressFunction = "nightly_progress";
    $t = time();
    if (!$curl->GetFile($ArticaFileTemp)) {
        _artica_update_event(0, "nightly builds Unable to download latest nightly build with error {$curl->error}", null, __FILE__, __LINE__);
        events("Unable to download latest nightly build with error {$curl->error}");
        system_admin_events("Unable to download latest nightly build with error {$curl->error}", __FUNCTION__, __FILE__, __LINE__, "artica-update");
        @unlink($ArticaFileTemp);
        return;
    }
    $took = $unix->distanceOfTimeInWords($t, time(), true);
    _artica_update_event(2, "artica-{$Lastest}.tgz download, took {$took}", null, __FILE__, __LINE__);
    system_admin_events("artica-{$Lastest}.tgz download, took {$took}", __FUNCTION__, __FILE__, __LINE__, "artica-update");
    events("artica-{$Lastest}.tgz download, took {$took}");
    $size = @filesize($ArticaFileTemp);
    $size = FormatBytes($size / 1024, true);
    ArticaMeta_nightly($ArticaFileTemp);
    echo "Starting......: " . date("H:i:s") . " nightly builds took {$took}\n";
    if (!$GLOBALS["FORCE"]) {
        if ($autoinstall == false) {
            _artica_update_event(2, "artica-latest.tgz will be stored in /root", null, __FILE__, __LINE__);
            @copy("{$ArticaFileTemp}", "/root/artica-latest.tgz");
            @unlink($ArticaFileTemp);
            _artica_update_event(1, "Nightly builds New Artica update v.{$Lastest} ({$size}) waiting order", null, __FILE__, __LINE__);
            system_admin_events("New Artica update v.{$Lastest} waiting your order", __FUNCTION__, __FILE__, __LINE__, "artica-update");
            return;
        } else {
        }
    }
    events("Now, installing the newest version in {$ArticaFileTemp} package...");
    $size = @filesize($ArticaFileTemp);
    $size = FormatBytes($size / 1024, true);
    if (!install_package($ArticaFileTemp, $Lastest)) {
        events("Install package Failed...");
        return false;
    }
    events("New Artica update v.{$Lastest}");
    _artica_update_event(1, "Nightly builds New Artica update v.{$Lastest} ({$size})", null, __FILE__, __LINE__);
    system_admin_events("New Artica update v.{$Lastest}", __FUNCTION__, __FILE__, __LINE__, "artica-update");
}
コード例 #25
0
function HyperCacheGetMimeType($uri, $ID)
{
    $curl = new ccurl($uri);
    if (!$curl->GetHeads()) {
        events("headers {failed} {$uri} Error number: {$curl->CURLINFO_HTTP_CODE}", $ID, 1, __LINE__);
        return "NONE_{$curl->CURLINFO_HTTP_CODE}";
    }
    if ($curl->CURLINFO_HTTP_CODE == 501) {
        return "NONE_501";
    }
    $content_type = $curl->CURL_ALL_INFOS["content_type"];
    if (strpos($content_type, ";") > 0) {
        $tbl = explode(";", $content_type);
        $content_type = trim($tbl[0]);
    }
    return $content_type;
}
コード例 #26
0
ファイル: exec.abuse-ch.php プロジェクト: articatech/artica
function xstart()
{
    $curl = new ccurl();
    $unix = new unix();
    $Pidfile = "/etc/artica-postfix/pids/exec.abuse-ch.pid";
    $PidTime = "/etc/artica-postfix/pids/exec.abuse-ch.time";
    $pid = $unix->get_pid_from_file($Pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Aborting Task already running pid {$pid} " . __FUNCTION__ . "()\n";
        }
        return;
    }
    @file_put_contents($Pidfile, getmypid());
    if (!$GLOBALS["VERBOSE"]) {
        $time = $unix->file_time_min($PidTime);
        if ($time < 10) {
            echo "Only each 10mn\n";
            die;
        }
        @unlink($PidTime);
        @file_put_contents($PidTime, time());
    }
    $curl = new ccurl("http://articatech.net/WebfilterDBS/ransomwaretracker.txt");
    $tmpfile = $unix->TEMP_DIR();
    if (!$curl->GetFile("{$tmpfile}/ransomwaretracker.txt")) {
        squid_admin_mysql(0, "ransomwaretracker.txt unable to get index file", $curl->error, __FILE__, __LINE__);
        return;
    }
    $array = unserialize(@file_get_contents("{$tmpfile}/ransomwaretracker.txt"));
    $TIME = $array["TIME"];
    if (!isset($array["MD5"])) {
        squid_admin_mysql(0, "ransomwaretracker.txt corrupted file", $curl->error, __FILE__, __LINE__);
        return;
    }
    @unlink("{$tmpfile}/ransomwaretracker.txt");
    $CurrentMD5 = @file_get_contents("/etc/artica-postfix/settings/Daemons/ransomwaretrackerMD5");
    if ($CurrentMD5 == $array["MD5"]) {
        return;
    }
    $curl = new ccurl("http://articatech.net/WebfilterDBS/ransomwaretracker.gz");
    if (!$curl->GetFile("{$tmpfile}/ransomwaretracker.gz")) {
        squid_admin_mysql(0, "ransomwaretracker.gz unable to get pattern file", $curl->error, __FILE__, __LINE__);
        return;
    }
    if (!$unix->uncompress("{$tmpfile}/ransomwaretracker.gz", "{$tmpfile}/ransomwaretracker.db")) {
        squid_admin_mysql(0, "ransomwaretracker.gz unable to extract file", $curl->error, __FILE__, __LINE__);
        return;
    }
    $ARRAY = unserialize(@file_get_contents("{$tmpfile}/ransomwaretracker.db"));
    if (!isset($ARRAY["URIS"])) {
        squid_admin_mysql(0, "ransomwaretracker.db corrupted database", $curl->error, __FILE__, __LINE__);
        return;
    }
    if (is_file("/etc/squid3/ransomwaretracker.db")) {
        @unlink("/etc/squid3/ransomwaretracker.db");
    }
    @copy("{$tmpfile}/ransomwaretracker.db", "/etc/squid3/ransomwaretracker.db");
    if (!is_file("/etc/artica-postfix/settings/Daemons/RansomwareReloaded")) {
        squid_admin_mysql(1, "Reloading Proxy service for updating Ranswomware function", null, __FILE__, __LINE__);
        $squid = $unix->LOCATE_SQUID_BIN();
        shell_exec("{$squid} -f /etc/squid3/squid.conf -k reconfigure");
        @touch("/etc/artica-postfix/settings/Daemons/RansomwareReloaded");
    }
    squid_admin_mysql(2, "Success updating ranswomware database v{$TIME}", null, __FILE__, __LINE__);
}
コード例 #27
0
ファイル: exec.backup.php プロジェクト: articatech/artica
function backup_webget($ID, $array)
{
    if ($GLOBALS["VERBOSE"]) {
        print_r($array);
    }
    $RemoteArticaServer = $array["RemoteArticaServer"];
    $RemoteArticaPort = $array["RemoteArticaPort"];
    $RemoteArticaUser = $array["RemoteArticaUser"];
    $RemoteArticaPassword = $array["RemoteArticaPassword"];
    $RemoteArticaSite = $array["RemoteArticaSite"];
    $AutoRestore = $array["AutoRestore"];
    $AutoRestoreSqlInstance = $array["AutoRestoreSqlInstance"];
    $AutoRestoreSiteName = $array["AutoRestoreSiteName"];
    if (!is_numeric($AutoRestore)) {
        $AutoRestore = 0;
    }
    if (!is_numeric($AutoRestoreSqlInstance)) {
        $AutoRestoreSqlInstance = 0;
    }
    $array["RemoteArticaPassword"] = md5($array["RemoteArticaPassword"]);
    $unix = new unix();
    $rm = $unix->find_program("rm");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $RESULTS = null;
    if (trim($RemoteArticaServer) == null) {
        backup_events($ID, $RemoteArticaSite, "ERROR, No remote Artica server defined...", __LINE__);
        return;
    }
    if (!is_numeric($RemoteArticaPort)) {
        $RemoteArticaPort = 9000;
    }
    $uri = "https://{$RemoteArticaServer}:{$RemoteArticaPort}";
    backup_events($ID, $RemoteArticaSite, "INFO, Connecting to {$uri} in order to send backup order.", __LINE__);
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $params = base64_encode(serialize($array));
    $curl = new ccurl("{$uri}/exec.articaget.php?params={$params}");
    $curl->Timeout = 5600;
    $curl->NoHTTP_POST = true;
    if (!$curl->get()) {
        backup_events($ID, $RemoteArticaSite, "ERROR, Connecting to {$uri} {$curl->error}", __LINE__);
        return;
    }
    $datas = $curl->data;
    if (preg_match("#<LOGS>(.*?)</LOGS>#is", $datas, $re)) {
        $events = $re[1];
    }
    if (preg_match("#<RESULTS>(.*?)</RESULTS>#is", $datas, $re)) {
        $RESULTS = $re[1];
    }
    if ($RESULTS == null) {
        backup_events($ID, $RemoteArticaSite, "ERROR, No answer from {$RemoteArticaServer} ??? {$datas}", __LINE__);
        return;
    }
    if ($RESULTS != "SUCCESS") {
        if ($GLOBALS["VERBOSE"]) {
            echo "\nFAILED\n\n";
        }
        backup_events($ID, $RemoteArticaSite, "ERROR, Failed -> `{$RESULTS}`", __LINE__);
        backup_events($ID, $RemoteArticaSite, "INFO, {$events}", __LINE__);
        return;
    }
    backup_events($ID, $RemoteArticaSite, "INFO,downloading {$RemoteArticaSite}.tar.gz package", __LINE__);
    $curl = new ccurl("{$uri}/ressources/logs/web/{$RemoteArticaSite}.tar.gz");
    $curl->Timeout = 5600;
    $curl->NoHTTP_POST = true;
    @mkdir("/var/tmp/{$RemoteArticaSite}", 0755, true);
    if ($GLOBALS["VERBOSE"]) {
        echo "\nDownloading {$uri}/ressources/logs/web/{$RemoteArticaSite}.tar.gz\n\n";
    }
    $curdate = date("YmdH");
    if (!$curl->GetFile("/var/tmp/{$RemoteArticaSite}/{$RemoteArticaSite}-{$curdate}.tar.gz")) {
        backup_events($ID, $RemoteArticaSite, "ERROR, Failed downloading {$RemoteArticaSite}.tar.gz {$curl->error}", __LINE__);
        return;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "\n\n";
    }
    backup_events($ID, $RemoteArticaSite, "INFO, Connecting to {$uri} in order to cleaning the backup container.", __LINE__);
    $curl = new ccurl("{$uri}/exec.articaget.php?params={$params}&remove=yes");
    $curl->NoHTTP_POST = true;
    if (!$curl->get()) {
        backup_events($ID, $RemoteArticaSite, "ERROR, ordering to cleaning container...{$uri} {$curl->error}", __LINE__);
    }
    //Auto-restore
    if ($AutoRestore == 0) {
        backup_events($ID, $RemoteArticaSite, "INFO the Autorestore feature is disabled...", __LINE__);
    }
    if ($AutoRestore == 1) {
        backup_events($ID, $RemoteArticaSite, "INFO the Autorestore feature is enabled on `{$AutoRestoreSiteName}` local website...", __LINE__);
        if ($AutoRestoreSiteName != null) {
            $tt1 = time();
            backup_events($ID, $RemoteArticaSite, "INFO, auto-restore {$RemoteArticaSite}.tar.gz to {$AutoRestoreSiteName}", __LINE__);
            $cmd = "{$php5} " . dirname(__FILE__) . "/exec.freeweb.php --restore \"{$AutoRestoreSiteName}\" \"/var/tmp/{$RemoteArticaSite}/{$RemoteArticaSite}-{$curdate}.tar.gz\" {$AutoRestoreSqlInstance} --verbose 2>&1";
            exec($cmd, $AutorestoreResults);
            $tt2 = time();
            $took = $unix->distanceOfTimeInWords($tt1, $tt2, true);
            backup_events($ID, $RemoteArticaSite, "INFO, Auto-restore finish took {$took}, see details:\n" . @implode("\n", $AutorestoreResults), __LINE__);
        } else {
            backup_events($ID, $RemoteArticaSite, "ERROR, Autorestore disabled `AutoRestoreSiteName` is null ", __LINE__);
        }
    }
    $DestinationPath = "{$GLOBALS["MOUNTED_PATH_FINAL"]}/freewebs/webget.{$RemoteArticaSite}";
    backup_mkdir($DestinationPath);
    if (!backup_isdir($DestinationPath)) {
        backup_events($ID, $RemoteArticaSite, "ERROR, {$DestinationPath} permission denied or no such file or directory", __LINE__);
        @unlink("/var/tmp/{$RemoteArticaSite}/{$RemoteArticaSite}.tar.gz");
        return false;
    }
    $info = backup_copy("/var/tmp/{$RemoteArticaSite}/", "{$DestinationPath}", $ID);
    backup_events($ID, $RemoteArticaSite, "INFO,/var/tmp/{$RemoteArticaSite}\n{$info}", __LINE__);
    backup_events($ID, $RemoteArticaSite, "INFO,cleaning /var/tmp/{$RemoteArticaSite}", __LINE__);
    if (is_dir("/var/tmp/{$RemoteArticaSite}")) {
        shell_exec("{$rm} -rf /var/tmp/{$RemoteArticaSite}");
    }
}
コード例 #28
0
function categorize_delete()
{
    $unix = new unix();
    $URIBASE = $unix->MAIN_URI();
    $tmpdir = $unix->TEMP_DIR();
    if (!is_file("{$tmpdir}/categorize_delete.sql")) {
        $curl = new ccurl("{$URIBASE}/blacklist/categorize_delete.gz");
        if (!$curl->GetFile("{$tmpdir}/categorize_delete.gz")) {
            // ufdbguard_admin_events("Fatal: unable to download categorize_delete.gz file $curl->error",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
            return;
        }
        if (!extractGZ("{$tmpdir}/categorize_delete.gz", "{$tmpdir}/categorize_delete.sql")) {
            // ufdbguard_admin_events("Fatal: unable to extract $tmpdir/categorize_delete.gz",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
            return;
        }
    }
    $q = new mysql_squid_builder();
    $datas = explode("\n", @file_get_contents("{$tmpdir}/categorize_delete.sql"));
    while (list($index, $row) = each($datas)) {
        if (trim($row) == null) {
            continue;
        }
        $ligne = unserialize($row);
        $category = $ligne["category"];
        $pattern = $ligne["sitename"];
        $tablename = "category_" . $q->category_transform_name($category);
        if (!$q->TABLE_EXISTS($tablename)) {
            $q->CreateCategoryTable($category);
        }
        $q->QUERY_SQL("UPDATE {$tablename} SET enabled=0 WHERE `pattern`='{$pattern}'");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    // ufdbguard_admin_events("Success updating deleted ". count($datas)." websites from categories",__FUNCTION__,__FILE__,__LINE__,"ufbd-artica");
    @unlink("{$tmpdir}/categorize_delete.sql");
}
コード例 #29
0
ファイル: compile-squid32.php プロジェクト: BillTheBest/1.6.x
function latests()
{
    $unix = new unix();
    $curl = new ccurl("http://www.squid-cache.org/Versions/v3/3.2/");
    if (!$curl->GetFile("/tmp/index.html")) {
        echo "{$curl->error}\n";
        return 0;
    }
    $f = explode("\n", @file_get_contents("/tmp/index.html"));
    while (list($num, $line) = each($f)) {
        if (preg_match("#<a href=\"squid-(.+?)\\.tar\\.gz#", $line, $re)) {
            $ve = $re[1];
            $STT = explode(".", $ve);
            $CountDeSTT = count($STT);
            if ($CountDeSTT < 4) {
                $ve = "{$ve}.00";
            }
            $veOrg = $ve;
            $ve = str_replace(".", "", $ve);
            $ve = str_replace("-", "", $ve);
            if ($GLOBALS["VERBOSE"]) {
                echo "Add version {$veOrg} -> `{$ve}`\n";
            }
            $file = "squid-{$re[1]}.tar.gz";
            $versions[$ve] = $file;
            if ($GLOBALS["VERBOSE"]) {
                echo "{$ve} -> {$file} {$CountDeSTT} points\n";
            }
        } else {
        }
    }
    krsort($versions);
    while (list($num, $filename) = each($versions)) {
        $vv[] = $filename;
    }
    echo "Found latest file version: `{$vv[0]}`\n";
    return $vv[0];
}
コード例 #30
0
ファイル: exec.failover.php プロジェクト: BillTheBest/1.6.x
function exunlink()
{
    $unix = new unix();
    $sock = new sockets();
    $net = new networking();
    $WgetBindIpAddress = $sock->GET_INFO("WgetBindIpAddress");
    $MAIN = unserialize(base64_decode($sock->GET_INFO("HASettings")));
    $eth = $MAIN["eth"];
    $t = time();
    if (!is_numeric($MAIN["SLAVE_SSL"])) {
        $MAIN["SLAVE_SSL"] = 1;
    }
    $proto = "http";
    if ($MAIN["SLAVE_SSL"] == 1) {
        $proto = "https";
    }
    $MAIN = unserialize(base64_decode($sock->GET_INFO("HASettings")));
    $eth = $MAIN["eth"];
    $nic = new system_nic($eth);
    $MAIN["BALANCE_IP"] = $MAIN["first_ipaddr"];
    $SEND_SETTING = base64_encode(serialize($MAIN));
    $uri = "{$proto}://{$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]}/nodes.listener.php?ucarp2-remove={$SEND_SETTING}&continue=true";
    build_progress("Notify {$MAIN["SLAVE"]}", 20);
    $curl = new ccurl($uri, true, $WgetBindIpAddress, true);
    $curl->NoHTTP_POST = true;
    if (!$curl->get()) {
        echo "{$curl->error}\n";
        debug_curl($curl->CURL_ALL_INFOS);
        build_progress("{reboot_networks} {$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]} {failed}", 110);
        return;
    }
    if (!preg_match("#<RESULTS>(.+?)</RESULTS>#is", $curl->data, $re)) {
        echo "Please verify that both servers must have the same Artica version\n";
        build_progress("{reboot_networks} {$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]} {protocol_error}", 110);
        return;
    }
    $array = unserialize(base64_decode($re[1]));
    if ($array["ERROR"]) {
        echo "{$array["ERROR_SHOW"]}\n";
        build_progress("{reboot_networks} {$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]} {failed}", 110);
        return;
    }
    build_progress("{please_wait_reconfigure_network}", 80);
    $nic = new system_nic($eth);
    $nic->ucarp_enabled = 0;
    $nic->ucarp_vip = null;
    $nic->ucarp_vid = 0;
    $nic->ucarp_master = 0;
    $nic->NoReboot = true;
    if (isset($MAIN["first_ipaddr"])) {
        if ($MAIN["first_ipaddr"] != null) {
            $nic->IPADDR = $MAIN["first_ipaddr"];
        }
    }
    if (!$nic->SaveNic()) {
        echo "Unable to save local settings\n";
        build_progress("{saving_local_parameters} {failed}", 110);
        return;
    }
    //please_wait_reconfigure_network
    $sock->SET_INFO("HASettings", base64_encode(serialize(array())));
    build_progress("{reboot_networks}", 75);
    $php = $unix->LOCATE_PHP5_BIN();
    system("{$php} /usr/share/artica-postfix/exec.virtuals-ip.php --build --force");
    build_progress("{reboot_networks}", 80);
    squid_admin_mysql(0, "Rebooting Network", null, __FILE__, __LINE__);
    system("/etc/init.d/artica-ifup --script=exec.failover.php/" . __FUNCTION__);
    build_progress("{starting_service}", 90);
    system("/etc/init.d/artica-failover stop");
    sleep(3);
    build_progress("{done}", 100);
}