Rev 1827 | Rev 2184 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><!-- written by Rexy --><HEAD><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><TITLE>Network Filter</TITLE><link rel="stylesheet" href="/css/style.css" type="text/css"></HEAD><body><TABLE width="100%" border=0 cellspacing=0 cellpadding=0><?# Choice of language$Language = 'en';if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);$Language = strtolower(substr(chop($Langue[0]),0,2)); }if($Language == 'fr'){$l_remove="Retirer de la liste";$l_title_proto = "Filtrage de protocoles réseau";$l_protocolsfilter="Vous pouvez personnaliser le profile de filtrage protocole 'personnalisable' ici. Vous pouvez ensuite l'attribuer à des utilisateurs via l'éditeur ou la création d'utilisateur.";$l_comment_on="À l'exclusion du WEB (port 80), les protocoles réseaux sont interdits.<BR>Choisissez ci-dessous les protocoles que vous autorisez";$l_comment_off="(tous les protocoles réseau sont autorisés)";$l_protocols="Protocoles autorisés";$l_error_open_file="Erreur d'ouverture du fichier";$l_port="Numéro de port";$l_proto="Nom du protocole";$l_enabled="Autorisé";$l_add_to_list="Ajouter à la liste";$l_save="Enregistrer les modifications";}else {$l_remove="Remove from list";$l_title_proto = "Network protocols filter";$l_protocolsfilter="You can change your \"custom\" protocol filtering here. You can set it to a user from ACC (create user / edit user)";$l_comment_on="(choose the authorized network protocols)";$l_comment_on="Except for the WEB (port 80), all protocols are blocked.<BR>Choose in the list below, the protocols you want authorize";$l_comment_off="(all the network protocols are allowed for authenticated users)";$l_protocols="Authorize protocols";$l_error_open_file="Error opening the file";$l_port="Port number";$l_proto="protocol name";$l_enabled="Authorized";$l_add_to_list="Add to the list";$l_save="Save changes";}/********************* TEST CONF FILES **********************/define ("SERVICES_LIST", "/usr/local/etc/alcasar-services");define ("CONF_FILE", "/usr/local/etc/alcasar.conf");$conf_files=array(SERVICES_LIST,CONF_FILE);foreach ($conf_files as $file){if (!file_exists($file)){exit("Requested file ".$file." isn't present");}if (!is_readable($file)){exit("Can't read the file ".$file);}}/*********************************** Read ALCASAR CONF_FILE ************************************/$ouvre=fopen(CONF_FILE,"r");if ($ouvre){while (!feof ($ouvre)){$tampon = fgets($ouvre, 4096);if (strpos($tampon,"=")!==false){$tmp = explode("=",$tampon);$conf[$tmp[0]] = $tmp[1];}}fclose($ouvre);}if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}switch ($choix){case 'new_port' :if ((trim($_POST['add_port']) != "80") and ($_POST['add_port'] != "") and ($_POST['add_proto'] != "") and (is_numeric($_POST['add_port']))){$_POST['add_proto'] = str_replace (CHR(32),"-",$_POST['add_proto']);$tab=file(SERVICES_LIST);$insert = true;if ($tab) // file isn't empty{foreach ($tab as $line) //test if port doesn't already exist{$proto_f=explode(" ", $line);if (trim($_POST['add_port']) == trim($proto_f[1])) {$insert = false;}}}if ($insert == true){$line = "\n" . "#" . trim($_POST['add_proto']) . " " . trim($_POST['add_port']);$pointeur=fopen(SERVICES_LIST,"a");fwrite ($pointeur, $line);fclose ($pointeur);exec ("sudo /usr/local/bin/alcasar-file-clean.sh");}}break;case 'change_port' :$tab=file(SERVICES_LIST);if ($tab){// authorize/block protocols$pointeur=fopen(SERVICES_LIST,"w+");foreach ($tab as $ligne){$proto_f=explode(" ", $ligne);$name_svc1=trim($proto_f[0],"#");$actif = False; $remove_line = false;foreach ($_POST as $key => $value){if (strstr($key,'del-')){$name_svc2 = str_replace('del-','',$key);if ($name_svc1 == $name_svc2){$remove_line = True;}}if (strstr($key,'chk-')){$name_svc2 = str_replace('chk-','',$key);if ($name_svc1 == $name_svc2){$actif = True;break;}}}if (! $remove_line){if (! $actif) { $line="#$name_svc1 $proto_f[1]";}else { $line="$name_svc1 $proto_f[1]";}fwrite($pointeur,$line);}}fclose($pointeur);}exec ("sudo /usr/local/bin/alcasar-iptables.sh -on");break;}?><TABLE width="100%" border=0 cellspacing=0 cellpadding=0><tr><th><?echo "$l_title_proto";?></th></tr><tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr></table><TABLE width="100%" border=1 cellspacing=0 cellpadding=0><tr><?echo "<td colspan=\"2\" valign=\"middle\" align=\"left\">";echo "<CENTER><H3>$l_protocolsfilter_on</H3>$l_comment_on</CENTER>";require ('protocols_filter2.php');?>