895 |
richard |
1 |
<?php
|
958 |
franck |
2 |
# $Id: intercept.php 2450 2017-12-05 21:53:42Z tom.houdayer $
|
895 |
richard |
3 |
#
|
1249 |
richard |
4 |
# intercept.php for ALCASAR captive portal
|
895 |
richard |
5 |
# Copyright (C) 2003, 2004 Mondru AB.
|
|
|
6 |
# Modify by REXY & steweb57
|
|
|
7 |
# UI & css style by stephane ERARD
|
|
|
8 |
# Help for language translation by B. AUBARD (thanks)
|
|
|
9 |
|
|
|
10 |
# The contents of this file may be used under the terms of the GNU
|
|
|
11 |
# General Public License Version 2, provided that the above copyright
|
|
|
12 |
# notice and this permission notice is included in all copies or
|
|
|
13 |
# substantial portions of the software.
|
|
|
14 |
|
|
|
15 |
# Redirects from CoovaChilli (chilli daemon) :
|
|
|
16 |
# Response to login:
|
|
|
17 |
# success : if login successful
|
|
|
18 |
# failed : if login failed
|
|
|
19 |
# logoff : if logout successful
|
|
|
20 |
# already : if tried to login while already logged in
|
|
|
21 |
# notyet : if not logged in yet
|
|
|
22 |
# Default : it was not a form request -> client go to login form
|
|
|
23 |
|
|
|
24 |
/****************************************************************
|
|
|
25 |
* GLOBAL FILE PATHS *
|
|
|
26 |
*****************************************************************/
|
2238 |
tom.houday |
27 |
define('CONF_FILE', '/usr/local/etc/alcasar.conf');
|
|
|
28 |
define('DOMAIN_ALLOWED_LIST', '/usr/local/etc/alcasar-uamdomain');
|
895 |
richard |
29 |
|
|
|
30 |
/****************************************************************
|
930 |
richard |
31 |
* FILE reading test *
|
895 |
richard |
32 |
*****************************************************************/
|
2238 |
tom.houday |
33 |
$conf_files = array(CONF_FILE, DOMAIN_ALLOWED_LIST);
|
2182 |
tom.houday |
34 |
foreach ($conf_files as $file) {
|
|
|
35 |
if (!file_exists($file)) {
|
2238 |
tom.houday |
36 |
exit("Fichier $file non présent");
|
913 |
richard |
37 |
}
|
2182 |
tom.houday |
38 |
if (!is_readable($file)) {
|
2238 |
tom.houday |
39 |
exit("Vous n'avez pas les droits de lecture sur le fichier $file");
|
913 |
richard |
40 |
}
|
|
|
41 |
}
|
895 |
richard |
42 |
/****************************************************************
|
|
|
43 |
* Read CONF_FILE *
|
|
|
44 |
*****************************************************************/
|
2182 |
tom.houday |
45 |
$file_conf = fopen(CONF_FILE, 'r');
|
|
|
46 |
if (!$file_conf) {
|
|
|
47 |
exit('Error opening the file '.CONF_FILE);
|
|
|
48 |
}
|
|
|
49 |
while (!feof($file_conf)) {
|
2238 |
tom.houday |
50 |
$buffer = fgets($file_conf, 4096);
|
|
|
51 |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
|
2450 |
tom.houday |
52 |
$tmp = explode('=', $buffer, 2);
|
2370 |
tom.houday |
53 |
$conf[trim($tmp[0])] = trim($tmp[1]);
|
895 |
richard |
54 |
}
|
|
|
55 |
}
|
2182 |
tom.houday |
56 |
fclose($file_conf);
|
|
|
57 |
|
2238 |
tom.houday |
58 |
$organisme = $conf["ORGANISM"];
|
895 |
richard |
59 |
|
2250 |
tom.houday |
60 |
// Shared secret used to encrypt password with coova.
|
930 |
richard |
61 |
$uamsecret = "";
|
895 |
richard |
62 |
|
2250 |
tom.houday |
63 |
// URL loaded after success authenticates (let blank for browser defaults)
|
895 |
richard |
64 |
$adminurl = "";
|
|
|
65 |
|
2250 |
tom.houday |
66 |
// Check if the SMS service is enable
|
|
|
67 |
$service_SMS_status = false;
|
|
|
68 |
|
|
|
69 |
// Our own path
|
2409 |
tom.houday |
70 |
$loginpath = htmlspecialchars($_SERVER['PHP_SELF']);
|
2378 |
tom.houday |
71 |
$useHTTPS = ((isset($_SERVER['HTTPS'])) && (!empty($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'] !== 'off'));
|
2409 |
tom.houday |
72 |
$alcasarpath = (($useHTTPS) ? 'https' : 'http' ).'://'.$conf['HOSTNAME'].'.'.$conf['DOMAIN'];
|
|
|
73 |
$statuspath = (($conf['HTTPS_CHILLI'] === 'on') ? 'https' : 'http' ).'://'.$conf['HOSTNAME'].'.'.$conf['DOMAIN'].'/status.php';
|
895 |
richard |
74 |
|
2250 |
tom.houday |
75 |
// Choice of language
|
895 |
richard |
76 |
$Language = 'en';
|
2250 |
tom.houday |
77 |
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
2182 |
tom.houday |
78 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
2370 |
tom.houday |
79 |
$Language = strtolower(substr(chop($Langue[0]), 0, 2));
|
1452 |
richard |
80 |
}
|
2238 |
tom.houday |
81 |
if ($Language === 'es') { // Spanish
|
|
|
82 |
$l_ChilliError = "La autenticación debe ser un éxito a través del servicio de portal cautivo.";
|
|
|
83 |
$l_login = "El éxito de la autenticación.<HR>Cierre esta ventana interrumpte la sesion.";
|
|
|
84 |
$l_logout = "Conexión de cierre";
|
|
|
85 |
$l_loginfailed = "Error de autenticación";
|
|
|
86 |
$l_loggingin = "Identificación en el portal cautivo";
|
|
|
87 |
$l_loggedcont = "Control de Acceso";
|
|
|
88 |
$l_loggedout = "Su sesión se cierra";
|
|
|
89 |
$l_user = "Usuario";
|
|
|
90 |
$l_password = "Contraseña";
|
|
|
91 |
$l_wait = "Por favor, espere un momento ...";
|
|
|
92 |
$l_onlinetime = "Tiempo de conexión:";
|
|
|
93 |
$l_remainingtime = "Desconexión en:";
|
|
|
94 |
$l_encrypted = "La apertura debe usar conexión cifrada";
|
|
|
95 |
$l_boutonO = "Autenticación";
|
|
|
96 |
$l_boutonF = "Cerrar";
|
|
|
97 |
$l_loggedin_stringl1 = "Information System Security";
|
|
|
98 |
$l_loggedin_stringl2 = "El portal fue creado reglamentos para garantizar la trazabilidad, la rendición de cuentas y el no repudio de las conexiones.";
|
|
|
99 |
$l_loggedin_stringl3 = "Su actividad en la red es registrada, de conformidad con la privacidad.";
|
|
|
100 |
$l_loggedin_stringl4 = "Los datos registrados pueden ser capaces de ser operado por una autoridad judicial en el curso de una investigación.";
|
|
|
101 |
$l_loggedin_stringl5 = "Estos datos se eliminan automáticamente después de un año.";
|
2370 |
tom.houday |
102 |
$l_loggedin_stringl6 = "Click <a href=\"$alcasarpath\">here</a> to change your password or to integrate the security certificate in your browser";
|
2238 |
tom.houday |
103 |
$l_loggedout_string = "Cerrar sesión hizo portal cautivo!";
|
|
|
104 |
$l_reply_1 = "Your daily connexion time has been reached";
|
|
|
105 |
$l_reply_2 = "Your monthly connexion time has been reached";
|
|
|
106 |
$l_reply_3 = "You try to connect outside of your allowed timespan";
|
|
|
107 |
$l_reply_4 = "your account expired";
|
|
|
108 |
$l_reply_5 = "You have reached the maximum number of simultaneous logins";
|
|
|
109 |
$l_reply_6 = "Your authorized connexion time has been reached";
|
|
|
110 |
$l_online_time = "Tiempo en linea";
|
|
|
111 |
$l_remaining_time = "Tiempo restante";
|
|
|
112 |
$l_uam_domain = "Sitios web autorizados : ";
|
|
|
113 |
$l_autoregistration = "Registo automático";
|
|
|
114 |
} else if ($Language === 'pt') { // Portuguese
|
|
|
115 |
$l_ChilliError = "A autenticação precisa ser bem sucedida através do portal.";
|
|
|
116 |
$l_login = "Sucesso na autenticação.<HR>Matenha esse pop-up apenas minimizado para não interromper a conexão";
|
|
|
117 |
$l_logout = "Encerrar conexão";
|
|
|
118 |
$l_loginfailed = "Falha na autenticação";
|
|
|
119 |
$l_loggingin = "Identificação do portal cativo";
|
|
|
120 |
$l_loggedcont = "Controle de acesso";
|
|
|
121 |
$l_loggedout = "Sua sessão foi fechada";
|
|
|
122 |
$l_user = "Usuário";
|
|
|
123 |
$l_password = "Senha";
|
|
|
124 |
$l_wait = "Por favor, aguarde um momento ...";
|
|
|
125 |
$l_onlinetime = "Tempo de conexão:";
|
|
|
126 |
$l_remainingtime = "Desconectado em:";
|
|
|
127 |
$l_encrypted = "A conexão com o portal deve ser criptografada";
|
|
|
128 |
$l_boutonO = "Autenticação";
|
|
|
129 |
$l_boutonF = "Fechar";
|
|
|
130 |
$l_loggedin_stringl1 = "Sistema de Informação e segurança";
|
|
|
131 |
$l_loggedin_stringl2 = "Este controle foi criado para garantir acesso seguro.";
|
|
|
132 |
$l_loggedin_stringl3 = "A autenticação será criptografada em 256 bits, impedindo captura por escâner de rede.";
|
|
|
133 |
$l_loggedin_stringl4 = "Sua atividade na Internet será resguardada de acordo com os regulamentos da lei.";
|
|
|
134 |
$l_loggedin_stringl5 = "Mantenha o popup da conexão minimizado para não interromper a cessão.";
|
2370 |
tom.houday |
135 |
$l_loggedin_stringl6 = "Clique <a href=\"$alcasarpath\">aqui</a> para alterar sua senha, instalar certificado ou sair do portal.";
|
2238 |
tom.houday |
136 |
$l_loggedout_string = "desconexão do portal cativo";
|
|
|
137 |
$l_reply_1 = "Seu tempo de conexão diária foi finalizado";
|
|
|
138 |
$l_reply_2 = "Seu tempo de conexão mensal foi finalizado";
|
|
|
139 |
$l_reply_3 = "Você tenta conectar-se fora do seu período de tempo permitido";
|
|
|
140 |
$l_reply_4 = "Sua conta expirou";
|
|
|
141 |
$l_reply_5 = "Você atingiu o número máximo de logins simultâneos";
|
|
|
142 |
$l_reply_6 = "Seu tempo de conexão autorizada finalizou";
|
|
|
143 |
$l_online_time = "Tempo Online";
|
|
|
144 |
$l_remaining_time = "Tempo restante";
|
|
|
145 |
$l_uam_domain = "Sites autorizados : ";
|
|
|
146 |
$l_autoregistration = "Registo automático";
|
|
|
147 |
} else if ($Language === 'zh') { // Chinese
|
|
|
148 |
$l_ChilliError = "验证必须通过强制门户服务";
|
|
|
149 |
$l_login = "验证成功<HR>关闭此窗口中断连接";
|
|
|
150 |
$l_logout = "关闭连接";
|
|
|
151 |
$l_loginfailed = "验证失败";
|
|
|
152 |
$l_loggingin = "强制门户身份识别";
|
|
|
153 |
$l_loggedcont = "访问控制";
|
|
|
154 |
$l_loggedout = "您的连接已关闭";
|
|
|
155 |
$l_user = "用户名";
|
|
|
156 |
$l_password = "密码";
|
|
|
157 |
$l_wait = "请等待 ...";
|
|
|
158 |
$l_onlinetime = "连接时间";
|
|
|
159 |
$l_remainingtime = "断开连接于";
|
|
|
160 |
$l_encrypted = "与门户的连接必须加密";
|
|
|
161 |
$l_boutonO = "验证";
|
|
|
162 |
$l_boutonF = "关闭";
|
|
|
163 |
$l_loggedin_stringl1 = "信息系统安全";
|
|
|
164 |
$l_loggedin_stringl2 = "这种控制实施以法定保证可追溯性,可归罪性和连接的不否认性.";
|
|
|
165 |
$l_loggedin_stringl3 = "您的网络活动是私密登记的.";
|
|
|
166 |
$l_loggedin_stringl4 = "记录的数据能被司法机关在调查中操作使用.";
|
|
|
167 |
$l_loggedin_stringl5 = "这些数据将在一年后自动删除.";
|
2370 |
tom.houday |
168 |
$l_loggedin_stringl6 = "点击 <a href=\"$alcasarpath\"> 这里 </a> 修改密码或安装浏览器安全证书";
|
2238 |
tom.houday |
169 |
$l_loggedout_string = "强制网络门户连接已断开";
|
|
|
170 |
$l_reply_1 = "您已经达到每日连接时间";
|
|
|
171 |
$l_reply_2 = "您已经达到每月连接时间";
|
|
|
172 |
$l_reply_3 = "您尝试在授权时间以外连接";
|
|
|
173 |
$l_reply_4 = "您的账号已过期";
|
|
|
174 |
$l_reply_5 = "您已经达到同时连接的最大数量";
|
|
|
175 |
$l_reply_6 = "已经到达您的允许连接时间";
|
|
|
176 |
$l_online_time = "在线时间";
|
|
|
177 |
$l_remaining_time = "剩余时间";
|
|
|
178 |
$l_uam_domain = "授权网站 : ";
|
|
|
179 |
$l_autoregistration = "短信注册";
|
2250 |
tom.houday |
180 |
} else if ($Language === 'ar') { // Arabic
|
2238 |
tom.houday |
181 |
$l_ChilliError = "يجب نجاح المصادقة على البوابة الأسيرة";
|
|
|
182 |
$l_login = "إغلاق هذه النافذة يقطع دورة عملك";
|
|
|
183 |
$l_logout = "إغلاق الدورة";
|
|
|
184 |
$l_loginfailed = "فشل المصادقة";
|
|
|
185 |
$l_loggingin = "التعريف على البوابة الأسيرة";
|
|
|
186 |
$l_loggedcont = "مراقبة الدخول";
|
|
|
187 |
$l_loggedout = "دورتكَ مغلقة";
|
|
|
188 |
$l_user = "التعريف";
|
|
|
189 |
$l_password = "كلمة السر";
|
|
|
190 |
$l_wait = "...إنتظر بعض اللحظات";
|
|
|
191 |
$l_onlinetime = ":مدة الإتصال";
|
|
|
192 |
$l_remainingtime = ":انقطاع الإتصال في";
|
|
|
193 |
$l_encrypted = "يجب تشفير الإتصال بالبوابة";
|
|
|
194 |
$l_boutonO = "مصادقة";
|
|
|
195 |
$l_boutonF = "أغلق";
|
|
|
196 |
$l_loggedin_stringl1 = "سلامة نظم المعلومات";
|
|
|
197 |
$l_loggedin_stringl2 = "وُضعت هذه المراقبة للضمان القانوني لتتبع ومساءلة وعدم تنصل الإتصالات";
|
|
|
198 |
$l_loggedin_stringl3 = "نشاطك على الشبكة مسجل وفقاً لاحترام الحريات الشخصية";
|
|
|
199 |
$l_loggedin_stringl4 = "لا يمكن استغلال البيانات المسجلة إلاّ من قِبل سلطات التحقيق القضائ";
|
|
|
200 |
$l_loggedin_stringl5 = "سيتم حدف هذه البيانات تلقائياً بعد سنة من الْيَوْمَ";
|
2370 |
tom.houday |
201 |
$l_loggedin_stringl6 = "لتغيير كلمة السر أو شهادة الأمان <a href=\"$alcasarpath\">هنا</a> اضغط ";
|
2238 |
tom.houday |
202 |
$l_loggedout_string = "تَمّ قطع الإتصال بالبوابة الأسيرة";
|
|
|
203 |
$l_reply_1 = "انتهى وقتك اليومي للإتصال";
|
|
|
204 |
$l_reply_2 = "انتهى وقتك الشهري للإتصال";
|
|
|
205 |
$l_reply_3 = "محاولة اتصال خارج فترتك المأذونة";
|
|
|
206 |
$l_reply_4 = "انتهت مدة صلاحية حسابك";
|
|
|
207 |
$l_reply_5 = "لقد استكملت العدد الأقصى للإتصالات المتزامنة";
|
|
|
208 |
$l_reply_6 = "استكملت مذة الإتصال المسموحة";
|
|
|
209 |
$l_online_time = "مذة الإتصال";
|
|
|
210 |
$l_remaining_time = "الوقت المتبق";
|
|
|
211 |
$l_uam_domain = ":المواقع المسموحة ";
|
|
|
212 |
$l_autoregistration = "تسجيل ذاتي (SMS)";
|
2250 |
tom.houday |
213 |
} else if ($Language === 'de') { // German
|
2238 |
tom.houday |
214 |
$l_ChilliError = "Die Authentifizierung ist erfolgreich durch die Nutzung des Portals erfolgt.";
|
|
|
215 |
$l_login = "Erfolgreiche Authentifizierung.<HR>Schlißen dieses fensters unterbricht die sitzung";
|
|
|
216 |
$l_logout = "Beenden der Verbindung";
|
|
|
217 |
$l_loginfailed = "Authentifizierungsfehler Eigenverbrauch";
|
|
|
218 |
$l_loggingin = "Kennzeichnung auf dem Eigenverbrauch";
|
|
|
219 |
$l_loggedcont = "Zutrittskontrolle";
|
|
|
220 |
$l_loggedout = "Ihre Sitzung ist geschlossen";
|
|
|
221 |
$l_user = "Benutzer";
|
|
|
222 |
$l_password = "Passwort";
|
|
|
223 |
$l_wait = "Bitte warten Sie einen Moment ...";
|
|
|
224 |
$l_onlinetime = "Online-Zeit:";
|
|
|
225 |
$l_remainingtime = "Abmelden:";
|
|
|
226 |
$l_encrypted = "Die Öffnung muß der Anschluß Zahlen";
|
|
|
227 |
$l_boutonO = "Authentifizierung";
|
|
|
228 |
$l_boutonF = "Schließen";
|
|
|
229 |
$l_loggedin_stringl1 = "Information System Security";
|
|
|
230 |
$l_loggedin_stringl2 = "Dieses Portal wurde eingerichtet, um ordnungsgemäß die Rückverfolgbarkeit, der Zurechenbarkeit und der Nicht-Anerkennung der Verbindungen.";
|
|
|
231 |
$l_loggedin_stringl3 = "Ihre Tätigkeit im Netzwerk registriert ist nach Schutz der Privatsphäre.";
|
|
|
232 |
$l_loggedin_stringl4 = "Die gespeicherten Daten nicht pouront genutzt werden, dass von einer Justizbehörde im Rahmen einer Untersuchung.";
|
|
|
233 |
$l_loggedin_stringl5 = "Diese Daten werden automatisch gelöscht nach einem Jahr.";
|
2370 |
tom.houday |
234 |
$l_loggedin_stringl6 = "Click <a href=\"$alcasarpath\">here</a> to change your password or to integrate the security certificate in your browser";
|
2238 |
tom.houday |
235 |
$l_loggedout_string = "Trennung des Portals erfolgt Gefangener!";
|
|
|
236 |
$l_reply_1 = "Your daily connexion time has been reached";
|
|
|
237 |
$l_reply_2 = "Your monthly connexion time has been reached";
|
|
|
238 |
$l_reply_3 = "You try to connect outside of your allowed timespan";
|
|
|
239 |
$l_reply_4 = "your account expired";
|
|
|
240 |
$l_reply_5 = "You have reached the maximum number of simultaneous logins";
|
|
|
241 |
$l_reply_6 = "Your authorized connexion time has been reached";
|
|
|
242 |
$l_online_time = "Online-zeit";
|
|
|
243 |
$l_remaining_time = "Restzeit";
|
|
|
244 |
$l_uam_domain = "Autorisierten websites : ";
|
|
|
245 |
$l_autoregistration = "Automatische registrierung";
|
2250 |
tom.houday |
246 |
} else if ($Language === 'nl') { // Dutch
|
2238 |
tom.houday |
247 |
$l_ChilliError = "De authenticatie moet een succes worden via de captive portal dienst.";
|
|
|
248 |
$l_login = "Succesvolle authenticatie.<HR>Dit venster te sluiten onderbreekt uw sessie.";
|
|
|
249 |
$l_logout = "Slotkoers verbinding";
|
|
|
250 |
$l_loginfailed = "Authenticatie mislukt";
|
|
|
251 |
$l_loggingin = "Identificatie van de captive-portaal";
|
|
|
252 |
$l_loggedcont = "toegangscontrole";
|
|
|
253 |
$l_loggedout = "Uw sessie is gesloten";
|
|
|
254 |
$l_user = "Gebruiker";
|
|
|
255 |
$l_password = "Wachtwoord";
|
|
|
256 |
$l_wait = "Wacht een moment ...";
|
|
|
257 |
$l_onlinetime = "Sluit tijd:";
|
|
|
258 |
$l_remainingtime = "Verbreking in:";
|
|
|
259 |
$l_encrypted = "De opening moet gebruiken gecodeerde verbinding";
|
|
|
260 |
$l_boutonO = "Authenticatie";
|
|
|
261 |
$l_boutonF = "Sluiten";
|
|
|
262 |
$l_loggedin_stringl1 = "Information System Security";
|
|
|
263 |
$l_loggedin_stringl2 = "Het portaal werd opgericht verordeningen om de traceerbaarheid, verantwoordelijkheid en onloochenbaarheid van de verbindingen.";
|
|
|
264 |
$l_loggedin_stringl3 = "Uw activiteit op het netwerk is geregistreerd in overeenstemming met de persoonlijke levenssfeer.";
|
|
|
265 |
$l_loggedin_stringl4 = "De geregistreerde gegevens kunnen worden kunnen worden bediend door een rechterlijke instantie in de loop van een onderzoek.";
|
|
|
266 |
$l_loggedin_stringl5 = "Deze gegevens worden automatisch verwijderd na een jaar.";
|
2370 |
tom.houday |
267 |
$l_loggedin_stringl6 = "Click <a href=\"$alcasarpath\">here</a> to change your password or to integrate the security certificate in your browser";
|
2238 |
tom.houday |
268 |
$l_loggedout_string = "Logout gemaakt intern portaal!";
|
|
|
269 |
$l_reply_1 = "Your daily connexion time has been reached";
|
|
|
270 |
$l_reply_2 = "Your monthly connexion time has been reached";
|
|
|
271 |
$l_reply_3 = "You try to connect outside of your allowed timespan";
|
|
|
272 |
$l_reply_4 = "your account expired";
|
|
|
273 |
$l_reply_5 = "You have reached the maximum number of simultaneous logins";
|
|
|
274 |
$l_reply_6 = "Your authorized connexion time has been reached";
|
|
|
275 |
$l_online_time = "Online tijd";
|
|
|
276 |
$l_remaining_time = "Reterende tijd";
|
|
|
277 |
$l_uam_domain = "Geautoriseerde website : ";
|
|
|
278 |
$l_autoregistration = "Automatische registratie";
|
2250 |
tom.houday |
279 |
} else if ($Language === 'fr') { // French
|
2238 |
tom.houday |
280 |
$l_ChilliError = "L'authentification doit être réussie sur le portail captif.";
|
|
|
281 |
$l_login = "Authentification réussie.<HR>La fermeture de cette fenêtre interrompt votre session.";
|
|
|
282 |
$l_logout = "Fermeture de la session";
|
|
|
283 |
$l_loginfailed = "Echec d'authentification";
|
|
|
284 |
$l_loggingin = "Identification sur le portail captif";
|
|
|
285 |
$l_loggedcont = "Contrôle d'accès";
|
|
|
286 |
$l_loggedout = "Votre session est fermée";
|
|
|
287 |
$l_user = "Identifiant";
|
|
|
288 |
$l_password = "Mot de passe";
|
|
|
289 |
$l_wait = "Patientez un instant ...";
|
|
|
290 |
$l_onlinetime = "Temps de connexion:";
|
|
|
291 |
$l_remainingtime = "Deconnexion dans :";
|
|
|
292 |
$l_encrypted = "La connexion avec le portail doit être chiffrée";
|
|
|
293 |
$l_boutonO = "Authentification";
|
|
|
294 |
$l_boutonF = "Fermer";
|
|
|
295 |
$l_loggedin_stringl1 = "Sécurité des Systèmes d'Information";
|
|
|
296 |
$l_loggedin_stringl2 = "Ce contrôle a été mis en place pour assurer réglementairement la traçabilité, l'imputabilité et la non-répudiation des connexions.";
|
|
|
297 |
$l_loggedin_stringl3 = "Votre activité sur le réseau est enregistrée conformément au respect de la vie privée.";
|
|
|
298 |
$l_loggedin_stringl4 = "Les données enregistrées ne pourront être exploitées que par une autorité judiciaire dans le cadre d'une enquête.";
|
|
|
299 |
$l_loggedin_stringl5 = "Ces données seront automatiquement supprimées au bout d'un an.";
|
2370 |
tom.houday |
300 |
$l_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";
|
2238 |
tom.houday |
301 |
$l_loggedout_string = "Déconnexion du portail captif effectuée !";
|
|
|
302 |
$l_reply_1 = "Votre durée de connexion journalière a été atteinte";
|
|
|
303 |
$l_reply_2 = "Votre durée de connexion mensuelle a été atteinte";
|
|
|
304 |
$l_reply_3 = "Vous tentez de vous connecter en dehors de votre période autorisée";
|
|
|
305 |
$l_reply_4 = "Votre compte a expiré";
|
|
|
306 |
$l_reply_5 = "Vous avez atteint le nombre maximum de connexions simultanées";
|
|
|
307 |
$l_reply_6 = "Votre durée de connexion autorisée a été atteinte";
|
|
|
308 |
$l_online_time = "Temps de connexion";
|
|
|
309 |
$l_remaining_time = "Temps restant";
|
|
|
310 |
$l_uam_domain = "Sites autorisés : ";
|
|
|
311 |
$l_autoregistration = "Auto enregistrement (sms)";
|
|
|
312 |
} else { // English
|
|
|
313 |
$l_ChilliError = "The authentication must be successful through the captive portal service.";
|
|
|
314 |
$l_login = "Successful authentication.<HR>Closing this window interrupts your session";
|
|
|
315 |
$l_logout = "Closing connection";
|
|
|
316 |
$l_loginfailed = "Authentication Failed";
|
|
|
317 |
$l_loggingin = "Identification on the captive portal";
|
|
|
318 |
$l_loggedcont = "Access Control";
|
|
|
319 |
$l_loggedout = "Your session is closed";
|
|
|
320 |
$l_user = "User";
|
|
|
321 |
$l_password = "Password";
|
|
|
322 |
$l_wait = "Please wait a moment ...";
|
|
|
323 |
$l_onlinetime = "Connect time:";
|
|
|
324 |
$l_remainingtime = "Disconnection in:";
|
|
|
325 |
$l_encrypted = "The connection with the portal must be encrypted";
|
|
|
326 |
$l_boutonO = "Authentication";
|
|
|
327 |
$l_boutonF = "Close";
|
|
|
328 |
$l_loggedin_stringl1 = "Information System Security";
|
|
|
329 |
$l_loggedin_stringl2 = "That control was set up regulations to ensure traceability, accountability and non-repudiation of connections.";
|
|
|
330 |
$l_loggedin_stringl3 = "Your activity on the network is registered in accordance with privacy.";
|
|
|
331 |
$l_loggedin_stringl4 = "The recorded data can be able to be operated by a judicial authority in the course of an investigation.";
|
|
|
332 |
$l_loggedin_stringl5 = "These data will be automatically deleted after one year.";
|
2370 |
tom.houday |
333 |
$l_loggedin_stringl6 = "Click <a href=\"$alcasarpath\">here</a> to change your password or to integrate the security certificate in your browser";
|
2238 |
tom.houday |
334 |
$l_loggedout_string = "Disconnection of the captive portal made";
|
|
|
335 |
$l_reply_1 = "Your daily connexion time has been reached";
|
|
|
336 |
$l_reply_2 = "Your monthly connexion time has been reached";
|
|
|
337 |
$l_reply_3 = "You try to connect outside of your allowed timespan";
|
|
|
338 |
$l_reply_4 = "your account expired";
|
|
|
339 |
$l_reply_5 = "You have reached the maximum number of simultaneous logins";
|
|
|
340 |
$l_reply_6 = "Your authorized connexion time has been reached";
|
|
|
341 |
$l_online_time = "Online time";
|
|
|
342 |
$l_remaining_time = "Remaining time";
|
|
|
343 |
$l_uam_domain = "Authorized websites : ";
|
|
|
344 |
$l_autoregistration = "Auto registration (sms)";
|
2182 |
tom.houday |
345 |
}
|
895 |
richard |
346 |
|
2324 |
tom.houday |
347 |
# If HTTPS not use, tell it's wrong
|
|
|
348 |
if (($conf['HTTPS_LOGIN'] === 'on') && ((!isset($_SERVER['HTTPS'])) || (empty($_SERVER['HTTPS'])) || ($_SERVER['HTTPS'] === 'off'))) {
|
2238 |
tom.houday |
349 |
// Cleaning the cache
|
|
|
350 |
header('Expires: Tue, 01 Jan 2000 00:00:00 GMT');
|
|
|
351 |
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
|
|
352 |
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
|
|
353 |
header('Cache-Control: post-check=0, pre-check=0', false);
|
|
|
354 |
header('Pragma: no-cache');
|
2182 |
tom.houday |
355 |
?>
|
2238 |
tom.houday |
356 |
<!DOCTYPE html>
|
2182 |
tom.houday |
357 |
<html>
|
|
|
358 |
<head>
|
|
|
359 |
<meta charset="utf-8">
|
|
|
360 |
<title><?= $l_loggedcont ?></title>
|
|
|
361 |
</head>
|
|
|
362 |
<body style="background-color: white;">
|
|
|
363 |
<h1 style="text-align: center;"><?= $l_loginfailed ?></h1>
|
|
|
364 |
<center><?= $l_encrypted ?></center>
|
|
|
365 |
</body>
|
|
|
366 |
</html>
|
|
|
367 |
<?php
|
|
|
368 |
exit();
|
895 |
richard |
369 |
}
|
|
|
370 |
|
|
|
371 |
# Read form parameters which we care about
|
1314 |
richard |
372 |
# avoid the "user as a MAC address" attempts
|
2378 |
tom.houday |
373 |
if ((isset($_POST['username'])) && (preg_match('/^([0-9A-F]{2}-){5}[0-9A-F]{2}$/', $_POST['username']) !== 1))
|
2407 |
tom.houday |
374 |
$username = htmlspecialchars(trim($_POST['username'])); else $username = '';
|
2378 |
tom.houday |
375 |
if (isset($_POST['password'])) $password = htmlspecialchars($_POST['password']); else $password = '';
|
2370 |
tom.houday |
376 |
if (isset($_POST['challenge'])) $challenge = htmlspecialchars($_POST['challenge']); else $challenge = '';
|
2205 |
tom.houday |
377 |
if (isset($_POST['button'])) $button = htmlspecialchars($_POST['button']); else $button = '';
|
|
|
378 |
// if (isset($_POST['logout'])) $logout = htmlspecialchars($_POST['logout']); else $logout = '';
|
|
|
379 |
// if (isset($_POST['prelogin'])) $prelogin = htmlspecialchars($_POST['prelogin']); else $prelogin = '';
|
2378 |
tom.houday |
380 |
// if (isset($_POST['res'])) $res = htmlspecialchars($_POST['res']); else $res = '';
|
|
|
381 |
// if (isset($_POST['uamip'])) $uamip = htmlspecialchars($_POST['uamip']); else $uamip = '';
|
|
|
382 |
// if (isset($_POST['uamport'])) $uamport = htmlspecialchars($_POST['uamport']); else $uamport = '';
|
2205 |
tom.houday |
383 |
if (isset($_POST['userurl'])) $userurl = htmlspecialchars($_POST['userurl']); else $userurl = '';
|
2378 |
tom.houday |
384 |
// if (isset($_POST['timeleft'])) $timeleft = htmlspecialchars($_POST['timeleft']); else $timeleft = '';
|
|
|
385 |
// if (isset($_POST['redirurl'])) $redirurl = htmlspecialchars($_POST['redirurl']); else $redirurl = '';
|
895 |
richard |
386 |
|
|
|
387 |
# Read query parameters which we care about
|
2378 |
tom.houday |
388 |
if (isset($_GET['res'])) $res = htmlspecialchars($_GET['res']); else $res = '';
|
|
|
389 |
// if (isset($_GET['reason'])) $reason = htmlspecialchars($_GET['reason']); else $reason = '';
|
2205 |
tom.houday |
390 |
if (isset($_GET['challenge'])) $challenge = htmlspecialchars($_GET['challenge']);
|
2378 |
tom.houday |
391 |
// if (isset($_GET['uamip'])) $uamip = htmlspecialchars($_GET['uamip']);
|
|
|
392 |
// if (isset($_GET['uamport'])) $uamport = htmlspecialchars($_GET['uamport']);
|
|
|
393 |
if (isset($_GET['timeleft'])) $timeleft = htmlspecialchars($_GET['timeleft']); else $timeleft = '';
|
|
|
394 |
if (isset($_GET['reply'])) $reply = htmlspecialchars(trim($_GET['reply'])); else $reply = '';
|
|
|
395 |
if (isset($_GET['redirurl'])) $redirurl = htmlspecialchars($_GET['redirurl']); else $redirurl = '';
|
2205 |
tom.houday |
396 |
if (isset($_GET['userurl'])) $userurl = htmlspecialchars($_GET['userurl']);
|
895 |
richard |
397 |
|
2378 |
tom.houday |
398 |
// TODO: clean unused query params
|
|
|
399 |
|
|
|
400 |
$uamip = $conf['HOSTNAME'].'.'.$conf['DOMAIN'];
|
2409 |
tom.houday |
401 |
if (($conf['HTTPS_CHILLI'] === 'on') && $useHTTPS) {
|
2378 |
tom.houday |
402 |
$uamproto = 'https';
|
|
|
403 |
$uamport = 3991;
|
|
|
404 |
} else {
|
|
|
405 |
$uamproto = 'http';
|
|
|
406 |
$uamport = 3990;
|
2239 |
tom.houday |
407 |
}
|
|
|
408 |
|
895 |
richard |
409 |
# translation of radius replies
|
2378 |
tom.houday |
410 |
if (!empty($reply)) {
|
|
|
411 |
switch ($reply) {
|
2205 |
tom.houday |
412 |
case 'Your maximum daily usage time has been reached' : $reply = $l_reply_1; break;
|
|
|
413 |
case 'Your maximum monthly usage time has been reached' : $reply = $l_reply_2; break;
|
|
|
414 |
case 'You are calling outside your allowed timespan' : $reply = $l_reply_3; break;
|
|
|
415 |
case 'Password Has Expired' : $reply = $l_reply_4; break;
|
|
|
416 |
case 'You are already logged in - access denied' : $reply = $l_reply_5; break;
|
|
|
417 |
case 'Your maximum never usage time has been reached' : $reply = $l_reply_6; break;
|
2182 |
tom.houday |
418 |
}
|
|
|
419 |
}
|
895 |
richard |
420 |
|
2182 |
tom.houday |
421 |
// If attempt to login
|
|
|
422 |
if ($button === $l_boutonO) {
|
|
|
423 |
//correction password length in coova-chilli
|
|
|
424 |
//thanks to http://www.stochasticgeometry.ie/2009/09/09/maximum-password-length-in-coova-chilli/
|
|
|
425 |
$hexchal = pack('H*', $challenge);
|
|
|
426 |
$newchal = pack('H*', md5($hexchal . $uamsecret));
|
1947 |
raphael.pi |
427 |
|
2182 |
tom.houday |
428 |
// If challenge isn't long enough, repeat it until it is
|
2238 |
tom.houday |
429 |
while (strlen($newchal) < strlen($password)) {
|
2182 |
tom.houday |
430 |
$newchal .= $newchal;
|
|
|
431 |
}
|
1947 |
raphael.pi |
432 |
|
2182 |
tom.houday |
433 |
$newpwd = pack('a*', $password);
|
|
|
434 |
// Encode plain text password with challenge
|
|
|
435 |
$pappassword = implode('', unpack('H*', ($newpwd ^ $newchal)));
|
2238 |
tom.houday |
436 |
|
2378 |
tom.houday |
437 |
header("Location: $uamproto://$uamip:$uamport/logon?username=$username&password=$pappassword&userurl=$userurl");
|
2182 |
tom.houday |
438 |
exit();
|
895 |
richard |
439 |
}
|
|
|
440 |
|
|
|
441 |
switch($res) {
|
2182 |
tom.houday |
442 |
case 'success': $result = 1; break; // If login successful
|
|
|
443 |
case 'failed': $result = 2; break; // If login failed
|
|
|
444 |
case 'logoff': $result = 3; break; // If logout successful
|
|
|
445 |
case 'already': $result = 4; break; // If tried to login while already logged in
|
|
|
446 |
case 'notyet': $result = 5; break; // If not logged in yet
|
|
|
447 |
default: $result = 0; // Default: It was not a form request -> client go to login form
|
895 |
richard |
448 |
}
|
|
|
449 |
|
2010 |
raphael.pi |
450 |
//check if we need to warn user about the imputability logs.
|
2378 |
tom.houday |
451 |
if ($result === 1) {
|
2182 |
tom.houday |
452 |
if ((is_file('./acc/manager/lib/sql/drivers/mysql/functions.php')) && (is_file('/etc/freeradius-web/config.php'))) {
|
|
|
453 |
include_once('/etc/freeradius-web/config.php');
|
|
|
454 |
include_once('./acc/manager/lib/sql/drivers/mysql/functions.php');
|
|
|
455 |
$link = @da_sql_pconnect($config); // on affiche pas les erreurs
|
|
|
456 |
if ($link) {
|
|
|
457 |
$user_uid = da_sql_escape_string($link, $_GET['uid']);
|
|
|
458 |
$sql = "SELECT attribute, value FROM radreply WHERE username='$user_uid' AND attribute='Filter-Id'";
|
|
|
459 |
$res = @da_sql_query($link, $config, $sql); // on affiche pas les erreurs
|
|
|
460 |
if ($res) {
|
|
|
461 |
$row = @da_sql_fetch_array($res, $config);
|
|
|
462 |
$filter_id = $row['value']; // on obtient le Filter-Id de l'utilisateur
|
2378 |
tom.houday |
463 |
if ($filter_id[3] === '1') {
|
2182 |
tom.houday |
464 |
//set the fourth bit of filter-id to '0'
|
|
|
465 |
$sql = "set @CurrentFilter=(SELECT value from radreply where username='$user_uid');set @CurrentFilterLeft=(SELECT LEFT(@CurrentFilter,3));set @CurrentFilterRight=(SELECT RIGHT(@CurrentFilter,4));UPDATE radreply SET value = CONCAT((@CurrentFilterLeft),'0', (@CurrentFilterRight)) WHERE username='$user_uid'";
|
|
|
466 |
$res = mysqli_multi_query($link,$sql);
|
2370 |
tom.houday |
467 |
header('Location: '.(($conf['HTTPS_LOGIN'] === 'on') ? 'https' : 'http').'://'.$conf['HOSTNAME'].'.'.$conf['DOMAIN'].'/index.php?warn=1&url='.urlencode($_GET['userurl'])); //we present to user information about imputability logs
|
2182 |
tom.houday |
468 |
exit();
|
|
|
469 |
}
|
|
|
470 |
}
|
|
|
471 |
}
|
|
|
472 |
}
|
2010 |
raphael.pi |
473 |
}
|
|
|
474 |
|
2378 |
tom.houday |
475 |
// By default, redirect to prelogin in order to generate a challenge
|
|
|
476 |
if ($result === 0) {
|
|
|
477 |
header("Location: $uamproto://$uamip:$uamport/prelogin");
|
2182 |
tom.houday |
478 |
exit();
|
895 |
richard |
479 |
}
|
2238 |
tom.houday |
480 |
|
|
|
481 |
// Cleaning the cache
|
|
|
482 |
header('Expires: Tue, 01 Jan 2000 00:00:00 GMT');
|
|
|
483 |
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
|
|
484 |
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
|
|
485 |
header('Cache-Control: post-check=0, pre-check=0', false);
|
|
|
486 |
header('Pragma: no-cache');
|
2182 |
tom.houday |
487 |
?>
|
2238 |
tom.houday |
488 |
<!DOCTYPE html>
|
895 |
richard |
489 |
<html>
|
|
|
490 |
<head>
|
2182 |
tom.houday |
491 |
<meta charset="utf-8">
|
|
|
492 |
<title><?= $l_loggingin ?></title>
|
|
|
493 |
<script type="text/javascript">
|
1346 |
richard |
494 |
function doOnLoad(result, userurl, redirurl, adminurl, timeleft) {
|
2283 |
tom.houday |
495 |
if ((result === 1) || (result === 4)) { // success or already
|
2201 |
tom.houday |
496 |
var url;
|
2182 |
tom.houday |
497 |
if (adminurl !== '') {
|
2201 |
tom.houday |
498 |
url = adminurl;
|
2182 |
tom.houday |
499 |
} else if (redirurl !== '') {
|
2201 |
tom.houday |
500 |
url = redirurl;
|
|
|
501 |
} else if (userurl !== '') {
|
|
|
502 |
url = userurl;
|
1346 |
richard |
503 |
}
|
2201 |
tom.houday |
504 |
|
|
|
505 |
if (typeof url !== 'undefined') {
|
2283 |
tom.houday |
506 |
var win = window.open('<?= $statuspath ?>', '_blank');
|
|
|
507 |
|
2406 |
tom.houday |
508 |
if ((win === null) || (typeof win === 'undefined')) { // Pop-up blocked
|
2283 |
tom.houday |
509 |
window.location = '<?= $statuspath ?>';
|
|
|
510 |
} else {
|
|
|
511 |
window.location = url;
|
2201 |
tom.houday |
512 |
}
|
2283 |
tom.houday |
513 |
} else {
|
|
|
514 |
window.location = '<?= $statuspath ?>';
|
2201 |
tom.houday |
515 |
}
|
1346 |
richard |
516 |
}
|
2283 |
tom.houday |
517 |
if ((result === 2) || (result === 3) || result === 5) { // failed or logoff or notyet
|
2378 |
tom.houday |
518 |
document.form1.username.focus();
|
1346 |
richard |
519 |
}
|
|
|
520 |
}
|
2182 |
tom.houday |
521 |
</script>
|
|
|
522 |
<link rel="stylesheet" href="/css/style_intercept.css" type="text/css">
|
895 |
richard |
523 |
</head>
|
2182 |
tom.houday |
524 |
<body onLoad="javascript:doOnLoad(<?= $result ?>,'<?= $userurl ?>','<?= $redirurl ?>','<?= $adminurl ?>','<?= $timeleft ?>')">
|
|
|
525 |
<center>
|
|
|
526 |
|
2283 |
tom.houday |
527 |
<?php if ($result === 2 || $result === 3 || $result === 5): // failed or logoff or notyet ?>
|
2182 |
tom.houday |
528 |
<div id="logon">
|
|
|
529 |
<h1><?= $organisme ?></h1>
|
|
|
530 |
<h2><?= $l_loggedcont ?></h2>
|
2283 |
tom.houday |
531 |
<?php if ($result === 2): // failed ?>
|
2182 |
tom.houday |
532 |
<h3><?= $l_loginfailed ?></h3>
|
2283 |
tom.houday |
533 |
<?php if ($reply): // traitement du reply ... ?>
|
2182 |
tom.houday |
534 |
<center><?= $reply ?><br><br></center>
|
|
|
535 |
<?php endif; ?>
|
|
|
536 |
<?php endif;
|
|
|
537 |
if ($userurl === 'http://logout/') $userurl = 'http://www.google.com'; // Avoid cyclic logout
|
|
|
538 |
?>
|
|
|
539 |
<img id="logo-alcasar" src="/images/logo-alcasar.png">
|
|
|
540 |
<form name="form1" method="post" action="<?= $loginpath ?>">
|
|
|
541 |
<input type="hidden" name="challenge" value="<?= $challenge ?>">
|
|
|
542 |
<input type="hidden" name="userurl" value="<?= $userurl ?>">
|
|
|
543 |
<table id="boite-logon">
|
|
|
544 |
<tr>
|
|
|
545 |
<td width="20%" rowspan="4"><img id="logo-organ" src="/images/organisme.png"></td>
|
|
|
546 |
<td width="30%" align="right"><?= $l_user ?></td>
|
2378 |
tom.houday |
547 |
<td width="50%" align="left"><input type="text" maxLength="32" name="username" autocomplete="off"></td>
|
2182 |
tom.houday |
548 |
</tr>
|
|
|
549 |
<tr>
|
|
|
550 |
<td align="right"><?= $l_password ?></td>
|
2378 |
tom.houday |
551 |
<td align="left"><input maxLength="32" type="password" name="password" autocomplete="off"></td>
|
2182 |
tom.houday |
552 |
</tr>
|
|
|
553 |
<tr>
|
2201 |
tom.houday |
554 |
<td height="23" align="left"><input value="<?= $l_boutonO ?>" type="submit" name="button"></td>
|
2250 |
tom.houday |
555 |
<?php if ($service_SMS_status): ?>
|
|
|
556 |
<td><a href="autoregistrationinfo.php"><?= $l_autoregistration ?></a></td>
|
2182 |
tom.houday |
557 |
<?php endif; ?>
|
|
|
558 |
</tr>
|
|
|
559 |
</table>
|
|
|
560 |
</form>
|
|
|
561 |
<table id="boite-info" cellSpacing="0" cellPadding="0" width="80%">
|
|
|
562 |
<tr>
|
|
|
563 |
<td align="center"><font color="red"><b><?= $l_loggedin_stringl1 ?></b></font></td>
|
|
|
564 |
</tr>
|
|
|
565 |
<tr>
|
|
|
566 |
<td align="left">
|
|
|
567 |
<ul>
|
|
|
568 |
<li><?= $l_loggedin_stringl2 ?></li>
|
|
|
569 |
<li><?= $l_loggedin_stringl4 ?></li>
|
|
|
570 |
<li><?= $l_loggedin_stringl3 ?></li>
|
|
|
571 |
<li><?= $l_loggedin_stringl5 ?></li>
|
|
|
572 |
<li><?= $l_loggedin_stringl6 ?></li>
|
|
|
573 |
</ul>
|
|
|
574 |
</td>
|
|
|
575 |
</tr>
|
|
|
576 |
</table>
|
|
|
577 |
<?php
|
|
|
578 |
// Read the "Domain allowed" file
|
|
|
579 |
$tab = file(DOMAIN_ALLOWED_LIST);
|
|
|
580 |
if ($tab) { // the file isn't empty
|
|
|
581 |
echo '<div id="authorized_domain">'.$l_uam_domain;
|
|
|
582 |
foreach ($tab as $line) {
|
|
|
583 |
if (trim($line) !== '') { // the line isn't empty
|
2238 |
tom.houday |
584 |
$domain_allowed = explode('#', $line);
|
2182 |
tom.houday |
585 |
if (trim($domain_allowed[1]) !== '') {
|
|
|
586 |
$domain = explode('"', $domain_allowed[0]);
|
|
|
587 |
// remove every '.' from the beginning of domain
|
|
|
588 |
$domain[1] = ltrim($domain[1], '.');
|
2184 |
richard |
589 |
echo '<a href="http://'.trim($domain[1]).'">'.trim($domain_allowed[1]).'</a> ';
|
2182 |
tom.houday |
590 |
}
|
|
|
591 |
}
|
|
|
592 |
}
|
2186 |
tom.houday |
593 |
echo '</div>';
|
895 |
richard |
594 |
}
|
2182 |
tom.houday |
595 |
?>
|
|
|
596 |
</div>
|
|
|
597 |
<?php endif; ?>
|
1349 |
richard |
598 |
|
2182 |
tom.houday |
599 |
</center>
|
895 |
richard |
600 |
</body>
|
2182 |
tom.houday |
601 |
</html>
|