Subversion Repositories ALCASAR

Rev

Rev 470 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 470 Rev 498
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy - 3abtux -->
2
<HTML><!-- written by Rexy - 3abtux -->
3
<HEAD>
3
<HEAD>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
<TITLE>Exceptions</TITLE>
5
<TITLE>Exceptions</TITLE>
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
7
</HEAD>
7
</HEAD>
8
<body>
8
<body>
9
<?
9
<?
10
# Choice of language
10
# Choice of language
11
$Language = 'en';
11
$Language = 'en';
12
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
12
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
13
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
13
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
14
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
14
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
15
if($Language == 'fr'){
15
if($Language == 'fr'){
-
 
16
  $l_error_open_file = "Erreur d'ouverture du fichier";
16
  $l_trusted_sites = "Sites Internet de confiance";
17
  $l_trusted_sites = "Sites Internet de confiance";
17
  $l_trusted_sites_explain1 = "Entrez ici les noms de site ou d'URLs Internet pouvant &ecirc;tre joints sans authentification";
18
  $l_trusted_sites_explain1 = "Entrez ici les noms de site ou d'URLs Internet pouvant &ecirc;tre joints sans authentification";
18
  $l_trusted_sites_explain2 = "Entrez un nom par ligne";
19
  $l_trusted_sites_explain2 = "Entrez un nom par ligne";
19
  $l_trusted_sites_list = "Liste de sites Internet de confiance";
20
  $l_trusted_sites_list = "Liste de sites Internet de confiance";
20
  $l_trusted_urls_list = "Liste d'URLs Internet de confiance";
21
  $l_trusted_urls_list = "Liste d'URLs Internet de confiance";
21
  $l_trusted_mac = "&Eacute;quipements de confiance";
22
  $l_trusted_mac = "&Eacute;quipements de confiance";
22
  $l_trusted_mac_explain1 = "Entrez ici les adresses MAC des &eacute;quipements autorisés à joindre Internet sans authentification";
23
  $l_trusted_mac_explain = "Entrez ici les adresses MAC des &eacute;quipements autorisés à joindre Internet sans authentification";
23
  $l_trusted_mac_explain2 = "Entrez une adresse MAC par ligne";
-
 
24
  $l_trusted_mac_list = "Liste des adresses MAC de confiance";
24
  $l_trusted_mac_list = "Liste des adresses MAC de confiance";
-
 
25
  $l_trusted_mac_address = "Adresse MAC autorisées";
-
 
26
  $l_trusted_mac_info = "Information équipement";
-
 
27
  $l_trusted_mac_del = "Supprimer de la liste";
25
  $l_submit = "Enregistrer";
28
  $l_submit = "Enregistrer";
26
}
29
}
27
else {
30
else {
-
 
31
  $l_error_open_file = "File open error";
28
  $l_trusted_sites = "Trusted Internet sites";
32
  $l_trusted_sites = "Trusted Internet sites";
29
  $l_trusted_sites_explain1 = "Enter name of Internet sites or URLS that could be joined without authentication";
33
  $l_trusted_sites_explain1 = "Enter name of Internet sites or URLS that could be joined without authentication";
30
  $l_trusted_sites_explain2 = "Enter one name per line";
34
  $l_trusted_sites_explain2 = "Enter one name per line";
31
  $l_trusted_sites_list = "Trusted Internet sites list";
35
  $l_trusted_sites_list = "Trusted Internet sites list";
32
  $l_trusted_urls_list = "Trusted Internet URLs list";
36
  $l_trusted_urls_list = "Trusted Internet URLs list";
33
  $l_trusted_mac = "Trusted Equipments";
37
  $l_trusted_mac = "Trusted Equipments";
34
  $l_trusted_mac_explain1 = "Enter MAC address of equipments that could contact Internet without authentification";
38
  $l_trusted_mac_explain = "Enter MAC address of equipments that could contact Internet without authentification";
35
  $l_trusted_mac_explain2 = "Enter one Mac address per line";
-
 
36
  $l_trusted_mac_list = "Trusted MAC addresses list";
39
  $l_trusted_mac_list = "Trusted MAC addresses list";
-
 
40
  $l_trusted_mac_address = "Allowed MAC adress MAC"; 
-
 
41
  $l_trusted_mac_info = "Equipment information";
-
 
42
  $l_trusted_mac_del = "Delete from list";
37
  $l_submit = "Submit";
43
  $l_submit = "Submit";
-
 
44
 
38
}
45
}
39
if (isset($_POST['choix'])){ 
46
if (isset($_POST['choix'])){ 
40
	switch ($_POST['choix'])
47
	switch ($_POST['choix'])
41
	{
48
	{
42
	case 'MAJ_UAMALLOWED' :
49
	case 'MAJ_UAMALLOWED' :
43
		$nb_domain=0;
50
		$nb_domain=0;
44
		$tab_domains = explode ("\n", $_POST['trusted_domains']);
51
		$tab_domains = explode ("\n", $_POST['trusted_domains']);
45
		$fichier=fopen("/usr/local/etc/alcasar-uamdomain","w+");
52
		$fichier=fopen("/usr/local/etc/alcasar-uamdomain","w+");
46
		fputs ($fichier, "uamdomain=\"");
53
		fputs ($fichier, "uamdomain=\"");
47
		foreach ($tab_domains as $domain ){
54
		foreach ($tab_domains as $domain ){
48
			$tr_domain=trim($domain);
55
			$tr_domain=trim($domain);
49
			$nb_domain++;
56
			$nb_domain++;
50
			if ($tr_domain != ""){
57
			if ($tr_domain != ""){
51
				if ($nb_domain>1) fputs ($fichier, ",".$tr_domain);
58
				if ($nb_domain>1) fputs ($fichier, ",".$tr_domain);
52
				else fputs ($fichier, $tr_domain);
59
				else fputs ($fichier, $tr_domain);
53
				}
60
				}
54
			}	
61
			}	
55
		fputs($fichier, "\"");
62
		fputs($fichier, "\"");
56
		fclose($fichier);
63
		fclose($fichier);
57
		unset($_POST['trusted_domains']);
64
		unset($_POST['trusted_domains']);
58
		unset($nb_domain);
65
		unset($nb_domain);
59
		$nb_url=0;
66
		$nb_url=0;
60
		$tab_urls = explode ("\n", $_POST['trusted_urls']);
67
		$tab_urls = explode ("\n", $_POST['trusted_urls']);
61
		$fichier=fopen("/usr/local/etc/alcasar-uamallowed","w+");
68
		$fichier=fopen("/usr/local/etc/alcasar-uamallowed","w+");
62
		fputs ($fichier, "uamallowed=\"");
69
		fputs ($fichier, "uamallowed=\"");
63
		foreach ($tab_urls as $url ){
70
		foreach ($tab_urls as $url ){
64
			$tr_url=trim($url);
71
			$tr_url=trim($url);
65
			$nb_url++;
72
			$nb_url++;
66
			if ($tr_url != ""){
73
			if ($tr_url != ""){
67
				if ($nb_url>1) fputs ($fichier, ",".$tr_url);
74
				if ($nb_url>1) fputs ($fichier, ",".$tr_url);
68
				else fputs ($fichier, $tr_url);
75
				else fputs ($fichier, $tr_url);
69
				}
76
				}
70
			}
77
			}
71
		fputs($fichier, "\"");
78
		fputs($fichier, "\"");
72
		fclose($fichier);
79
		fclose($fichier);
73
		unset($_POST['trusted_urls']);
80
		unset($_POST['trusted_urls']);
74
		unset($nb_url);
81
		unset($nb_url);
75
		exec ("sudo service chilli restart");
82
		exec ("sudo service chilli restart");
76
		unset ($_POST['choix']);
83
		unset ($_POST['choix']);
77
		break;
84
		break;
78
	case 'MAJ_MACALLOWED' :
85
	case 'MAJ_MACALLOWED' :
79
		$nb_mac=0;
86
		$nb_mac=0;
80
		$tab_macs = explode ("\n", $_POST['trusted_macs']);
87
		$tab_macs = explode ("\n", $_POST['trusted_macs']);
81
		$fichier=fopen("/usr/local/etc/alcasar-macallowed","w+");
88
		$fichier=fopen("/usr/local/etc/alcasar-macallowed","w+");
82
		fputs ($fichier, "macallowed=\"");
89
		fputs ($fichier, "macallowed=\"");
83
		foreach ($tab_macs as $macs ){
90
		foreach ($tab_macs as $macs ){
84
			$tr_macs=trim($macs);
91
			$tr_macs=trim($macs);
85
			$nb_mac++;
92
			$nb_mac++;
86
			if ($tr_macs != ""){
93
			if ($tr_macs != ""){
87
				if ($nb_mac>1) fputs ($fichier, ",".$tr_macs);
94
				if ($nb_mac>1) fputs ($fichier, ",".$tr_macs);
88
				else fputs ($fichier, $tr_macs);
95
				else fputs ($fichier, $tr_macs);
89
				}
96
				}
90
			}
97
			}
91
		fputs($fichier, "\"");
98
		fputs($fichier, "\"");
92
		fclose($fichier);
99
		fclose($fichier);
93
		unset($_POST['trusted_macs']);
100
		unset($_POST['trusted_macs']);
94
		unset($nb_mac);
101
		unset($nb_mac);
95
		exec ("sudo service chilli restart");
102
		exec ("sudo service chilli restart");
96
		unset ($_POST['choix']);
103
		unset ($_POST['choix']);
97
		break;
104
		break;
98
	}	
105
	}	
99
}
106
}
100
?>
107
?>
101
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
108
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
102
	<tr><th><?php echo $l_trusted_sites ;?></th></tr>
109
	<tr><th><?php echo $l_trusted_sites ;?></th></tr>
103
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
110
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
104
</TABLE>
111
</TABLE>
105
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
112
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
106
	<tr bgcolor="#666666"><td>
113
	<tr bgcolor="#666666"><td>
107
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
114
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
108
		<tr><td valign="middle" align="left">
115
		<tr><td valign="middle" align="left">
109
		<center><?php
116
		<center><?php
110
		echo "$l_trusted_sites_explain1 <BR>";
117
		echo "$l_trusted_sites_explain1 <BR>";
111
		echo "$l_trusted_sites_explain2" ;
118
		echo "$l_trusted_sites_explain2" ;
112
		echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
119
		echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
113
		<TABLE cellspacing=2 cellpadding=3 border=1>
120
		<TABLE cellspacing=2 cellpadding=3 border=1>
114
		<tr><td width=50% height=100% align=center>
121
		<tr><td width=50% height=100% align=center>
115
			<H3><?php echo $l_trusted_sites_list ;?></H3>
122
			<H3><?php echo $l_trusted_sites_list ;?></H3>
116
			exemple1 : www.domain1.org<BR>
123
			exemple1 : www.domain1.org<BR>
117
			exemple2 : domain2.net<BR>
124
			exemple2 : domain2.net<BR>
118
			<?php
125
			<?php
119
				echo "<textarea name='trusted_domains' rows=5 cols=40>";
126
				echo "<textarea name='trusted_domains' rows=5 cols=40>";
120
				$trusted_domains_file="/usr/local/etc/alcasar-uamdomain";
127
				$trusted_domains_file="/usr/local/etc/alcasar-uamdomain";
121
				$ouvre=fopen($trusted_domains_file,"r");
128
				$ouvre=fopen($trusted_domains_file,"r");
122
				if ($ouvre)
129
				if ($ouvre)
123
					{
130
					{
124
					while (!feof ($ouvre))
131
					while (!feof ($ouvre))
125
						{
132
						{
126
						$tampon = fgets($ouvre, 4096);
133
						$tampon = fgets($ouvre, 4096);
127
						$domain_list_l = substr($tampon,10);
134
						$domain_list_l = substr($tampon,10);
128
						$domain_list = trim ($domain_list_l,"\"\n\t ");
135
						$domain_list = trim ($domain_list_l,"\"\n\t ");
129
						$tab_domains = explode (",", $domain_list);
136
						$tab_domains = explode (",", $domain_list);
130
						foreach ($tab_domains as $domain ){
137
						foreach ($tab_domains as $domain ){
131
							if ($domain) { echo $domain."\n";}
138
							if ($domain) { echo $domain."\n";}
132
							}
139
							}
133
		  				}
140
		  				}
134
					}
141
					}
135
				else	{
142
				else	{
136
					echo "failed to open $trusted_domains_file";
143
					echo "failed to open $trusted_domains_file";
137
					}
144
					}
138
				fclose($ouvre);
145
				fclose($ouvre);
139
				echo "</textarea>";
146
				echo "</textarea>";
140
			?>
147
			?>
141
		</td>
148
		</td>
142
		<td  width=50% height=100% align=center>
149
		<td  width=50% height=100% align=center>
143
			<H3><?php echo $l_trusted_urls_list ;?></H3>
150
			<H3><?php echo $l_trusted_urls_list ;?></H3>
144
			exemple1 : www.domain3.net/admin/index.htm<BR>
151
			exemple1 : www.domain3.net/admin/index.htm<BR>
145
			exemple2 : domain4.org/~polux/index.html<BR>
152
			exemple2 : domain4.org/~polux/index.html<BR>
146
			<?php
153
			<?php
147
				echo "<textarea name='trusted_urls' rows=5 cols=40>";
154
				echo "<textarea name='trusted_urls' rows=5 cols=40>";
148
				$trusted_urls_file="/usr/local/etc/alcasar-uamallowed";
155
				$trusted_urls_file="/usr/local/etc/alcasar-uamallowed";
149
				$ouvre=fopen($trusted_urls_file,"r");
156
				$ouvre=fopen($trusted_urls_file,"r");
150
				if ($ouvre)
157
				if ($ouvre)
151
			       		{
158
			       		{
152
					while (!feof ($ouvre))
159
					while (!feof ($ouvre))
153
						{
160
						{
154
						$tampon = fgets($ouvre, 4096);
161
						$tampon = fgets($ouvre, 4096);
155
						$url_list_l = substr($tampon,11);
162
						$url_list_l = substr($tampon,11);
156
						$url_list = trim ($url_list_l,"\"\n\t ");
163
						$url_list = trim ($url_list_l,"\"\n\t ");
157
						$tab_urls = explode (",", $url_list);
164
						$tab_urls = explode (",", $url_list);
158
						foreach ($tab_urls as $url ){
165
						foreach ($tab_urls as $url ){
159
							if ($url) echo $url."\n";
166
							if ($url) echo $url."\n";
160
							}
167
							}
161
						}
168
						}
162
					}
169
					}
163
				else	{
170
				else	{
164
					echo "failed to open $trusted_urls_file";
171
					echo "failed to open $trusted_urls_file";
165
					}
172
					}
166
				fclose($ouvre);
173
				fclose($ouvre);
167
				echo "</textarea>";
174
				echo "</textarea>";
168
			?>
175
			?>
169
		</td></tr>
176
		</td></tr>
170
		</TABLE>
177
		</TABLE>
171
		<input type='hidden' name='choix' value='MAJ_UAMALLOWED'>
178
		<input type='hidden' name='choix' value='MAJ_UAMALLOWED'>
172
		<input type='submit' value='<?php echo $l_submit ;?>'>
179
		<input type='submit' value='<?php echo $l_submit ;?>'>
173
		</FORM>
180
		</FORM>
174
	</td></tr>
181
	</td></tr>
175
	</TABLE>
182
	</TABLE>
176
</TABLE>
183
</TABLE>
177
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
184
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
178
	<tr><th><?php echo $l_trusted_mac ;?></th></tr>
185
	<tr><th><?php echo $l_trusted_mac ;?></th></tr>
179
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
186
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
180
</TABLE>
187
</TABLE>
-
 
188
 
-
 
189
<table width="100%" border=1 cellspacing=0 cellpadding=1>
-
 
190
<tr><td colspan=2 align="center">
-
 
191
<?
-
 
192
echo "$l_trusted_mac_explain</td></tr>";
-
 
193
echo "<tr><td align='center' valign='middle'>";
-
 
194
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
-
 
195
echo "<table cellspacing=2 cellpadding=3 border=1>";
-
 
196
echo "<tr><th>$l_trusted_mac_address<th>$l_trusted_mac_info<th>$l_trusted_mac_del</tr>";
-
 
197
// On lit et on interprète le fichier de filtrage de protocoles
-
 
198
$trusted_mac_file="/usr/local/etc/alcasar-macallowed";
-
 
199
if (file_exists($trusted_mac_file))
-
 
200
	{
-
 
201
	$pointeur=fopen($trusted_mac_file,"r");
-
 
202
	while (!feof ($pointeur))
-
 
203
		{
-
 
204
		$ligne=fgets($pointeur, 4096);
-
 
205
		if ($ligne)
-
 
206
			{
-
 
207
			$field=explode(" ", $ligne);
-
 
208
			$mac_info=trim($field[2],"#");
-
 
209
			echo "<tr><td>$field[1]";
-
 
210
			echo "<td>$mac_info";
-
 
211
			echo "<td><input type='checkbox' name='del-$field[1]'>";
-
 
212
			echo "</tr>";
-
 
213
			}
-
 
214
		}
-
 
215
	fclose($pointeur);
-
 
216
	}
-
 
217
else	{
-
 
218
	echo "$l_error_open_file $trusted_mac_file";
-
 
219
	}
-
 
220
?>
-
 
221
</table>
-
 
222
<input type='hidden' name='choix' value='change'>
-
 
223
<input type='submit' value='<?echo"$l_submit";?>'>
-
 
224
</form>
-
 
225
</td>
-
 
226
<td valign='middle' align='center'>
-
 
227
<form action='net_filter.php' method='POST'>
-
 
228
<table cellspacing=2 cellpadding=3 border=1>
-
 
229
<tr><th><?echo"$l_trusted_mac_address<th>$l_trusted_mac_info";?></tr>
-
 
230
<tr><td><input type='text' name='add_proto' size='10'></td>
-
 
231
<td><input type='text' name='add_port' size='5'></td>
-
 
232
<input type='hidden' name='choix' value='new_proto'>
-
 
233
<td><input type='submit' value='<?echo"$l_add_to_list";?>'></td>
-
 
234
</tr></table>
-
 
235
</form>
-
 
236
</td></tr>
-
 
237
</table>
-
 
238
 
181
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
239
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
182
	<tr bgcolor="#666666"><td>
240
	<tr bgcolor="#666666"><td>
183
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
241
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
184
		<tr><td valign="middle" align="left">
242
		<tr><td valign="middle" align="left">
185
		<center><?php
243
		<center><?php
186
		echo "$l_trusted_mac_explain1 <BR>";
244
		echo "$l_trusted_mac_explain1 <BR>";
187
		echo "$l_trusted_mac_explain2";
245
		echo "$l_trusted_mac_explain2";
188
		echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
246
		echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
189
		<TABLE cellspacing=2 cellpadding=3 border=1>
247
		<TABLE cellspacing=2 cellpadding=3 border=1>
190
		<tr><td width=60% height=100% align=center>
248
		<tr><td width=60% height=100% align=center>
191
			<H3><?php echo $l_trusted_mac_list ;?></H3>
249
			<H3><?php echo $l_trusted_mac_list ;?></H3>
192
			exemple : 12-2f-36-a4-df-43<BR>
250
			exemple : 12-2f-36-a4-df-43<BR>
193
			<?php
251
			<?php
194
				echo "<textarea name='trusted_macs' rows=5 cols=40>";
252
				echo "<textarea name='trusted_macs' rows=5 cols=40>";
195
				$trusted_macs_file="/usr/local/etc/alcasar-macallowed";
253
				$trusted_macs_file="/usr/local/etc/alcasar-macallowed";
196
				$ouvre=fopen($trusted_macs_file,"r");
254
				$ouvre=fopen($trusted_macs_file,"r");
197
				if ($ouvre)
255
				if ($ouvre)
198
					{
256
					{
199
					while (!feof ($ouvre))
257
					while (!feof ($ouvre))
200
						{
258
						{
201
						$tampon = fgets($ouvre, 4096);
259
						$tampon = fgets($ouvre, 4096);
202
						$mac_list_l = substr($tampon,11);
260
						$mac_list_l = substr($tampon,11);
203
						$mac_list = trim ($mac_list_l,"\"\n\t ");
261
						$mac_list = trim ($mac_list_l,"\"\n\t ");
204
						$tab_macs = explode (",", $mac_list);
262
						$tab_macs = explode (",", $mac_list);
205
						foreach ($tab_macs as $macs ){
263
						foreach ($tab_macs as $macs ){
206
							if ($macs) echo $macs."\n";
264
							if ($macs) echo $macs."\n";
207
							}
265
							}
208
		  				}
266
		  				}
209
					}
267
					}
210
				else	{
268
				else	{
211
					echo "failed to open $trusted_macs_file";
269
					echo "failed to open $trusted_macs_file";
212
					}
270
					}
213
				fclose($ouvre);
271
				fclose($ouvre);
214
				echo "</textarea>";
272
				echo "</textarea>";
215
			?>
273
			?>
216
		</td></tr>
274
		</td></tr>
217
		</TABLE>
275
		</TABLE>
218
		<input type='hidden' name='choix' value='MAJ_MACALLOWED'>
276
		<input type='hidden' name='choix' value='MAJ_MACALLOWED'>
219
		<input type='submit' value='<?php echo $l_submit ;?>'>
277
		<input type='submit' value='<?php echo $l_submit ;?>'>
220
		</FORM>
278
		</FORM>
221
	</td></tr>
279
	</td></tr>
222
</TABLE>
280
</TABLE>
223
</BODY>
281
</BODY>
224
</HTML>
282
</HTML>
225
 
283