318 |
richard |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
2 |
<HTML><!-- written by Rexy - 3abtux -->
|
|
|
3 |
<HEAD>
|
|
|
4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
5 |
<TITLE>Exceptions</TITLE>
|
|
|
6 |
<link rel="stylesheet" href="/css/style.css" type="text/css">
|
|
|
7 |
</HEAD>
|
|
|
8 |
<body>
|
|
|
9 |
<?
|
870 |
richard |
10 |
/********************
|
|
|
11 |
* TEST CONF FILES *
|
|
|
12 |
*********************/
|
|
|
13 |
define ("DOMAIN_ALLOWED_LIST", "/usr/local/etc/alcasar-uamdomain");
|
|
|
14 |
define ("IP_ALLOWED_LIST", "/usr/local/etc/alcasar-uamallowed");
|
|
|
15 |
$conf_files=array(DOMAIN_ALLOWED_LIST,IP_ALLOWED_LIST);
|
|
|
16 |
foreach ($conf_files as $file){
|
|
|
17 |
if (!file_exists($file)){
|
|
|
18 |
exit("Requested file ".$file." isn't present");}
|
|
|
19 |
if (!is_readable($file)){
|
|
|
20 |
exit("Can't read the file ".$file);}
|
|
|
21 |
}
|
606 |
richard |
22 |
$domain_allowed_list="/usr/local/etc/alcasar-uamdomain";
|
|
|
23 |
$url_allowed_list="/usr/local/etc/alcasar-uamallowed";
|
318 |
richard |
24 |
# Choice of language
|
|
|
25 |
$Language = 'en';
|
|
|
26 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
870 |
richard |
27 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
28 |
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
|
318 |
richard |
29 |
if($Language == 'fr'){
|
870 |
richard |
30 |
$l_error_open_file = "Erreur d'ouverture du fichier";
|
|
|
31 |
$l_trusted_domain = "Noms de domaine Internet de confiance";
|
|
|
32 |
$l_domain = "Noms de domaine";
|
871 |
richard |
33 |
$l_comment_explain = "Lien affiché dans la page d'interception";
|
870 |
richard |
34 |
$l_comment_explain2 = "Laissez vide si non affiché";
|
|
|
35 |
$l_remove = "Retirer de la liste";
|
|
|
36 |
$l_trusted_ip = "adresses IP de confiance";
|
885 |
richard |
37 |
$l_trusted_equipments = "Equipements de consultation de confiance";
|
870 |
richard |
38 |
$l_comment = "Commentaires";
|
|
|
39 |
$l_trusted_domain_explain = "Gérez ici les noms de domaine Internet pouvant être joints sans authentification";
|
885 |
richard |
40 |
$l_trusted_equipments_explain = "Pour gérer les équipements du réseau de consultation pouvant accéder à Internet sans aêtre interceptés : lisez la documentation d'exploitation (ch.4.7c)";
|
870 |
richard |
41 |
$l_trusted_ip_explain = "Gérez ici les adresses IP de systèmes ou de réseaux pouvant être joints sans authentification";
|
|
|
42 |
$l_submit = "Enregistrer";
|
|
|
43 |
$l_add_to_list = "Ajouter à la liste";
|
|
|
44 |
$l_apply = "Appliquer les changements";
|
318 |
richard |
45 |
}
|
|
|
46 |
else {
|
870 |
richard |
47 |
$l_error_open_file = "File open error";
|
|
|
48 |
$l_trusted_domain = "Trusted Internet domain names";
|
|
|
49 |
$l_domain = "Domain names";
|
871 |
richard |
50 |
$l_comment_explain = "Link displayed in intercept page";
|
|
|
51 |
$l_comment_explain2 = "Let empty to not display link";
|
870 |
richard |
52 |
$l_remove = "Remove from list";
|
|
|
53 |
$l_trusted_ip = "Trusted Internet domain and IP addresses";
|
885 |
richard |
54 |
$l_trusted_equipments = "Trusted consultation equipements";
|
|
|
55 |
$l_trusted_equipments_explain = "To manage consultation equipments allowed to be connected to Internet withoout interception, read exploitation documentation (ch.4.7c)";
|
870 |
richard |
56 |
$l_comment = "Comments";
|
|
|
57 |
$l_trusted_domain_explain = "Manage Internet domain names that can be joined without authentication";
|
|
|
58 |
$l_trusted_ip_explain = "Manage systems or networks IP addresses that can be joined without authentication";
|
|
|
59 |
$l_submit = "Submit";
|
|
|
60 |
$l_add_to_list = "Add to list";
|
|
|
61 |
$l_apply = "Apply changes";
|
318 |
richard |
62 |
}
|
|
|
63 |
if (isset($_POST['choix'])){
|
|
|
64 |
switch ($_POST['choix'])
|
|
|
65 |
{
|
870 |
richard |
66 |
case 'new_uamdomain' :
|
|
|
67 |
if (trim($_POST['add_uamdomain']) != "")
|
|
|
68 |
{
|
|
|
69 |
$tab=file(DOMAIN_ALLOWED_LIST);
|
|
|
70 |
$insert = true;
|
|
|
71 |
if ($tab) // file isn't empty
|
|
|
72 |
{
|
|
|
73 |
foreach ($tab as $line) // test if domain address doesn't already exist
|
|
|
74 |
{
|
|
|
75 |
$domain=explode("\"", $line);
|
|
|
76 |
if (strcmp(trim($_POST['add_uamdomain']),$domain[1]) == 0)
|
|
|
77 |
{
|
|
|
78 |
$insert = false;
|
|
|
79 |
break;
|
|
|
80 |
}
|
|
|
81 |
}
|
318 |
richard |
82 |
}
|
870 |
richard |
83 |
if ($insert == true)
|
|
|
84 |
{
|
|
|
85 |
$line ="\nuamdomain=\"" . trim($_POST['add_uamdomain']) . "\" #" . trim($_POST['add_domain_comment']);
|
|
|
86 |
$pointeur=fopen(DOMAIN_ALLOWED_LIST,"a");
|
|
|
87 |
fwrite ($pointeur, $line);
|
|
|
88 |
fclose ($pointeur);
|
|
|
89 |
exec ("sudo /usr/local/bin/alcasar-file-clean.sh");
|
|
|
90 |
exec ("sudo service chilli restart");
|
|
|
91 |
}
|
|
|
92 |
}
|
|
|
93 |
break;
|
|
|
94 |
case 'change_uamdomain' :
|
|
|
95 |
$tab=file(DOMAIN_ALLOWED_LIST);
|
|
|
96 |
if ($tab)
|
|
|
97 |
{
|
|
|
98 |
$pointeur=fopen(DOMAIN_ALLOWED_LIST,"w+");
|
|
|
99 |
foreach ($tab as $ligne)
|
|
|
100 |
{
|
|
|
101 |
$uamdomain1=explode("\"", $ligne);
|
|
|
102 |
$remove_line = false;
|
|
|
103 |
foreach ($_POST as $key => $value)
|
|
|
104 |
{
|
|
|
105 |
$key = str_replace ("_",".",$key); // dot are replace by '_' in post request
|
|
|
106 |
if (strstr($key,'del-'))
|
|
|
107 |
{
|
|
|
108 |
$uamdomain2 = str_replace('del-','',$key);
|
|
|
109 |
if (strcmp($uamdomain1[1],$uamdomain2) == 0)
|
|
|
110 |
{
|
|
|
111 |
$remove_line = True;
|
|
|
112 |
break;
|
|
|
113 |
}
|
|
|
114 |
}
|
|
|
115 |
}
|
|
|
116 |
if (! $remove_line)
|
|
|
117 |
{
|
|
|
118 |
fwrite($pointeur,$ligne);
|
|
|
119 |
}
|
|
|
120 |
}
|
|
|
121 |
fclose($pointeur);
|
|
|
122 |
}
|
|
|
123 |
exec ("sudo service chilli restart");
|
|
|
124 |
break;
|
|
|
125 |
case 'new_ip' :
|
|
|
126 |
if (trim($_POST['add_ip']) != "")
|
|
|
127 |
{
|
|
|
128 |
$tab=file(IP_ALLOWED_LIST);
|
|
|
129 |
$insert = true;
|
|
|
130 |
if ($tab) // file isn't empty
|
|
|
131 |
{
|
|
|
132 |
foreach ($tab as $line) // test if domain address doesn't already exist
|
|
|
133 |
{
|
|
|
134 |
$ip=explode("\"", $line);
|
|
|
135 |
if (strcmp(trim($_POST['add_ip']),$ip[1]) == 0)
|
|
|
136 |
{
|
|
|
137 |
$insert = false;
|
|
|
138 |
break;
|
|
|
139 |
}
|
|
|
140 |
}
|
|
|
141 |
}
|
|
|
142 |
if ($insert == true)
|
|
|
143 |
{
|
|
|
144 |
$line ="\nuamallowed=\"" . trim($_POST['add_ip']) ."\" #" . trim($_POST['add_ip_comment']);
|
|
|
145 |
$pointeur=fopen(IP_ALLOWED_LIST,"a");
|
|
|
146 |
fwrite ($pointeur, $line);
|
|
|
147 |
fclose ($pointeur);
|
|
|
148 |
exec ("sudo /usr/local/bin/alcasar-file-clean.sh");
|
|
|
149 |
exec ("sudo service chilli restart");
|
|
|
150 |
}
|
|
|
151 |
}
|
|
|
152 |
break;
|
|
|
153 |
case 'change_ip' :
|
|
|
154 |
$tab=file(IP_ALLOWED_LIST);
|
|
|
155 |
if ($tab)
|
|
|
156 |
{
|
|
|
157 |
$pointeur=fopen(IP_ALLOWED_LIST,"w+");
|
|
|
158 |
foreach ($tab as $ligne)
|
|
|
159 |
{
|
|
|
160 |
$ip1=explode("\"", $ligne);
|
|
|
161 |
$remove_line = false;
|
|
|
162 |
foreach ($_POST as $key => $value)
|
|
|
163 |
{
|
|
|
164 |
$key = str_replace ("_",".",$key); // dot are replace by '_' in post request
|
|
|
165 |
if (strstr($key,'del-'))
|
|
|
166 |
{
|
|
|
167 |
$ip2 = str_replace('del-','',$key);
|
|
|
168 |
if (strcmp($ip1[1],$ip2) == 0)
|
|
|
169 |
{
|
|
|
170 |
$remove_line = True;
|
|
|
171 |
break;
|
|
|
172 |
}
|
|
|
173 |
}
|
|
|
174 |
}
|
|
|
175 |
if (! $remove_line)
|
|
|
176 |
{
|
|
|
177 |
fwrite($pointeur,$ligne);
|
|
|
178 |
}
|
|
|
179 |
}
|
|
|
180 |
fclose($pointeur);
|
|
|
181 |
}
|
|
|
182 |
exec ("sudo service chilli restart");
|
|
|
183 |
break;
|
|
|
184 |
}
|
318 |
richard |
185 |
}
|
|
|
186 |
?>
|
870 |
richard |
187 |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
|
|
|
188 |
<tr><th><?echo "$l_trusted_domain";?></th></tr>
|
|
|
189 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
190 |
</table>
|
|
|
191 |
<table width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
192 |
<tr><td colspan=2 align="center">
|
|
|
193 |
<?
|
|
|
194 |
echo "$l_trusted_domain_explain</td></tr>";
|
|
|
195 |
echo "<tr><td align='center' valign='middle'>";
|
|
|
196 |
echo "<table cellspacing=2 cellpadding=2 border=1>";
|
|
|
197 |
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
|
912 |
richard |
198 |
echo "<tr align='center' bgcolor='#d0ddb0'><td>$l_domain<td>$l_comment_explain<td>$l_remove</tr>";
|
870 |
richard |
199 |
// Read the "Domain alowed" file
|
|
|
200 |
$tab=file(DOMAIN_ALLOWED_LIST);
|
|
|
201 |
if ($tab) # the file isn't empty
|
|
|
202 |
{
|
|
|
203 |
foreach ($tab as $line)
|
|
|
204 |
{
|
|
|
205 |
if (trim($line) != '') # the line isn't empty
|
|
|
206 |
{
|
|
|
207 |
$domain_allowed=explode("#", $line);
|
|
|
208 |
$uamdomain=trim($domain_allowed[0],"#");
|
|
|
209 |
$domain=explode("\"", $uamdomain);
|
|
|
210 |
echo "<tr><td>$domain[1]";
|
|
|
211 |
echo "<td>";
|
|
|
212 |
if (isset ($domain_allowed[1])) {
|
|
|
213 |
echo trim($domain_allowed[1]);}
|
|
|
214 |
else echo " ";
|
|
|
215 |
echo "<td>";
|
|
|
216 |
echo "<input type='checkbox' name='del-$domain[1]'>";
|
|
|
217 |
echo "</tr>";
|
|
|
218 |
}
|
|
|
219 |
}
|
|
|
220 |
}
|
|
|
221 |
echo "</table>";
|
|
|
222 |
if ($tab)
|
|
|
223 |
{
|
|
|
224 |
echo "<input type='hidden' name='choix' value='change_uamdomain'>";
|
|
|
225 |
echo "<input type='submit' value='$l_apply'>";
|
|
|
226 |
}
|
|
|
227 |
?>
|
|
|
228 |
</form>
|
|
|
229 |
</td><td valign='middle' align='center'>
|
|
|
230 |
<form action='<?echo"$_SERVER[PHP_SELF]"?>' method='POST'>
|
|
|
231 |
<table cellspacing=2 cellpadding=3 border=1>
|
912 |
richard |
232 |
<tr align='center'><td bgcolor='#d0ddb0'><?echo "$l_domain<td bgcolor='#d0ddb0'>$l_comment_explain";?>
|
|
|
233 |
<td></tr>
|
|
|
234 |
<tr><td>exemple1 : www.mydomain.com <br>exemple2 : .yourdomain.net
|
|
|
235 |
<td>My domain<br><?echo "$l_comment_explain2";?><td></tr>
|
|
|
236 |
<tr><td><input type='text' name='add_uamdomain' size='20'>
|
|
|
237 |
<td><input type='text' name='add_domain_comment' size='15'>
|
870 |
richard |
238 |
<input type='hidden' name='choix' value='new_uamdomain'>
|
912 |
richard |
239 |
<td><input type='submit' value='<?echo "$l_add_to_list";?>'>
|
870 |
richard |
240 |
</tr></table>
|
|
|
241 |
</form>
|
912 |
richard |
242 |
</tr>
|
870 |
richard |
243 |
</table>
|
885 |
richard |
244 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
245 |
<tr><th><?php echo "$l_trusted_ip" ;?></th></tr>
|
318 |
richard |
246 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
885 |
richard |
247 |
</table>
|
870 |
richard |
248 |
<table width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
249 |
<tr><td colspan=2 align="center">
|
|
|
250 |
<?
|
|
|
251 |
echo "$l_trusted_ip_explain</td></tr>";
|
|
|
252 |
echo "<tr><td align='center' valign='middle'>";
|
|
|
253 |
echo "<table cellspacing=2 cellpadding=2 border=1>";
|
|
|
254 |
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
|
912 |
richard |
255 |
echo "<tr align='center' bgcolor='#d0ddb0'><td>$l_trusted_ip<td>$l_comment<td>$l_remove</tr>";
|
870 |
richard |
256 |
// Read the "ip alowed" file
|
|
|
257 |
$tab=file(IP_ALLOWED_LIST);
|
|
|
258 |
if ($tab) # the file isn't empty
|
|
|
259 |
{
|
|
|
260 |
foreach ($tab as $line)
|
|
|
261 |
{
|
|
|
262 |
if (trim($line) != '') # the line isn't empty
|
|
|
263 |
{
|
|
|
264 |
$ip_allowed=explode("#", $line);
|
|
|
265 |
$ip_a=trim($ip_allowed[0],"#");
|
|
|
266 |
$ip=explode("\"", $ip_a);
|
|
|
267 |
echo "<tr><td>$ip[1]";
|
|
|
268 |
echo "<td>";
|
|
|
269 |
if (isset($ip_allowed[1]))
|
|
|
270 |
echo trim($ip_allowed[1]);
|
|
|
271 |
else echo " ";
|
|
|
272 |
echo "<td><input type='checkbox' name='del-$ip[1]'>";
|
|
|
273 |
echo "</tr>";
|
|
|
274 |
}
|
|
|
275 |
}
|
|
|
276 |
}
|
|
|
277 |
echo "</table>";
|
|
|
278 |
if ($tab)
|
|
|
279 |
{
|
|
|
280 |
echo "<input type='hidden' name='choix' value='change_ip'>";
|
|
|
281 |
echo "<input type='submit' value='$l_apply'>";
|
|
|
282 |
}
|
|
|
283 |
?>
|
|
|
284 |
</form>
|
|
|
285 |
</td><td valign='middle' align='center'>
|
885 |
richard |
286 |
<form action='<?echo "$_SERVER[PHP_SELF]"?>' method='POST'>
|
870 |
richard |
287 |
<table cellspacing=2 cellpadding=3 border=1>
|
912 |
richard |
288 |
<tr align='center'><td bgcolor='#d0ddb0'><?echo "$l_trusted_ip<td bgcolor='#d0ddb0'>$l_comment";?>
|
|
|
289 |
<td></tr>
|
870 |
richard |
290 |
<tr><td>exemple1 : 170.25.23.10 <br>exemple2 : 15.20.20.0/16</td>
|
912 |
richard |
291 |
<td>my_web_server <br>my_dmz<td></tr>
|
870 |
richard |
292 |
<tr><td><input type='text' name='add_ip' size='20'></td>
|
|
|
293 |
<td><input type='text' name='add_ip_comment' size='15'></td>
|
|
|
294 |
<input type='hidden' name='choix' value='new_ip'>
|
885 |
richard |
295 |
<td><input type='submit' value='<?echo "$l_add_to_list";?>'></td>
|
870 |
richard |
296 |
</tr></table>
|
|
|
297 |
</td></tr>
|
|
|
298 |
</table>
|
912 |
richard |
299 |
</form>
|
885 |
richard |
300 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
301 |
<tr><th><?php echo "$l_trusted_equipments";?></th></tr>
|
|
|
302 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
303 |
</table>
|
|
|
304 |
<table width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
305 |
<tr><td colspan=2 align="center">
|
|
|
306 |
<?echo "$l_trusted_equipments_explain";?>
|
|
|
307 |
</td></tr>
|
|
|
308 |
</table>
|
318 |
richard |
309 |
</BODY>
|
|
|
310 |
</HTML>
|