Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 503 → Rev 504

/web/intercept.php
25,7 → 25,7
# Default : it was not a form request
 
# Shared secret used to encrypt challenge with radius.
$uamsecret = "Mkb0pAEE";
$uamsecret = "";
 
# URL loaded after success authenticates (let blank for browser defaults)
$adminurl = "";
32,7 → 32,8
 
# Our own path
$loginpath = $_SERVER['PHP_SELF'];
$statuspath = "http://alcasar/status.php";
$alcasarpath = "http://alcasar";
$statuspath = $alcasarpath."/status.php";
$debug = false;
 
# Choice of language
50,7 → 51,6
$R_loggedout = "Su sesión se cierra";
$R_user = "Usuario";
$R_password = "Contraseña";
$R_passwordchg = "Cambie su contraseña";
$R_wait = "Por favor, espere un momento ...";
$R_onlinetime = "Tiempo de conexión:";
$R_remainingtime = "Desconexión en:";
57,12 → 57,12
$R_encrypted = "La apertura debe usar conexión cifrada";
$R_boutonO = "Autenticación";
$R_boutonF = "Cerrar";
$R_loggedin_stringl0 = "Information System Security";
$R_loggedin_stringl1 = "Bienvenido portal ALCASAR";
$R_loggedin_stringl1 = "Information System Security";
$R_loggedin_stringl2 = "El portal fue creado reglamentos para garantizar la trazabilidad, la rendición de cuentas y el no repudio de las conexiones.";
$R_loggedin_stringl3 = "Su actividad en la red es registrada, de conformidad con la privacidad.";
$R_loggedin_stringl4 = "Los datos registrados pueden ser capaces de ser operado por una autoridad judicial en el curso de una investigación.";
$R_loggedin_stringl5 = "Estos datos se eliminan automáticamente después de un año.";
$R_loggedin_stringl6 = "Click <a href=$alcasarpath>here</a> to change your password or to integrate the security certificate in your browser";
$R_loggedout_string = "Cerrar sesión hizo portal cautivo!";
$R_reply_1 = "Your daily connexion time has been reached";
$R_reply_2 = "Your monthly connexion time has been reached";
69,10 → 69,6
$R_reply_3 = "You try to connect outside of your allowed timespan";
$R_reply_4 = "your account expired";
$R_reply_5 = "You have reached the maximum number of simultaneous logins";
$R_ca_1 = "How integrate the ALCASAR";
$R_ca_2 = "certificate";
$R_ca_3 = "in your web browser?";
$R_ca_4 = "-help-";
$R_online_time = "Tiempo en linea";
$R_remaining_time = "Tiempo restante";
}
86,7 → 82,6
$R_loggedout = "Ihre Sitzung ist geschlossen";
$R_user = "Benutzer";
$R_password = "Passwort";
$R_passwordchg = "Passwort ändern";
$R_wait = "Bitte warten Sie einen Moment ...";
$R_onlinetime = "Online-Zeit:";
$R_remainingtime = "Abmelden:";
93,12 → 88,12
$R_encrypted = "Die Öffnung muß der Anschluß Zahlen";
$R_boutonO = "Authentifizierung";
$R_boutonF = "Schließen";
$R_loggedin_stringl0 = "Information System Security";
$R_loggedin_stringl1 = "Willkommen portal ALCASAR";
$R_loggedin_stringl1 = "Information System Security";
$R_loggedin_stringl2 = "Dieses Portal wurde eingerichtet, um ordnungsgemäß die Rückverfolgbarkeit, der Zurechenbarkeit und der Nicht-Anerkennung der Verbindungen.";
$R_loggedin_stringl3 = "Ihre Tätigkeit im Netzwerk registriert ist nach Schutz der Privatsphäre.";
$R_loggedin_stringl4 = "Die gespeicherten Daten nicht pouront genutzt werden, dass von einer Justizbehörde im Rahmen einer Untersuchung.";
$R_loggedin_stringl5 = "Diese Daten werden automatisch gelöscht nach einem Jahr.";
$R_loggedin_stringl6 = "Click <a href=$alcasarpath>here</a> to change your password or to integrate the security certificate in your browser";
$R_loggedout_string = "Trennung des Portals erfolgt Gefangener!";
$R_reply_1 = "Your daily connexion time has been reached";
$R_reply_2 = "Your monthly connexion time has been reached";
105,10 → 100,6
$R_reply_3 = "You try to connect outside of your allowed timespan";
$R_reply_4 = "your account expired";
$R_reply_5 = "You have reached the maximum number of simultaneous logins";
$R_ca_1 = "How integrate the ALCASAR";
$R_ca_2 = "certificate";
$R_ca_3 = "in your web browser?";
$R_ca_4 = "-help-";
$R_online_time = "Online-zeit";
$R_remaining_time = "Restzeit";
 
123,7 → 114,6
$R_loggedout = "Uw sessie is gesloten";
$R_user = "Gebruiker";
$R_password = "Wachtwoord";
$R_passwordchg = "Wijzig uw wachtwoord";
$R_wait = "Wacht een moment ...";
$R_onlinetime = "Sluit tijd:";
$R_remainingtime = "Verbreking in:";
130,12 → 120,12
$R_encrypted = "De opening moet gebruiken gecodeerde verbinding";
$R_boutonO = "Authenticatie";
$R_boutonF = "Sluiten";
$R_loggedin_stringl0 = "Information System Security";
$R_loggedin_stringl1 = "Welkom portaal ALCASAR";
$R_loggedin_stringl1 = "Information System Security";
$R_loggedin_stringl2 = "Het portaal werd opgericht verordeningen om de traceerbaarheid, verantwoordelijkheid en onloochenbaarheid van de verbindingen.";
$R_loggedin_stringl3 = "Uw activiteit op het netwerk is geregistreerd in overeenstemming met de persoonlijke levenssfeer.";
$R_loggedin_stringl4 = "De geregistreerde gegevens kunnen worden kunnen worden bediend door een rechterlijke instantie in de loop van een onderzoek.";
$R_loggedin_stringl5 = "Deze gegevens worden automatisch verwijderd na een jaar.";
$R_loggedin_stringl6 = "Click <a href=$alcasarpath>here</a> to change your password or to integrate the security certificate in your browser";
$R_loggedout_string = "Logout gemaakt intern portaal!";
$R_reply_1 = "Your daily connexion time has been reached";
$R_reply_2 = "Your monthly connexion time has been reached";
142,10 → 132,6
$R_reply_3 = "You try to connect outside of your allowed timespan";
$R_reply_4 = "your account expired";
$R_reply_5 = "You have reached the maximum number of simultaneous logins";
$R_ca_1 = "How integrate the ALCASAR";
$R_ca_2 = "certificate";
$R_ca_3 = "in your web browser?";
$R_ca_4 = "-help-";
$R_online_time = "Online tijd";
$R_remaining_time = "Reterende tijd";
}
159,7 → 145,6
$R_loggedout = "Votre session est fermée";
$R_user = "Identifiant";
$R_password = "Mot de passe";
$R_passwordchg = "Modifier son mot de passe";
$R_wait = "Patientez un instant ...";
$R_onlinetime = "Temps de connexion:";
$R_remainingtime = "Deconnexion dans :";
166,12 → 151,12
$R_encrypted = "La connexion avec le portail doit &ecirc;tre chiffr&eacute;e";
$R_boutonO = "Authentification";
$R_boutonF = "Fermer";
$R_loggedin_stringl0 = "S&eacute;curit&eacute; des Syst&egrave;mes d'Information";
$R_loggedin_stringl1 = "Bienvenue sur le portail captif ALCASAR";
$R_loggedin_stringl2 = "Ce portail a &eacute;t&eacute; mis en place pour assurer r&eacute;glementairement la tra&ccedil;abilit&eacute;, l'imputabilit&eacute; et la non-r&eacute;pudiation des connexions.";
$R_loggedin_stringl1 = "S&eacute;curit&eacute; des Syst&egrave;mes d'Information";
$R_loggedin_stringl2 = "Ce contr&ocirc;le a &eacute;t&eacute; mis en place pour assurer r&eacute;glementairement la tra&ccedil;abilit&eacute;, l'imputabilit&eacute; et la non-r&eacute;pudiation des connexions.";
$R_loggedin_stringl3 = "Votre activit&eacute; sur le r&eacute;seau est enregistr&eacute;e conform&eacute;ment au respect de la vie priv&eacute;e.";
$R_loggedin_stringl4 = "Les donn&eacute;es enregistr&eacute;es ne pourront &ecirc;tre exploit&eacute;es que par une autorit&eacute judiciaire dans le cadre d'une enqu&ecirc;te.";
$R_loggedin_stringl5 = "Ces donn&eacute;es seront automatiquement supprim&eacute;es au bout d'un an.";
$R_loggedin_stringl6 = "Cliquez <a href=$alcasarpath>ici</a> pour changer votre mot de passe ou pour intégrer le certificat de sécurité à votre navigateur";
$R_loggedout_string = "D&eacute;connexion du portail captif effectu&eacute;e !";
$R_reply_1 = "Votre dur&eacute;e de connexion journali&egrave;re a &eacute;t&eacute; atteinte";
$R_reply_2 = "Votre dur&eacute;e de connexion mensuelle a &eacute;t&eacute; atteinte";
178,10 → 163,6
$R_reply_3 = "Vous tentez de vous connecter en dehors de votre p&eacute;riode autoris&eacute;e";
$R_reply_4 = "Votre compte a expir&eacute";
$R_reply_5 = "Vous avez atteint le nombre maximum de connexions simultan&eacute;es";
$R_ca_1 = "Int&eacute;grer le ";
$R_ca_2 = "certificat";
$R_ca_3 = "d'ALCASAR dans votre navigateur WEB";
$R_ca_4 = "- Aide -";
$R_online_time = "Temps de connexion";
$R_remaining_time = "Temps restant";
}
195,7 → 176,6
$R_loggedout = "Your session is closed";
$R_user = "User";
$R_password = "Password";
$R_passwordchg = "Change your password";
$R_wait = "Please wait a moment ...";
$R_onlinetime = "Connect time:";
$R_remainingtime = "Disconnection in:";
202,12 → 182,12
$R_encrypted = "The opening must use encrypted connection";
$R_boutonO = "Authentication";
$R_boutonF = "Close";
$R_loggedin_stringl0 = "Information System Security";
$R_loggedin_stringl1 = "Welcome on captive portal ALCASAR";
$R_loggedin_stringl2 = "The portal was set up regulations to ensure traceability, accountability and non-repudiation of connections.";
$R_loggedin_stringl1 = "Information System Security";
$R_loggedin_stringl2 = "That control was set up regulations to ensure traceability, accountability and non-repudiation of connections.";
$R_loggedin_stringl3 = "Your activity on the network is registered in accordance with privacy.";
$R_loggedin_stringl4 = "The recorded data can be able to be operated by a judicial authority in the course of an investigation.";
$R_loggedin_stringl5 = "These data will be automatically deleted after one year.";
$R_loggedin_stringl6 = "Click <a href=$alcasarpath>here</a> to change your password or to integrate the security certificate in your browser";
$R_loggedout_string = "Logout made captive portal!";
$R_reply_1 = "Your daily connexion time has been reached";
$R_reply_2 = "Your monthly connexion time has been reached";
214,10 → 194,6
$R_reply_3 = "You try to connect outside of your allowed timespan";
$R_reply_4 = "your account expired";
$R_reply_5 = "You have reached the maximum number of simultaneous logins";
$R_ca_1 = "Integrate the ALCASAR";
$R_ca_2 = "certificate";
$R_ca_3 = "in your web browser";
$R_ca_4 = "-help-";
$R_online_time = "Online time";
$R_remaining_time = "Remaining time";
}
433,7 → 409,7
<input type=\"hidden\" name=\"userurl\" value=\"$userurl\">
<TABLE id=\"boite-logon\">
<TR>
<TD width=\"20%\" rowspan=\"4\"><IMG id=\"logo-organ\" src=\"/images/organisme.png\"></TD>
<TD width=\"20%\" rowspan=\"3\"><IMG id=\"logo-organ\" src=\"/images/organisme.png\"></TD>
<TD width=\"30%\" align=\"right\">$R_user</TD>
<TD width=\"50%\" align=\"left\"><INPUT type=\"text\" maxLength=\"32\" name=\"UserName\"></TD>
</TR>
444,18 → 420,12
<TR>
<TD height=\"23\" colSpan=\"2\" align=\"center\"><INPUT value=\"$R_boutonO\" type=\"submit\" name=\"button\" onclick=\"javascript:popUp('$statuspath')\"></TD>
</TR>
<TR>
<TD colSpan=2 align=center><H6><A href=\"https://$uamip/pass/\">$R_passwordchg</A></H6></TD>
</TR>
</TABLE>
<TABLE id=\"boite-info\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\">
<TR>
<TD align=\"center\"><FONT color=\"red\"><B>$R_loggedin_stringl0</B></FONT></TD>
<TD align=\"center\"><FONT color=\"red\"><B>$R_loggedin_stringl1</B></FONT></TD>
</TR>
<TR>
<TD align=\"center\"><FONT color=\"black\"><B>$R_loggedin_stringl1</B></FONT></TD>
</TR>
<TR>
<TD align=\"left\">
<UL>
<LI>$R_loggedin_stringl2</LI>
462,10 → 432,8
<LI>$R_loggedin_stringl4</LI>
<LI>$R_loggedin_stringl3</LI>
<LI>$R_loggedin_stringl5</LI>
<LI>$R_loggedin_stringl6</LI>
</UL>
<P id=\"aide-certif\">
$R_ca_1 <A href=\"/certs/certificat_alcasar_ca.crt\">$R_ca_2</a> $R_ca_3 <a href=\"/alcasar-certificat.pdf\">$R_ca_4</A>
</P>
</TD>
</TR>
</TABLE>
/web/acc/admin/net_filter.php
34,7 → 34,6
$l_delete="Supprimer de la liste";
$l_add_to_list="Ajouter &agrave; la liste";
$l_save_modif="Enregistrer les modifications";
$l_exception_txt="Entrez ici les adresses IP des stations du réseau de consultation ne subissant ce filtrage de protocoles<BR>Entrez une adresse IP par ligne";
}
else {
$l_title_antivir = "WEB antivirus";
56,7 → 55,6
$l_delete="Delete from list";
$l_add_to_list="Add to the list";
$l_save_modif="Save modifications";
$l_exception_txt="Put here the stations IP address that won't be protocols filtered<BR>Put one IP adress per row";
}
echo "
<tr><th>$l_title_antivir</th></tr>
148,18 → 146,6
else {echo "$l_error_open_file $services_list";}
exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
break;
case 'IP_exceptions' :
// réencodage iso + format unix + rc fin de ligne (ouf...)
$ip_list = str_replace("\r\n", "\n", utf8_decode($_POST['exception_list']));
if (strlen($ip_list) != 0){
if ($ip_list[strlen($ip_list)-1] != "\n") { $ip_list[strlen($ip_list)]="\n";} ;} ;
unset($_POST['exception_list']);
// écriture exception pour filtrage réseau
$fichier=fopen("/usr/local/etc/alcasar-filter-exceptions", "w+");
fputs($fichier, $ip_list);
fclose($fichier);
exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
break;
}
?>
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
/web/acc/admin/net_filter2.php
48,33 → 48,6
</tr></table>
</form>
</td></tr>
<tr><td colspan=2 valign="middle" align="center">
<B>Exceptions</B><br>
<form action='net_filter.php' method='POST'>
<?php
echo " $l_exception_txt";
echo "<BR><textarea name='exception_list' rows=5 cols=40>";
$filename="/usr/local/etc/alcasar-filter-exceptions";
if (file_exists($filename))
{
if (filesize($filename) != 0)
{
$pointeur=fopen($filename,"r");
$tampon = fread($pointeur, filesize($filename));
fclose($pointeur);
echo trim ($tampon);
}
}
else
{
echo "erreur d'ouverture du fichier $filename";
}
echo "</textarea><BR>";
?>
<input type='hidden' name='choix' value='IP_exceptions'>
<input type='submit' value='<?php echo "$l_save_modif"; ?>'>
</FORM>
</td></tr>
</TABLE>
</BODY>
</HTML>
/web/acc/admin/auth_exceptions.php
7,6 → 7,7
</HEAD>
<body>
<?
$mac_allowed_list="/usr/local/etc/alcasar-macallowed";
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
22,10 → 23,11
$l_trusted_mac = "&Eacute;quipements de confiance";
$l_trusted_mac_explain = "Entrez ici les adresses MAC des &eacute;quipements autorisés à joindre Internet sans authentification";
$l_trusted_mac_list = "Liste des adresses MAC de confiance";
$l_trusted_mac_address = "Adresse MAC autorisées";
$l_trusted_mac_address = "Adresses MAC autorisées";
$l_trusted_mac_info = "Information équipement";
$l_trusted_mac_del = "Supprimer de la liste";
$l_submit = "Enregistrer";
$l_add_to_list = "Ajouter";
}
else {
$l_error_open_file = "File open error";
35,13 → 37,13
$l_trusted_sites_list = "Trusted Internet sites list";
$l_trusted_urls_list = "Trusted Internet URLs list";
$l_trusted_mac = "Trusted Equipments";
$l_trusted_mac_explain = "Enter MAC address of equipments that could contact Internet without authentification";
$l_trusted_mac_explain = "Enter MAC address of equipments that could contact Internet without authentication";
$l_trusted_mac_list = "Trusted MAC addresses list";
$l_trusted_mac_address = "Allowed MAC adress MAC";
$l_trusted_mac_address = "Allowed MAC adress";
$l_trusted_mac_info = "Equipment information";
$l_trusted_mac_del = "Delete from list";
$l_submit = "Submit";
 
$l_add_to_list = "Add";
}
if (isset($_POST['choix'])){
switch ($_POST['choix'])
82,26 → 84,63
exec ("sudo service chilli restart");
unset ($_POST['choix']);
break;
case 'MAJ_MACALLOWED' :
$nb_mac=0;
$tab_macs = explode ("\n", $_POST['trusted_macs']);
$fichier=fopen("/usr/local/etc/alcasar-macallowed","w+");
fputs ($fichier, "macallowed=\"");
foreach ($tab_macs as $macs ){
$tr_macs=trim($macs);
$nb_mac++;
if ($tr_macs != ""){
if ($nb_mac>1) fputs ($fichier, ",".$tr_macs);
else fputs ($fichier, $tr_macs);
case 'new_mac' :
if (trim($_POST['add_mac']) != "")
{
if (is_file ($mac_allowed_list)) # le fichier existe
{
$tab=file($mac_allowed_list);
$insert = true;
if ($tab) # le fichier n'est pas vide
{
foreach ($tab as $line) # on teste si l'adresse mac n'est pas déjà présente
{
$field=explode("#", $line);
$mac_addr=trim($field[0],"macallowed=");
if (trim($_POST['add_mac']) == trim ($mac_addr))
{
$insert = false;;
break;
}
}
}
if ($insert == true)
{
$line = "macallowed=" . trim($_POST['add_mac']) . " #" . trim($_POST['add_comment']) . "\n";
$pointeur=fopen($mac_allowed_list,"a");
fwrite ($pointeur, $line);
fclose ($pointeur);
exec ("sudo service chilli restart");
}
}
fputs($fichier, "\"");
fclose($fichier);
unset($_POST['trusted_macs']);
unset($nb_mac);
else {echo "$l_error_open_file $mac_allowed_list";}
}
break;
case 'del_mac' :
$tab=file($mac_allowed_list);
if ($tab)
{
$pointeur=fopen($mac_allowed_list,"w+");
foreach ($tab as $line)
{
$field=explode("#", $line);
$mac_addr=trim(trim($field[0],"macallowed="));
$remove_line = false;
foreach ($_POST as $key => $value)
{
if ($mac_addr == $key)
{
$remove_line = True;
break;
}
}
if (! $remove_line) {fwrite($pointeur,$line);}
}
fclose($pointeur);
exec ("sudo service chilli restart");
unset ($_POST['choix']);
break;
}
else {echo "$l_error_open_file $mac_allowed_list";}
break;
}
}
?>
194,89 → 233,50
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
echo "<table cellspacing=2 cellpadding=3 border=1>";
echo "<tr><th>$l_trusted_mac_address<th>$l_trusted_mac_info<th>$l_trusted_mac_del</tr>";
// On lit et on interprète le fichier de filtrage de protocoles
$trusted_mac_file="/usr/local/etc/alcasar-macallowed";
if (file_exists($trusted_mac_file))
// On lit et on affiche le fichier d'exception
$display_form = true;
if (is_file ($mac_allowed_list))
{
$pointeur=fopen($trusted_mac_file,"r");
while (!feof ($pointeur))
$tab=file($mac_allowed_list);
if ($tab) # le fichier n'est pas vide
{
$ligne=fgets($pointeur, 4096);
if ($ligne)
foreach ($tab as $line)
{
$field=explode(" ", $ligne);
$mac_info=trim($field[2],"#");
echo "<tr><td>$field[1]";
$field=explode("#", $line);
$mac_addr=trim(trim($field[0],"macallowed="));
$mac_info=trim($field[1],"#");
echo "<tr><td>$mac_addr";
echo "<td>$mac_info";
echo "<td><input type='checkbox' name='del-$field[1]'>";
echo "<td><input type='checkbox' name='$mac_addr'>";
echo "</tr>";
}
}
fclose($pointeur);
else { $display_form = false;}
}
else {
echo "$l_error_open_file $trusted_mac_file";
echo "$l_error_open_file $mac_allowed_list";
$display_form = false;
}
echo "</table>";
if ($display_form)
{
echo "<input type='hidden' name='choix' value='del_mac'>";
echo "<input type='submit' value='$l_submit'>";
}
echo "</form></td><td valign='middle' align='center'>";
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
echo "<table cellspacing=2 cellpadding=3 border=1>";
echo "<tr><th>$l_trusted_mac_address<th>$l_trusted_mac_info";
?>
</table>
<input type='hidden' name='choix' value='change'>
<input type='submit' value='<?echo"$l_submit";?>'>
</form>
</td>
<td valign='middle' align='center'>
<form action='net_filter.php' method='POST'>
<table cellspacing=2 cellpadding=3 border=1>
<tr><th><?echo"$l_trusted_mac_address<th>$l_trusted_mac_info";?></tr>
<tr><td><input type='text' name='add_proto' size='10'></td>
<td><input type='text' name='add_port' size='5'></td>
<input type='hidden' name='choix' value='new_proto'>
<td></td></tr>
<tr><td>exemple : 12-2f-36-a4-df-43</td><td>exemple : PC of the boss</td><td></td></tr>
<tr><td><input type='text' name='add_mac' size='17'></td>
<td><input type='text' name='add_comment' size='10'></td>
<input type='hidden' name='choix' value='new_mac'>
<td><input type='submit' value='<?echo"$l_add_to_list";?>'></td>
</tr></table>
</form>
</td></tr>
</table>
 
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
<tr bgcolor="#666666"><td>
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
<tr><td valign="middle" align="left">
<center><?php
echo "$l_trusted_mac_explain1 <BR>";
echo "$l_trusted_mac_explain2";
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
<TABLE cellspacing=2 cellpadding=3 border=1>
<tr><td width=60% height=100% align=center>
<H3><?php echo $l_trusted_mac_list ;?></H3>
exemple : 12-2f-36-a4-df-43<BR>
<?php
echo "<textarea name='trusted_macs' rows=5 cols=40>";
$trusted_macs_file="/usr/local/etc/alcasar-macallowed";
$ouvre=fopen($trusted_macs_file,"r");
if ($ouvre)
{
while (!feof ($ouvre))
{
$tampon = fgets($ouvre, 4096);
$mac_list_l = substr($tampon,11);
$mac_list = trim ($mac_list_l,"\"\n\t ");
$tab_macs = explode (",", $mac_list);
foreach ($tab_macs as $macs ){
if ($macs) echo $macs."\n";
}
}
}
else {
echo "failed to open $trusted_macs_file";
}
fclose($ouvre);
echo "</textarea>";
?>
</td></tr>
</TABLE>
<input type='hidden' name='choix' value='MAJ_MACALLOWED'>
<input type='submit' value='<?php echo $l_submit ;?>'>
</FORM>
</td></tr>
</TABLE>
</BODY>
</HTML>
/web/acc/admin/filter_exceptions.php
0,0 → 1,120
<!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>ALCASAR Filter Exceptions</TITLE>
<link rel="stylesheet" href="/css/style.css" type="text/css">
</HEAD>
<body>
<?
# 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_exception_IP = "Exception au filtrage";
$l_exception_txt="Entrez ici les adresses IP des stations du réseau de consultation ne subissant ni filtrage WEB ni filtrage réseau<BR>Entrez une adresse IP par ligne";
$l_submit = "Enregistrer";
}
else {
$l_exception_IP = "Network filtering exceptions";
$l_exception_txt="Put here the stations IP address that won't be neither WEB filtered nor network filtered<BR>Put one IP per row";
$l_submit = "Submit";
}
if (isset($_POST['choix'])){
switch ($_POST['choix'])
{
case 'IP_exceptions' :
// réencodage iso + format unix + rc fin de ligne (ouf...)
$ip_list = str_replace("\r\n", "\n", utf8_decode($_POST['exception_list']));
if (strlen($ip_list) != 0){
if ($ip_list[strlen($ip_list)-1] != "\n") { $ip_list[strlen($ip_list)]="\n";} ;} ;
unset($_POST['exception_list']);
// écriture exception pour Dansguardian
$fichier=fopen("/etc/dansguardian/lists/exceptioniplist", "w+");
fputs($fichier,$ip_list);
fclose($fichier);
// écriture exception pour filtrage réseau et filtrage DNS
$fichier=fopen("/usr/local/etc/alcasar-filter-exceptions", "w+");
fputs($fichier, $ip_list);
fclose($fichier);
// test si le filtrage Dansguardian est activé
$pointeur = fopen("/etc/dansguardian/dansguardian.conf", "r");
$result = false;
if ($pointeur)
{
while (!feof($pointeur))
{
$ligne = fgets($pointeur);
if (preg_match("/^reportinglevel = 3/", $ligne, $r))
{
$result = true;
break;
}
}
}
fclose($pointeur);
if ($result)
{
exec ("sudo service dansguardian restart");
}
// test si filtrage réseau activé
$pointeur = fopen("/usr/local/bin/alcasar-iptables.sh", "r");
$result = False ;
if ($pointeur)
{
while (!feof($pointeur))
{
$ligne = fgets($pointeur);
if (preg_match('/^FILTERING="yes"/', $ligne, $r))
{
$result = True ;
break;
}
}
}
fclose($pointeur);
if ($result)
{
exec ("sudo /usr/local/bin/alcasar-iptables.sh");
}
break;
}
}
?>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th><?php echo $l_exception_IP ;?></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=1>
<tr><td valign="middle" align="left">
<TABLE width=70% border=0>
<?php
echo "<form action='$_SERVER[PHP_SELF]' method='POST'>";
echo " $l_exception_txt";
echo "<BR><textarea name='exception_list' rows=5 cols=40>";
$filename="/usr/local/etc/alcasar-filter-exceptions";
if (file_exists($filename))
{
if (filesize($filename) != 0)
{
$pointeur=fopen($filename,"r");
$tampon = fread($pointeur, filesize($filename));
fclose($pointeur);
echo $tampon;
}
}
else
{
echo "erreur d'ouverture du fichier $filename";
}
echo "</textarea><BR>";
?>
<input type='hidden' name='choix' value='IP_exceptions'>
<input type='submit' value='Enregistrer les modifications'></CENTER>
</FORM>
</td></tr>
</TABLE>
</BODY>
</HTML>
/web/acc/filtering.php
1,8 → 1,10
<?
$select[0]="$l_domains_filter";
$select[1]=$l_network;
$select[2]="Exceptions";
$fich[0]="admin/dns_filter.php";
$fich[1]="admin/net_filter.php";
$fich[2]="admin/filter_exceptions.php";
$j=0;
$nb=count($select);
while ($j != $nb)