示例#1
0
function SaveConf()
{
    $sock = new sockets();
    $sock->SET_INFO("CyrusEnableAV", $_GET["CyrusEnableAV"]);
    $ini = new Bs_IniHandler();
    while (list($num, $val) = each($_GET)) {
        $ini->_params["SCAN"][$num] = trim($val);
    }
    $sock->SaveConfigFile($ini->toString(), "CyrusAVConfig");
    $tpl = new templates();
    $sock->getFrameWork('cmd.php?RestartDaemon=yes');
    echo html_entity_decode($tpl->_ENGINE_parse_body('{success}'));
}
示例#2
0
 function SaveParams()
 {
     $ini = new Bs_IniHandler();
     $ini->_params = $this->params;
     $ou = $this->ou;
     $name = str_replace('.', '_', $ou);
     $name = str_replace('-', '_', $name);
     $sock = new sockets();
     $sock->SaveConfigFile($ini->toString(), "JoomlaConfOrg_{$name}");
     $this->SaveLDAPParams();
     $this->SaveAdminPassword();
     $sock->getfile('JoomlaReload');
 }
示例#3
0
function save()
{
    $uid = $_GET["uid"];
    if (strpos($uid, '$') == 0) {
        $uid = $uid . '$';
    }
    $computer = new computers($uid);
    $ini = new Bs_IniHandler();
    $ini->loadString($computer->ComputerCryptedInfos);
    $ini->_params["ACCOUNT"]["USERNAME"] = $_GET["username"];
    $ini->_params["ACCOUNT"]["PASSWORD"] = $_GET["password"];
    $computer->ComputerCryptedInfos = $ini->toString();
    $computer->SaveCryptedInfos();
}
示例#4
0
function SaveSchedule()
{
    $computer = new computers($_GET["uid"] . '$');
    $ini = new Bs_IniHandler();
    $ini->loadString($computer->ComputerCryptedInfos);
    $ini->_params["SCHEDULE"]["cron"] = $_GET["SaveSchedule"];
    $computer->ComputerCryptedInfos = $ini->toString();
    $computer->SaveCryptedInfos();
}
示例#5
0
function artica_import_save()
{
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadString($sock->GET_INFO("ComputersImportArtica"));
    while (list($num, $line) = each($_GET)) {
        $ini->_params[$_GET["artica_ip_addr"]][$num] = $line;
    }
    $sock->SaveConfigFile($ini->toString(), "ComputersImportArtica");
    $sock->getFrameWork("cmd.php?computers-import-nets=yes");
}
示例#6
0
function BuildTunServer(){
LoadArgvs();
   $unix=new unix();
   if(isset($GLOBALS["CLASS_SOCKETS"])){$sock=$GLOBALS["CLASS_SOCKETS"];}else{$GLOBALS["CLASS_SOCKETS"]=new sockets();$sock=$GLOBALS["CLASS_SOCKETS"];}
   $servername=$unix->hostname_g();	
   $routess=array();
   $duplicate_cn=null;
 
   
  if(preg_match("#^(.+?)\.#",$servername,$re)){$servername=$re[1];}
   $servername=strtoupper($servername);       
   echo "Starting......: OpenVPN building settings for $servername...\n";
   
   
   
   $ini=new Bs_IniHandler();
   
   $ini->loadString($sock->GET_INFO("ArticaOpenVPNSettings"));
   if(!isset($ini->_params["GLOBAL"]["ENABLE_BRIDGE_MODE"])){$ini->_params["GLOBAL"]["ENABLE_BRIDGE_MODE"]=0;}
   if(!isset($ini->_params["GLOBAL"]["IP_START"])){$ini->_params["GLOBAL"]["IP_START"]="10.8.0.0";}
   if(!isset($ini->_params["GLOBAL"]["NETMASK"])){$ini->_params["GLOBAL"]["NETMASK"]="255.255.255.0";}
   
   
   if($ini->_params["GLOBAL"]["ENABLE_BRIDGE_MODE"]==1){
   		echo "Starting......: OpenVPN building settings mode bridge enabled...\n";
   		BuildBridgeServer();
   		return;
   }
   
   
   $IPTABLES_ETH=$GLOBALS["IPTABLES_ETH"];
   $DEV_TYPE=$ini->_params["GLOBAL"]["DEV_TYPE"];
   $port=$ini->_params["GLOBAL"]["LISTEN_PORT"];
   $IP_START=$ini->_params["GLOBAL"]["IP_START"];
   $NETMASK=$ini->_params["GLOBAL"]["NETMASK"];
   $bind_addr=$ini->_params["GLOBAL"]["LOCAL_BIND"];
   $LISTEN_PROTO=$ini->_params["GLOBAL"]["LISTEN_PROTO"];
   if($LISTEN_PROTO==null){$LISTEN_PROTO="udp";}
   if($LISTEN_PROTO=="udp"){$proto="--proto udp";}else{$proto="--proto tcp-server";}
   
    
   if(trim($port)==null){$port=1194;}
   if(trim($IP_START)==null){$IP_START="10.8.0.0";}
   if(trim($NETMASK)==null){$NETMASK="255.255.255.0";}
   
$nic=new networking();

while (list ($num, $ligne) = each ($nic->array_TCP) ){
	if($ligne==null){continue;}
		$eths[][$num]=$num;
		$ethi[$num]=$ligne;
	} 

if($IPTABLES_ETH<>null){
		echo "Starting......: OpenVPN linked to $IPTABLES_ETH ({$ethi[$IPTABLES_ETH]})...\n";
		$IPTABLES_ETH_ROUTE=IpCalcRoute($ethi[$IPTABLES_ETH]);
}else{
	echo "Starting......: OpenVPN no local NIC linked...\n";
}
	
   $ca='/etc/artica-postfix/openvpn/keys/allca.crt';
   $dh='/etc/artica-postfix/openvpn/keys/dh1024.pem';
   $key="/etc/artica-postfix/openvpn/keys/vpn-server.key";
   $crt="/etc/artica-postfix/openvpn/keys/vpn-server.crt";
   $route='';
   
   //$IPTABLES_ETH_IP=

if (is_file('/etc/artica-postfix/settings/Daemons/OpenVPNRoutes')){
   $routes=(explode("\n",@file_get_contents("/etc/artica-postfix/settings/Daemons/OpenVPNRoutes")));
   while (list ($num, $ligne) = each ($routes) ){
   	if(!preg_match("#(.+?)\s+(.+)#",$ligne,$re)){continue;}
   	$routess[]="--push \"route {$re[1]} {$re[2]}\"";
   }
}
$GetRoutes=GetRoutes();
$routess=$routess+$GetRoutes;



if(count($routess)==0){
	if($IPTABLES_ETH_ROUTE<>null){
		echo "Starting......: OpenVPN IP adding default route \"$IPTABLES_ETH_ROUTE\"\n";
		$routess[]="--push \"route $IPTABLES_ETH_ROUTE\"";
	}
  }else{
  	echo "Starting......: OpenVPN IP adding ".count($routess)." routes\n";
  }
   

	
   if(trim($bind_addr)<>null){
   	$local=" --local $bind_addr";
   	echo "Starting......: OpenVPN IP bind $bind_addr\n";
   }
   
   $IP_START=FIX_IP_START($IP_START,$local);
   $ini->set("GLOBAL","IP_START",$IP_START); 	
  
   if(preg_match("#(.+?)\.([0-9]+)$#",$IP_START,$re)){
   	$calc_ip=" {$re[1]}.0";
   	$calc_ip_end="{$re[1]}.254";
   	echo "Starting......: OpenVPN IP pool from {$re[1]}.2 to {$re[1]}.254 mask:$NETMASK\n";
   	$server_ip="{$re[1]}.1";
   	$IP_START_PREFIX=$re[1];
   }

   if($NETMASK==null){
			$ip=new IP();
			$cdir=$ip->ip2cidr($calc_ip,$calc_ip_end);
			$arr=$ip->parseCIDR($cdir);
			$rang=$arr[0];
			$netbit=$arr[1];
			$ipv=new ipv4($calc_ip,$netbit);
			$NETMASK=$ipv->netmask();	   
			if($NETMASK=="255.255.255.255"){$NETMASK="255.255.255.0";}		
   			echo "Starting......: OpenVPN Netmask is null for the range $calc_ip, assume $NETMASK\n";
   			$ini->set("GLOBAL","NETMASK",$NETMASK);
   	}
   	
	$OpenVpnPasswordCert=$sock->GET_INFO("OpenVpnPasswordCert");
	if($OpenVpnPasswordCert==null){$OpenVpnPasswordCert="MyKey";}
   
	$askpass=null;
   	if(is_file("/etc/artica-postfix/openvpn/keys/password")){
   		$askpass="******";
   	}
   	
   	$ifconfig_pool_persist=" --ifconfig-pool-persist /etc/artica-postfix/openvpn/ipp.txt ";
   	
 	if(isset($GLOBALS["OPENVPNPARAMS"]["duplicate-cn"])){
 		echo "Starting......: OpenVPN duplicate-cn is enabled\n";
 		$duplicate_cn=" --duplicate-cn ";
 		$ifconfig_pool_persist=null;
 	}
 	
 	if(isset($GLOBALS["OPENVPNPARAMS"]["script-security"])){
 		echo "Starting......: OpenVPN script-security is enabled\n";
 		$script_security=" --script-security 2";
 	} 	
 	
	if(!is_dir("/etc/openvpn/cdd")){@mkdir("/etc/openvpn/cdd");}
	$already=array();
 	echo "Starting......: OpenVPN get remote sites routes...\n";
 	$sql="SELECT sitename,IP_START,netmask,remote_site_routes,FixedIPAddr FROM vpnclient WHERE connexion_type=1";
 	$q=new mysql();
	$results=$q->QUERY_SQL($sql,"artica_backup");
	if(!$q->ok){echo2("Starting......: OpenVPN : $q->mysql_error");}
 	while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){
 		$iroute=array();
 		$sitename=$ligne["sitename"];
 		$FixedIPAddr=$ligne["FixedIPAddr"];
 		if(!is_numeric($FixedIPAddr)){$FixedIPAddr=0;}
 		
 		if($IP_START_PREFIX<>null){
 			if($FixedIPAddr>2){
 				if($FixedIPAddr<255){
 					echo "Starting......: OpenVPN $sitename $IP_START_PREFIX.$FixedIPAddr fixed IP address\n";
 					$iroute[]="ifconfig-push $IP_START_PREFIX.$FixedIPAddr $IP_START_PREFIX.2";
 				}
 			}
 		}
 		
 		if(!isset($already[$ligne["IP_START"]])){
 			echo "Starting......: OpenVPN $sitename ({$ligne["IP_START"]} {$ligne["netmask"]})\n";
 			$rou[]=" --route {$ligne["IP_START"]} {$ligne["netmask"]}";
 			$iroute[]="iroute {$ligne["IP_START"]} {$ligne["netmask"]}";
 			$already[$ligne["IP_START"]]=true;
 		}
 		
 		$remote_site_routes=unserialize(base64_decode($ligne["remote_site_routes"]));
		while (list ($num, $site_mask) = each ($remote_site_routes) ){
			if(!isset($already[$num])){
				echo "Starting......: OpenVPN $sitename ($num $site_mask)\n";
				$rou[]=" --route $num $site_mask";
				$iroute[]="iroute $num $site_mask";
				$already[$num]=true;
			}
		}
 		echo "Starting......: OpenVPN cdd $sitename\n";
 		@file_put_contents("/etc/openvpn/cdd/$sitename",@implode("\n", $iroute) );
 		
 	}
 	if(count($rou)>0){
 		$localroutes=@implode(" ", $rou);
 		$client_config_dir=" --client-config-dir /etc/openvpn/cdd";
 	}
 	
 	 
 	
 	$LDAP_AUTH=$ini->_params["GLOBAL"]["LDAP_AUTH"];
 	if($LDAP_AUTH==1){
 		if(is_file("/usr/lib/openvpn/openvpn-auth-pam.so")){
 		$plugin=" --plugin /usr/lib/openvpn/openvpn-auth-pam.so common-auth";
 		echo "Starting......: OpenVPN auth is enabled\n";
 		shell_exec("/usr/share/artica-postfix/bin/artica-install --nsswitch");
 		}
 	}
   
   @mkdir("/etc/openvpn/ccd",0666,true);
   $php5=$unix->LOCATE_PHP5_BIN();
   $me=__FILE__;
   $cmd=" --port $port --dev tun $proto --server $IP_START $NETMASK$localroutes$client_config_dir --comp-lzo $local --ca $ca --dh $dh --key $key --cert $crt";
   $cmd=$cmd. "$ifconfig_pool_persist " . implode(" ",$routess);
   $cmd=$cmd. " $askpass$duplicate_cn--client-to-client$script_security$plugin --learn-address \"$php5 $me --client-connect\" --keepalive 10 60 --persist-tun --verb 5 --daemon --writepid /var/run/openvpn/openvpn-server.pid --log \"/var/log/openvpn/openvpn.log\"";
   $cmd=$cmd. " --status /var/log/openvpn/openvpn-status.log 10";
   echo "Starting......: OpenVPN building /etc/openvpn/cmdline.conf done\n";
   @file_put_contents("/etc/openvpn/cmdline.conf",$cmd);
  
   
   $sock->SaveConfigFile($ini->toString(),"ArticaOpenVPNSettings");
   send_email_events("OpenVPN was successfully reconfigured",$cmd,"VPN");
   echo "Starting......: OpenVPN building settings done.\n";
   if($GLOBALS["VERBOSE"]){writelogs("$cmd",__FUNCTION__,__FILE__,__LINE__);}
}
示例#7
0
function save_parameters()
{
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    if ($_GET["enable_remote_sync"] == 0) {
        $_GET["UseOnlyRsync"] = 0;
    }
    $sock->SET_INFO("UseOnlyRsync", $_GET["UseOnlyRsync"]);
    unset($_GET["UseOnlyRsync"]);
    while (list($num, $ligne) = each($_GET)) {
        $ini->_params["CONF"][$num] = $ligne;
    }
    $sock->SaveConfigFile($ini->toString(), "RsyncClientParameters");
}
示例#8
0
 function Save()
 {
     $tpl = new templates();
     writelogs("enabled={$this->BigMailHTMLEnabled}", __FUNCTION__, __FILE__);
     $upd["BigMailHTMLEnabled"][0] = $this->BigMailHTMLEnabled;
     $ini = new Bs_IniHandler();
     $ini->_params = $this->params;
     $upd["BigMailHtmlConfig"][0] = $ini->toString();
     $upd["BigMailHtmlBody"][0] = $this->BigMailHtmlBody;
     $ldap = new clladp();
     if ($ldap->Ldap_modify($this->dn, $upd)) {
         echo $tpl->_ENGINE_parse_body('{success}');
     } else {
         echo $ldap->ldap_last_error;
     }
 }
示例#9
0
function quarantine_ou_settings_save()
{
    $ou = $_GET["ou"];
    $ouU = strtoupper($ou);
    $ini = new Bs_IniHandler();
    $ini->_params["NEXT"]["hour"] = $_GET["hour"];
    $ini->_params["NEXT"]["Min"] = $_GET["Min"];
    $ini->_params["NEXT"]["Enabled"] = $_GET["OuSendQuarantineReports"];
    $ini->_params["NEXT"]["org"] = $ou;
    $ini->_params["NEXT"]["days"] = $_GET["days"];
    $ini->_params["NEXT"]["cron"] = $_GET["Min"] . ' ' . $_GET["hour"] . ' * * *';
    $ini->_params["NEXT"]["subject"] = $_GET["subject"];
    $ini->_params["NEXT"]["title1"] = $_GET["title1"];
    $ini->_params["NEXT"]["title2"] = $_GET["title2"];
    $ini->_params["NEXT"]["explain"] = $_GET["explain"];
    $ini->_params["NEXT"]["mailfrom"] = $_GET["mailfrom"];
    $ini->_params["NEXT"]["externalLink"] = $_GET["externalLink"];
    $sock = new sockets();
    $sock->SaveConfigFile($ini->toString(), "OuSendQuarantineReports{$ouU}");
    $sock->getfile("RestartDaemon");
}
示例#10
0
function SaveArticaWebRootURI()
{
    $ArticaWebRootURI = $_GET["ArticaWebRootURI"];
    if (!is_numeric($_GET["ArticaMaxTempLogFilesDay"])) {
        $_GET["ArticaMaxTempLogFilesDay"] = 3;
    }
    $artica = new artica_general();
    $ini = new Bs_IniHandler();
    $ini->loadString($artica->ArticaPerformancesSettings);
    $ini->_params["PERFORMANCES"]["ArticaMaxLogsSize"] = $_GET["ArticaMaxLogsSize"];
    writelogs("Save PERFORMANCES/ArticaMaxLogsSize={$ini->_params["PERFORMANCES"]["ArticaMaxLogsSize"]}", __FUNCTION__, __FILE__);
    $artica->ArticaPerformancesSettings = $ini->toString();
    $artica->MaxTempLogFilesDay = $_GET["ArticaMaxTempLogFilesDay"];
    $artica->Save();
    $ldap = new clladp();
    $upd["ArticaWebRootURI"][0] = $ArticaWebRootURI;
    if (!$ldap->Ldap_modify("cn=artica,{$ldap->suffix}", $upd)) {
        echo $ldap->ldap_last_error;
    } else {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body('Logs:{success}');
    }
}
示例#11
0
function TOOLS_IMPORT_SAVE()
{
    $uid = $_GET["uid"];
    $ini = new Bs_IniHandler();
    $ini->_params["INFO"]["remote_imap_server"] = $_GET["remote_imap_server"];
    $ini->_params["INFO"]["remote_imap_username"] = $_GET["remote_imap_username"];
    $ini->_params["INFO"]["remote_imap_password"] = $_GET["remote_imap_password"];
    $ini->_params["INFO"]["use_ssl"] = $_GET["use_ssl"];
    $sock = new sockets();
    $sock->SaveConfigFile($ini->toString(), "{$uid}ImportMailBoxData");
    $tpl = new templates();
    echo html_entity_decode($tpl->_ENGINE_parse_body('{success}'));
}
示例#12
0
function folder_conf()
{
    $folder = $_GET["prop"];
    $smb = new samba();
    $ini = new Bs_IniHandler();
    $q[$folder] = $smb->main_array[$folder];
    $ini->_params = $q;
    $conf = $g = nl2br($ini->toString());
    $html = "\n\t<h3 style='font-size:22px'>{config}</h3>\n\t<div style='padding:5px;margin:5px;border:1px solid #CCCCCC;width:98%;background-color:white' id=''>\t\n\t<code style='font-size:18px'>{$conf}</code>\n\t\n\t</div>";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}
示例#13
0
 function Save()
 {
     $days = null;
     $sock = new sockets();
     $sock->SET_INFO('WBLReplicEachMin', $this->WBLReplicEachMin);
     $sock->SET_INFO('WBLReplicEnable', $this->WBLReplicEnable);
     $sock->SET_INFO('WBLReplicaHamEnable', $this->WBLReplicaHamEnable);
     while (list($num, $line) = each($this->array_days)) {
         if ($this->WBLReplicSchedule["DAYS"][$line] == 1) {
             $days[] = $num;
         }
     }
     if (is_array($days)) {
         $this->WBLReplicSchedule["CRON"]["days"] = implode(',', $days);
     } else {
         $this->WBLReplicSchedule["CRON"]["days"] = null;
     }
     $this->WBLReplicSchedule["CRON"]["time"] = $this->WBLReplicSchedule["TIME"]["time"];
     $ini = new Bs_IniHandler();
     $ini->_params = $this->WBLReplicSchedule;
     $sock->SaveConfigFile($ini->toString(), 'WBLReplicSchedule');
     $sock->getfile("delcron:artica-autolearn");
     if ($this->WBLReplicSchedule["CRON"]["days"] != null) {
         if (preg_match('#(.+?):(.+)#', $this->WBLReplicSchedule["CRON"]["time"], $re)) {
             $sock->getfile("addcron:{$re[2]} {$re[1]} * * {$this->WBLReplicSchedule["CRON"]["days"]} root /usr/share/artica-postfix/bin/artica-learn >/dev/null 2>&1;artica-autolearn");
         }
     }
 }
示例#14
0
function server_receive_status()
{
    writelogs("Receive infos from {$_POST["NTFY_STATUS"]}", __FUNCTION__, __FILE__, __LINE__);
    $gl = new gluster();
    if ($gl->clients[$_POST["NTFY_STATUS"]] == null) {
        writelogs("Depreciated server, send order to delete", __FUNCTION__, __FILE__, __LINE__);
        echo "DELETE_YOU";
        exit;
    }
    $ini = new Bs_IniHandler();
    while (list($num, $ligne) = each($_POST)) {
        writelogs("Receive infos {$num} = {$ligne} from {$_POST["NTFY_STATUS"]}", __FUNCTION__, __FILE__, __LINE__);
        $ini->_params["CLUSTER"][$num] = $ligne;
    }
    $sock = new sockets();
    $sock->SaveClusterConfigFile($ini->toString(), "clusters-" . $_POST["NTFY_STATUS"]);
    $cyrus_id = $sock->getFrameWork("cmd.php?idofUser=cyrus");
    echo "CYRUS-ID={$cyrus_id};\n";
    $gl = new gluster();
    if (is_array($gl->clients)) {
        while (list($num, $name) = each($gl->clients)) {
            $cl[] = $name;
        }
    }
    $datas = implode(";", $cl);
    writelogs("Sending servers list " . strlen($datas) . " bytes", __FUNCTION__, __FILE__, __LINE__);
    echo $datas;
}
示例#15
0
function deletelic()
{
    $sock = new sockets();
    $shallalistLicense = $sock->GET_INFO("shallalistLicense");
    $ini = new Bs_IniHandler();
    $ini->loadString($shallalistLicense);
    unset($ini->_params["SHALLA"]["LICENSE"]);
    $sock->SaveConfigFile($ini->toString(), "shallalistLicense");
}
示例#16
0
function build(){
	$sock=new sockets();
	$users=new usersMenus();
	$ini=new Bs_IniHandler();
	
	$_SESSION["WIZARD_CYRUS"]["LOCAL_ARTICA_SERVER"]=$_GET["LOCAL_ARTICA_SERVER"];
	
	$ini->_params["REPLICA"]["servername"]=$_SESSION["WIZARD_CYRUS"]["REMOTE_ARTICA_SERVER"];
	$ini->_params["REPLICA"]["artica_port"]=$_SESSION["WIZARD_CYRUS"]["REMOTE_ARTICA_SERVER_PORT"];
	$ini->_params["REPLICA"]["username"]=$_SESSION["WIZARD_CYRUS"]["REMOTE_ARTICA_USR"];
	$ini->_params["REPLICA"]["password"]=$_SESSION["WIZARD_CYRUS"]["REMOTE_ARTICA_PASS"];
	$ini->_params["REPLICA"]["master_ip"]=$_SESSION["WIZARD_CYRUS"]["LOCAL_ARTICA_SERVER"];
	$sock=new sockets();
	$sock->SaveConfigFile($ini->toString(),"CyrusClusterReplicaInfos");
	$cyrus=new cyrus_cluster();
	if(!$cyrus->notify_replica()){
		$tpl=new templates();
		echo $tpl->javascript_parse_text("{failed}:$cyrus->error_text");
		$sock->SET_INFO("EnableCyrusMasterCluster",0);
		$sock->SET_INFO("CyrusClusterPort","2005");
		$sock->SET_INFO("CyrusClusterID",1);		
		return;	
		
	}
	
	$sock->SET_INFO("EnableCyrusMasterCluster",1);
	$sock->SET_INFO("CyrusClusterPort","2005");
	$sock->SET_INFO("CyrusClusterID",1);	
	
	
}
示例#17
0
function save_scan_parameters()
{
    $uid = $_GET["uid"];
    $computer = new computers($uid . '$');
    $ini = new Bs_IniHandler();
    $tpl = new templates();
    while (list($num, $ligne) = each($_GET)) {
        $ini->_params["scanner.options"][$num] = $ligne;
    }
    $datas = $ini->toString();
    $computer->KasperkyAVScanningDatas = $datas;
    if ($computer->SaveScannerOptions()) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body('{success}');
    } else {
        echo $tpl->_ENGINE_parse_body('{failed}');
    }
}
}function nonhierarchical_direct(){
	$sock=new sockets();
	$ini=new Bs_IniHandler();
	$ArticaSquidParameters=$sock->GET_INFO('ArticaSquidParameters');
	$ini->loadString($ArticaSquidParameters);
	$ini->_params["NETWORK"]["nonhierarchical_direct"]=$_GET["nonhierarchical_direct"];
	$sock->SET_INFO("ArticaSquidParameters",$ini->toString());
	
}
示例#19
0
function EnableParentProxy()
{
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ArticaSquidParameters = $sock->GET_INFO('ArticaSquidParameters');
    $ini->loadString($ArticaSquidParameters);
    $ini->_params["NETWORK"]["EnableParentProxy"] = $_GET["EnableParentProxy"];
    $sock->SET_INFO("ArticaSquidParameters", $ini->toString());
    $sock->getFrameWork("cmd.php?squidnewbee=yes");
}
示例#20
0
function sugar_save()
{
    $ou = $_GET["ou"];
    $name = str_replace('.', '_', $ou);
    $name = str_replace('-', '_', $name);
    $ldap = new clladp();
    $ini = new Bs_IniHandler();
    $ini->_params["CONF"]["sugaradminname"] = $_GET["sugaradminname"];
    $ini->_params["CONF"]["sugaradminpassword"] = $_GET["sugaradminpassword"];
    $ini->_params["CONF"]["sugarservername"] = $_GET["sugarservername"];
    $ini->_params["CONF"]["ou"] = $_GET["ou"];
    $ini->_params["CONF"]["ldap_connection_user"] = $ldap->ldap_admin;
    $sock = new sockets();
    $sock->SaveConfigFile($ini->toString(), "JoomlaConfOrg_{$name}");
    $su = new SugarCRM($ou);
    $su->CreateAdminPassword();
    $su->UpdateLDAPConfig();
}
示例#21
0
function greylist_save()
{
    $sock = new sockets();
    $sock->SET_INFO('ASSPEnableDelaying', $_GET["ASSPEnableDelaying"]);
    $ini = new Bs_IniHandler();
    while (list($num, $val) = each($_GET)) {
        $ini->_params["CONF"][$num] = $val;
    }
    $sock->SaveConfigFile($ini->toString(), "ASSPDelayingConfig");
    $sock->getFrameWork("cmd.pĥp?reload-assp=yes");
}
示例#22
0
function round_robin_save()
{
    $ou = $_GET["ou"];
    $tpl = new templates();
    $roundrobin_nameserver = $_GET["roundrobin_nameserver"];
    $roundrobin_ipaddress = $_GET["roundrobin_ipaddress"];
    $domain = $_GET["domain"];
    if (IsIPValid($roundrobin_nameserver)) {
        echo $tpl->_ENGINE_parse_body("{servername}:\n{$roundrobin_nameserver}\n {error_cannot_be_ip_address}");
        exit;
    }
    if (!IsIPValid($roundrobin_ipaddress)) {
        echo $tpl->_ENGINE_parse_body("{add_ip_address}:\n{$roundrobin_ipaddress}\n {error_must_be_ip_address}");
        exit;
    }
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $datas = $sock->GET_INFO('RoundRobinHosts');
    $ini->loadString($datas);
    $ips = explode(",", $ini->_params["{$domain}"]["IP"]);
    $ips[] = $roundrobin_ipaddress;
    $ini->_params["{$domain}"]["servername"] = $roundrobin_nameserver;
    $ini->_params["{$domain}"]["IP"] = implode(",", $ips);
    $sock->SaveConfigFile($ini->toString(), "RoundRobinHosts");
    $sock->getfile("RoundRobinHosts");
    $ldap = new clladp();
    $dn = "cn={$domain},cn=transport_map,ou={$ou},dc=organizations,{$ldap->suffix}";
    $upd["transport"][0] = "[{$roundrobin_nameserver}]";
    if (!$ldap->Ldap_modify($dn, $upd)) {
        echo $ldap->ldap_last_error;
        exit;
    }
    echo html_entity_decode($tpl->_ENGINE_parse_body('{success}'));
}
示例#23
0
function save_mimedefang()
{
    $artica = new artica_general();
    $ini = new Bs_IniHandler();
    $ini->loadString($artica->ArticaPerformancesSettings);
    while (list($num, $val) = each($_GET)) {
        $ini->_params["MIMEDEFANG"][$num] = $val;
    }
    $artica->ArticaPerformancesSettings = $ini->toString();
    $artica->Save();
    $sock = new sockets();
    $sock->getfile('restartmimedefang');
}
示例#24
0
function Save(){
	$sock=new sockets();
	$ini=new Bs_IniHandler();
	$ArticaSquidParameters=$sock->GET_INFO('ArticaSquidParameters');
	$ini->loadString($ArticaSquidParameters);
	
	if($_POST["StandardPortSSL"]==1){
		$sock->SET_INFO("DisableSSLStandardPort",0);
		$sock->SET_INFO("EnableSSLOnStandardPort", 1);
		$ini->_params["NETWORK"]["SSL_BUMP"]=1;
		
	}else{
		$sock->SET_INFO("DisableSSLStandardPort",1);
		$sock->SET_INFO("EnableSSLOnStandardPort", 0);
	}
	$sock->SET_INFO("sslproxy_version", $_POST["sslproxy_version"]);
	
	
	$ini->_params["NETWORK"]["certificate_center"]=$_POST["certificate"];
	$ini->_params["NETWORK"]["SSL_BUMP_WHITE_LIST"]=$_POST["SSL_BUMP_WHITE_LIST"];
	
	$sock->SaveConfigFile($ini->toString(), "ArticaSquidParameters");
	
}
示例#25
0
function parsequeue()
{
    $unix = new unix();
    $iptables = $unix->find_program("iptables");
    $q = new mysql();
    $q->Check_iptables_table();
    $ini = new Bs_IniHandler();
    $ini->loadFile('/etc/artica-postfix/settings/Daemons/PostfixAutoBlockResults');
    if ($GLOBALS["VERBOSE"]) {
        echo "Scanning /var/log/artica-postfix/smtp-hack\n";
    }
    foreach (glob("/var/log/artica-postfix/smtp-hack/*.hack") as $filename) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Scanning {$filename}\n";
        }
        $basename = basename($filename);
        $array = unserialize(@file_get_contents($filename));
        $IP = $array["IP"];
        if ($IP == "127.0.0.1") {
            @unlink($filename);
            continue;
        }
        $server_name = gethostbyaddr($IP);
        $matches = $array["MATCHES"];
        $EVENTS = $array["EVENTS"];
        $date = $array["DATE"];
        if ($GLOBALS["VERBOSE"]) {
            echo "{$basename}: servername:{$server_name} IP=[{$IP}]\n";
        }
        $cmd = "{$iptables} -A INPUT -s {$IP} -p tcp --destination-port 25 -j DROP -m comment --comment \"ArticaInstantPostfix\"";
        $iptablesClass = new iptables_chains();
        $iptablesClass->serverip = $IP;
        $iptablesClass->servername = $server_name;
        $iptablesClass->rule_string = $cmd;
        $iptablesClass->EventsToAdd = $EVENTS;
        if ($iptablesClass->addPostfix_chain()) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Add IP:Addr=<{$IP}>, servername=<{$server_name}> to mysql\n";
            }
            $ini->set($IP, "events", $matches);
            $ini->set($IP, "iptablerule", $cmd);
            $ini->set($IP, "hostname", $server_name);
            if ($GLOBALS["VERBOSE"]) {
                echo "delete {$filename}\n";
            }
            @unlink($filename);
        }
        $cmd = "{$iptables} -A INPUT -s {$IP} -p tcp --destination-port 587 -j DROP -m comment --comment \"ArticaInstantPostfix\"";
        $iptablesClass = new iptables_chains(587);
        $iptablesClass->serverip = $IP;
        $iptablesClass->servername = $server_name;
        $iptablesClass->rule_string = $cmd;
        $iptablesClass->EventsToAdd = $EVENTS;
        $iptablesClass->addPostfix_chain();
        $cmd = "{$iptables} -A INPUT -s {$IP} -p tcp --destination-port 465 -j DROP -m comment --comment \"ArticaInstantPostfix\"";
        $iptablesClass = new iptables_chains();
        $iptablesClass->serverip = $IP;
        $iptablesClass->servername = $server_name;
        $iptablesClass->rule_string = $cmd;
        $iptablesClass->EventsToAdd = $EVENTS;
        $iptablesClass->addPostfix_chain(465);
    }
    $filestr = $ini->toString();
    file_put_contents("/etc/artica-postfix/settings/Daemons/PostfixAutoBlockResults", $filestr);
}
示例#26
0
function SaveConf()
{
    writelogs("AUTOUPDATE -> SAVE", __FUNCTION__, __FILE__);
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $configDisk = trim($sock->GET_INFO('ArticaAutoUpdateConfig'));
    $ini->loadString($configDisk);
    while (list($num, $ligne) = each($_GET)) {
        writelogs("AUTOUPDATE:: {$num}={$ligne}", __FUNCTION__, __FILE__);
        $ini->_params["AUTOUPDATE"][$num] = $ligne;
    }
    $data = $ini->toString();
    $sock->SET_INFO("WgetBindIpAddress", $_GET["WgetBindIpAddress"]);
    $sock->SaveConfigFile($data, "ArticaAutoUpdateConfig");
    $sock->getFrameWork("cmd.php?ForceRefreshLeft=yes");
    $tpl = new templates();
}
示例#27
0
 public function save()
 {
     $ini = new Bs_IniHandler();
     $ini->_params = $this->list;
     $sock = new sockets();
     $sock->SaveConfigFile($ini->toString(), 'CyrusBackupRessource');
     $sock->getFrameWork('RestartDaemon');
 }
示例#28
0
function SaveReplicaInfos()
{
    $ini = new Bs_IniHandler();
    $ini->_params["REPLICA"]["servername"] = $_GET["servername"];
    $ini->_params["REPLICA"]["artica_port"] = $_GET["artica_port"];
    $ini->_params["REPLICA"]["username"] = $_GET["username"];
    $ini->_params["REPLICA"]["password"] = $_GET["password"];
    $ini->_params["REPLICA"]["master_ip"] = $_GET["master_ip"];
    $tpl = new templates();
    $sock = new sockets();
    $sock->SaveConfigFile($ini->toString(), "CyrusClusterReplicaInfos");
    $cyrus = new cyrus_cluster();
    if (!$cyrus->notify_replica()) {
        $tpl = new templates();
        echo $tpl->javascript_parse_text("{failed}:{$cyrus->error_text}");
        return;
    }
    $sock->getFrameWork('cmd.php?cyrus-reconfigure=yes&force=yes');
}
示例#29
0
function SaveConf()
{
    writelogs("AUTOUPDATE -> SAVE", __FUNCTION__, __FILE__);
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $configDisk = trim($sock->GET_INFO('ArticaAutoUpdateConfig'));
    $ini->loadString($configDisk);
    while (list($num, $ligne) = each($_GET)) {
        writelogs("AUTOUPDATE:: {$num}={$ligne}", __FUNCTION__, __FILE__);
        $ini->_params["AUTOUPDATE"][$num] = $ligne;
    }
    $data = $ini->toString();
    $sock->SET_INFO("WgetBindIpAddress", $_GET["WgetBindIpAddress"]);
    $sock->SET_INFO("EnableNightlyInFrontEnd", $_GET["EnableNightlyInFrontEnd"]);
    $sock->SET_INFO("ArticaScheduleUpdates", $_GET["ArticaScheduleUpdates"]);
    $sock->SET_INFO("RebootAfterArticaUpgrade", $_GET["RebootAfterArticaUpgrade"]);
    $sock->SET_INFO("EnableSystemUpdates", $_GET["EnableSystemUpdates"]);
    $sock->SET_INFO("ArticaUpdateIntervalAllways", $_GET["ArticaUpdateIntervalAllways"]);
    if (isset($_GET["CurlBandwith"])) {
        $sock->SET_INFO("CurlBandwith", $_GET["CurlBandwith"]);
    }
    if (isset($_GET["CurlTimeOut"])) {
        $sock->SET_INFO("CurlTimeOut", $_GET["CurlTimeOut"]);
    }
    if (isset($_GET["NoCheckSquid"])) {
        $sock->SET_INFO("NoCheckSquid", $_GET["NoCheckSquid"]);
    }
    writelogs("EnableScheduleUpdates = {$_GET["EnableScheduleUpdates"]}, RebootAfterArticaUpgrade = {$_GET["RebootAfterArticaUpgrade"]}", __FUNCTION__, __FILE__, __LINE__);
    if (isset($_GET["EnableScheduleUpdates"])) {
        $sock->SET_INFO("EnableScheduleUpdates", $_GET["EnableScheduleUpdates"]);
    }
    $sock->SaveConfigFile($data, "ArticaAutoUpdateConfig");
    if (isset($_GET["EnablePatchUpdates"])) {
        $sock->SET_INFO("EnablePatchUpdates", $_GET["EnablePatchUpdates"]);
    }
    if (isset($_GET["EnableRebootAfterUpgrade"])) {
        $sock->SET_INFO("EnableRebootAfterUpgrade", $_GET["EnableRebootAfterUpgrade"]);
    }
    if (isset($_GET["DisableInstantLDAPBackup"])) {
        $sock->SET_INFO("DisableInstantLDAPBackup", $_GET["DisableInstantLDAPBackup"]);
    }
    $sock->getFrameWork("cmd.php?ForceRefreshLeft=yes");
    $sock->getFrameWork("services.php?artica-update-cron=yes");
    $sock->getFrameWork("services.php?artica-patchs=yes");
    $tpl = new templates();
}
示例#30
0
function SaveRule()
{
    include_once dirname(__FILE__) . '/ressources/class.ini.inc';
    $return_rule = false;
    $ruleid = $_GET["ruleid"];
    if ($ruleid == null) {
        $ruleid = "add";
    }
    $HASH["inadyn"] = GetRuleidArray($ruleid);
    $aliases = explode(',', $HASH["inadyn"]["alias"]);
    if ($_GET["alias"] != null) {
        $aliases[] = $_GET["alias"];
        unset($_GET["alias"]);
    }
    if ($_GET["delete_alias"]) {
        unset($aliases[$_GET["delete_alias"]]);
        unset($_GET["delete_alias"]);
        $return_rule = true;
    }
    $ldap = new clladp();
    $dn = "cn=inadyn,cn=artica,{$ldap->suffix}";
    if (!$ldap->ExistsDN($dn)) {
        $upd["objectClass"][] = 'top';
        $upd["objectClass"][] = 'ArticaInadyn';
        $upd["cn"] = "inadyn";
        $upd["ArticaInadynPoolRule"][] = "10";
        if (!$ldap->ldap_add($dn, $upd)) {
            echo $ldap->ldap_last_error;
            exit;
        }
        unset($upd);
    }
    if (isset($_GET)) {
        while (list($num, $ligne) = each($_GET)) {
            $HASH["inadyn"][$num] = $ligne;
        }
    }
    if (isset($aliases)) {
        while (list($num, $ligne) = each($aliases)) {
            if ($ligne != null) {
                $NEWAL[$ligne] = $ligne;
            }
        }
    }
    $HASH["inadyn"]["alias"] = implode(',', $NEWAL);
    $ini = new Bs_IniHandler();
    $ini->_params = $HASH;
    $rule = $ini->toString();
    writelogs("Save rule {$rule}", __FUNCTION__, __FILE__);
    if ($ruleid == "add") {
        $upd["ArticaInadynRule"] = $rule;
        if (!$ldap->Ldap_add_mod($dn, $upd)) {
            echo $ldap->ldap_last_error;
        }
    } else {
        $upd["ArticaInadynRule"][$ruleid] = $rule;
        if (!$ldap->Ldap_modify($dn, $upd)) {
            echo $ldap->ldap_last_error;
        }
    }
    if ($return_rule) {
        echo add_dynamic_rule_form();
        exit;
    }
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body('{success}');
}