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";
|
|
|
33 |
$l_comment_explain = "Lien de la page d'interception";
|
|
|
34 |
$l_comment_explain2 = "Laissez vide si non affiché";
|
|
|
35 |
$l_remove = "Retirer de la liste";
|
|
|
36 |
$l_trusted_ip = "adresses IP de confiance";
|
|
|
37 |
$l_comment = "Commentaires";
|
|
|
38 |
$l_trusted_domain_explain = "Gérez ici les noms de domaine Internet pouvant être joints sans authentification";
|
|
|
39 |
$l_trusted_ip_explain = "Gérez ici les adresses IP de systèmes ou de réseaux pouvant être joints sans authentification";
|
|
|
40 |
$l_submit = "Enregistrer";
|
|
|
41 |
$l_add_to_list = "Ajouter à la liste";
|
|
|
42 |
$l_apply = "Appliquer les changements";
|
318 |
richard |
43 |
}
|
|
|
44 |
else {
|
870 |
richard |
45 |
$l_error_open_file = "File open error";
|
|
|
46 |
$l_trusted_domain = "Trusted Internet domain names";
|
|
|
47 |
$l_domain = "Domain names";
|
|
|
48 |
$l_comment_explain = "Link showed in intercep page";
|
|
|
49 |
$l_comment_explain2 = "Let empty for no link";
|
|
|
50 |
$l_remove = "Remove from list";
|
|
|
51 |
$l_trusted_ip = "Trusted Internet domain and IP addresses";
|
|
|
52 |
$l_comment = "Comments";
|
|
|
53 |
$l_trusted_domain_explain = "Manage Internet domain names that can be joined without authentication";
|
|
|
54 |
$l_trusted_ip_explain = "Manage systems or networks IP addresses that can be joined without authentication";
|
|
|
55 |
$l_submit = "Submit";
|
|
|
56 |
$l_add_to_list = "Add to list";
|
|
|
57 |
$l_apply = "Apply changes";
|
318 |
richard |
58 |
}
|
|
|
59 |
if (isset($_POST['choix'])){
|
|
|
60 |
switch ($_POST['choix'])
|
|
|
61 |
{
|
870 |
richard |
62 |
case 'new_uamdomain' :
|
|
|
63 |
if (trim($_POST['add_uamdomain']) != "")
|
|
|
64 |
{
|
|
|
65 |
$tab=file(DOMAIN_ALLOWED_LIST);
|
|
|
66 |
$insert = true;
|
|
|
67 |
if ($tab) // file isn't empty
|
|
|
68 |
{
|
|
|
69 |
foreach ($tab as $line) // test if domain address doesn't already exist
|
|
|
70 |
{
|
|
|
71 |
$domain=explode("\"", $line);
|
|
|
72 |
if (strcmp(trim($_POST['add_uamdomain']),$domain[1]) == 0)
|
|
|
73 |
{
|
|
|
74 |
$insert = false;
|
|
|
75 |
break;
|
|
|
76 |
}
|
|
|
77 |
}
|
318 |
richard |
78 |
}
|
870 |
richard |
79 |
if ($insert == true)
|
|
|
80 |
{
|
|
|
81 |
$line ="\nuamdomain=\"" . trim($_POST['add_uamdomain']) . "\" #" . trim($_POST['add_domain_comment']);
|
|
|
82 |
$pointeur=fopen(DOMAIN_ALLOWED_LIST,"a");
|
|
|
83 |
fwrite ($pointeur, $line);
|
|
|
84 |
fclose ($pointeur);
|
|
|
85 |
exec ("sudo /usr/local/bin/alcasar-file-clean.sh");
|
|
|
86 |
exec ("sudo service chilli restart");
|
|
|
87 |
}
|
|
|
88 |
}
|
|
|
89 |
break;
|
|
|
90 |
case 'change_uamdomain' :
|
|
|
91 |
$tab=file(DOMAIN_ALLOWED_LIST);
|
|
|
92 |
if ($tab)
|
|
|
93 |
{
|
|
|
94 |
$pointeur=fopen(DOMAIN_ALLOWED_LIST,"w+");
|
|
|
95 |
foreach ($tab as $ligne)
|
|
|
96 |
{
|
|
|
97 |
$uamdomain1=explode("\"", $ligne);
|
|
|
98 |
$remove_line = false;
|
|
|
99 |
foreach ($_POST as $key => $value)
|
|
|
100 |
{
|
|
|
101 |
$key = str_replace ("_",".",$key); // dot are replace by '_' in post request
|
|
|
102 |
if (strstr($key,'del-'))
|
|
|
103 |
{
|
|
|
104 |
$uamdomain2 = str_replace('del-','',$key);
|
|
|
105 |
if (strcmp($uamdomain1[1],$uamdomain2) == 0)
|
|
|
106 |
{
|
|
|
107 |
$remove_line = True;
|
|
|
108 |
break;
|
|
|
109 |
}
|
|
|
110 |
}
|
|
|
111 |
}
|
|
|
112 |
if (! $remove_line)
|
|
|
113 |
{
|
|
|
114 |
fwrite($pointeur,$ligne);
|
|
|
115 |
}
|
|
|
116 |
}
|
|
|
117 |
fclose($pointeur);
|
|
|
118 |
}
|
|
|
119 |
exec ("sudo service chilli restart");
|
|
|
120 |
break;
|
|
|
121 |
case 'new_ip' :
|
|
|
122 |
if (trim($_POST['add_ip']) != "")
|
|
|
123 |
{
|
|
|
124 |
$tab=file(IP_ALLOWED_LIST);
|
|
|
125 |
$insert = true;
|
|
|
126 |
if ($tab) // file isn't empty
|
|
|
127 |
{
|
|
|
128 |
foreach ($tab as $line) // test if domain address doesn't already exist
|
|
|
129 |
{
|
|
|
130 |
$ip=explode("\"", $line);
|
|
|
131 |
if (strcmp(trim($_POST['add_ip']),$ip[1]) == 0)
|
|
|
132 |
{
|
|
|
133 |
$insert = false;
|
|
|
134 |
break;
|
|
|
135 |
}
|
|
|
136 |
}
|
|
|
137 |
}
|
|
|
138 |
if ($insert == true)
|
|
|
139 |
{
|
|
|
140 |
$line ="\nuamallowed=\"" . trim($_POST['add_ip']) ."\" #" . trim($_POST['add_ip_comment']);
|
|
|
141 |
$pointeur=fopen(IP_ALLOWED_LIST,"a");
|
|
|
142 |
fwrite ($pointeur, $line);
|
|
|
143 |
fclose ($pointeur);
|
|
|
144 |
exec ("sudo /usr/local/bin/alcasar-file-clean.sh");
|
|
|
145 |
exec ("sudo service chilli restart");
|
|
|
146 |
}
|
|
|
147 |
}
|
|
|
148 |
break;
|
|
|
149 |
case 'change_ip' :
|
|
|
150 |
$tab=file(IP_ALLOWED_LIST);
|
|
|
151 |
if ($tab)
|
|
|
152 |
{
|
|
|
153 |
$pointeur=fopen(IP_ALLOWED_LIST,"w+");
|
|
|
154 |
foreach ($tab as $ligne)
|
|
|
155 |
{
|
|
|
156 |
$ip1=explode("\"", $ligne);
|
|
|
157 |
$remove_line = false;
|
|
|
158 |
foreach ($_POST as $key => $value)
|
|
|
159 |
{
|
|
|
160 |
$key = str_replace ("_",".",$key); // dot are replace by '_' in post request
|
|
|
161 |
if (strstr($key,'del-'))
|
|
|
162 |
{
|
|
|
163 |
$ip2 = str_replace('del-','',$key);
|
|
|
164 |
if (strcmp($ip1[1],$ip2) == 0)
|
|
|
165 |
{
|
|
|
166 |
$remove_line = True;
|
|
|
167 |
break;
|
|
|
168 |
}
|
|
|
169 |
}
|
|
|
170 |
}
|
|
|
171 |
if (! $remove_line)
|
|
|
172 |
{
|
|
|
173 |
fwrite($pointeur,$ligne);
|
|
|
174 |
}
|
|
|
175 |
}
|
|
|
176 |
fclose($pointeur);
|
|
|
177 |
}
|
|
|
178 |
exec ("sudo service chilli restart");
|
|
|
179 |
break;
|
|
|
180 |
}
|
318 |
richard |
181 |
}
|
|
|
182 |
?>
|
870 |
richard |
183 |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
|
|
|
184 |
<tr><th><?echo "$l_trusted_domain";?></th></tr>
|
|
|
185 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
186 |
</table>
|
|
|
187 |
<table width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
188 |
<tr><td colspan=2 align="center">
|
|
|
189 |
<?
|
|
|
190 |
echo "$l_trusted_domain_explain</td></tr>";
|
|
|
191 |
echo "<tr><td align='center' valign='middle'>";
|
|
|
192 |
echo "<table cellspacing=2 cellpadding=2 border=1>";
|
|
|
193 |
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
|
|
|
194 |
echo "<tr><th>$l_domain<th>$l_comment_explain<th>$l_remove</tr>";
|
|
|
195 |
// Read the "Domain alowed" file
|
|
|
196 |
$tab=file(DOMAIN_ALLOWED_LIST);
|
|
|
197 |
if ($tab) # the file isn't empty
|
|
|
198 |
{
|
|
|
199 |
foreach ($tab as $line)
|
|
|
200 |
{
|
|
|
201 |
if (trim($line) != '') # the line isn't empty
|
|
|
202 |
{
|
|
|
203 |
$domain_allowed=explode("#", $line);
|
|
|
204 |
$uamdomain=trim($domain_allowed[0],"#");
|
|
|
205 |
$domain=explode("\"", $uamdomain);
|
|
|
206 |
echo "<tr><td>$domain[1]";
|
|
|
207 |
echo "<td>";
|
|
|
208 |
if (isset ($domain_allowed[1])) {
|
|
|
209 |
echo trim($domain_allowed[1]);}
|
|
|
210 |
else echo " ";
|
|
|
211 |
echo "<td>";
|
|
|
212 |
echo "<input type='checkbox' name='del-$domain[1]'>";
|
|
|
213 |
echo "</tr>";
|
|
|
214 |
}
|
|
|
215 |
}
|
|
|
216 |
}
|
|
|
217 |
echo "</table>";
|
|
|
218 |
if ($tab)
|
|
|
219 |
{
|
|
|
220 |
echo "<input type='hidden' name='choix' value='change_uamdomain'>";
|
|
|
221 |
echo "<input type='submit' value='$l_apply'>";
|
|
|
222 |
}
|
|
|
223 |
?>
|
|
|
224 |
</form>
|
|
|
225 |
</td><td valign='middle' align='center'>
|
|
|
226 |
<form action='<?echo"$_SERVER[PHP_SELF]"?>' method='POST'>
|
|
|
227 |
<table cellspacing=2 cellpadding=3 border=1>
|
|
|
228 |
<tr><th><?echo"$l_domain</th><th>$l_comment_explain";?>
|
|
|
229 |
<td></td></tr>
|
|
|
230 |
<tr><td>exemple1 : www.mydomain.com <br>exemple2 : .yourdomain.net</td>
|
|
|
231 |
<td>My domain<br><?echo"$l_comment_explain2";?></td></tr>
|
|
|
232 |
<tr><td><input type='text' name='add_uamdomain' size='20'></td>
|
|
|
233 |
<td><input type='text' name='add_domain_comment' size='15'></td>
|
|
|
234 |
<input type='hidden' name='choix' value='new_uamdomain'>
|
|
|
235 |
<td><input type='submit' value='<?echo"$l_add_to_list";?>'></td>
|
|
|
236 |
</tr></table>
|
|
|
237 |
</form>
|
|
|
238 |
</td></tr>
|
|
|
239 |
</table>
|
318 |
richard |
240 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
870 |
richard |
241 |
<tr><th><?php echo $l_trusted_ip ;?></th></tr>
|
318 |
richard |
242 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
|
|
243 |
</TABLE>
|
|
|
244 |
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
|
|
|
245 |
</TABLE>
|
870 |
richard |
246 |
<table width="100%" border=1 cellspacing=0 cellpadding=1>
|
|
|
247 |
<tr><td colspan=2 align="center">
|
|
|
248 |
<?
|
|
|
249 |
echo "$l_trusted_ip_explain</td></tr>";
|
|
|
250 |
echo "<tr><td align='center' valign='middle'>";
|
|
|
251 |
echo "<table cellspacing=2 cellpadding=2 border=1>";
|
|
|
252 |
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
|
|
|
253 |
echo "<tr><th>$l_trusted_ip<th>$l_comment<th>$l_remove</tr>";
|
|
|
254 |
// Read the "ip alowed" file
|
|
|
255 |
$tab=file(IP_ALLOWED_LIST);
|
|
|
256 |
if ($tab) # the file isn't empty
|
|
|
257 |
{
|
|
|
258 |
foreach ($tab as $line)
|
|
|
259 |
{
|
|
|
260 |
if (trim($line) != '') # the line isn't empty
|
|
|
261 |
{
|
|
|
262 |
$ip_allowed=explode("#", $line);
|
|
|
263 |
$ip_a=trim($ip_allowed[0],"#");
|
|
|
264 |
$ip=explode("\"", $ip_a);
|
|
|
265 |
echo "<tr><td>$ip[1]";
|
|
|
266 |
echo "<td>";
|
|
|
267 |
if (isset($ip_allowed[1]))
|
|
|
268 |
echo trim($ip_allowed[1]);
|
|
|
269 |
else echo " ";
|
|
|
270 |
echo "<td><input type='checkbox' name='del-$ip[1]'>";
|
|
|
271 |
echo "</tr>";
|
|
|
272 |
}
|
|
|
273 |
}
|
|
|
274 |
}
|
|
|
275 |
echo "</table>";
|
|
|
276 |
if ($tab)
|
|
|
277 |
{
|
|
|
278 |
echo "<input type='hidden' name='choix' value='change_ip'>";
|
|
|
279 |
echo "<input type='submit' value='$l_apply'>";
|
|
|
280 |
}
|
|
|
281 |
?>
|
|
|
282 |
</form>
|
|
|
283 |
</td><td valign='middle' align='center'>
|
|
|
284 |
<form action='<?echo"$_SERVER[PHP_SELF]"?>' method='POST'>
|
|
|
285 |
<table cellspacing=2 cellpadding=3 border=1>
|
|
|
286 |
<tr><th><?echo"$l_trusted_ip</th><th>$l_comment";?>
|
|
|
287 |
<td></td></tr>
|
|
|
288 |
<tr><td>exemple1 : 170.25.23.10 <br>exemple2 : 15.20.20.0/16</td>
|
|
|
289 |
<td>my_web_server <br>my_dmz</td>
|
|
|
290 |
<tr><td><input type='text' name='add_ip' size='20'></td>
|
|
|
291 |
<td><input type='text' name='add_ip_comment' size='15'></td>
|
|
|
292 |
<input type='hidden' name='choix' value='new_ip'>
|
|
|
293 |
<td><input type='submit' value='<?echo"$l_add_to_list";?>'></td>
|
|
|
294 |
</tr></table>
|
|
|
295 |
</form>
|
|
|
296 |
</td></tr>
|
|
|
297 |
</table>
|
318 |
richard |
298 |
</BODY>
|
|
|
299 |
</HTML>
|