Subversion Repositories ALCASAR

Rev

Rev 1710 | Rev 1740 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1710 Rev 1733
Line 1... Line 1...
1
<?php
1
<?php
2
/* written by steweb57 & Rexy */
2
/* written by steweb57 & Rexy */
3
 
3
 
4
/********************
4
/********************
5
* CONF FILES EXIST  *
5
* TEST CONF FILES   *
6
*********************/
6
*********************/
7
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
7
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
8
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
8
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
9
$conf_files=array(CONF_FILE,ETHERS_FILE);
9
$conf_files=array(CONF_FILE,ETHERS_FILE);
10
foreach ($conf_files as $file){
10
foreach ($conf_files as $file){
Line 22... Line 22...
22
if($Language == 'fr'){
22
if($Language == 'fr'){
23
	$l_network_title	= "Configuration réseau";
23
	$l_network_title	= "Configuration réseau";
24
	$l_extif_legend		= " (Interface connectée à Internet)";
24
	$l_extif_legend		= " (Interface connectée à Internet)";
25
	$l_intif_legend		= " (Réseau de consultation)";
25
	$l_intif_legend		= " (Réseau de consultation)";
26
	$l_internet_legend	= "INTERNET";
26
	$l_internet_legend	= "INTERNET";
27
	$l_ip_adr			= "Adresse IP";
27
	$l_ip_adr		= "Adresse IP";
28
	$l_ip_mask			= "Masque";
28
	$l_ip_mask		= "Masque";
29
	$l_ip_router		= "Passerelle";
29
	$l_ip_router		= "Passerelle";
30
	$l_ip_public		= "Adresse IP publique";
30
	$l_ip_public		= "Adresse IP publique";
31
	$l_ip_dns1			= "DNS1";
31
	$l_ip_dns1		= "DNS1";
32
	$l_ip_dns2			= "DNS2";
32
	$l_ip_dns2		= "DNS2";
33
	$l_dhcp_title		= "Service DHCP";
33
	$l_dhcp_title		= "Service DHCP";
34
	$l_dhcp_state		= "Mode actuel";
34
	$l_dhcp_state		= "Mode actuel";
35
	$l_DHCP_on		= "actif";
35
	$l_DHCP_on		= "actif";
36
	$l_DHCP_off		= "inactif";
36
	$l_DHCP_off		= "inactif";
37
	$l_DHCP_off_explain	= "! Avant d'arrêter le serveur DHCP, vous devez renseigner les paramètres d'un serveur externe (cf. documentation).";
37
	$l_DHCP_off_explain	= "! Avant d'arrêter le serveur DHCP, vous devez renseigner les paramètres d'un serveur externe (cf. documentation).";
38
	$l_static_dhcp_title	= "Réservation d'adresses IP statiques";
38
	$l_static_dhcp_title	= "Réservation d'adresses IP statiques";
39
	$l_mac_address		= "Adresse MAC";
39
	$l_mac_address		= "Adresse MAC";
40
	$l_ip_address		= "Adresse IP";
40
	$l_ip_address		= "Adresse IP";
41
	$l_mac_del			= "Supprimer de la liste";
41
	$l_mac_del		= "Supprimer de la liste";
42
	$l_add_to_list		= "Ajouter";
42
	$l_add_to_list		= "Ajouter";
43
	$l_apply			= "Appliquer les changements";
43
	$l_apply		= "Appliquer les changements";
-
 
44
	$l_import_cert		= "Import de certificat";
-
 
45
	$l_private_key		= "Clé privée (.key) :";
-
 
46
	$l_certificate		= "Certificat (.crt) :";
-
 
47
	$l_server_chain		= "Server-chain (Si nécéssaire : .crt) :";
-
 
48
	$l_default_cert		= "Retourner aux certificat par défaut";
44
 
49
 
45
} else {
50
} else {
46
	$l_network_title	= "Network configuration";
51
	$l_network_title	= "Network configuration";
47
	$l_extif_legend		= " (Internet connected interface)";
52
	$l_extif_legend		= " (Internet connected interface)";
48
	$l_intif_legend		= " (Private network)";
53
	$l_intif_legend		= " (Private network)";
49
	$l_internet_legend	= "INTERNET";
54
	$l_internet_legend	= "INTERNET";
50
	$l_ip_adr			= "IP Address";
55
	$l_ip_adr		= "IP Address";
51
	$l_ip_mask			= "Mask";
56
	$l_ip_mask		= "Mask";
52
	$l_ip_router		= "Gateway";
57
	$l_ip_router		= "Gateway";
53
	$l_ip_public		= "Public IP address";
58
	$l_ip_public		= "Public IP address";
54
	$l_ip_dns1			= "DNS1 :";
59
	$l_ip_dns1		= "DNS1";
55
	$l_ip_dns2			= "DNS2";
60
	$l_ip_dns2		= "DNS2";
56
	$l_dhcp_title		= "DHCP service";
61
	$l_dhcp_title		= "DHCP service";
57
	$l_dhcp_state		= "Current mode";
62
	$l_dhcp_state		= "Current mode";
58
	$l_DHCP_on		= "enabled";
63
	$l_DHCP_on		= "enabled";
59
	$l_DHCP_off		= "disabled";
64
	$l_DHCP_off		= "disabled";
60
	$l_DHCP_off_explain	= "! Before disabling the DHCP server, you must write the extern DHCP parameters in the config file (see Documentation)";
65
	$l_DHCP_off_explain	= "! Before disabling the DHCP server, you must write the extern DHCP parameters in the config file (see Documentation)";
61
	$l_static_dhcp_title	= "Static IP addresses reservation";
66
	$l_static_dhcp_title	= "Static IP addresses reservation";
62
	$l_mac_address		= "MAC Address";
67
	$l_mac_address		= "MAC Address";
63
	$l_ip_address		= "IP Address";
68
	$l_ip_address		= "IP Address";
64
	$l_mac_del			= "Delete from list";
69
	$l_mac_del		= "Delete from list";
65
	$l_add_to_list		= "Add";
70
	$l_add_to_list		= "Add";
66
	$l_apply			= "Apply changes";
71
	$l_apply		= "Apply changes";
-
 
72
	$l_import_cert		= "Certificate import";
-
 
73
	$l_private_key		= "Private key (.key) :";
-
 
74
	$l_certificate		= "Certificate (.crt) :";
-
 
75
	$l_server_chain		= "Server-chain (If necessary : .crt) :";
-
 
76
	$l_default_cert		= "Back to default certificate";
67
}
77
}
68
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
78
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
69
switch ($choix)
79
switch ($choix)
70
{
80
{
71
case 'DHCP_On' :
81
case 'DHCP_On' :
Line 95... Line 105...
95
					$insert="False";
105
					$insert="False";
96
					break;
106
					break;
97
					}
107
					}
98
				}
108
				}
99
			}
109
			}
100
		if ($insert == "True") 
110
		if ($insert == "True")
101
			{
111
			{
102
			$line = trim($_POST['add_mac']) . " " . trim($_POST['add_ip']) . "\n";
112
			$line = trim($_POST['add_mac']) . " " . trim($_POST['add_ip']) . "\n";
103
			$pointeur=fopen(ETHERS_FILE,"a");
113
			$pointeur=fopen(ETHERS_FILE,"a");
104
			fwrite ($pointeur, $line);
114
			fwrite ($pointeur, $line);
105
			fclose ($pointeur);
115
			fclose ($pointeur);
Line 137... Line 147...
137
function internetTest(){
147
function internetTest(){
138
	$host = "www.google.fr"; # Google Test
148
	$host = "www.google.fr"; # Google Test
139
	$port = "80";
149
	$port = "80";
140
	//var $num;	//not used
150
	//var $num;	//not used
141
	//var $error;	//not used
151
	//var $error;	//not used
142
	
152
 
143
	if (! $sock = @fsockopen($host, $port, $num, $error, 5)) {
153
	if (! $sock = @fsockopen($host, $port, $num, $error, 5)) {
144
		return false;
154
		return false;
145
	} else {
155
	} else {
146
		fclose($sock);
156
		fclose($sock);
147
		return true;
157
		return true;
Line 252... Line 262...
252
else { echo "</TABLE>"; }
262
else { echo "</TABLE>"; }
253
$maxsize=100000;
263
$maxsize=100000;
254
?>
264
?>
255
 
265
 
256
<table width="100%" border="0" cellspacing="0" cellpadding="0">
266
<table width="100%" border="0" cellspacing="0" cellpadding="0">
257
	<tr><th>Import de certificat</th></tr>
267
	<tr><th><?php echo $l_import_cert;?></th></tr>
258
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
268
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
259
</table>
269
</table>
260
<table width="100%" border="1" cellspacing="0" cellpadding="0">
270
<table width="100%" border="1" cellspacing="0" cellpadding="0">
261
	<tr><td>
271
	<tr><td>
262
	<form method="post" action="network.php" enctype="multipart/form-data">
272
	<form method="post" action="network.php" enctype="multipart/form-data">
263
	Clé privée (.key): <input type="file" name="key"/><br/>
273
	<?php echo $l_private_key;?><input type="file" name="key"/><br/>
264
	Certificat (.crt):<input type="file" name="crt"/><br/>
274
	<?php echo $l_certificate;?><input type="file" name="crt"/><br/>
265
	Server-chain (Recommandé : .crt):<input type="file" name="sc"/>
275
	<?php echo $l_server_chain;?><input type="file" name="sc"/>
266
	<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxsize ?>" /><br/>
276
	<input type="hidden" name="MAX_FILE_SIZE" value=<?php echo $maxsize;?> /><br/>
267
	<input type="submit" value="Valider"/>
277
	<input type="submit" value="Valider"/>
268
	</form>
278
	</form>
269
	</td><td>
279
	</td><td>
270
	<form method="post" action="network.php">
280
	<form method="post" action="network.php">
271
	<input type="hidden" name="default"/>
281
	<input type="hidden" name="default"/>
272
	<input type="submit" value="Retourner aux certificats par défaut"/>
282
	<input type="submit" <?php echo "value=\"".$l_default_cert."\""?>/>
273
	</form>
283
	</form>
274
	</td>
284
	</td>
275
	</tr>
285
	</tr>
276
</table>
286
</table>
277
 
287
 
Line 279... Line 289...
279
</html>
289
</html>
280
 
290
 
281
<?php
291
<?php
282
if(isset($_POST['default'])){
292
if(isset($_POST['default'])){
283
	echo "Retour au certificats par défaut";
293
	echo "Retour au certificats par défaut";
284
	exec("sudo alcasar-defaultcert.sh");
294
	exec("sudo alcasar-importcert.sh -d");
285
}
295
}
286
if(isset($_POST['MAX_FILE_SIZE'])){
296
if(isset($_POST['MAX_FILE_SIZE'])){
287
	echo "changement";
297
	echo "changement";
288
	$maxsize = 100000;
298
	$maxsize = 100000;
289
	if(isset($_FILES['key']) && isset($_FILES['crt']) && $_FILES['key']['error'] == 0 && $_FILES['crt']['error'] == 0){
299
	if(isset($_FILES['key']) && isset($_FILES['crt']) && $_FILES['key']['error'] == 0 && $_FILES['crt']['error'] == 0){
Line 306... Line 316...
306
			}
316
			}
307
		}
317
		}
308
	}
318
	}
309
}
319
}
310
?>
320
?>
311
 
-