Subversion Repositories ALCASAR

Rev

Rev 470 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
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
<?
10
# Choice of language
11
$Language = 'en';
12
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
13
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
14
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
15
if($Language == 'fr'){
498 richard 16
  $l_error_open_file = "Erreur d'ouverture du fichier";
318 richard 17
  $l_trusted_sites = "Sites Internet de confiance";
18
  $l_trusted_sites_explain1 = "Entrez ici les noms de site ou d'URLs Internet pouvant &ecirc;tre joints sans authentification";
470 richard 19
  $l_trusted_sites_explain2 = "Entrez un nom par ligne";
318 richard 20
  $l_trusted_sites_list = "Liste de sites Internet de confiance";
21
  $l_trusted_urls_list = "Liste d'URLs Internet de confiance";
22
  $l_trusted_mac = "&Eacute;quipements de confiance";
498 richard 23
  $l_trusted_mac_explain = "Entrez ici les adresses MAC des &eacute;quipements autorisés à joindre Internet sans authentification";
318 richard 24
  $l_trusted_mac_list = "Liste des adresses MAC de confiance";
498 richard 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";
318 richard 28
  $l_submit = "Enregistrer";
29
}
30
else {
498 richard 31
  $l_error_open_file = "File open error";
318 richard 32
  $l_trusted_sites = "Trusted Internet sites";
33
  $l_trusted_sites_explain1 = "Enter name of Internet sites or URLS that could be joined without authentication";
34
  $l_trusted_sites_explain2 = "Enter one name per line";
35
  $l_trusted_sites_list = "Trusted Internet sites list";
36
  $l_trusted_urls_list = "Trusted Internet URLs list";
37
  $l_trusted_mac = "Trusted Equipments";
498 richard 38
  $l_trusted_mac_explain = "Enter MAC address of equipments that could contact Internet without authentification";
318 richard 39
  $l_trusted_mac_list = "Trusted MAC addresses list";
498 richard 40
  $l_trusted_mac_address = "Allowed MAC adress MAC"; 
41
  $l_trusted_mac_info = "Equipment information";
42
  $l_trusted_mac_del = "Delete from list";
318 richard 43
  $l_submit = "Submit";
498 richard 44
 
318 richard 45
}
46
if (isset($_POST['choix'])){ 
47
	switch ($_POST['choix'])
48
	{
49
	case 'MAJ_UAMALLOWED' :
50
		$nb_domain=0;
51
		$tab_domains = explode ("\n", $_POST['trusted_domains']);
346 richard 52
		$fichier=fopen("/usr/local/etc/alcasar-uamdomain","w+");
53
		fputs ($fichier, "uamdomain=\"");
318 richard 54
		foreach ($tab_domains as $domain ){
55
			$tr_domain=trim($domain);
56
			$nb_domain++;
57
			if ($tr_domain != ""){
58
				if ($nb_domain>1) fputs ($fichier, ",".$tr_domain);
59
				else fputs ($fichier, $tr_domain);
60
				}
61
			}	
346 richard 62
		fputs($fichier, "\"");
318 richard 63
		fclose($fichier);
64
		unset($_POST['trusted_domains']);
65
		unset($nb_domain);
66
		$nb_url=0;
67
		$tab_urls = explode ("\n", $_POST['trusted_urls']);
346 richard 68
		$fichier=fopen("/usr/local/etc/alcasar-uamallowed","w+");
69
		fputs ($fichier, "uamallowed=\"");
318 richard 70
		foreach ($tab_urls as $url ){
71
			$tr_url=trim($url);
72
			$nb_url++;
73
			if ($tr_url != ""){
74
				if ($nb_url>1) fputs ($fichier, ",".$tr_url);
75
				else fputs ($fichier, $tr_url);
76
				}
77
			}
346 richard 78
		fputs($fichier, "\"");
318 richard 79
		fclose($fichier);
80
		unset($_POST['trusted_urls']);
81
		unset($nb_url);
82
		exec ("sudo service chilli restart");
83
		unset ($_POST['choix']);
84
		break;
85
	case 'MAJ_MACALLOWED' :
86
		$nb_mac=0;
87
		$tab_macs = explode ("\n", $_POST['trusted_macs']);
346 richard 88
		$fichier=fopen("/usr/local/etc/alcasar-macallowed","w+");
89
		fputs ($fichier, "macallowed=\"");
318 richard 90
		foreach ($tab_macs as $macs ){
91
			$tr_macs=trim($macs);
92
			$nb_mac++;
93
			if ($tr_macs != ""){
94
				if ($nb_mac>1) fputs ($fichier, ",".$tr_macs);
95
				else fputs ($fichier, $tr_macs);
96
				}
97
			}
346 richard 98
		fputs($fichier, "\"");
318 richard 99
		fclose($fichier);
100
		unset($_POST['trusted_macs']);
101
		unset($nb_mac);
102
		exec ("sudo service chilli restart");
103
		unset ($_POST['choix']);
104
		break;
105
	}	
106
}
107
?>
108
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
109
	<tr><th><?php echo $l_trusted_sites ;?></th></tr>
110
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
111
</TABLE>
112
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
113
	<tr bgcolor="#666666"><td>
114
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
115
		<tr><td valign="middle" align="left">
116
		<center><?php
117
		echo "$l_trusted_sites_explain1 <BR>";
118
		echo "$l_trusted_sites_explain2" ;
119
		echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
120
		<TABLE cellspacing=2 cellpadding=3 border=1>
121
		<tr><td width=50% height=100% align=center>
122
			<H3><?php echo $l_trusted_sites_list ;?></H3>
123
			exemple1 : www.domain1.org<BR>
124
			exemple2 : domain2.net<BR>
125
			<?php
126
				echo "<textarea name='trusted_domains' rows=5 cols=40>";
346 richard 127
				$trusted_domains_file="/usr/local/etc/alcasar-uamdomain";
318 richard 128
				$ouvre=fopen($trusted_domains_file,"r");
129
				if ($ouvre)
130
					{
131
					while (!feof ($ouvre))
132
						{
133
						$tampon = fgets($ouvre, 4096);
356 richard 134
						$domain_list_l = substr($tampon,10);
135
						$domain_list = trim ($domain_list_l,"\"\n\t ");
346 richard 136
						$tab_domains = explode (",", $domain_list);
318 richard 137
						foreach ($tab_domains as $domain ){
346 richard 138
							if ($domain) { echo $domain."\n";}
318 richard 139
							}
140
		  				}
141
					}
142
				else	{
143
					echo "failed to open $trusted_domains_file";
144
					}
145
				fclose($ouvre);
146
				echo "</textarea>";
147
			?>
148
		</td>
149
		<td  width=50% height=100% align=center>
150
			<H3><?php echo $l_trusted_urls_list ;?></H3>
151
			exemple1 : www.domain3.net/admin/index.htm<BR>
152
			exemple2 : domain4.org/~polux/index.html<BR>
153
			<?php
154
				echo "<textarea name='trusted_urls' rows=5 cols=40>";
346 richard 155
				$trusted_urls_file="/usr/local/etc/alcasar-uamallowed";
318 richard 156
				$ouvre=fopen($trusted_urls_file,"r");
157
				if ($ouvre)
158
			       		{
159
					while (!feof ($ouvre))
160
						{
161
						$tampon = fgets($ouvre, 4096);
356 richard 162
						$url_list_l = substr($tampon,11);
163
						$url_list = trim ($url_list_l,"\"\n\t ");
164
						$tab_urls = explode (",", $url_list);
318 richard 165
						foreach ($tab_urls as $url ){
346 richard 166
							if ($url) echo $url."\n";
318 richard 167
							}
168
						}
169
					}
170
				else	{
171
					echo "failed to open $trusted_urls_file";
172
					}
173
				fclose($ouvre);
174
				echo "</textarea>";
175
			?>
176
		</td></tr>
177
		</TABLE>
178
		<input type='hidden' name='choix' value='MAJ_UAMALLOWED'>
179
		<input type='submit' value='<?php echo $l_submit ;?>'>
180
		</FORM>
181
	</td></tr>
182
	</TABLE>
183
</TABLE>
184
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
185
	<tr><th><?php echo $l_trusted_mac ;?></th></tr>
186
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
187
</TABLE>
498 richard 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
 
318 richard 239
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
240
	<tr bgcolor="#666666"><td>
241
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
242
		<tr><td valign="middle" align="left">
243
		<center><?php
244
		echo "$l_trusted_mac_explain1 <BR>";
245
		echo "$l_trusted_mac_explain2";
246
		echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
247
		<TABLE cellspacing=2 cellpadding=3 border=1>
248
		<tr><td width=60% height=100% align=center>
249
			<H3><?php echo $l_trusted_mac_list ;?></H3>
250
			exemple : 12-2f-36-a4-df-43<BR>
251
			<?php
252
				echo "<textarea name='trusted_macs' rows=5 cols=40>";
346 richard 253
				$trusted_macs_file="/usr/local/etc/alcasar-macallowed";
318 richard 254
				$ouvre=fopen($trusted_macs_file,"r");
255
				if ($ouvre)
256
					{
257
					while (!feof ($ouvre))
258
						{
259
						$tampon = fgets($ouvre, 4096);
356 richard 260
						$mac_list_l = substr($tampon,11);
261
						$mac_list = trim ($mac_list_l,"\"\n\t ");
262
						$tab_macs = explode (",", $mac_list);
318 richard 263
						foreach ($tab_macs as $macs ){
346 richard 264
							if ($macs) echo $macs."\n";
318 richard 265
							}
266
		  				}
267
					}
268
				else	{
269
					echo "failed to open $trusted_macs_file";
270
					}
271
				fclose($ouvre);
272
				echo "</textarea>";
273
			?>
274
		</td></tr>
275
		</TABLE>
276
		<input type='hidden' name='choix' value='MAJ_MACALLOWED'>
277
		<input type='submit' value='<?php echo $l_submit ;?>'>
278
		</FORM>
279
	</td></tr>
280
</TABLE>
281
</BODY>
282
</HTML>