Пример #1
0
function save()
{
    $eth = new system_nic($_POST["nic"]);
    $eth->FireQOS = $_POST["FireQOS"];
    $eth->InputSpeed = $_POST["InputSpeed"];
    $eth->OutputSpeed = $_POST["OutputSpeed"];
    $eth->ModemType = $_POST["ModemType"];
    $eth->SpeedUnit = $_POST["SpeedUnit"];
    $eth->SaveNic();
}
Пример #2
0
function save()
{
    $sock = new sockets();
    $FireHolConf = unserialize(base64_decode($sock->GET_INFO("FireHolConf")));
    while (list($index, $ligne) = each($_POST)) {
        $FireHolConf[$index] = $ligne;
    }
    $sock->SaveConfigFile(base64_encode(serialize($FireHolConf)), "FireHolConf");
    //$FireHolConf=unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/settings/Daemons/FireHolConf")));
    $IF_WAN = $FireHolConf["IF_WAN"];
    $IF_LAN = $FireHolConf["IF_LAN"];
    if ($IF_WAN == null) {
        return;
    }
    $zMD5 = md5($IF_LAN . $IF_WAN);
    if ($IF_LAN == null) {
        echo "No LAN interface defined !";
        return;
    }
    if ($IF_WAN == null) {
        echo "No WAN interface defined !";
        return;
    }
    $q = new mysql();
    $sql = "CREATE TABLE IF NOT EXISTS `pnic_bridges` (\n\t\t`ID` INT(10) NOT NULL AUTO_INCREMENT,\n\t\t`zMD5` varchar(90) NOT NULL,\n\t\t`nic_from` varchar(50) NOT NULL,\n\t\t`nic_to` varchar(50) NOT NULL,\n\t\t`enabled` smallint(1) NOT NULL DEFAULT 1,\n\t\t`DenyDHCP` smallint(1) NOT NULL DEFAULT 1,\n\t\tPRIMARY KEY (`ID`),\n\t\tUNIQUE KEY (`zMD5`),\n\t\tKEY `nic_from` (`nic_from`),\n\t\tKEY `nic_to` (`nic_to`),\n\t\tKEY `DenyDHCP` (`DenyDHCP`),\n\t\tKEY `enabled` (`enabled`)\n\t\t) ENGINE=MYISAM;";
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->FIELD_EXISTS("pnic_bridges", "zMD5", "artica_backup")) {
        $q->QUERY_SQL("ALTER TABLE pnic_bridges ADD zMD5 varchar(90), ADD UNIQUE KEY (`zMD5`)", "artica_backup");
        if (!$q->ok) {
            echo "ALTER TABLE pnic_bridges failed\n{$q->mysql_error}\n";
            return;
        }
    }
    if (!$q->FIELD_EXISTS("pnic_bridges", "STP", "artica_backup")) {
        $q->QUERY_SQL("ALTER TABLE pnic_bridges ADD STP smallint(1) DEFAULT 1", "artica_backup");
        if (!$q->ok) {
            echo "ALTER TABLE STP failed\n{$q->mysql_error}\n";
            return;
        }
    }
    if (!$q->FIELD_EXISTS("pnic_bridges", "DenyDHCP", "artica_backup")) {
        $q->QUERY_SQL("ALTER TABLE pnic_bridges ADD DenyDHCP smallint(1) DEFAULT 1", "artica_backup");
        if (!$q->ok) {
            echo "ALTER TABLE DenyDHCP failed\n{$q->mysql_error}\n";
            return;
        }
    }
    if (!$q->FIELD_EXISTS("pnic_bridges", "DenyCountries", "artica_backup")) {
        $q->QUERY_SQL("ALTER TABLE pnic_bridges ADD DenyCountries smallint(1) DEFAULT 0", "artica_backup");
        if (!$q->ok) {
            echo "ALTER TABLE DenyCountries failed\n{$q->mysql_error}\n";
            return;
        }
    }
    if (!$q->FIELD_EXISTS("pnic_bridges", "masquerading", "artica_backup")) {
        $q->QUERY_SQL("ALTER TABLE pnic_bridges ADD masquerading smallint(1) DEFAULT 0", "artica_backup");
        if (!$q->ok) {
            echo "ALTER TABLE masquerading failed\n{$q->mysql_error}\n";
            return;
        }
    }
    if (!$q->FIELD_EXISTS("pnic_bridges", "masquerading_invert", "artica_backup")) {
        $q->QUERY_SQL("ALTER TABLE pnic_bridges ADD masquerading_invert smallint(1) DEFAULT 0", "artica_backup");
        if (!$q->ok) {
            echo "ALTER TABLE masquerading_invert failed\n{$q->mysql_error}\n";
            return;
        }
    }
    $sql = "INSERT INTO pnic_bridges (zMD5,nic_from,nic_to,enabled,STP,DenyDHCP,masquerading,masquerading_invert)\n\tVALUES ('{$zMD5}','{$IF_LAN}','{$IF_WAN}','1','1','1','1','0')";
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    $nic = new system_nic($IF_WAN);
    $nic->firewall_policy = "reject";
    $nic->firewall_behavior = 2;
    $nic->firewall_masquerade = 1;
    $nic->firewall_artica = 1;
    $nic->SaveNic();
    $nic = new system_nic($IF_LAN);
    $nic->firewall_policy = "accept";
    $nic->firewall_behavior = 1;
    $nic->SaveNic();
    $sock->GET_INFO("FireHolConfigured", 1);
    $sock->SET_INFO("FireHolEnable", 1);
    $sock->SET_INFO("FireHolRouter", 1);
    $sock->SET_INFO("FireHolConfigured", 1);
    $sock->SaveConfigFile(base64_encode(serialize(array())), "FireHolConf");
}
Пример #3
0
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);
}
Пример #4
0
function savenic($NIC)
{
    $unix = new unix();
    $ipClass = new IP();
    $ETH_IP = trim(@file_get_contents("/etc/artica-postfix/WIZARDIP_{$NIC}"));
    $NETMASK = trim(@file_get_contents("/etc/artica-postfix/WIZARDMASK_{$NIC}"));
    $GATEWAY = trim(@file_get_contents("/etc/artica-postfix/WIZARDGATEWAY_{$NIC}"));
    if (!$ipClass->isIPAddress($ETH_IP)) {
        echo "* * * * {$ETH_IP} * * * * WRONG !!!!\n";
        @file_put_contents("/etc/artica-postfix/WIZARDRESULT_{$NIC}", 0);
        return;
    }
    if (!$ipClass->isIPAddress($GATEWAY)) {
        echo "* * * * {$GATEWAY} * * * * WRONG !!!!\n";
        @file_put_contents("/etc/artica-postfix/WIZARDRESULT_{$NIC}", 0);
        return;
    }
    $nics = new system_nic($NIC);
    $nics->eth = $NIC;
    $nics->IPADDR = $ETH_IP;
    $nics->NETMASK = $NETMASK;
    $nics->GATEWAY = $GATEWAY;
    $nics->dhcp = 0;
    $nics->metric = 1;
    $nics->defaultroute = 1;
    $nics->enabled = 1;
    if (!$nics->SaveNic()) {
        echo "* * * * MYSQL ERROR !!! * * * * WRONG !!!!\n";
        @file_put_contents("/etc/artica-postfix/WIZARDRESULT_{$NIC}", 0);
        return;
    }
    $php = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    $php5 = $php;
    system("{$php5} " . dirname(__FILE__) . " /exec.virtuals-ip.php --build --force >/dev/null 2>&1");
    echo "20%] Please Wait, apply network configuration....\n";
    system("/etc/init.d/artica-ifup start");
    echo "30%] Please Wait, restarting services....\n";
    $unix->THREAD_COMMAND_SET("{$php5} /usr/share/artica-postfix/exec.postfix.maincf.php --reconfigure");
    $unix->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --reconfigure-cyrus");
    system("{$nohup} /etc/init.d/artica-status reload >/dev/null 2>&1 &");
    system("{$nohup} /etc/init.d/nginx restart >/dev/null 2>&1 &");
    system("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
    echo "30%] Please Wait, Changing IP address to {$NIC}....\n";
    $ifconfig = $unix->find_program("ifconfig");
    system("{$ifconfig} {$NIC} down");
    system("{$ifconfig} {$NIC} {$ETH_IP} netmask {$NETMASK} up");
    system("/bin/ip route add 127.0.0.1 dev lo");
    if ($GATEWAY != "0.0.0.0") {
        echo "31%] Please Wait, Define default gateway to {$GATEWAY}....\n";
        system("/sbin/route add {$GATEWAY} dev {$NIC}");
        $route = $unix->find_program("route");
        shell_exec("{$route} add -net 0.0.0.0 gw {$GATEWAY} dev {$NIC} metric 1");
    }
    echo "95%] Restarting Web Console\n";
    system("/etc/init.d/artica-webconsole restart");
    echo "100%] Configuration done.\n";
    @file_put_contents("/etc/artica-postfix/WIZARDRESULT_{$NIC}", 1);
    echo "###################################################\n";
    echo "############                          #############\n";
    echo "############         SUCCESS          #############\n";
    echo "############                          #############\n";
    echo "###################################################\n\n\n\n";
}
Пример #5
0
function isFW_save(){
	$eth=$_POST["eth"];
	
	if(preg_match("#^br([0-9]+)#", $eth,$re)){
		$q=new mysql();
		$q->QUERY_SQL("UPDATE `nics_bridge` SET 
		`isFW`='{$_POST["isFW"]}',
		`isFWLogBlocked`='{$_POST["isFWLogBlocked"]}',
		`isFWAcceptNet`='{$_POST["isFWAcceptNet"]}'		
		WHERE `ID`='{$re[1]}'","artica_backup");
		if(!$q->ok){echo $q->mysql_error;}
		return;
	}	
	
	
	$ethC=new system_nic($eth);
	$ethC->isFW=$_POST["isFW"];
	$ethC->isFWAcceptNet=$_POST["isFWAcceptNet"];
	$ethC->isFWLogBlocked=$_POST["isFWLogBlocked"];
	$ethC->SaveNic();
}
Пример #6
0
function articalogon()
{
    if (!is_file("/etc/artica-postfix/network.first.settings")) {
        return;
    }
    $f = explode(";", @file_get_contents("/etc/artica-postfix/network.first.settings"));
    //l.Add(IP+';'+Gayteway+';'+netmask+';'+DNS);
    $IPADDR = $f[0];
    $GATEWAY = $f[1];
    $NETMASK = $f[2];
    $DNS1 = $f[3];
    $eth = $f[4];
    $nics = new system_nic($eth);
    $nics->eth = $eth;
    $nics->IPADDR = $IPADDR;
    $nics->NETMASK = $NETMASK;
    $nics->GATEWAY = $GATEWAY;
    $nics->DNS1 = $DNS1;
    $nics->dhcp = 0;
    $nics->enabled = 1;
    $nics->NoReboot = true;
    $nics->SaveNic();
    dev_shm();
    build();
    echo "Settings {$eth} ({$IPADDR}) done...\n";
}
Пример #7
0
function BUILD_NETWORK()
{
    $SUBNIC = null;
    $unix = new unix();
    $sock = new sockets();
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $savedsettings = unserialize(base64_decode(file_get_contents("/etc/artica-postfix/settings/Daemons/WizardSavedSettings")));
    $KEEPNET = $savedsettings["KEEPNET"];
    if ($KEEPNET == 1) {
        return;
    }
    $netbiosname = $savedsettings["netbiosname"];
    if (strlen($netbiosname) > 15) {
        $netbiosname = substr(0, 15, $netbiosname);
    }
    if (isset($savedsettings["domain"])) {
        $domainname = $savedsettings["domain"];
        $SEARCH_DOMAIN = $domainname;
    }
    $EnableKerbAuth = intval($sock->GET_INFO("EnableKerbAuth"));
    if ($EnableKerbAuth == 1) {
        $array = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos")));
        if (isset($array["WINDOWS_DNS_SUFFIX"])) {
            $SEARCH_DOMAIN = $array["WINDOWS_DNS_SUFFIX"];
            $domainname = $SEARCH_DOMAIN;
        }
    }
    $Encoded = base64_encode(serialize($savedsettings));
    @file_put_contents("/etc/artica-postfix/settings/Daemons/WizardSavedSettings", $Encoded);
    if (!isset($savedsettings["NIC"])) {
        $savedsettings["NIC"] = "eth0";
    }
    $NIC = $savedsettings["NIC"];
    if (preg_match("#(.+?):([0-9]+)#", $savedsettings["NIC"], $re)) {
        $NIC = trim($re[1]);
        $SUBNIC = $re[2];
    }
    writeprogress(60, "{building_networks}");
    $nics = new system_nic($NIC);
    $nics->CheckMySQLFields();
    $dhclient = $unix->find_program("dhclient");
    if (is_file($dhclient)) {
        $pid = $unix->PIDOF($dhclient);
        if ($unix->process_exists($pid)) {
            $unix->KILL_PROCESS($pid, 9);
        }
    }
    $nics->eth = $NIC;
    if ($SUBNIC != null) {
        $nics->IPADDR = "127.0.0.2";
        $nics->NETMASK = "255.255.255.255";
        $nics->GATEWAY = "0.0.0.0";
        $nics->BROADCAST = "0.0.0.0";
        $nics->DNS1 = $savedsettings["DNS1"];
        $nics->DNS2 = $savedsettings["DNS2"];
        $nics->dhcp = 0;
        $nics->metric = $savedsettings["metric"];
        $nics->enabled = 1;
        $nics->defaultroute = 1;
    } else {
        $nics->IPADDR = $savedsettings["IPADDR"];
        $nics->NETMASK = $savedsettings["NETMASK"];
        $nics->GATEWAY = $savedsettings["GATEWAY"];
        $nics->BROADCAST = $savedsettings["BROADCAST"];
        $nics->DNS1 = $savedsettings["DNS1"];
        $nics->DNS2 = $savedsettings["DNS2"];
        $nics->dhcp = 0;
        $nics->metric = $savedsettings["metric"];
        $nics->enabled = 1;
        $nics->defaultroute = 1;
    }
    writeprogress(60, "{saving_network}");
    $nics->SaveNic();
    if ($SUBNIC != null) {
        $q = new mysql();
        $sql = "INSERT INTO nics_virtuals (ID,nic,org,ipaddr,netmask,cdir,gateway,ForceGateway,failover,metric)\n\t\tVALUES('{$SUBNIC}','{$NIC}','','{$savedsettings["IPADDR"]}','{$savedsettings["NETMASK"]}',\n\t\t'','{$savedsettings["GATEWAY"]}',0,0,1);";
        $q->QUERY_SQL($sql, "artica_backup");
        $sql = "UPDATE nics_virtuals SET nic='{$NIC}',\n\t\torg='',\n\t\tipaddr='{$savedsettings["IPADDR"]}',\n\t\tnetmask='{$savedsettings["NETMASK"]}',\n\t\tcdir='',\n\t\t\t\tgateway='{$savedsettings["GATEWAY"]}',\n\t\t\t\tForceGateway='0',\n\t\t\t\tfailover='0',\n\t\t\t\tmetric='1'\n\t\t\t\tWHERE ID={$SUBNIC}";
        $q->QUERY_SQL($sql, "artica_backup");
    }
    writeprogress(60, "Loading resolv library");
    $resolv = new resolv_conf();
    $arrayNameServers[0] = $savedsettings["DNS1"];
    $arrayNameServers[1] = $savedsettings["DNS2"];
    $resolv->MainArray["DNS1"] = $arrayNameServers[0];
    $resolv->MainArray["DNS2"] = $arrayNameServers[1];
    $resolv->MainArray["DOMAINS1"] = $SEARCH_DOMAIN;
    writeprogress(60, "Saving DNS settings");
    $resolv->save();
    $nic = new system_nic();
    writeprogress(60, "{set_new_hostname} {$netbiosname}.{$domainname}");
    $nic->set_hostname("{$netbiosname}.{$domainname}");
    $php = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    writeprogress(60, "{building_resolv_configuration}");
    shell_exec(trim("{$nohup} " . $unix->LOCATE_PHP5_BIN() . " /usr/share/artica-postfix/exec.virtuals-ip.php --resolvconf >/dev/null 2>&1"));
    writeprogress(60, "{building_networks_scripts}");
    shell_exec("{$php5} /usr/share/artica-postfix/exec.virtuals-ip.php >/dev/null 2>&1");
}
Пример #8
0
function step7(){
	$tpl=new templates();
	$sock=new sockets();
	$net=new networking();
	$page=CurrentPageName();
	$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"];

	$nic->IPADDR=$MAIN["second_ipaddr"];
	$nic->ucarp_enabled=1;
	$nic->ucarp_vip=$MAIN["BALANCE_IP"];
	$nic->ucarp_vid=$MAIN["ucarp_vid"];
	$nic->ucarp_master=1;
	$nic->NoReboot=true;
	if(!$nic->SaveNic()){
		echo FATAL_WARNING_SHOW_128("<hr><strong>Unable to save local settings</strong>".wizard_restart());
		return;
	}
	
	$t=time();
	$reboot_remote_server_net=$tpl->javascript_parse_text("{reboot_networks}");
	echo $tpl->_ENGINE_parse_body("<center style='font-size:22px'>{please_wait}</center>").
	"<script>
	function Start$t(){
	document.getElementById('failover-title').innerHTML='$reboot_remote_server_net';
	LoadAjax('failover-div','$page?step8=yes');
	}
	setTimeout('Start$t()',2000);
	</script>
	";	
	
}
Пример #9
0
function UCARP_REMOVE()
{
    $sock = new sockets();
    $SEND_SETTING = unserialize(base64_decode($_GET["ucarp2-remove"]));
    if (!is_array($SEND_SETTING)) {
        $array["ERROR"] = true;
        $array["ERROR_SHOW"] = "{corrupted_parameters}";
        echo "\n\n<RESULTS>" . base64_decode(serialize($array)) . "<br>Not an array()</RESULTS>\n\n";
        return;
    }
    $second_ipaddr = $SEND_SETTING["SLAVE"];
    $ip = new IP();
    if (!$ip->isValid($second_ipaddr)) {
        $array["ERROR"] = true;
        while (list($a, $b) = each($SEND_SETTING)) {
            $f[] = "<strong>{$a} = {$b}</strong><br>";
        }
        $array["ERROR_SHOW"] = "{corrupted_parameters}: {ipaddr}: {$second_ipaddr}<br>" . @implode("\n", $f);
        echo "\n\n<RESULTS>" . base64_encode(serialize($array)) . "</RESULTS>\n\n";
        return;
    }
    $ip = new networking();
    while (list($eth, $cip) = each($ip->array_TCP)) {
        if ($cip == null) {
            continue;
        }
        if ($cip == $second_ipaddr) {
            $MyEth = $eth;
        }
    }
    if ($MyEth == null) {
        $array["ERROR"] = true;
        $array["ERROR_SHOW"] = "{corrupted_parameters}: {ipaddr}: {$second_ipaddr} {cannot_found_interface}";
        echo "\n\n<RESULTS>" . base64_encode(serialize($array)) . "</RESULTS>\n\n";
        return;
    }
    $nic = new system_nic($MyEth);
    if ($nic->IPADDR == null) {
        $array["ERROR"] = true;
        $array["ERROR_SHOW"] = "{unconfigured_network}";
        echo "\n\n<RESULTS>" . base64_encode(serialize($array)) . "</RESULTS>\n\n";
        return;
    }
    $nic->ucarp_enabled = 0;
    $nic->ucarp_vip = null;
    $nic->ucarp_vid = 0;
    $nic->ucarp_master = 0;
    $nic->NoReboot = true;
    if (!$nic->SaveNic()) {
        $array["ERROR"] = true;
        $array["ERROR_SHOW"] = "Save in Database failed";
        echo "\n\n<RESULTS>" . base64_encode(serialize($array)) . "</RESULTS>\n\n";
        return;
    }
    echo "\n<RESULTS>SUCCESS</RESULTS>";
    $data = base64_decode($sock->getFrameWork("network.php?ucarp-down={$MyEth}&master={$_SERVER["REMOTE_ADDR"]}"));
    $sock->getFrameWork("network.php?reconfigure-restart=yes");
}
Пример #10
0
function setup_3()
{
    $GLOBALS["DEBUG_TEMPLATE"] = true;
    include_once dirname(__FILE__) . "/ressources/class.langages.inc";
    $langAutodetect = new articaLang();
    $DetectedLanguage = $langAutodetect->get_languages();
    $GLOBALS["FIXED_LANGUAGE"] = $DetectedLanguage;
    $tpl = new templates();
    $page = CurrentPageName();
    $users = new usersMenus();
    $sock = new sockets();
    $savedsettings = unserialize(base64_decode($_GET["savedsettings"]));
    $users = new usersMenus();
    $sock = new sockets();
    $EnableUfdbGuard = $sock->GET_INFO("EnableUfdbGuard");
    if ($EnableUfdbGuard != $savedsettings["EnableWebFiltering"]) {
        $savedsettings["EnableWebFiltering"] = $EnableUfdbGuard;
    }
    $please_fill_all_form_values = $tpl->javascript_parse_text("{please_fill_all_form_values}");
    $organization = $savedsettings["organization"];
    $employees = $savedsettings["employees"];
    $company_name = $savedsettings["company_name"];
    $country = $savedsettings["country"];
    $city = $savedsettings["city"];
    $mail = $savedsettings["mail"];
    $telephone = $savedsettings["telephone"];
    $UseServerV = $savedsettings["UseServer"];
    $smtp_domainname = $savedsettings["smtp_domainname"];
    $company_www = $savedsettings["company_www"];
    $GoldKey = $savedsettings["GoldKey"];
    $KEEPNET = $savedsettings["KEEPNET"];
    if (!is_numeric($KEEPNET)) {
        $KEEPNET = 0;
    }
    $t = time();
    $MBX = false;
    $Postfix = false;
    $Samba = false;
    $squid_installed = false;
    $nginx_installed = false;
    $UseServer[null] = "{select}";
    if ($users->POSTFIX_INSTALLED) {
        $Postfix = true;
    }
    if ($users->ZARAFA_INSTALLED) {
        $MBX = true;
    }
    if ($users->cyrus_imapd_installed) {
        $MBX = true;
    }
    if ($MBX) {
        $UseServer["ASMAIL"] = "{mail_server}";
    }
    if ($users->SAMBA_INSTALLED) {
        $Samba = true;
    }
    if ($users->SQUID_INSTALLED) {
        $squid_installed = true;
    }
    if ($users->NGINX_INSTALLED) {
        $nginx_installed = true;
    }
    if ($Postfix) {
        $UseServer["ASRELAY"] = "{relay_server}";
    }
    if ($Samba) {
        $UseServer["ASFILE"] = "{file_server}";
    }
    if ($squid_installed) {
        $UseServer["ASPROXY"] = "{proxy_server}";
    }
    if ($nginx_installed) {
        $UseServer["ASREVERSEPROXY"] = "{reverse_proxy_server}";
    }
    $UseServer["AS_WORDPRESS"] = "Wordpress appliance";
    $netbiosname = $savedsettings["netbiosname"];
    $domainname = $savedsettings["domain"];
    $arrayNameServers[0] = $savedsettings["DNS1"];
    $arrayNameServers[1] = $savedsettings["DNS2"];
    $page = CurrentPageName();
    $tpl = new templates();
    if ($KEEPNET == 0) {
        $resolv = new resolv_conf();
        $resolv->MainArray["DNS1"] = $arrayNameServers[0];
        $resolv->MainArray["DNS2"] = $arrayNameServers[1];
        $resolv->save();
    }
    if ($KEEPNET == 0) {
        if ($_POST["IPADDR"] != null) {
            $nics = new system_nic("eth0");
            $nics->eth = "ethO";
            $nics->IPADDR = $arrayNameServers["IPADDR"];
            $nics->NETMASK = $arrayNameServers["NETMASK"];
            $nics->GATEWAY = $arrayNameServers["GATEWAY"];
            $nics->BROADCAST = $arrayNameServers["BROADCAST"];
            $nics->DNS1 = $arrayNameServers[0];
            $nics->DNS2 = $arrayNameServers[1];
            $nics->dhcp = 0;
            $nics->metric = $savedsettings["metric"];
            $nics->enabled = 1;
            $nics->NoReboot = true;
            $nics->SaveNic();
        }
    }
    $UseServerF = Field_array_Hash($UseServer, "UseServer", $UseServerV, "style:font-size:25px");
    $UseServerFF = "\t\n\t</tr>\n\t\t<td class=legend style='font-size:25px'>{you_using_this_server_for}:</td>\n\t\t<td>{$UseServerF}</td>\n\t</tr>";
    if ($users->WORDPRESS_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Wordpress Appliance'>";
    }
    if ($users->SMTP_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='SMTP Relay Appliance'>";
    }
    if ($users->KASPERSKY_WEB_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Kaspersky Web Appliance'>";
    }
    if ($users->LOAD_BALANCE_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Load balance Appliance'>";
    }
    if ($users->ZARAFA_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Zarafa Appliance'>";
    }
    if ($users->SAMBA_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='File Sharing Appliance'>";
    }
    if ($users->WEBSTATS_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Web statistics Appliance'>";
    }
    if ($users->STATS_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Statistics Appliance'>";
    }
    if ($users->KASPERSKY_SMTP_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Kaspersky SMTP Appliance'>";
    }
    if ($users->APACHE_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Apache Appliance'>";
    }
    if ($users->SQUID_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Proxy Appliance'>";
    }
    if ($users->HAPRROXY_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Load balance Appliance'>";
    }
    if ($users->FULL_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Artica Full Appliance'>";
    }
    if ($users->MYCOSI_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='MyCOSI Appliance'>";
    }
    if ($users->CYRUS_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='IMAP-POP3 OpenSource Appliance'>";
    }
    if ($users->PROXYTINY_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Tiny Proxy Appliance'>";
    }
    if ($users->SQUID_REVERSE_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Reverse Proxy Appliance' >";
    }
    if ($users->GATEWAY_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Gateway Appliance' >";
    }
    if ($users->WORDPRESS_APPLIANCE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Wordpress Appliance' >";
    }
    if ($users->WEBSECURIZE) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='WebSecurize Appliance' >";
    }
    if ($users->BAMSIGHT) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='BamSight' >";
    }
    if ($users->LANWANSAT) {
        $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='LANWANSAT Appliance' >";
    }
    //toujours à la fin...
    if ($UseServerFF == null) {
        if ($users->FROM_SETUP) {
            $UseServerFF = "<input type='hidden' id='UseServer' name='UseServer' value='Installed from Setup'>";
        }
    }
    $noticeregisterform = "<div style='font-size:11px;text-align:right'>{noticeregisterform}</div>";
    if ($users->WEBSECURIZE) {
        $noticeregisterform = null;
    }
    if ($users->LANWANSAT) {
        $noticeregisterform = null;
    }
    if ($users->BAMSIGHT) {
        $noticeregisterform = null;
    }
    $company_name_txtjs = $tpl->javascript_parse_text("{company_name}");
    $FORM = "\n\t<div style='width:98%' class=form>\n\t<table style='width:100%' id='{$t}'>\n\t\n\t<tr>\n\t\t<td colspan=2 style='font-size:50px;font-weight:bolder'>{YourRealCompany}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:25px'>{gold_license}:</td>\n\t\t<td>" . Field_text("GoldKey", $GoldKey, "font-size:25px;width:440px") . "</td>\n\t</tr>\n\t\t<tr><td colspan=2 align='right'><i>{gold_license_explain}</i></td></tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:25px'>{company_name}:</td>\n\t\t<td>" . Field_text("company_name", $company_name, "font-size:25px;width:440px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:25px'>{company_website}:</td>\n\t\t<td>" . Field_text("company_www", $company_www, "font-size:25px;width:440px") . "</td>\n\t</tr>\t\t\t\t\n\t</tr>\n\t\t<td class=legend style='font-size:25px'>{country}:</td>\n\t\t<td>" . Field_text("country", $country, "font-size:25px;width:440px") . "</td>\n\t</tr>\n\t</tr>\n\t\t<td class=legend style='font-size:25px'>{city}:</td>\n\t\t<td>" . Field_text("city", $city, "font-size:25px;width:440px") . "</td>\n\t</tr>\n\t\t\t\t\t\n\t</tr>\n\t\t<td class=legend style='font-size:25px'>{your_email_address}:</td>\n\t\t<td>" . Field_text("mail", $mail, "font-size:25px;width:440px") . "</td>\n\t</tr>\t\n\t</tr>\n\t\t<td class=legend style='font-size:25px'>{phone_title}:</td>\n\t\t<td>" . Field_text("telephone", $telephone, "font-size:25px;width:440px") . "</td>\n\t</tr>\n\t</tr>\n\t\t<td class=legend style='font-size:25px'>{nb_employees}</td>\n\t\t<td>" . Field_text("employees", $employees, "font-size:25px;width:440px") . "</td>\n\t</tr>\n\n\t{$UseServerFF}\n\t\n\t<tr>\n\t\t<td colspan=2 style='font-size:25px;font-weight:bolder'>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 style='font-size:50px;font-weight:bolder'>{virtual_company}</div></td>\n\t</tr>\t\n\t</tr>\n\t\t<td class=legend style='font-size:25px'>{organization}:</td>\n\t\t<td>" . Field_text("organization", $organization, "font-size:25px;width:440px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:25px'>{domain}:</td>\n\t\t<td>" . Field_text("smtp_domainname", $smtp_domainname, "font-size:25px;width:440px", null, null, null, false, "CheckMyForm{$t}(event)") . "</td>\n\t</tr>\t\n\t\t<tr>\n\t\t<td colspan=2 style='font-size:25px;font-weight:bolder'>&nbsp;</td>\n\t</tr>\n\t<tr>\n\t\t<td style='font-size:16px;font-weight:bolder'><div style='text-align:left'>" . button("{back}", "LoadAjax('setup-content','{$page}?setup-2=yes&savedsettings={$_GET["savedsettings"]}')", "30px") . "</div></td>\n\t\t<td style='font-size:16px;font-weight:bolder'><div style='text-align:right'>" . button("{next}", "ChangeCompanySettings()", "30px") . "</div></td>\n\t</tr>\n\t</table>\n\t{$noticeregisterform}\n\t\n\t<script>\n\t\tvar X_ChangeCompanySettings= function (obj) {\n\t\t\tUnlockPage();\n\t\t\tvar results=obj.responseText;\n\t\t\tvar KEEPNET={$KEEPNET};\n\t\t\tif(KEEPNET==0){\n\t\t\t\tLoadAjax('setup-content','{$page}?setup-4=yes&savedsettings='+results);\n\t\t\t}else{\n\t\t\t\tLoadAjax('setup-content','{$page}?setup-5=yes&savedsettings='+results);\n\t\t\t}\n\t\t\n\t\t\t}\n\t\t\n\t\t\t\n\t\tfunction CheckMyForm{$t}(e){\n\t\t\tif(!checkEnter(e)){return;}\n\t\t}\n\t\t\n\t\tfunction ChangeCompanySettings(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tvar testval=document.getElementById('company_name').value;\n\t\t\tif(testval.length==0){alert('{$please_fill_all_form_values}: {$company_name_txtjs}');return;}\n\t\t\tvar testval=document.getElementById('country').value;\n\t\t\tif(testval.length==0){alert('{$please_fill_all_form_values}');return;}\n\t\t\tvar testval=document.getElementById('city').value;\n\t\t\tif(testval.length==0){alert('{$please_fill_all_form_values}');return;}\t\t\t\t\t\t\n\t\t\tvar testval=document.getElementById('mail').value;\n\t\t\tif(testval.length==0){alert('{$please_fill_all_form_values} - mail');return;}\n\t\t\tvar testval=document.getElementById('employees').value;\n\t\t\tif(testval.length==0){alert('{$please_fill_all_form_values}');return;}\n\t\t\tvar testval=document.getElementById('organization').value;\n\t\t\tif(testval.length==0){alert('{$please_fill_all_form_values}');return;}\n\t\t\tvar testval=document.getElementById('smtp_domainname').value;\n\t\t\tif(testval.length==0){alert('{$please_fill_all_form_values}');return;}\t\t\t\n\t\t\t\n\t\t\tXHR.appendData('company_name',encodeURIComponent(document.getElementById('company_name').value));\n\t\t\tXHR.appendData('city',encodeURIComponent(document.getElementById('city').value));\n\t\t\tXHR.appendData('organization',encodeURIComponent(document.getElementById('organization').value));\n\t\t\tXHR.appendData('country',encodeURIComponent(document.getElementById('country').value));\n\t\t\tXHR.appendData('smtp_domainname',document.getElementById('smtp_domainname').value);\n\t\t\tXHR.appendData('organization',document.getElementById('organization').value);\n\t\t\tXHR.appendData('mail',document.getElementById('mail').value);\n\t\t\tXHR.appendData('telephone',document.getElementById('telephone').value);\n\t\t\tXHR.appendData('employees',document.getElementById('employees').value);\n\t\t\tXHR.appendData('company_www',document.getElementById('company_www').value);\n\t\t\tXHR.appendData('EnableWebFiltering','{$savedsettings["EnableWebFiltering"]}');\n\t\t\tXHR.appendData('GoldKey',document.getElementById('GoldKey').value);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tXHR.appendData('savedsettings','{$_GET["savedsettings"]}');\n\t\t\tLockPage();\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',X_ChangeCompanySettings);\n\t\t\t\n\t\t}\n\tdocument.getElementById('content').style.height='930px';\n\t</script>\n\t\n\t";
    $html = "\n\t\n\t<div style='font-size:32px;font-weight:bolder;margin-bottom:50px'>{ContactAndOrganization}</div>{$FORM}\n\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #11
0
function stepfinal()
{
    $sock = new sockets();
    $sock->GET_INFO("FireHolConfigured", 1);
    $sock->SET_INFO("FireHolEnable", 1);
    $sock->SET_INFO("FireHolRouter", 0);
    $FireHolConf = unserialize(base64_decode($sock->GET_INFO("FireHolConf")));
    $eth = new system_nic($FireHolConf["IF_LAN"]);
    $eth->firewall_policy = $FireHolConf["IF_LAN_BEHAVIOR"];
    $eth->isFW = 1;
    $eth->SaveNic();
    $servs[] = "artica";
    $servs[] = "http";
    $servs[] = "https";
    $servs[] = "dns";
    $servs[] = "ping";
    $servs[] = "ssh";
    $servs[] = "squid";
    $servs[] = "snmp";
    $servs[] = "snmptrap";
    $servs[] = "icmp";
    $servs[] = "dhcp";
    $f = new firehol();
    if ($FireHolConf["IF_LAN_BEHAVIOR"] == "reject") {
        if (!$f->checkTables()) {
            echo "FAILED";
            return false;
        }
        while (list($a, $service) = each($servs)) {
            if (!$f->edit_service($FireHolConf["IF_LAN"], $service, 1, 1)) {
                echo "edit_service({$service}) FAILED";
                return;
            }
        }
    }
    $servs = array();
    $servs1[] = "http";
    $servs1[] = "https";
    $servs1[] = "ftp";
    $servs1[] = "dns";
    $servs1[] = "ping";
    $servs1[] = "icmp";
    if (!$f->checkTables()) {
        echo "FAILED";
        return false;
    }
    while (list($a, $service) = each($servs1)) {
        if (!$f->edit_client_service($FireHolConf["IF_LAN"], $service, 1, 1)) {
            echo "edit_client_service({$service}) FAILED";
            return;
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "edit_client_service({$service}) TRUE<br>\n";
        }
    }
    $sock->SET_INFO("FireHolConfigured", 1);
    echo "<script>Loadjs('firehol.progress.php');</script>";
}
Пример #12
0
function isFW()
{
    $nic = new system_nic($_POST["nic"]);
    $nic->isFW = $_POST["isFW"];
    $nic->SaveNic();
}
Пример #13
0
function nic_params_save()
{
    $nic = new system_nic($_POST["nic"]);
    $nic->firewall_policy = $_POST["firewall_policy"];
    $nic->firewall_behavior = $_POST["firewall_behavior"];
    $nic->firewall_masquerade = $_POST["firewall_masquerade"];
    $nic->SaveNic();
}
function save_nic()
{
    $eth = $_POST["save_nic"];
    if (preg_match("#^tun#", $eth)) {
        echo "{$eth} cannot be edited manually...";
        return;
    }
    unset($_POST["save_nic"]);
    $nic = new system_nic($eth);
    if ($_POST["ucarp_vip"] == $nic->IPADDR) {
        echo "{$_POST["ucarp_vip"]} cannot be the same of the real interface !";
        return;
    }
    while (list($key, $value) = each($_POST)) {
        writelogs("{$key} = `{$value}`", __FUNCTION__, __FILE__, __LINE__);
        $nic->{$key} = $value;
    }
    $nic->NoReboot = true;
    $nic->SaveNic();
    $sock = new sockets();
    $sock->getFrameWork("system.php?ucarp-compile=yes");
    $sock->getFrameWork("chilli.php?restart=yes&nohup=yes");
}
Пример #15
0
function ipconfig_routes_del(){
	$user=new usersMenus();
	$tpl=new templates();
	$ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
	if(!$user->AsSystemAdministrator){echo $ERROR_NO_PRIVS;return;}
	$ip=new networking();
	$nic=new system_nic($_GET["nic"]);
	unset($nic->ROUTES[$_GET["IP"]]);
	$nic->SaveNic();	
}
function network_bridge_associates_save(){
	$eth=$_POST["eth"];
	$nic=new system_nic($eth);
	$nic->Bridged=1;
	$nic->BridgedTo="br{$_POST["ID"]}";
	$nic->SaveNic();
	
}
function ACTION_NETWORK()
{
    $unix = new unix();
    $clear = $unix->find_program("clear");
    if (is_file($clear)) {
        system("{$clear}");
    }
    $users = new usersMenus();
    $q = new mysql();
    if (!$q->BD_CONNECT(true)) {
        echo "There is an issue while connecting to MySQL\n{$q->mysql_error}\nPress Key to exit.\n";
        $line = fgets(STDIN);
        return;
    }
    $DEFAULT = null;
    $net = new networking();
    $interfaces = $net->Local_interfaces();
    unset($interfaces["lo"]);
    if (isset($interfaces["eth0"])) {
        $DEFAULT = "eth0";
    }
    while (list($num, $letter) = each($interfaces)) {
        $int[] = "\"{$num}\"";
    }
    if ($DEFAULT == null) {
        $DEFAULT = $int[0];
    }
    $q->BuildTables();
    echo "This wizard will help to configure network.\n";
    echo "Press q letter to exit or any key to continue:";
    $answer = trim(strtolower(fgets(STDIN)));
    if ($answer == "q") {
        return;
    }
    if (is_file($clear)) {
        system("{$clear}");
    }
    echo "Give here the interface name of the network interface\n";
    echo "you need to setup.\n\n";
    echo "Should be one of :" . @implode(", ", $int) . "\n";
    echo "Default: [{$DEFAULT}]\n";
    $NIC = trim(strtolower(fgets(STDIN)));
    if ($NIC == null) {
        $NIC = $DEFAULT;
    }
    if (!preg_match("#([a-z])([0-9+)\$#", $NIC)) {
        $NIC = $DEFAULT;
    }
    $ETH_IP = trim(ASK_ETH_IP($NIC));
    $GATEWAY = trim(ASK_GATEWAY($NIC));
    $NETMASK = trim(ASK_NETMASK($NIC));
    $DNS = trim(ASK_DNS1($NIC));
    if (is_file($clear)) {
        system("{$clear}");
    }
    echo "Your Settings:\n";
    echo "Interface.........: \"{$NIC}\"\n";
    echo "IP address........: \"{$ETH_IP}\"\n";
    echo "Gateway...........: \"{$GATEWAY}\"\n";
    echo "Netmask...........: \"{$NETMASK}\"\n";
    echo "DNS server 1......: \"{$DNS}\"\n";
    echo "\n";
    //ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);
    echo "If your are agree with these settings\n";
    echo "Press any key to apply settings or press \"q\" to return to menu.\n";
    $answer = trim(strtolower(fgets(STDIN)));
    if ($answer == "q") {
        return;
    }
    echo "5%] Please Wait, saving configuration...\n";
    $nics = new system_nic($NIC);
    $nics->eth = $NIC;
    $nics->IPADDR = $ETH_IP;
    $nics->NETMASK = $NETMASK;
    $nics->GATEWAY = $GATEWAY;
    $nics->DNS1 = $DNS;
    $nics->dhcp = 0;
    $nics->metric = 1;
    $nics->defaultroute = 1;
    $nics->enabled = 1;
    echo "7%] Please Wait, saving Networks parameters to MySQL DB...\n";
    if (!$nics->SaveNic()) {
        echo "There is an issue while saving your settings\n";
        echo "Press any key to exit.\n";
        $answer = trim(strtolower(fgets(STDIN)));
        return;
    }
    echo "10%] Please Wait, building configuration....\n";
    $php = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    $php5 = $php;
    shell_exec2("{$php5} " . dirname(__FILE__) . " /exec.virtuals-ip.php --build --force >/dev/null 2>&1");
    echo "20%] Please Wait, apply network configuration....\n";
    shell_exec2("{$php5} /usr/share/artica-postfix/exec.initslapd.php");
    shell_exec2("/etc/init.d/artica-ifup start");
    echo "30%] Please Wait, restarting services....\n";
    $unix->THREAD_COMMAND_SET("{$php5} /usr/share/artica-postfix/exec.postfix.maincf.php --reconfigure");
    $unix->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --reconfigure-cyrus");
    shell_exec2("{$nohup} /etc/init.d/artica-status reload >/dev/null 2>&1 &");
    shell_exec2("{$nohup} /etc/init.d/nginx restart >/dev/null 2>&1 &");
    shell_exec2("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
    echo "30%] Please Wait, Changing IP address to {$NIC}....\n";
    $ifconfig = $unix->find_program("ifconfig");
    shell_exec2("{$ifconfig} {$NIC} down");
    shell_exec2("{$ifconfig} {$NIC} {$ETH_IP} netmask {$NETMASK} up");
    shell_exec2("/bin/ip route add 127.0.0.1 dev lo");
    if ($GATEWAY != "0.0.0.0") {
        echo "31%] Please Wait, Define default gateway to {$GATEWAY}....\n";
        shell_exec2("/sbin/route add {$GATEWAY} dev {$NIC}");
        $route = $unix->find_program("route");
        shell_exec("{$route} add -net 0.0.0.0 gw {$GATEWAY} dev {$NIC} metric 1");
    }
    echo "80%] Please Wait, Changing DNS to {$DNS}....\n";
    echo "81%] Please Wait, Loading DNS library\n";
    $GLOBALS["PROGRESS"] = true;
    $resolv = new resolv_conf();
    echo "92%] Set DNS1 to {$DNS}\n";
    $resolv->MainArray["DNS1"] = $DNS;
    $resolv->output = true;
    echo "93%] Saving config\n";
    $resolvDatas = $resolv->build();
    echo "94%] Saving /etc/resolv.conf\n";
    @file_put_contents("/etc/resolv.conf", $resolvDatas);
    echo "95%] Restarting Web Console\n";
    shell_exec2("{$nohup} /etc/init.d/artica-webconsole restart");
    echo "100%] Configuration done.\n";
    echo "Press any key to return to menu.";
    $answer = trim(strtolower(fgets(STDIN)));
    MAIN_MENU();
}