Subversion Repositories ALCASAR

Rev

Details | 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'){
16
  $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_explain2 = "Entrez un noms par ligne";
19
  $l_trusted_sites_list = "Liste de sites Internet de confiance";
20
  $l_trusted_urls_list = "Liste d'URLs Internet de confiance";
21
  $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_explain2 = "Entrez une adresse MAC par ligne";
24
  $l_trusted_mac_list = "Liste des adresses MAC de confiance";
25
  $l_submit = "Enregistrer";
26
}
27
else {
28
  $l_trusted_sites = "Trusted Internet sites";
29
  $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";
31
  $l_trusted_sites_list = "Trusted Internet sites list";
32
  $l_trusted_urls_list = "Trusted Internet URLs list";
33
  $l_trusted_mac = "Trusted Equipments";
34
  $l_trusted_mac_explain1 = "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";
37
  $l_submit = "Submit";
38
}
39
if (isset($_POST['choix'])){ 
40
	switch ($_POST['choix'])
41
	{
42
	case 'MAJ_UAMALLOWED' :
43
		$nb_domain=0;
44
		$tab_domains = explode ("\n", $_POST['trusted_domains']);
346 richard 45
		$fichier=fopen("/usr/local/etc/alcasar-uamdomain","w+");
46
		fputs ($fichier, "uamdomain=\"");
318 richard 47
		foreach ($tab_domains as $domain ){
48
			$tr_domain=trim($domain);
49
			$nb_domain++;
50
			if ($tr_domain != ""){
51
				if ($nb_domain>1) fputs ($fichier, ",".$tr_domain);
52
				else fputs ($fichier, $tr_domain);
53
				}
54
			}	
346 richard 55
		fputs($fichier, "\"");
318 richard 56
		fclose($fichier);
57
		unset($_POST['trusted_domains']);
58
		unset($nb_domain);
59
		$nb_url=0;
60
		$tab_urls = explode ("\n", $_POST['trusted_urls']);
346 richard 61
		$fichier=fopen("/usr/local/etc/alcasar-uamallowed","w+");
62
		fputs ($fichier, "uamallowed=\"");
318 richard 63
		foreach ($tab_urls as $url ){
64
			$tr_url=trim($url);
65
			$nb_url++;
66
			if ($tr_url != ""){
67
				if ($nb_url>1) fputs ($fichier, ",".$tr_url);
68
				else fputs ($fichier, $tr_url);
69
				}
70
			}
346 richard 71
		fputs($fichier, "\"");
318 richard 72
		fclose($fichier);
73
		unset($_POST['trusted_urls']);
74
		unset($nb_url);
75
		exec ("sudo service chilli restart");
76
		unset ($_POST['choix']);
77
		break;
78
	case 'MAJ_MACALLOWED' :
79
		$nb_mac=0;
80
		$tab_macs = explode ("\n", $_POST['trusted_macs']);
346 richard 81
		$fichier=fopen("/usr/local/etc/alcasar-macallowed","w+");
82
		fputs ($fichier, "macallowed=\"");
318 richard 83
		foreach ($tab_macs as $macs ){
84
			$tr_macs=trim($macs);
85
			$nb_mac++;
86
			if ($tr_macs != ""){
87
				if ($nb_mac>1) fputs ($fichier, ",".$tr_macs);
88
				else fputs ($fichier, $tr_macs);
89
				}
90
			}
346 richard 91
		fputs($fichier, "\"");
318 richard 92
		fclose($fichier);
93
		unset($_POST['trusted_macs']);
94
		unset($nb_mac);
95
		exec ("sudo service chilli restart");
96
		unset ($_POST['choix']);
97
		break;
98
	}	
99
}
100
?>
101
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
102
	<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>
104
</TABLE>
105
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
106
	<tr bgcolor="#666666"><td>
107
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
108
		<tr><td valign="middle" align="left">
109
		<center><?php
110
		echo "$l_trusted_sites_explain1 <BR>";
111
		echo "$l_trusted_sites_explain2" ;
112
		echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
113
		<TABLE cellspacing=2 cellpadding=3 border=1>
114
		<tr><td width=50% height=100% align=center>
115
			<H3><?php echo $l_trusted_sites_list ;?></H3>
116
			exemple1 : www.domain1.org<BR>
117
			exemple2 : domain2.net<BR>
118
			<?php
119
				echo "<textarea name='trusted_domains' rows=5 cols=40>";
346 richard 120
				$trusted_domains_file="/usr/local/etc/alcasar-uamdomain";
318 richard 121
				$ouvre=fopen($trusted_domains_file,"r");
122
				if ($ouvre)
123
					{
124
					while (!feof ($ouvre))
125
						{
126
						$tampon = fgets($ouvre, 4096);
356 richard 127
						$domain_list_l = substr($tampon,10);
128
						$domain_list = trim ($domain_list_l,"\"\n\t ");
346 richard 129
						$tab_domains = explode (",", $domain_list);
318 richard 130
						foreach ($tab_domains as $domain ){
346 richard 131
							if ($domain) { echo $domain."\n";}
318 richard 132
							}
133
		  				}
134
					}
135
				else	{
136
					echo "failed to open $trusted_domains_file";
137
					}
138
				fclose($ouvre);
139
				echo "</textarea>";
140
			?>
141
		</td>
142
		<td  width=50% height=100% align=center>
143
			<H3><?php echo $l_trusted_urls_list ;?></H3>
144
			exemple1 : www.domain3.net/admin/index.htm<BR>
145
			exemple2 : domain4.org/~polux/index.html<BR>
146
			<?php
147
				echo "<textarea name='trusted_urls' rows=5 cols=40>";
346 richard 148
				$trusted_urls_file="/usr/local/etc/alcasar-uamallowed";
318 richard 149
				$ouvre=fopen($trusted_urls_file,"r");
150
				if ($ouvre)
151
			       		{
152
					while (!feof ($ouvre))
153
						{
154
						$tampon = fgets($ouvre, 4096);
356 richard 155
						$url_list_l = substr($tampon,11);
156
						$url_list = trim ($url_list_l,"\"\n\t ");
157
						$tab_urls = explode (",", $url_list);
318 richard 158
						foreach ($tab_urls as $url ){
346 richard 159
							if ($url) echo $url."\n";
318 richard 160
							}
161
						}
162
					}
163
				else	{
164
					echo "failed to open $trusted_urls_file";
165
					}
166
				fclose($ouvre);
167
				echo "</textarea>";
168
			?>
169
		</td></tr>
170
		</TABLE>
171
		<input type='hidden' name='choix' value='MAJ_UAMALLOWED'>
172
		<input type='submit' value='<?php echo $l_submit ;?>'>
173
		</FORM>
174
	</td></tr>
175
	</TABLE>
176
</TABLE>
177
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
178
	<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>
180
</TABLE>
181
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
182
	<tr bgcolor="#666666"><td>
183
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
184
		<tr><td valign="middle" align="left">
185
		<center><?php
186
		echo "$l_trusted_mac_explain1 <BR>";
187
		echo "$l_trusted_mac_explain2";
188
		echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
189
		<TABLE cellspacing=2 cellpadding=3 border=1>
190
		<tr><td width=60% height=100% align=center>
191
			<H3><?php echo $l_trusted_mac_list ;?></H3>
192
			exemple : 12-2f-36-a4-df-43<BR>
193
			<?php
194
				echo "<textarea name='trusted_macs' rows=5 cols=40>";
346 richard 195
				$trusted_macs_file="/usr/local/etc/alcasar-macallowed";
318 richard 196
				$ouvre=fopen($trusted_macs_file,"r");
197
				if ($ouvre)
198
					{
199
					while (!feof ($ouvre))
200
						{
201
						$tampon = fgets($ouvre, 4096);
356 richard 202
						$mac_list_l = substr($tampon,11);
203
						$mac_list = trim ($mac_list_l,"\"\n\t ");
204
						$tab_macs = explode (",", $mac_list);
318 richard 205
						foreach ($tab_macs as $macs ){
346 richard 206
							if ($macs) echo $macs."\n";
318 richard 207
							}
208
		  				}
209
					}
210
				else	{
211
					echo "failed to open $trusted_macs_file";
212
					}
213
				fclose($ouvre);
214
				echo "</textarea>";
215
			?>
216
		</td></tr>
217
		</TABLE>
218
		<input type='hidden' name='choix' value='MAJ_MACALLOWED'>
219
		<input type='submit' value='<?php echo $l_submit ;?>'>
220
		</FORM>
221
	</td></tr>
222
</TABLE>
223
</BODY>
224
</HTML>