7,24 → 7,26 |
# General Public License Version 2, provided that the above copyright |
# notice and this permission notice is included in all copies or |
# substantial portions of the software. |
|
/**************************************************************** |
* GLOBAL FILE PATHS * |
*****************************************************************/ |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf"); |
define ("DOMAIN_ALLOWED_LIST", "/usr/local/etc/alcasar-uamdomain"); |
define('CONF_FILE', '/usr/local/etc/alcasar.conf'); |
define('DOMAIN_ALLOWED_LIST', '/usr/local/etc/alcasar-uamdomain'); |
|
/**************************************************************** |
* FILE reading test * |
*****************************************************************/ |
$conf_files = array(CONF_FILE); |
$conf_files = array(CONF_FILE, DOMAIN_ALLOWED_LIST); |
foreach ($conf_files as $file) { |
if (!file_exists($file)) { |
exit("File ".$file." unknown"); |
exit("Fichier $file non présent"); |
} |
if (!is_readable($file)) { |
exit("You don't have read rights on the file ".$file); |
exit("Vous n'avez pas les droits de lecture sur le fichier $file"); |
} |
} |
|
/**************************************************************** |
* Read CONF_FILE * |
*****************************************************************/ |
34,7 → 36,7 |
} |
while (!feof($file_conf)) { |
$buffer = fgets($file_conf, 4096); |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) { |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '//')) { |
$tmp = explode('=', $buffer); |
$conf[$tmp[0]] = trim($tmp[1]); |
} |
43,31 → 45,45 |
|
$organisme = $conf["ORGANISM"]; |
$hostname = $conf["HOSTNAME"].'.'.$conf["DOMAIN"]; |
$network_pb = False; # "alcasar-watchdog.sh" changes this value if a network issue is detected |
$diagnostic = "can't contact the default router"; # "alcasar-watchdog.sh" changes this value if a network issue is detected |
$network_pb = false; // "alcasar-watchdog.sh" changes this value if a network issue is detected |
$diagnostic = "can't contact the default router"; // "alcasar-watchdog.sh" changes this value if a network issue is detected |
$cert_add = "http://$hostname/certs"; |
$direct_access = False; |
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ""; |
$tab = array();$user = array(); |
$connection_history = ""; |
$direct_access = false; |
$remote_ip = preg_match('#^([0-9]{1,3}\.){3}[0-9]{1,3}$#', $_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; |
$connection_history = ''; |
$nb_connection_history = 3; |
$Language = 'en'; |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]),0,2)); |
|
$redirect_link = 'www.euronews.com'; // Default redirection for HTTPS interception (beware, this website must run in HTTP) |
|
// Check if the SMS service is enable |
$service_SMS_status = false; |
|
// Retrieve the user info behind the remote ip |
$output = []; |
exec('sudo /usr/sbin/chilli_query list | grep -Ew '.escapeshellarg($remote_ip), $output); |
if (!empty($output)) { |
$userRaw = explode(' ', $output[0]); |
$user = (object) [ |
'mac' => $userRaw[0], |
'connected' => ($userRaw[4] === '1'), |
'username' => $userRaw[5] |
]; |
} else { |
// CoovaChilli does not know the user |
// TODO: useless? |
$user = (object) [ |
'mac' => '', |
'connected' => false, |
'username' => '' |
]; |
} |
$redirect_link = "www.euronews.com"; # Default redirection for HTTPS interception (beware, this website must run in HTTP) |
|
# Retrieve the user info behind the remote ip |
exec ("sudo /usr/sbin/chilli_query list | grep -Ew $remote_ip" , $tab); |
$user = explode (" ", $tab[0]); |
|
# Test if it's a direct connexion to ALCASAR |
// Test if it's a direct connexion to ALCASAR |
if (isset($_SERVER['HTTP_HOST']) && (($_SERVER['HTTP_HOST'] === $_SERVER['SERVER_ADDR']) || ($_SERVER['HTTP_HOST'] === 'alcasar') || ($_SERVER['HTTP_HOST'] === $hostname) || ($_SERVER['HTTP_HOST'] === $organisme))) { |
$direct_access = true; |
} |
|
# Function to adapt time connexion in seconds to H,M,S |
// Function to adapt time connexion in seconds to H,M,S |
function secondsToDuration($seconds = null){ |
if ($seconds == null) return ""; |
$temp = $seconds % 3600; |
74,49 → 90,57 |
$time[0] = ( $seconds - $temp ) / 3600 ; // hours |
$time[2] = $temp % 60 ; // seconds |
$time[1] = ( $temp - $time[2] ) / 60; // minutes |
return $time[0]." h ".$time[1]." m ".$time[2]." s"; |
return $time[0].' h '.$time[1].' m '.$time[2].' s'; |
} |
|
# if user need to be warned |
// if user need to be warned |
if (isset($_GET['warn']) && isset($_GET['url'])) { |
$direct_access = false; |
} |
|
if ((isset($user[4])) && ($user[4] != "0")) { # the user is authenticated |
if (isset($_GET['redirect'])) { # if user has been warned, we redirect him to his website |
if ($user->connected) { // the user is authenticated |
if (isset($_GET['redirect'])) { // if user has been warned, we redirect him to his website |
header('Location: '.$_GET['url'], true, 307); |
exit(); |
} |
|
# we retrieve his three last connections |
if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){ |
include_once("/etc/freeradius-web/config.php"); |
include_once("./acc/manager/lib/sql/drivers/mysql/functions.php"); |
$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history"; |
// We retrieve his three last connections |
if ((is_file('./acc/manager/lib/sql/drivers/mysql/functions.php'))&&(is_file('/etc/freeradius-web/config.php'))){ |
include_once('/etc/freeradius-web/config.php'); |
include_once('./acc/manager/lib/sql/drivers/mysql/functions.php'); |
$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user->username' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history"; |
$link = @da_sql_pconnect($config); |
if ($link){ |
$res = @da_sql_query($link,$config,$sql); |
if ($res){ |
$connection_history.= "<ul>"; |
$connection_history .= '<ul>'; |
while(($row = @da_sql_fetch_array($res,$config))){ |
$connected = ""; |
if ($row['acctstoptime'] == "") $connected = " (active)"; |
$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row['acctsessiontime']).")'>$row[acctstarttime] (".secondsToDuration($row['acctsessiontime']).") $connected</li>"; |
$connected = ''; |
if ($row['acctstoptime'] === '') { |
$connected = ' (active)'; |
} |
$connection_history.="</ul>"; |
$sessionTimeFormated = secondsToDuration($row['acctsessiontime']); |
$connection_history .= "<li title=\"$row[username] $row[acctstarttime] $row[acctstoptime] ($sessionTimeFormated)\">$row[acctstarttime] ($sessionTimeFormated) $connected</li>"; |
} |
$connection_history .= '</ul>'; |
} |
} |
} |
else { # the user isn't authenticated |
if (isset($_GET['url'])) { # it's the second stage (when user has clicked on the button "open a connection") |
} else { // the user isn't authenticated |
if (isset($_GET['url'])) { // it's the second stage (when user has clicked on the button "open a connection") |
$redir = 'http://'.$_GET['url']; |
header("Location: $redir", true, 307); |
exit(); |
} |
} |
# Choice of language |
if($Language == 'fr'){ |
|
// 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') { // French |
$l_access_denied = "Contrôle d'accès"; |
$l_access_welcome = "Bienvenue sur ALCASAR"; |
$l_access_unavailable = "ACCÈS INDISPONIBLE"; |
132,17 → 156,15 |
$l_certif_explain = "Permet l'échange de données sécurisées entre votre station de consultation et le portail captif ALCASAR.<BR>Si ce certificat n'est pas enregistré sur votre station de consultation, il est possible que des alertes de sécurité soient émises par votre navigateur.<br><br>"; |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide complémentaire</a>"; |
$l_category = "catégorie :"; |
if ((isset ($user[4])) && ($user[4] == "0")){ |
if (!$user->connected) { |
$l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre système."; |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Ouvrir une session Internet</a>"; |
} |
else{ |
if ($user[5] != $user[0]){ # authentication exception or not |
$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"; |
} else { |
if ($user->username != $user->mac) { // authentication exception or not |
$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->username\"><b>$user->username</b></a><br><br>$nb_connection_history dernières connexions :$connection_history"; |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Se déconnecter d'internet</a>"; |
} |
else{ |
$l_logout_explain = "Votre système ($user[5]) est en exception d'authentication.<br><br>$nb_connection_history dernières connexions :$connection_history"; |
} else { |
$l_logout_explain = "Votre système ($user->username) est en exception d'authentication.<br><br>$nb_connection_history dernières connexions :$connection_history"; |
$l_logout = "Information des connexions"; |
} |
} |
156,8 → 178,7 |
$l_explain_warn = "L'administrateur a créé une archive contenant vos journaux de connexion dans le cadre d'une affaire judiciaire."; |
if(isset($_GET['url'])){ |
$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">Je comprends et je souhaite continuer ma navigation.</a>"; |
} |
else{ |
} else { |
$l_continue_link = "<a href=\"index.php\" class=\"button\">Je comprends et je souhaite continuer ma navigation.</a>"; |
} |
$l_title_warn="Cher utilisateur, "; |
166,8 → 187,7 |
$l_explain_warn_date="a consulté vos journaux de connexion le "; |
$l_explain_warn_reason="Raison invoquée : "; |
$l_uam_domain = "Sites autorisés : "; |
} |
else if($Language == 'pt'){ |
} else if ($Language === 'pt') { // Portuguese |
$l_access_denied = "Controle de acesso"; |
$l_access_welcome = "Bem-vindo ao Alcasar"; |
$l_access_unavailable = "ACESSO INDISPONÍVEL"; |
183,17 → 203,15 |
$l_certif_explain = "O certificado Permiti a troca de dados seguro entre seu computador e o portal Alcasar.<BR>Se este certificado não estiver incorporado no seu computador, alguns alertas de segurança deverá aparecer no navegador.<br><br>"; |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Essa foi uma ajuda complementar</a>"; |
$l_category = "categoria :"; |
if ((isset ($user[4])) && ($user[4] == "0")){ |
if (!$user->connected) { |
$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?"; |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Abrir uma conexão de Internet</a>"; |
} |
else{ |
if ($user[5] != $user[0]){ # authentication exception or not |
$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"; |
} else { |
if ($user->username != $user->mac) { // authentication exception or not |
$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->username\"><b>$user->username</b></a><br><br>$nb_connection_history logins últimos :$connection_history"; |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Sair da Internet</a>"; |
} |
else{ |
$l_logout_explain = "O sistema ($user[5]) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history"; |
} else { |
$l_logout_explain = "O sistema ($user->username) detctou exesso de autenticação.<br><br>$nb_connection_history logins últimos :$connection_history"; |
$l_logout = "Informações de conexões"; |
} |
} |
207,8 → 225,7 |
$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."; |
if(isset($_GET['url'])){ |
$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">Lo comprendo y deseo continuar mi navegación.</a>"; |
} |
else{ |
} else { |
$l_continue_link = "<a href=\"index.php\" class=\"button\">Lo comprendo y deseo continuar mi navegación.</a>"; |
} |
$l_title_warn="Estimado usuario,"; |
217,8 → 234,7 |
$l_explain_warn_date="consultó a sus registros de conexión el "; |
$l_explain_warn_reason="con la siguiente razón : "; |
$l_uam_domain = "Sites autorizados : "; |
} |
else if($Language == 'zn'){ |
} else if ($Language === 'zn') { // Chinese |
$l_access_denied = "访问控制"; |
$l_access_welcome = "欢迎来到ALCASAR"; |
$l_access_unavailable = "不可访问"; |
234,17 → 250,15 |
$l_certif_explain = "允许您的计算机与ALCASAR门户进行安全数据交换。<BR>如果该证书未包含在您的计算机中,您的浏览器将出现一些安全提醒。<br><br>"; |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">额外帮助</a>"; |
$l_category = "类别 :"; |
if ((isset ($user[4])) && ($user[4] == "0")){ |
if (!$user->connected) { |
$l_logout_explain = "您的系统目前没有打开任何网络咨询进程。"; |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">打开一个网络进程</a>"; |
} |
else{ |
if ($user[5] != $user[0]){ # authentication exception or not |
$l_logout_explain = "关闭当前连接进程。<br> 已连接用户:<a href=\"http://$hostname:3990/logoff\" title=\" $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history 最后连接 :$connection_history"; |
} else { |
if ($user->username != $user->mac) { // authentication exception or not |
$l_logout_explain = "关闭当前连接进程。<br> 已连接用户:<a href=\"http://$hostname:3990/logoff\" title=\" $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history 最后连接 :$connection_history"; |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">断开网络</a>"; |
} |
else{ |
$l_logout_explain = "您的系统($user[5])验证例外<br><br>$nb_connection_history 最后连接: $connection_history"; |
} else { |
$l_logout_explain = "您的系统($user->username)验证例外<br><br>$nb_connection_history 最后连接: $connection_history"; |
$l_logout = "连接信息"; |
} |
} |
258,8 → 272,7 |
$l_explain_warn = "管理员创建了一份可用于司法调查的连接日志文档。"; |
if(isset($_GET['url'])){ |
$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">我明白并希望继续浏览。</a>"; |
} |
else{ |
} else { |
$l_continue_link = "<a href=\"index.php\" class=\"button\">我明白并希望继续浏览。</a>"; |
} |
$l_title_warn="亲爱的用户,"; |
268,8 → 281,7 |
$l_explain_warn_date="查看您的连接日志于"; |
$l_explain_warn_reason=" 如下原因:"; |
$l_uam_domain = "授权网站 : "; |
} |
else if ($Language == 'ar'){ |
} else if ($Language === 'ar') { // Arabic |
$l_access_denied = "مراقبة الدخول"; |
$l_access_welcome = "ALCASAR مرحبا بك في"; |
$l_access_unavailable = "الدخول غير متوفر"; |
289,25 → 301,23 |
$l_certif_explain = "<br><br>.$cert_not_saved_text<br> .$exchange_data_text"; |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">مساعدة إضافية </a>"; |
$l_category = "فئة :"; |
if ((isset ($user[4])) && ($user[4] == "0")){ |
if (!$user->connected) { |
$l_logout_explain = "و لا جلسة استفسار للإنترنت مفتوحة حاليا على نظامك"; |
$close_session_text = "فتح جلسة الإنترنت"; |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">$close_session_text</a>"; |
} |
else{ |
if ($user[5] != $user[0]){ # authentication exception or not |
} else { |
if ($user->username != $user->mac) { // authentication exception or not |
$close_session_text = "إقفال جلسة المستخدم المتصل حاليا"; |
$user_logged_text = "المستخدم متصل"; |
$userlogged_text = "المستخدم متصل"; |
$disconnect_user_text = "قطع الاتصال على المستخدم"; |
$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"; |
$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->username\"><b>$user->username</b></a><br><br>$nb_connection_history dernières connexions :$connection_history"; |
$logout_internet_text = "قطع الاتصال على الإنترنت"; |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">$logout_internet_text</a>"; |
} |
else{ |
} else { |
$your_system_text = "نظامك"; |
$auth_except_text = "على توثيق استثنائي"; |
$last_conn_text = "اتصالات مشاركة"; |
$l_logout_explain = "$connection_history :$last_conn_text $nb_connection_history<br><br>$auth_except_text ($user[5]) $your_system_text"; |
$l_logout_explain = "$connection_history :$last_conn_text $nb_connection_history<br><br>$auth_except_text ($user->username) $your_system_text"; |
$l_logout = "معلومات على الاتصالات "; |
} |
} |
331,8 → 341,7 |
$understand_text = "أنا متفهم و أريد ان أواصل التصفح"; |
if(isset($_GET['url'])){ |
$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">$understand_text</a>"; |
} |
else{ |
} else { |
$l_continue_link = "<a href=\"index.php\" class=\"button\">$understand_text</a>"; |
} |
$l_title_warn = "عزيزي المستعمل, "; |
341,8 → 350,7 |
$l_explain_warn_date = "إطّلع على سجلات الاتصال الخاصة بك في"; |
$l_explain_warn_reason = "السبب المسرّح به: "; |
$l_uam_domain = ":المواقع المسموحة "; |
} |
else{ |
} else { // English |
$l_access_denied = "Access control"; |
$l_access_welcome = "Welcome on ALCASAR"; |
$l_access_unavailable = "ACCESS UNAVAILABLE"; |
358,17 → 366,15 |
$l_certif_explain = "Allow secure data exchange between your computer and ALCASAR portal.<BR>If this certificate isn't incorporated in your computer, some security alerts should appear in your browser.<br><br>"; |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>"; |
$l_category = "category :"; |
if ((isset ($user[4])) && ($user[4] == "0")){ |
if (!$user->connected) { |
$l_logout_explain = "No Internet consultation session is actualy open on your system"; |
$l_logout = "<a href=\"http://$hostname/index.php?url=$redirect_link\">Open an Internet session</a>"; |
} |
else{ |
if ($user[5] != $user[0]){ # authentication exception or not |
$l_logout_explain = "Close the session of the user currently connected.<br> User logged-on : <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"; |
} else { |
if ($user->username != $user->mac) { // authentication exception or not |
$l_logout_explain = "Close the session of the user currently connected.<br> User logged-on : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user->username\"><b>$user->username</b></a><br><br>$nb_connection_history last connections :$connection_history"; |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>"; |
} |
else{ |
$l_logout_explain = "Your system ($user[5]) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history"; |
} else { |
$l_logout_explain = "Your system ($user->username) is in exception of authentication.<br><br>$nb_connection_history Last logins :$connection_history"; |
$l_logout = "Connections information"; |
} |
} |
382,8 → 388,7 |
$l_explain_warn = "The administrator created an archive which contains your imputabilities logs for a judicial investigation."; |
if(isset($_GET['url'])){ |
$l_continue_link = "<a href=\"index.php?redirect=1&url=".urlencode($_GET['url'])."\" class=\"button\">I understand and I wish to continue.</a>"; |
} |
else{ |
} else { |
$l_continue_link = "<a href=\"index.php\" class=\"button\">I understand and I wish to continue.</a>"; |
} |
$l_title_warn="Dear user,"; |
397,89 → 402,65 |
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied)); |
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny)); |
|
# set the icons |
$img_rep = "/images/"; |
$img_organisme = "organisme.png"; |
$img_access = "globe_acces_70.png"; |
$img_connect = "globe_70.png"; |
$img_warning = "globe_warning_70.png"; |
$img_pwd = "cle_ombre.png"; |
$img_certificate = "certificat.png"; |
$img_acc = "logo-alcasar_70.png"; |
$img_sms = "sms.png"; |
$img_false = "interdit.png"; |
$img_adm = "adm.png"; |
$img_internet = $img_connect; |
// Set the icons |
$img_rep = '/images/'; |
$img_organisme = 'organisme.png'; |
$img_access = 'globe_acces_70.png'; |
$img_connect = 'globe_70.png'; |
$img_warning = 'globe_warning_70.png'; |
$img_pwd = 'cle_ombre.png'; |
$img_certificate = 'certificat.png'; |
$img_acc = 'logo-alcasar_70.png'; |
$img_sms = 'sms.png'; |
$img_false = 'interdit.png'; |
$img_adm = 'adm.png'; |
|
if ((isset ($user[4])) && ($user[4] == "0")){ |
if (! $network_pb){ |
$img_internet = $img_access; |
$img_internet = (($user->connected) ? $img_connect : ($network_pb ? $img_warning : $img_access)); |
|
if ($direct_access) { |
// Read the "Domain allowed" file |
$domainsAllowed = []; |
$fileContent = file(DOMAIN_ALLOWED_LIST); |
if ($fileContent) { // the file isn't empty |
foreach ($fileContent as $line) { |
if (!empty(trim($line))) { |
$domain_fields = explode('#', $line); |
if (!empty(trim($domain_fields[1]))) { |
$domain = explode('"', $domain_fields[0]); |
$domain[1] = ltrim($domain[1], '.'); // remove every '.' from the beginning of domain |
$domainsAllowed[] = (object) [ |
'name' => trim($domain_fields[1]), |
'domain' => trim($domain[1]) |
]; |
} |
else{ |
$img_internet = $img_warning; |
} |
} |
else{ |
$img_internet = $img_connect; |
} |
|
# cleaning the cache |
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT"); |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); |
header("Cache-Control: post-check=0, pre-check=0", false); |
header("Pragma: no-cache"); |
|
?> |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
<html> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<title>ALCASAR - <?php echo $l_title; ?></title> |
<meta http-equiv="Cache-control" content="no-cache"> |
<meta http-equiv="Pragma" content="no-cache"> |
<link rel="stylesheet" href="/css/style_intercept.css" type="text/css"> |
<script type="text/javascript"> |
function valoriserDiv5(param){ |
document.getElementById("box_info").innerHTML = param.innerHTML; |
} else { |
if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] === '1') { |
// user need to be warned that someone reads his logs |
$filename = '/var/www/html/acc/backup/log_info.txt'; |
if (file_exists($filename)) { |
$fichier = fopen($filename, 'r'); |
$content = file($filename); |
foreach ($content as $line) { |
$infos = explode('|||', $line); |
$log_date = $infos[0]; |
$log_user = $infos[1]; |
$log_reason = $infos[2]; |
$log_ip = $infos[3]; |
} |
</script> |
</head> |
<body onload="valoriserDiv5(text_conn);"> |
<?php |
if ($direct_access){ |
echo " |
<div id=\"cadre_titre\" class=\"titre_controle\"> |
<p id=\"acces_controle\" class=\"titre_controle\">$l_title</p>"; |
if ($network_pb) { |
echo " <span>$l_explain_net_pb</span>"; |
$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"; |
} else { |
$l_explain_warn = 'Log error!'; |
} |
} |
else{ # the user is intercepted |
# if user need to be warned that someone reads his logs |
if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1') { |
echo " |
<div id=\"cadre_titre\" class=\"titre_refus\"> |
<p id=\"acces_controle\" class=\"titre_refus\">$l_title_warn</p>"; |
} |
else{ # the user is blacklisted (or whitelisted) |
echo " |
<div id=\"cadre_titre\" class=\"titre_refus\"> |
<p id=\"acces_controle\" class=\"titre_refus\">$l_title</p>"; |
} |
} |
?> |
|
<div id="boite_logo"> |
<img src="<?php echo "$img_rep$img_organisme"; ?>"> |
</div> |
</div> |
<div id="contenu_acces"> |
<div id="box_url"> |
<?php |
// Search blacklist categories |
if ((!$direct_access) && (!$network_pb) && (!isset($_GET['warn']))) { |
$pattern = str_replace('www.', '', $_SERVER['HTTP_HOST']); |
$output = []; |
exec('grep -Re ' . escapeshellarg('^'.$pattern.'$') . " /etc/dansguardian/lists/blacklists/*/domains | cut -d'/' -f6", $output); |
$lists = []; |
foreach ($output as $line) { |
486,146 → 467,155 |
$lists[] = $line; |
} |
|
echo $l_required_domain.' : '.htmlspecialchars($_SERVER['HTTP_HOST']); |
$filteredUrlHtml = $l_required_domain.' : '.htmlspecialchars($_SERVER['HTTP_HOST']); |
if (!empty($lists)) { |
echo "<br>$l_category ".implode(', ', $lists); |
$filteredUrlHtml .= "<br>$l_category ".implode(', ', $lists); |
} |
} |
|
// Cleaning the cache |
header('Expires: Tue, 01 Jan 2000 00:00:00 GMT'); |
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); |
header('Cache-Control: post-check=0, pre-check=0', false); |
header('Pragma: no-cache'); |
?> |
<!DOCTYPE html> |
<html> |
<head> |
<meta charset="UTF-8"> |
<title>ALCASAR - <?= $l_title ?></title> |
<link type="text/css" href="/css/style_intercept.css" rel="stylesheet"> |
<?php if ($direct_access): ?> |
<script> |
function setBoxInfoContent(param){ |
document.getElementById('box_info').innerHTML = document.getElementById(param).innerHTML; |
} |
</script> |
<?php endif; ?> |
</head> |
<body<? (($direct_access) ? ' onload="setBoxInfoContent(\'text_conn\');"' : '') ?>> |
<?php if ($direct_access): ?> |
<div id="cadre_titre" class="titre_controle"> |
<p id="acces_controle" class="titre_controle"><?= $l_title ?></p> |
<?php if ($network_pb): ?> |
<span><?= $l_explain_net_pb ?></span> |
<?php endif; ?> |
<?php else: // the user is intercepted ?> |
<?php if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] == '1'): // if user need to be warned that someone reads his logs ?> |
<div id="cadre_titre" class="titre_refus"> |
<p id="acces_controle" class="titre_refus"><?= $l_title_warn ?></p> |
<?php else: // the user is blacklisted (or whitelisted) ?> |
<div id="cadre_titre" class="titre_refus"> |
<p id="acces_controle" class="titre_refus"><?= $l_title ?></p> |
<?php endif; ?> |
<?php endif; ?> |
|
<div id="boite_logo"> |
<img src="<?= $img_rep.$img_organisme ?>"> |
</div> |
<?php |
# Check if the SMS service is enable |
$service_SMS_status="false"; |
if ($service_SMS_status == "true"){ |
$sms_div=' |
<div class="box_menu" id="box_acc" onmouseover="valoriserDiv5(text_acc);"> |
<span>'.$l_sms_access.'</span> |
<img src="'.$img_rep.''.$img_sms.'"> |
</div> |
'; |
<div id="contenu_acces"> |
<div id="box_url"> |
<?php if ((!$direct_access) && (!$network_pb) && (!isset($_GET['warn']))): // Print blacklist categories ?> |
<?= $filteredUrlHtml ?> |
<?php endif; ?> |
</div> |
|
$sms_div_over=' |
<div class="div-cache" id="text_acc"> |
<h2>'.$l_sms_access.'</h2> |
<p>'.$l_sms_explain.'</p> |
<p><font color="green"><center>'.$l_service_sms.'</center></font></p> |
<img src="'.$img_rep.''.$img_sms.'"> |
<?php if ($direct_access): ?> |
<?php if (!$network_pb): ?> |
<div class="box_menu" id="box_conn" onmouseover="setBoxInfoContent('text_conn');"> |
<span><?= $l_logout ?></span> |
<img src="<?= $img_rep.$img_internet ?>"> |
</div> |
'; |
} |
else { |
$sms_div=''; |
$sms_div_over=''; |
} |
if ($direct_access) { |
if (!$network_pb) { |
echo " |
<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\"> |
<span>$l_logout</span> |
<img src=\"$img_rep$img_internet\"> |
</div>"; |
} |
<?php endif; ?> |
|
// Read the "Domain allowed" file |
$domainAllowedHtml = ''; |
$tab = file(DOMAIN_ALLOWED_LIST); |
if ($tab) { // the file isn't empty |
$domainAllowedHtml .= '<p>'.$l_uam_domain.'<br><ul>'; |
foreach ($tab as $line) { |
if (trim($line) !== '') { // the line isn't empty |
$domain_allowed = explode('#', $line); |
if (trim($domain_allowed[1]) !== '') { |
$domain = explode('"', $domain_allowed[0]); |
// remove every '.' from the beginning of domain |
$domain[1] = ltrim($domain[1], '.'); |
$domainAllowedHtml .= '<li><a href="http://'.trim($domain[1]).'">'.trim($domain_allowed[1]).'</a></li>'; |
} |
} |
} |
$domainAllowedHtml .= '</ul></p>'; |
} |
<div class="box_menu" id="box_certif" onmouseover="setBoxInfoContent('text_certif');"> |
<span><?= $l_install_certif ?></span> |
<img src="<?= $img_rep.$img_certificate ?>"> |
</div> |
|
echo " |
<div class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\"> |
<span>$l_install_certif</span> |
<img src=\"$img_rep$img_certificate\"> |
<div class="box_menu" id="box_mdp" onmouseover="setBoxInfoContent('text_mdp');"> |
<img src="<?= $img_rep.$img_pwd ?>"> |
<span><?= $l_password_change ?></span> |
</div> |
<div class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\"> |
<img src=\"$img_rep$img_pwd\"> |
<span>$l_password_change</span> |
|
<?php if ($service_SMS_status === true): ?> |
<div class="box_menu" id="box_acc" onmouseover="setBoxInfoContent('text_acc');"> |
<span><?= $l_sms_access ?></span> |
<img src="<?= $img_rep.$img_sms ?>"> |
</div> |
$sms_div |
<div class=\"div-cache\" id=\"text_conn\"> |
<h2>$l_logout</h2> |
<p>$l_logout_explain</p> |
$domainAllowedHtml |
<img src=\"$img_rep$img_internet\"> |
<?php endif; ?> |
|
<div class="div-cache" id="text_conn"> |
<h2><?= $l_logout ?></h2> |
<p><?= $l_logout_explain ?></p> |
<?php if (!empty($domainsAllowed)): ?> |
<p><?= $l_uam_domain ?> |
<ul> |
<?php foreach ($domainsAllowed as $domainAllowed): ?> |
<li><a href="http://<?= $domainAllowed->domain ?>"><?= $domainAllowed->name ?></a></li> |
<?php endforeach; ?> |
</ul> |
</p> |
<?php endif; ?> |
<img src="<?= $img_rep.$img_internet ?>"> |
</div> |
<div class=\"div-cache\" id=\"text_certif\"> |
<h2>$l_install_certif_more</h2> |
<p>$l_certif_explain $l_certif_explain_help</p> |
<img src=\"$img_rep$img_certificate\"> |
|
<div class="div-cache" id="text_certif"> |
<h2><?= $l_install_certif_more ?></h2> |
<p><?= "$l_certif_explain $l_certif_explain_help" ?></p> |
<img src="<?= $img_rep.$img_certificate ?>"> |
</div> |
<div class=\"div-cache\" id=\"text_mdp\"> |
<h2>$l_password_change</h2> |
<p>$l_password_change_explain</p> |
<img src=\"$img_rep$img_pwd\"> |
|
<div class="div-cache" id="text_mdp"> |
<h2><?= $l_password_change ?></h2> |
<p><?= $l_password_change_explain ?></p> |
<img src="<?= $img_rep.$img_pwd ?>"> |
</div> |
$sms_div_over |
<div id=\"box_info\"> |
</div>"; |
} |
else { |
# user need to be warned that someone reads his logs |
if(isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] === '1'){ |
$filename = '/var/www/html/acc/backup/log_info.txt'; |
$l_explain_warn = ''; |
if (file_exists($filename)) { |
$fichier = fopen($filename, 'r'); |
$content = file($filename); |
foreach ($content as $line) { |
$infos = explode('|||', $line); |
$log_date = $infos[0]; |
$log_user = $infos[1]; |
$log_reason = $infos[2]; |
$log_ip = $infos[3]; |
} |
$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"; |
} |
else{ |
echo "Log error!"; |
} |
echo " |
<div id=\"box_refuse\"> |
<img src=\"$img_rep$img_warning\"> |
<p>$l_explain_warn</p> |
|
<?php if ($service_SMS_status === true): ?> |
<div class="div-cache" id="text_acc"> |
<h2><?= $l_sms_access ?></h2> |
<p><?= $l_sms_explain ?></p> |
<p style="color: green; text-align: center;"><?= $l_service_sms ?></p> |
<img src="<?= $img_rep.$img_sms ?>"> |
</div> |
<div id=\"liens_redir\"> |
<p>$l_continue_link</p> |
</div>"; |
} |
else{ |
echo " |
<div id=\"box_refuse\"> |
<img src=\"$img_rep$img_false\"> |
<p>$l_explain</p> |
<?php endif; ?> |
|
<div id="box_info"> |
</div> |
<div id=\"liens_redir\"> |
<p>$l_back_page</p> |
</div>"; |
} |
} |
if (($network_pb)&&(! $direct_access)) { |
echo " <span>Diagnostic : $diagnostic</span>"; |
} |
echo "</div>"; |
if($direct_access){ # display the admin logo (wheel) at the bottom right |
echo "<div id=\"corner\">"; |
echo "<div id=\"adm\" class=\"corn\">"; |
echo "<a href=\"https://$hostname/acc/\"><img src=\"$img_rep$img_adm\"></a>"; |
echo "</div>"; |
echo "</div>"; |
} |
?> |
<?php else: // the user is intercepted ?> |
<?php if (isset($_GET['warn']) && isset($_GET['url']) && $_GET['warn'] === '1'): // user need to be warned that someone reads his logs ?> |
<div id="box_refuse"> |
<img src="<?= $img_rep.$img_warning ?>"> |
<p><?= $l_explain_warn ?></p> |
</div> |
<div id="liens_redir"> |
<p><?= $l_continue_link ?></p> |
</div> |
<?php else: ?> |
<div id="box_refuse"> |
<img src="<?= $img_rep.$img_false ?>"> |
<p><?= $l_explain ?></p> |
</div> |
<div id="liens_redir"> |
<p><?= $l_back_page ?></p> |
</div> |
<?php endif; ?> |
<?php endif; ?> |
|
<?php if (($network_pb) && (!$direct_access)): ?> |
<span>Diagnostic : <?= $diagnostic ?></span> |
<?php endif; ?> |
</div> |
|
<?php if ($direct_access): // display the admin logo (wheel) at the bottom right ?> |
<div id="corner"> |
<div id="adm" class="corn"> |
<a href="<?= "https://$hostname/acc/" ?>"><img src="<?= $img_rep.$img_adm ?>"></a> |
</div> |
</div> |
<?php endif; ?> |
</body> |
</html> |