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']);
45
		$fichier=fopen("/etc/chilli/alcasar-uamdomain","w+");
46
		fputs ($fichier, "HS_UAMDOMAINS=\"");
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
			}	
55
		fputs ($fichier, "\"");
56
		fclose($fichier);
57
		unset($_POST['trusted_domains']);
58
		unset($nb_domain);
59
		$nb_url=0;
60
		$tab_urls = explode ("\n", $_POST['trusted_urls']);
61
		$fichier=fopen("/etc/chilli/alcasar-uamallowed","w+");
62
		fputs ($fichier, "HS_UAMALLOW=\"");
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
			}
71
		fputs ($fichier, "\"");
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']);
81
		$fichier=fopen("/etc/chilli/alcasar-macallowed","w+");
82
		fputs ($fichier, "HS_MACALLOW=\"");
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
			}
91
		fputs ($fichier, "\"");
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>";
120
				$trusted_domains_file="/etc/chilli/alcasar-uamdomain";
121
				$ouvre=fopen($trusted_domains_file,"r");
122
				if ($ouvre)
123
					{
124
					while (!feof ($ouvre))
125
						{
126
						$tampon = fgets($ouvre, 4096);
127
						$domains = substr($tampon,15,-1);
128
						$tab_domains = explode (",", $domains);
129
						foreach ($tab_domains as $domain ){
130
							if ($domain != "\"") echo $domain."\n";
131
							}
132
		  				}
133
					}
134
				else	{
135
					echo "failed to open $trusted_domains_file";
136
					}
137
				fclose($ouvre);
138
				echo "</textarea>";
139
			?>
140
		</td>
141
		<td  width=50% height=100% align=center>
142
			<H3><?php echo $l_trusted_urls_list ;?></H3>
143
			exemple1 : www.domain3.net/admin/index.htm<BR>
144
			exemple2 : domain4.org/~polux/index.html<BR>
145
			<?php
146
				echo "<textarea name='trusted_urls' rows=5 cols=40>";
147
				$trusted_urls_file="/etc/chilli/alcasar-uamallowed";
148
				$ouvre=fopen($trusted_urls_file,"r");
149
				if ($ouvre)
150
			       		{
151
					while (!feof ($ouvre))
152
						{
153
						$tampon = fgets($ouvre, 4096);
154
						$urls = substr($tampon,13,-1);
155
						$tab_urls = explode (",", $urls);
156
						foreach ($tab_urls as $url ){
157
							if ($url != "\"") echo $url."\n";
158
							}
159
						}
160
					}
161
				else	{
162
					echo "failed to open $trusted_urls_file";
163
					}
164
				fclose($ouvre);
165
				echo "</textarea>";
166
			?>
167
		</td></tr>
168
		</TABLE>
169
		<input type='hidden' name='choix' value='MAJ_UAMALLOWED'>
170
		<input type='submit' value='<?php echo $l_submit ;?>'>
171
		</FORM>
172
	</td></tr>
173
	</TABLE>
174
</TABLE>
175
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
176
	<tr><th><?php echo $l_trusted_mac ;?></th></tr>
177
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
178
</TABLE>
179
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
180
	<tr bgcolor="#666666"><td>
181
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
182
		<tr><td valign="middle" align="left">
183
		<center><?php
184
		echo "$l_trusted_mac_explain1 <BR>";
185
		echo "$l_trusted_mac_explain2";
186
		echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
187
		<TABLE cellspacing=2 cellpadding=3 border=1>
188
		<tr><td width=60% height=100% align=center>
189
			<H3><?php echo $l_trusted_mac_list ;?></H3>
190
			exemple : 12-2f-36-a4-df-43<BR>
191
			<?php
192
				echo "<textarea name='trusted_macs' rows=5 cols=40>";
193
				$trusted_macs_file="/etc/chilli/alcasar-macallowed";
194
				$ouvre=fopen($trusted_macs_file,"r");
195
				if ($ouvre)
196
					{
197
					while (!feof ($ouvre))
198
						{
199
						$tampon = fgets($ouvre, 4096);
200
						$macs = substr($tampon,13,-1);
201
						$tab_macs = explode (",", $macs);
202
						foreach ($tab_macs as $macs ){
203
							if ($macs != "\"") echo $macs."\n";
204
							}
205
		  				}
206
					}
207
				else	{
208
					echo "failed to open $trusted_macs_file";
209
					}
210
				fclose($ouvre);
211
				echo "</textarea>";
212
			?>
213
		</td></tr>
214
		</TABLE>
215
		<input type='hidden' name='choix' value='MAJ_MACALLOWED'>
216
		<input type='submit' value='<?php echo $l_submit ;?>'>
217
		</FORM>
218
	</td></tr>
219
</TABLE>
220
</BODY>
221
</HTML>