Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
# $Id: index.php 2136 2017-03-16 23:09:43Z richard $
|
2 |
# $Id: index.php 2186 2017-04-26 18:12:04Z tom.houdayer $
|
3 |
#
|
3 |
#
|
4 |
# index.php for ALCASAR by Rexy
|
4 |
# index.php for ALCASAR by Rexy
|
5 |
# UI & css style by stephane ERARD
|
5 |
# UI & css style by stephane ERARD
|
6 |
# The contents of this file may be used under the terms of the GNU
|
6 |
# The contents of this file may be used under the terms of the GNU
|
7 |
# General Public License Version 2, provided that the above copyright
|
7 |
# General Public License Version 2, provided that the above copyright
|
Line 9... |
Line 9... |
9 |
# substantial portions of the software.
|
9 |
# substantial portions of the software.
|
10 |
/****************************************************************
|
10 |
/****************************************************************
|
11 |
* GLOBAL FILE PATHS *
|
11 |
* GLOBAL FILE PATHS *
|
12 |
*****************************************************************/
|
12 |
*****************************************************************/
|
13 |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
|
13 |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
|
- |
|
14 |
define ("DOMAIN_ALLOWED_LIST", "/usr/local/etc/alcasar-uamdomain");
|
14 |
|
15 |
|
15 |
/****************************************************************
|
16 |
/****************************************************************
|
16 |
* FILE reading test *
|
17 |
* FILE reading test *
|
17 |
*****************************************************************/
|
18 |
*****************************************************************/
|
18 |
$conf_files=array(CONF_FILE);
|
19 |
$conf_files = array(CONF_FILE);
|
Line 25... |
Line 26... |
25 |
}
|
26 |
}
|
26 |
}
|
27 |
}
|
27 |
/****************************************************************
|
28 |
/****************************************************************
|
28 |
* Read CONF_FILE *
|
29 |
* Read CONF_FILE *
|
29 |
*****************************************************************/
|
30 |
*****************************************************************/
|
30 |
$ouvre=fopen(CONF_FILE,"r");
|
31 |
$file_conf = fopen(CONF_FILE, 'r');
|
31 |
if ($ouvre){
|
32 |
if (!$file_conf) {
|
- |
|
33 |
exit('Error opening the file '.CONF_FILE);
|
- |
|
34 |
}
|
32 |
while (!feof ($ouvre)){
|
35 |
while (!feof($file_conf)) {
|
33 |
$tampon = fgets($ouvre, 4096);
|
36 |
$tampon = fgets($file_conf, 4096);
|
34 |
if (strpos($tampon,"=")!==false){
|
37 |
if ((strpos($tampon, '=') !== false) && (substr($tampon, 0, 1) !== '#')) {
|
35 |
$tmp = explode("=",$tampon);
|
38 |
$tmp = explode('=', $tampon);
|
36 |
$conf[$tmp[0]] = $tmp[1];
|
39 |
$conf[$tmp[0]] = trim($tmp[1]);
|
37 |
}
|
40 |
}
|
38 |
}
|
41 |
}
|
39 |
}else{
|
- |
|
40 |
exit("Error opening the file ".CONF_FILE);
|
42 |
fclose($file_conf);
|
41 |
}
|
43 |
|
42 |
fclose($ouvre);
|
- |
|
43 |
$organisme = trim($conf["ORGANISM"]);
|
44 |
$organisme = trim($conf["ORGANISM"]);
|
44 |
$domainname = trim($conf["DOMAIN"]);
|
45 |
$hostname = trim($conf["HOSTNAME"]).'.'.trim($conf["DOMAIN"]);
|
45 |
$hostname = "alcasar.".$domainname;
|
- |
|
46 |
$network_pb = False; # "alcasar-watchdog.sh" changes this value if a network issue is detected
|
46 |
$network_pb = False; # "alcasar-watchdog.sh" changes this value if a network issue is detected
|
47 |
$diagnostic = "can't contact the default router"; # "alcasar-watchdog.sh" changes this value if a network issue is detected
|
47 |
$diagnostic = "can't contact the default router"; # "alcasar-watchdog.sh" changes this value if a network issue is detected
|
48 |
$cert_add = "http://$hostname/certs";
|
48 |
$cert_add = "http://$hostname/certs";
|
49 |
$direct_access = False;
|
49 |
$direct_access = False;
|
50 |
$display_menu=False;
|
50 |
$display_menu=False;
|
Line 62... |
Line 62... |
62 |
# Retrieve the user info behind the remote ip
|
62 |
# Retrieve the user info behind the remote ip
|
63 |
exec ("sudo /usr/sbin/chilli_query list | grep -Ew $remote_ip" , $tab);
|
63 |
exec ("sudo /usr/sbin/chilli_query list | grep -Ew $remote_ip" , $tab);
|
64 |
$user = explode (" ", $tab[0]);
|
64 |
$user = explode (" ", $tab[0]);
|
65 |
|
65 |
|
66 |
# Test if it's a direct connexion to ALCASAR
|
66 |
# Test if it's a direct connexion to ALCASAR
|
67 |
if (isset($_SERVER['HTTP_HOST'])){
|
- |
|
68 |
if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || (preg_match ("/^alcasar$/", $_SERVER['HTTP_HOST'])) || (preg_match ("/^$hostname$/", $_SERVER['HTTP_HOST'])) || (preg_match ("/^$organisme$/", $_SERVER['HTTP_HOST']))){
|
67 |
if (isset($_SERVER['HTTP_HOST']) && (($_SERVER['HTTP_HOST'] === $_SERVER['SERVER_ADDR']) || ($_SERVER['HTTP_HOST'] === 'alcasar') || ($_SERVER['HTTP_HOST'] === $hostname) || ($_SERVER['HTTP_HOST'] === $organisme))) {
|
69 |
$direct_access=True;
|
68 |
$direct_access = true;
|
70 |
exec("sudo /usr/sbin/ipset del not_auth_yet $remote_ip"); # del user of the ipset "not_auth_yet" to not loop
|
69 |
exec("sudo /usr/sbin/ipset del not_auth_yet $remote_ip"); # del user of the ipset "not_auth_yet" to not loop
|
71 |
}
|
70 |
}
|
72 |
}
|
71 |
|
73 |
# Function to adapt time connexion in seconds to H,M,S
|
72 |
# Function to adapt time connexion in seconds to H,M,S
|
74 |
function secondsToDuration($seconds = null){
|
73 |
function secondsToDuration($seconds = null){
|
75 |
if ($seconds == null) return "";
|
74 |
if ($seconds == null) return "";
|
76 |
$temp = $seconds % 3600;
|
75 |
$temp = $seconds % 3600;
|
77 |
$time[0] = ( $seconds - $temp ) / 3600 ; // hours
|
76 |
$time[0] = ( $seconds - $temp ) / 3600 ; // hours
|
Line 87... |
Line 86... |
87 |
}
|
86 |
}
|
88 |
|
87 |
|
89 |
if ((isset ($user[4])) && ($user[4] != "0")){ # the user is authenticated
|
88 |
if ((isset ($user[4])) && ($user[4] != "0")){ # the user is authenticated
|
90 |
if(isset($_GET['redirect'])) # if user has been warned, we redirect him to his website
|
89 |
if(isset($_GET['redirect'])) # if user has been warned, we redirect him to his website
|
91 |
{
|
90 |
{
|
92 |
$redir = "http://".$_GET['url'];
|
- |
|
93 |
header("Location: $_GET[url]",TRUE,307);
|
91 |
header('Location: '.$_GET['url'], true, 307);
|
94 |
exit;
|
92 |
exit;
|
95 |
}
|
93 |
}
|
96 |
# we retrieve his three last connections
|
94 |
# we retrieve his three last connections
|
97 |
if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
|
95 |
if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
|
98 |
include_once("/etc/freeradius-web/config.php");
|
96 |
include_once("/etc/freeradius-web/config.php");
|
Line 157... |
Line 155... |
157 |
if ($user[5] != $user[0]){ # authentication exception or not
|
155 |
if ($user[5] != $user[0]){ # authentication exception or not
|
158 |
$l_logout_explain = "Ferme la session de l'usager actuellement connecté. <br><br>Utilisateur connecté : <a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
|
156 |
$l_logout_explain = "Ferme la session de l'usager actuellement connecté. <br><br>Utilisateur connecté : <a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history dernières connexions :$connection_history";
|
159 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se déconnecter d'internet</a>";
|
157 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se déconnecter d'internet</a>";
|
160 |
}
|
158 |
}
|
161 |
else{
|
159 |
else{
|
162 |
$l_logout_explain = "Votre système ($user[5]) est en exception d'authentication.<br><br>$nb_connection_history last connections :$connection_history";
|
160 |
$l_logout_explain = "Votre système ($user[5]) est en exception d'authentication.<br><br>$nb_connection_history dernières connexions :$connection_history";
|
163 |
$l_logout = "Information des connexions";
|
161 |
$l_logout = "Information des connexions";
|
164 |
}
|
162 |
}
|
165 |
}
|
163 |
}
|
166 |
$l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
|
164 |
$l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</a>";
|
167 |
$l_password_change_explain = "Vous redirige sur la page de changement du mot de passe de votre compte d'accès à Internet.<br><br>Vous devez avoir un compte internet valide.";
|
165 |
$l_password_change_explain = "Vous redirige sur la page de changement du mot de passe de votre compte d'accès à Internet.<br><br>Vous devez avoir un compte internet valide.";
|
Line 170... |
Line 168... |
170 |
$l_service_sms = "Service SMS actif";
|
168 |
$l_service_sms = "Service SMS actif";
|
171 |
$l_service_sms_n = "Service SMS non actif";
|
169 |
$l_service_sms_n = "Service SMS non actif";
|
172 |
$l_acc_sms = "Auto enregistrement par SMS";
|
170 |
$l_acc_sms = "Auto enregistrement par SMS";
|
173 |
$l_explain_warn = "L'administrateur a créé une archive contenant vos journaux de connexion dans le cadre d'une affaire judiciaire.";
|
171 |
$l_explain_warn = "L'administrateur a créé une archive contenant vos journaux de connexion dans le cadre d'une affaire judiciaire.";
|
174 |
if(isset($_GET['url'])){
|
172 |
if(isset($_GET['url'])){
|
175 |
$l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>Je comprends et je souhaite continuer ma navigation.</a>";
|
173 |
$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">Je comprends et je souhaite continuer ma navigation.</a>";
|
176 |
}
|
174 |
}
|
177 |
else{
|
175 |
else{
|
178 |
$l_continue_link = "<a href='index.php' class='button'>Je comprends et je souhaite continuer ma navigation.</a>";
|
176 |
$l_continue_link = "<a href=\"index.php\" class=\"button\">Je comprends et je souhaite continuer ma navigation.</a>";
|
179 |
}
|
177 |
}
|
180 |
$l_title_warn="Cher utilisateur, ";
|
178 |
$l_title_warn="Cher utilisateur, ";
|
181 |
$l_explain_warn_name="Une personne sous le nom de ";
|
179 |
$l_explain_warn_name="Une personne sous le nom de ";
|
182 |
$l_explain_warn_ip="sous cette IP : ";
|
180 |
$l_explain_warn_ip="sous cette IP : ";
|
183 |
$l_explain_warn_date="a consulté vos journaux de connexion le ";
|
181 |
$l_explain_warn_date="a consulté vos journaux de connexion le ";
|
184 |
$l_explain_warn_reason="Raison invoquée : ";
|
182 |
$l_explain_warn_reason="Raison invoquée : ";
|
- |
|
183 |
$l_uam_domain = "Sites autorisés : ";
|
185 |
}
|
184 |
}
|
186 |
else if($Language == 'pt'){
|
185 |
else if($Language == 'pt'){
|
187 |
$l_access_denied = "Controle de acesso";
|
186 |
$l_access_denied = "Controle de acesso";
|
188 |
$l_access_welcome = "Bem-vindo ao Alcasar";
|
187 |
$l_access_welcome = "Bem-vindo ao Alcasar";
|
189 |
$l_access_unavailable = "ACESSO INDISPONÍVEL";
|
188 |
$l_access_unavailable = "ACESSO INDISPONÍVEL";
|
Line 203... |
Line 202... |
203 |
$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
|
202 |
$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
|
204 |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Abrir uma conexão de Internet</a>";
|
203 |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Abrir uma conexão de Internet</a>";
|
205 |
}
|
204 |
}
|
206 |
else{
|
205 |
else{
|
207 |
if ($user[5] != $user[0]){ # authentication exception or not
|
206 |
if ($user[5] != $user[0]){ # authentication exception or not
|
208 |
$l_logout_explain = "Se desejar, feche a conexão do usuário atual conectado.<br> Usuário conectado : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
|
207 |
$l_logout_explain = "Se desejar, feche a conexão do usuário atual conectado.<br> Usuário conectado : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history logins últimos :$connection_history";
|
209 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
|
208 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>";
|
210 |
}
|
209 |
}
|
211 |
else{
|
210 |
else{
|
212 |
$l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
|
211 |
$l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history";
|
213 |
$l_logout = "Informações de conexões";
|
212 |
$l_logout = "Informações de conexões";
|
Line 220... |
Line 219... |
220 |
$l_service_sms = "SMS service enable";
|
219 |
$l_service_sms = "SMS service enable";
|
221 |
$l_service_sms_n = "SMS service disable";
|
220 |
$l_service_sms_n = "SMS service disable";
|
222 |
$l_acc_sms = "Auto registration by SMS";
|
221 |
$l_acc_sms = "Auto registration by SMS";
|
223 |
$l_explain_warn = "El administrador ha creado un archivo que contiene los periódicos de inicio de sesión como parte de un proceso judicial.";
|
222 |
$l_explain_warn = "El administrador ha creado un archivo que contiene los periódicos de inicio de sesión como parte de un proceso judicial.";
|
224 |
if(isset($_GET['url'])){
|
223 |
if(isset($_GET['url'])){
|
225 |
$l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>Lo comprendo y deseo continuar mi navegación.</a>";
|
224 |
$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">Lo comprendo y deseo continuar mi navegación.</a>";
|
226 |
}
|
225 |
}
|
227 |
else{
|
226 |
else{
|
228 |
$l_continue_link = "<a href='index.php' class='button'>Lo comprendo y deseo continuar mi navegación.</a>";
|
227 |
$l_continue_link = "<a href=\"index.php\" class=\"button\">Lo comprendo y deseo continuar mi navegación.</a>";
|
229 |
}
|
228 |
}
|
230 |
$l_title_warn="Estimado usuario,";
|
229 |
$l_title_warn="Estimado usuario,";
|
231 |
$l_explain_warn_name="El usario ";
|
230 |
$l_explain_warn_name="El usario ";
|
232 |
$l_explain_warn_ip="con este IP : ";
|
231 |
$l_explain_warn_ip="con este IP : ";
|
233 |
$l_explain_warn_date="consultó a sus registros de conexión el ";
|
232 |
$l_explain_warn_date="consultó a sus registros de conexión el ";
|
234 |
$l_explain_warn_reason="con la siguiente razón : ";
|
233 |
$l_explain_warn_reason="con la siguiente razón : ";
|
- |
|
234 |
$l_uam_domain = "Sites autorizados : ";
|
235 |
}
|
235 |
}
|
236 |
else if($Language == 'zn'){
|
236 |
else if($Language == 'zn'){
|
237 |
$l_access_denied = "访问控制";
|
237 |
$l_access_denied = "访问控制";
|
238 |
$l_access_welcome = "欢迎来到ALCASAR";
|
238 |
$l_access_welcome = "欢迎来到ALCASAR";
|
239 |
$l_access_unavailable = "不可访问";
|
239 |
$l_access_unavailable = "不可访问";
|
Line 270... |
Line 270... |
270 |
$l_service_sms = "短信服务可用";
|
270 |
$l_service_sms = "短信服务可用";
|
271 |
$l_service_sms_n = "短信服务禁用";
|
271 |
$l_service_sms_n = "短信服务禁用";
|
272 |
$l_acc_sms = "短信自动注册";
|
272 |
$l_acc_sms = "短信自动注册";
|
273 |
$l_explain_warn = "管理员创建了一份可用于司法调查的连接日志文档。";
|
273 |
$l_explain_warn = "管理员创建了一份可用于司法调查的连接日志文档。";
|
274 |
if(isset($_GET['url'])){
|
274 |
if(isset($_GET['url'])){
|
275 |
$l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>我明白并希望继续浏览。</a>";
|
275 |
$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">我明白并希望继续浏览。</a>";
|
276 |
}
|
276 |
}
|
277 |
else{
|
277 |
else{
|
278 |
$l_continue_link = "<a href='index.php' class='button'>我明白并希望继续浏览。</a>";
|
278 |
$l_continue_link = "<a href=\"index.php\" class=\"button\">我明白并希望继续浏览。</a>";
|
279 |
}
|
279 |
}
|
280 |
$l_title_warn="亲爱的用户,";
|
280 |
$l_title_warn="亲爱的用户,";
|
281 |
$l_explain_warn_name="一人名为";
|
281 |
$l_explain_warn_name="一人名为";
|
282 |
$l_explain_warn_ip="在此IP:";
|
282 |
$l_explain_warn_ip="在此IP:";
|
283 |
$l_explain_warn_date="查看您的连接日志于";
|
283 |
$l_explain_warn_date="查看您的连接日志于";
|
284 |
$l_explain_warn_reason=" 如下原因:";
|
284 |
$l_explain_warn_reason=" 如下原因:";
|
- |
|
285 |
$l_uam_domain = "授权网站 : ";
|
285 |
}
|
286 |
}
|
286 |
else if ($Language == 'ar'){
|
287 |
else if ($Language == 'ar'){
|
287 |
$l_access_denied = "مراقبة الدخول";
|
288 |
$l_access_denied = "مراقبة الدخول";
|
288 |
$l_access_welcome = "ALCASAR مرحبا بك في";
|
289 |
$l_access_welcome = "ALCASAR مرحبا بك في";
|
289 |
$l_access_unavailable = "الدخول غير متوفر";
|
290 |
$l_access_unavailable = "الدخول غير متوفر";
|
Line 342... |
Line 343... |
342 |
$l_service_sms_n = "غير نشطة SMS خدمة";
|
343 |
$l_service_sms_n = "غير نشطة SMS خدمة";
|
343 |
$l_acc_sms = "تسجيل ذاتي عن طريق SMS";
|
344 |
$l_acc_sms = "تسجيل ذاتي عن طريق SMS";
|
344 |
$l_explain_warn = "المسؤول أنشأ أرشيفاً تحتوي على سجلات الاتصال في إطار تحقيق قضائي";
|
345 |
$l_explain_warn = "المسؤول أنشأ أرشيفاً تحتوي على سجلات الاتصال في إطار تحقيق قضائي";
|
345 |
$understand_text = "أنا متفهم و أريد ان أواصل التصفح";
|
346 |
$understand_text = "أنا متفهم و أريد ان أواصل التصفح";
|
346 |
if(isset($_GET['url'])){
|
347 |
if(isset($_GET['url'])){
|
347 |
$l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>$understand_text</a>";
|
348 |
$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">$understand_text</a>";
|
348 |
}
|
349 |
}
|
349 |
else{
|
350 |
else{
|
350 |
$l_continue_link = "<a href='index.php' class='button'>$understand_text</a>";
|
351 |
$l_continue_link = "<a href=\"index.php\" class=\"button\">$understand_text</a>";
|
351 |
}
|
352 |
}
|
352 |
$l_title_warn = "عزيزي المستعمل, ";
|
353 |
$l_title_warn = "عزيزي المستعمل, ";
|
353 |
$l_explain_warn_name = "شخص مسمىٰ ";
|
354 |
$l_explain_warn_name = "شخص مسمىٰ ";
|
354 |
$l_explain_warn_ip = "تحت هذا IP: ";
|
355 |
$l_explain_warn_ip = "تحت هذا IP: ";
|
355 |
$l_explain_warn_date = "إطّلع على سجلات الاتصال الخاصة بك في";
|
356 |
$l_explain_warn_date = "إطّلع على سجلات الاتصال الخاصة بك في";
|
356 |
$l_explain_warn_reason = "السبب المسرّح به: ";
|
357 |
$l_explain_warn_reason = "السبب المسرّح به: ";
|
- |
|
358 |
$l_uam_domain = ":المواقع المسموحة ";
|
357 |
}
|
359 |
}
|
358 |
else{
|
360 |
else{
|
359 |
$l_access_denied = "Access control";
|
361 |
$l_access_denied = "Access control";
|
360 |
$l_access_welcome = "Welcome on ALCASAR";
|
362 |
$l_access_welcome = "Welcome on ALCASAR";
|
361 |
$l_access_unavailable = "ACCESS UNAVAILABLE";
|
363 |
$l_access_unavailable = "ACCESS UNAVAILABLE";
|
Line 392... |
Line 394... |
392 |
$l_service_sms = "SMS service enable";
|
394 |
$l_service_sms = "SMS service enable";
|
393 |
$l_service_sms_n = "SMS service disable";
|
395 |
$l_service_sms_n = "SMS service disable";
|
394 |
$l_acc_sms = "Auto registration by SMS";
|
396 |
$l_acc_sms = "Auto registration by SMS";
|
395 |
$l_explain_warn = "The administrator created an archive which contains your imputabilities logs for a judicial investigation.";
|
397 |
$l_explain_warn = "The administrator created an archive which contains your imputabilities logs for a judicial investigation.";
|
396 |
if(isset($_GET['url'])){
|
398 |
if(isset($_GET['url'])){
|
397 |
$l_continue_link = "<a href='index.php?redirect=1&url=$_GET[url]' class='button'>I understand and I wish to continue.</a>";
|
399 |
$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">I understand and I wish to continue.</a>";
|
398 |
}
|
400 |
}
|
399 |
else{
|
401 |
else{
|
400 |
$l_continue_link = "<a href='index.php' class='button'>I understand and I wish to continue.</a>";
|
402 |
$l_continue_link = "<a href=\"index.php\" class=\"button\">I understand and I wish to continue.</a>";
|
401 |
}
|
403 |
}
|
402 |
$l_title_warn="Dear user,";
|
404 |
$l_title_warn="Dear user,";
|
403 |
$l_explain_warn_name="Someone called ";
|
405 |
$l_explain_warn_name="Someone called ";
|
404 |
$l_explain_warn_ip="with this IP : ";
|
406 |
$l_explain_warn_ip="with this IP : ";
|
405 |
$l_explain_warn_date="has read your connexion logs at ";
|
407 |
$l_explain_warn_date="has read your connexion logs at ";
|
406 |
$l_explain_warn_reason="For this reason : ";
|
408 |
$l_explain_warn_reason="For this reason : ";
|
- |
|
409 |
$l_uam_domain = "Authorized websites : ";
|
407 |
}
|
410 |
}
|
408 |
|
411 |
|
409 |
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
|
412 |
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
|
410 |
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
|
413 |
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
|
411 |
|
414 |
|
Line 439... |
Line 442... |
439 |
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
|
442 |
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
|
440 |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
443 |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
441 |
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
|
444 |
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
|
442 |
header("Cache-Control: post-check=0, pre-check=0", false);
|
445 |
header("Cache-Control: post-check=0, pre-check=0", false);
|
443 |
header("Pragma: no-cache");
|
446 |
header("Pragma: no-cache");
|
- |
|
447 |
|
- |
|
448 |
exec("sudo /usr/sbin/ipset list not_filtered | grep $remote_ip | wc -l 2>&1", $ipset_not_filtered);
|
- |
|
449 |
# if user is in "ipset_not_filtered" then he must refresh its dns cache (we are in the interception process)
|
- |
|
450 |
if (!$direct_access && !$display_menu && ($ipset_not_filtered[0] == '1') && (!$network_pb) && (!isset($_GET['warn']))) {
|
- |
|
451 |
echo '<!doctype html><html><head><script>window.location.reload(true)</script></head><body></body></html>'; # force DNS request
|
- |
|
452 |
}
|
- |
|
453 |
|
444 |
?>
|
454 |
?>
|
445 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
455 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
446 |
<html>
|
456 |
<html>
|
447 |
<head>
|
457 |
<head>
|
448 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
458 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
449 |
<title>ALCASAR - <?php echo $l_title; ?></title>
|
459 |
<title>ALCASAR - <?php echo $l_title; ?></title>
|
450 |
<meta http-equiv="Cache-control" content="no-cache">
|
460 |
<meta http-equiv="Cache-control" content="no-cache">
|
451 |
<meta http-equiv="Pragma" content="no-cache">
|
461 |
<meta http-equiv="Pragma" content="no-cache">
|
452 |
<?php
|
- |
|
453 |
echo "<style>";
|
- |
|
454 |
include("css/style_intercept.css");
|
462 |
<link rel="stylesheet" href="/css/style_intercept.css" type="text/css">
|
455 |
echo "</style>";
|
- |
|
456 |
?>
|
- |
|
457 |
|
- |
|
458 |
<script type="text/javascript">
|
463 |
<script type="text/javascript">
|
459 |
function valoriserDiv5(param){
|
464 |
function valoriserDiv5(param){
|
460 |
document.getElementById("box_info").innerHTML = param.innerHTML;
|
465 |
document.getElementById("box_info").innerHTML = param.innerHTML;
|
461 |
}
|
466 |
}
|
462 |
</script>
|
467 |
</script>
|
Line 470... |
Line 475... |
470 |
if ($network_pb) {
|
475 |
if ($network_pb) {
|
471 |
echo " <span>$l_explain_net_pb</span>";
|
476 |
echo " <span>$l_explain_net_pb</span>";
|
472 |
}
|
477 |
}
|
473 |
}
|
478 |
}
|
474 |
else{ # the user is intercepted
|
479 |
else{ # the user is intercepted
|
475 |
exec("sudo /usr/sbin/ipset list not_filtered | grep $remote_ip | wc -l 2>&1", $ipset_not_filtered);
|
- |
|
476 |
# if user is in "ipset_not_filtered" then he must refresh its dns cache (we are in the interception process)
|
- |
|
477 |
if (($ipset_not_filtered[0] == '1') && (!$network_pb)){
|
- |
|
478 |
echo "<script>window.location.reload(true)</script>"; # force DNS request
|
- |
|
479 |
}
|
- |
|
480 |
# if user need to be warned that someone reads his logs
|
480 |
# if user need to be warned that someone reads his logs
|
481 |
if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1'){
|
481 |
if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1') {
|
482 |
echo "
|
482 |
echo "
|
483 |
<div id=\"cadre_titre\" class=\"titre_refus\">
|
483 |
<div id=\"cadre_titre\" class=\"titre_refus\">
|
484 |
<p id=\"acces_controle\" class=\"titre_refus\">$l_title_warn</p>";
|
484 |
<p id=\"acces_controle\" class=\"titre_refus\">$l_title_warn</p>";
|
Line 531... |
Line 531... |
531 |
<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
|
531 |
<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
|
532 |
<span>$l_logout</span>
|
532 |
<span>$l_logout</span>
|
533 |
<img src=\"$img_rep$img_internet\">
|
533 |
<img src=\"$img_rep$img_internet\">
|
534 |
</div>";
|
534 |
</div>";
|
535 |
}
|
535 |
}
|
- |
|
536 |
|
- |
|
537 |
// Read the "Domain allowed" file
|
- |
|
538 |
$domainAllowedHtml = '';
|
- |
|
539 |
$tab = file(DOMAIN_ALLOWED_LIST);
|
- |
|
540 |
if ($tab) { // the file isn't empty
|
- |
|
541 |
$domainAllowedHtml .= '<p>'.$l_uam_domain.'<br><ul>';
|
- |
|
542 |
foreach ($tab as $line) {
|
- |
|
543 |
if (trim($line) !== '') { // the line isn't empty
|
- |
|
544 |
$domain_allowed = explode("#", $line);
|
- |
|
545 |
if (trim($domain_allowed[1]) !== '') {
|
- |
|
546 |
$domain = explode('"', $domain_allowed[0]);
|
- |
|
547 |
// remove every '.' from the beginning of domain
|
- |
|
548 |
$domain[1] = ltrim($domain[1], '.');
|
- |
|
549 |
$domainAllowedHtml .= '<li><a href="http://'.trim($domain[1]).'">'.trim($domain_allowed[1]).'</a></li>';
|
- |
|
550 |
}
|
- |
|
551 |
}
|
- |
|
552 |
}
|
- |
|
553 |
$domainAllowedHtml .= '</ul></p>';
|
- |
|
554 |
}
|
- |
|
555 |
|
536 |
echo "
|
556 |
echo "
|
537 |
<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
|
557 |
<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
|
538 |
<span>$l_install_certif</span>
|
558 |
<span>$l_install_certif</span>
|
539 |
<img src=\"$img_rep$img_certificate\">
|
559 |
<img src=\"$img_rep$img_certificate\">
|
540 |
</div>
|
560 |
</div>
|
Line 544... |
Line 564... |
544 |
</div>
|
564 |
</div>
|
545 |
$sms_div
|
565 |
$sms_div
|
546 |
<div class=\"div-cache\" id=\"text_conn\">
|
566 |
<div class=\"div-cache\" id=\"text_conn\">
|
547 |
<h2>$l_logout</h2>
|
567 |
<h2>$l_logout</h2>
|
548 |
<p>$l_logout_explain</p>
|
568 |
<p>$l_logout_explain</p>
|
- |
|
569 |
$domainAllowedHtml
|
549 |
<img src=\"$img_rep$img_internet\">
|
570 |
<img src=\"$img_rep$img_internet\">
|
550 |
</div>
|
571 |
</div>
|
551 |
<div class=\"div-cache\" id=\"text_certif\">
|
572 |
<div class=\"div-cache\" id=\"text_certif\">
|
552 |
<h2>$l_install_certif_more</h2>
|
573 |
<h2>$l_install_certif_more</h2>
|
553 |
<p>$l_certif_explain $l_certif_explain_help</p>
|
574 |
<p>$l_certif_explain $l_certif_explain_help</p>
|
Line 562... |
Line 583... |
562 |
<div id=\"box_info\">
|
583 |
<div id=\"box_info\">
|
563 |
</div>";
|
584 |
</div>";
|
564 |
}
|
585 |
}
|
565 |
else {
|
586 |
else {
|
566 |
# user need to be warned that someone reads his logs
|
587 |
# user need to be warned that someone reads his logs
|
567 |
if(isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1'){
|
588 |
if(isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] === '1'){
|
568 |
$filename="/var/www/html/acc/backup/log_info.txt";
|
589 |
$filename = '/var/www/html/acc/backup/log_info.txt';
|
569 |
$l_explain_warn="";
|
590 |
$l_explain_warn = '';
|
570 |
if(file_exists($filename)){
|
591 |
if (file_exists($filename)) {
|
571 |
$fichier = fopen($filename, "r");
|
592 |
$fichier = fopen($filename, 'r');
|
572 |
$content = file($filename);
|
593 |
$content = file($filename);
|
573 |
foreach($content as $line){
|
594 |
foreach ($content as $line) {
|
574 |
$infos=explode("|||", $line);
|
595 |
$infos = explode('|||', $line);
|
575 |
$log_date=$infos[0];
|
596 |
$log_date = $infos[0];
|
576 |
$log_user=$infos[1];
|
597 |
$log_user = $infos[1];
|
577 |
$log_reason=$infos[2];
|
598 |
$log_reason = $infos[2];
|
578 |
$log_ip=$infos[3];
|
599 |
$log_ip = $infos[3];
|
579 |
}
|
600 |
}
|
580 |
$l_explain_warn="$l_explain_warn_name$log_user ( $l_explain_warn_ip$log_ip ) $l_explain_warn_date$log_date $l_explain_warn_reason$log_reason";
|
601 |
$l_explain_warn = "$l_explain_warn_name$log_user ($l_explain_warn_ip$log_ip) $l_explain_warn_date$log_date.<br>$l_explain_warn_reason<br>$log_reason";
|
581 |
}
|
602 |
}
|
582 |
else{
|
603 |
else{
|
583 |
echo "Log error!";
|
604 |
echo "Log error!";
|
584 |
}
|
605 |
}
|
585 |
echo "
|
606 |
echo "
|