Subversion Repositories ALCASAR

Rev

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

Rev Author Line No. Line
318 richard 1
<?php
2304 tom.houday 2
# $Id: network.php 2558 2018-06-05 21:56:34Z rexy $
3
 
2316 tom.houday 4
// written by steweb57, Rexy & Tom HOUDAYER
318 richard 5
 
861 richard 6
/********************
2316 tom.houday 7
*  READ CONF FILES  *
861 richard 8
*********************/
2316 tom.houday 9
define('CONF_FILE', '/usr/local/etc/alcasar.conf');
10
define('ETHERS_FILE', '/usr/local/etc/alcasar-ethers');
11
define('ETHERS_INFO_FILE', '/usr/local/etc/alcasar-ethers-info');
2558 rexy 12
define('DNS_LOCAL_FILE', '/etc/hosts');
2304 tom.houday 13
define('LETS_ENCRYPT_FILE', '/usr/local/etc/alcasar-letsencrypt');
2316 tom.houday 14
$conf_files = [CONF_FILE, ETHERS_FILE, ETHERS_INFO_FILE, DNS_LOCAL_FILE, LETS_ENCRYPT_FILE];
15
 
16
// Files reading test
17
foreach ($conf_files as $file) {
18
	if (!file_exists($file)) {
19
		exit("Requested file $file isn't present");
20
	}
21
	if (!is_readable($file)) {
22
		exit("Can't read the file $file");
23
	}
841 richard 24
}
2316 tom.houday 25
 
26
// Read ALCASAR CONF_FILE
27
$file_conf = fopen(CONF_FILE, 'r');
28
if (!$file_conf) {
29
	exit('Error opening the file '.CONF_FILE);
30
}
31
while (!feof($file_conf)) {
32
	$buffer = fgets($file_conf, 4096);
33
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
2450 tom.houday 34
		$tmp = explode('=', $buffer, 2);
2316 tom.houday 35
		$conf[trim($tmp[0])] = trim($tmp[1]);
36
	}
37
}
38
fclose($file_conf);
39
 
40
// Choice of language
318 richard 41
$Language = 'en';
2316 tom.houday 42
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
43
	$Langue	  = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
44
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
45
}
46
if ($Language === 'fr') {	// French
318 richard 47
	$l_network_title	= "Configuration réseau";
48
	$l_internet_legend	= "INTERNET";
1733 richard 49
	$l_ip_mask		= "Masque";
318 richard 50
	$l_ip_router		= "Passerelle";
736 franck 51
	$l_ip_public		= "Adresse IP publique";
2316 tom.houday 52
	$l_ip_dns1		= "DNS n°1";
53
	$l_ip_dns2		= "DNS n°2";
861 richard 54
	$l_dhcp_title		= "Service DHCP";
862 richard 55
	$l_dhcp_state		= "Mode actuel";
1484 richard 56
	$l_DHCP_on		= "actif";
57
	$l_DHCP_off		= "inactif";
2304 tom.houday 58
	$l_DHCP_off_explain	= "/!\\ Avant d'arrêter le serveur DHCP, vous devez renseigner les paramètres d'un serveur externe (cf. documentation).";
841 richard 59
	$l_static_dhcp_title	= "Réservation d'adresses IP statiques";
60
	$l_mac_address		= "Adresse MAC";
61
	$l_ip_address		= "Adresse IP";
1959 richard 62
	$l_host_name		= "Nom d'hôte";
63
	$l_del			= "Supprimer de la liste";
841 richard 64
	$l_add_to_list		= "Ajouter";
1733 richard 65
	$l_apply		= "Appliquer les changements";
1959 richard 66
	$l_local_dns		= "Résolution local de nom";
1733 richard 67
	$l_import_cert		= "Import de certificat";
68
	$l_private_key		= "Clé privée (.key) :";
69
	$l_certificate		= "Certificat (.crt) :";
1740 richard 70
	$l_server_chain		= "Chaîne de certification (si nécéssaire : .crt) :";
71
	$l_default_cert		= "Revenir au certificat d'origine";
72
	$l_import		= "Importer";
1743 clement.si 73
	$l_current_certificate  = "Certificat actuel";
74
	$l_validated		= "Validé par :";
2316 tom.houday 75
	$l_empty		= "Vide";
2326 tom.houday 76
	$l_yes			= "Oui";
77
	$l_no			= "Non";
78
	$l_allow_unsecured_login	= "Autoriser les utilisateurs à se connecter de manière non sécurisée (HTTP) :";
79
	$l_unsecured_login_warning	= "/!\\ Les identifiants de connexion seront envoyés en clair.";
80
	$l_cert_expiration	= "Date d'expiration :";
2380 tom.houday 81
	$l_cert_commonname	= "Nom commun :";
82
	$l_cert_organization	= "Organisation :";
2326 tom.houday 83
	$l_upload_certificate	= "Importer un certificat";
84
	$l_le_integration	= "Intégration Let's Encrypt";
85
	$l_le_status		= "Status :";
86
	$l_disabled		= "Inactif";
87
	$l_pending_validation	= "En attente de validation";
88
	$l_enabled		= "Actif";
89
	$l_le_email		= "Email :";
90
	$l_le_domain_name	= "Nom de domaine :";
91
	$l_send			= "Envoyer";
92
	$l_le_ask_on		= "Demandé le :";
93
	$l_le_dns_entry_txt	= "Entrée DNS TXT :";
94
	$l_le_challenge		= "Challenge :";
95
	$l_recheck		= "Revérifier";
96
	$l_cancel		= "Annuler";
97
	$l_le_api		= "API :";
98
	$l_le_next_renewal	= "Prochain renouvellement :";
99
	$l_renew		= "Renouveller";
100
	$l_renew_force		= "Renouveller (forcer)";
2316 tom.houday 101
} else {			// English
318 richard 102
	$l_network_title	= "Network configuration";
103
	$l_internet_legend	= "INTERNET";
1733 richard 104
	$l_ip_mask		= "Mask";
841 richard 105
	$l_ip_router		= "Gateway";
318 richard 106
	$l_ip_public		= "Public IP address";
2316 tom.houday 107
	$l_ip_dns1		= "DNS n°1";
108
	$l_ip_dns2		= "DNS n°2";
861 richard 109
	$l_dhcp_title		= "DHCP service";
862 richard 110
	$l_dhcp_state		= "Current mode";
1484 richard 111
	$l_DHCP_on		= "enabled";
112
	$l_DHCP_off		= "disabled";
2304 tom.houday 113
	$l_DHCP_off_explain	= "/!\\ Before disabling the DHCP server, you must write the extern DHCP parameters in the config file (see Documentation)";
841 richard 114
	$l_static_dhcp_title	= "Static IP addresses reservation";
115
	$l_mac_address		= "MAC Address";
116
	$l_ip_address		= "IP Address";
1959 richard 117
	$l_host_name		= "Host name";
118
	$l_del			= "Delete from list";
841 richard 119
	$l_add_to_list		= "Add";
1733 richard 120
	$l_apply		= "Apply changes";
1959 richard 121
	$l_local_dns		= "Local name resolution";
1733 richard 122
	$l_import_cert		= "Certificate import";
123
	$l_private_key		= "Private key (.key) :";
124
	$l_certificate		= "Certificate (.crt) :";
1740 richard 125
	$l_server_chain		= "Server-chain (if necessary : .crt) :";
1733 richard 126
	$l_default_cert		= "Back to default certificate";
1740 richard 127
	$l_import		= "Import";
1743 clement.si 128
	$l_current_certificate  = "Current certificate";
129
	$l_validated		= "Validated by :";
2316 tom.houday 130
	$l_empty		= "Empty";
2326 tom.houday 131
	$l_yes			= "Yes";
132
	$l_no			= "No";
133
	$l_allow_unsecured_login	= "Allow users to login with insecure connection (HTTP):";
134
	$l_unsecured_login_warning	= "/!\\ Credentials will be sent in plain text.";
135
	$l_cert_expiration	= "Expiration date:";
136
	$l_cert_commonname	= "Common name:";
137
	$l_cert_organization	= "Organization:";
138
	$l_upload_certificate	= "Importer un certificat";
139
	$l_le_integration	= "Let's Encrypt integration";
140
	$l_le_status		= "Status:";
141
	$l_disabled		= "Disabled";
142
	$l_pending_validation	= "Pending validation";
143
	$l_enabled		= "Enabled";
144
	$l_le_email		= "Email:";
145
	$l_le_domain_name	= "Domain name:";
146
	$l_send			= "Send";
147
	$l_le_ask_on		= "Ask on:";
148
	$l_le_dns_entry_txt	= "DNS TXT entry:";
149
	$l_le_challenge		= "Challenge:";
150
	$l_recheck		= "Recheck";
151
	$l_cancel		= "Cancel";
152
	$l_le_api		= "API:";
153
	$l_le_next_renewal	= "Next renewal:";
154
	$l_renew		= "Renew";
155
	$l_renew_force		= "Renew (force)";
318 richard 156
}
2316 tom.houday 157
 
158
$reg_ip      = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
159
$reg_ip_cidr = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/';
2380 tom.houday 160
$reg_mac     = '/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/';
161
$reg_host    = '/^[a-zA-Z0-9-_]+$/';
2316 tom.houday 162
 
163
$choix = (isset($_POST['choix'])) ? $_POST['choix'] : '';
164
 
165
switch ($choix) {
166
	case 'DHCP_On':
167
		exec('sudo /usr/local/bin/alcasar-dhcp.sh -on');
168
		break;
169
	case 'DHCP_Off':
170
		exec('sudo /usr/local/bin/alcasar-dhcp.sh -off');
171
		break;
172
 
173
	case 'new_mac':
2380 tom.houday 174
		$new_mac_addr = trim($_POST['add_mac']);
175
		$new_ip_addr  = trim($_POST['add_ip']);
176
		if (((!empty($new_mac_addr)) && (preg_match($reg_mac, $new_mac_addr))) && ((!empty($new_ip_addr)) && (preg_match($reg_ip, $new_ip_addr)))) {
2316 tom.houday 177
			$tab = file(ETHERS_FILE);
178
			if ($tab) { // the file isn't empty
179
				$insert = true;
180
				foreach ($tab as $line) { // verify that MAC or IP address doesn't exist
181
					$field = explode(' ', $line);
182
					$mac_addr = trim($field[0]);
183
					$ip_addr  = trim($field[1]);
184
					if (strcasecmp($new_mac_addr, $mac_addr) === 0) {
185
						$insert = false;
186
						break;
841 richard 187
					}
2316 tom.houday 188
					if (strcasecmp($new_ip_addr, $ip_addr) === 0) {
189
						$insert = false;
190
						break;
841 richard 191
					}
192
				}
2316 tom.houday 193
				if ($insert) {
194
					$line = $new_mac_addr . ' ' . $new_ip_addr . "\n";
195
					$pointeur = fopen(ETHERS_FILE, 'a');
196
					fwrite($pointeur, $line);
197
					fclose($pointeur);
198
					$pointeur = fopen(ETHERS_INFO_FILE, 'a');
199
					$line = "$new_mac_addr $new_ip_addr #" . trim($_POST['info'],"\x00..\x20") . "\n";
200
					fwrite($pointeur, $line);
201
					fclose($pointeur);
202
					exec('sudo /usr/bin/systemctl reload chilli');
1959 richard 203
				}
841 richard 204
			}
1959 richard 205
		}
2316 tom.houday 206
		break;
207
	case 'del_mac':
208
		foreach ($_POST as $key => $value) {
209
			if ($value == 'on') {
210
				$ether_file = ETHERS_FILE;
211
				$ether_file_info = ETHERS_INFO_FILE;
212
				exec("/bin/sed -i ".escapeshellarg("/^$key/d")." $ether_file"); 
213
				exec("/bin/sed -i ".escapeshellarg("/^$key/d")." $ether_file_info"); 
214
				exec('sudo /usr/bin/systemctl reload chilli');
841 richard 215
			}
216
		}
2316 tom.houday 217
		break;
218
 
219
	case 'new_host':
2380 tom.houday 220
		$add_host = trim($_POST['add_host']);
221
		$add_ip   = trim($_POST['add_ip']);
222
		if (((!empty($add_host)) && (preg_match($reg_host, $add_host))) && ((!empty($add_ip)) && (preg_match($reg_ip, $add_ip)))) {
2316 tom.houday 223
			$tab = file(DNS_LOCAL_FILE);
224
			if ($tab) { // the file isn't empty
225
				$insert = true;
2558 rexy 226
				foreach ($tab as $line) { // verify that host or IP address doesn't already exist
227
					$field = explode('\t', $line);
228
					$host_name = trim($field[1]);
229
					$ip_addr   = trim($field[2]);
230
					if (strcasecmp($add_host, $host_name) === 0) {
231
						$insert = false;
232
						break;
841 richard 233
					}
2558 rexy 234
					if (strcmp($add_ip, $ip_addr) === 0) {
235
						$insert = false;
236
						break;
237
					}
238
			}
2316 tom.houday 239
				if ($insert) {
2558 rexy 240
					$line1 = $add_ip.'\t'.$add_host."\n";
2316 tom.houday 241
					$pointeur=fopen(DNS_LOCAL_FILE, 'a');
242
					fwrite($pointeur, $line1);
243
					fclose($pointeur);
244
					exec('sudo /usr/bin/systemctl restart dnsmasq');
245
					exec('sudo /usr/bin/systemctl restart dnsmasq-blacklist');
246
					exec('sudo /usr/bin/systemctl restart dnsmasq-whitelist');
1959 richard 247
				}
841 richard 248
			}
2380 tom.houday 249
		}
2316 tom.houday 250
		break;
251
	case 'del_host':
252
		foreach ($_POST as $key => $value) {
253
			if ($value == 'on') {
2380 tom.houday 254
				exec('/bin/sed -i '.escapeshellarg("\\@^address=/$key/@d;\\@^ptr-record=.*,$key\$@d").' '.DNS_LOCAL_FILE); 
2316 tom.houday 255
				exec('sudo /usr/bin/systemctl restart dnsmasq');
256
				exec('sudo /usr/bin/systemctl restart dnsmasq-blacklist');
257
				exec('sudo /usr/bin/systemctl restart dnsmasq-whitelist');
258
			}
841 richard 259
		}
2316 tom.houday 260
		break;
261
 
262
	case 'default_cert':	// Restore default certificate
263
		exec('sudo alcasar-importcert.sh -d');
264
		break;
265
 
266
	case 'import_cert':	// Import certificate
2479 tom.houday 267
		$maxsize = 100000;
2316 tom.houday 268
		if (isset($_FILES['key']) && isset($_FILES['crt']) && ($_FILES['key']['error'] == 0) && ($_FILES['crt']['error'] == 0)) {
269
			if ($_FILES['key']['size'] <= $maxsize && $_FILES['crt']['size'] <= $maxsize) {
2479 tom.houday 270
				if (pathinfo($_FILES['key']['name'])['extension'] == 'key' && ((pathinfo($_FILES['crt']['name'])['extension'] == 'crt') || (pathinfo($_FILES['crt']['name'])['extension'] == 'cer'))) {
2316 tom.houday 271
					$dest = '/tmp/';
2380 tom.houday 272
					$scpath = '';
2479 tom.houday 273
					if (isset($_FILES['sc']) && ((pathinfo($_FILES['sc']['name'])['extension'] == 'crt') || (pathinfo($_FILES['sc']['name'])['extension'] == 'cer'))) {
2316 tom.houday 274
						$scpath = $dest.'server-chain.crt';
275
						move_uploaded_file($_FILES['sc']['tmp_name'], $scpath);
276
					}
2380 tom.houday 277
					$keypath = $dest.'alcasar.key';
278
					$crtpath = $dest.'alcasar.crt';
2316 tom.houday 279
					move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
280
					move_uploaded_file($_FILES['crt']['tmp_name'], $crtpath);
281
					exec("sudo alcasar-importcert.sh -i $crtpath -k $keypath -c $scpath");
282
					if (file_exists($crtpath)) unlink($crtpath); 
283
					if (file_exists($keypath)) unlink($keypath); 
284
					if (file_exists($scpath))  unlink($scpath); 
285
				}
1959 richard 286
			}
287
		}
2316 tom.houday 288
		break;
2324 tom.houday 289
 
290
	case 'https_login':	// Set HTTPS login status
291
		if ($_POST['https_login'] === 'on') {
292
			exec('sudo /usr/local/bin/alcasar-https.sh --on');
293
		} else {
294
			exec('sudo /usr/local/bin/alcasar-https.sh --off');
295
		}
296
		header('Location: '.$_SERVER['PHP_SELF']);
297
		exit();
318 richard 298
}
299
 
2316 tom.houday 300
// Network changes
301
if ($choix === 'network_change') {
302
	$network_modification = false;
1733 richard 303
 
2316 tom.houday 304
	if (isset($_POST['dns1']) && (trim($_POST['dns1']) !== $conf['DNS1']) && preg_match($reg_ip, $_POST['dns1'])) {
305
		file_put_contents(CONF_FILE, str_replace('DNS1='.$conf['DNS1'], 'DNS1='.trim($_POST['dns1']), file_get_contents(CONF_FILE)));
306
		$network_modification = true;
318 richard 307
	}
2316 tom.houday 308
	if (isset($_POST['dns2']) && (trim($_POST['dns2']) !== $conf['DNS2']) && preg_match($reg_ip, $_POST['dns2'])) {
309
		file_put_contents(CONF_FILE, str_replace('DNS2='.$conf['DNS2'], 'DNS2='.trim($_POST['dns2']), file_get_contents(CONF_FILE)));
310
		$network_modification = true;
318 richard 311
	}
2316 tom.houday 312
	if (isset($_POST['ip_public']) && (trim($_POST['ip_public']) !== $conf['PUBLIC_IP']) && preg_match($reg_ip_cidr, $_POST['ip_public'])) {
313
		file_put_contents(CONF_FILE, str_replace('PUBLIC_IP='.$conf['PUBLIC_IP'], 'PUBLIC_IP='.trim($_POST['ip_public']), file_get_contents(CONF_FILE)));
314
		$network_modification = true;
315
	}
316
	if (isset($_POST['ip_gw']) && (trim($_POST['ip_gw']) !== $conf['GW']) && preg_match($reg_ip, $_POST['ip_gw'])) {
317
		file_put_contents(CONF_FILE, str_replace('GW='.$conf['GW'], 'GW='.trim($_POST['ip_gw']), file_get_contents(CONF_FILE)));
318
		$network_modification = true;
319
	}
320
	if (isset($_POST['ip_private']) && (trim($_POST['ip_private']) !== $conf['PRIVATE_IP']) && preg_match($reg_ip_cidr, $_POST['ip_private'])) {
321
		file_put_contents(CONF_FILE, str_replace('PRIVATE_IP='.$conf['PRIVATE_IP'], 'PRIVATE_IP='.trim($_POST['ip_private']), file_get_contents(CONF_FILE)));
322
		$network_modification = true;
323
	}
324
 
325
	if ($network_modification) {
326
		exec('sudo /usr/local/bin/alcasar-conf.sh -apply');
327
	}
328
 
329
	// Read CONF_FILE updated
330
	$file_conf = fopen(CONF_FILE, 'r');
331
	if (!$file_conf) {
332
		exit('Error opening the file '.CONF_FILE);
333
	}
334
	while (!feof($file_conf)) {
335
		$buffer = fgets($file_conf, 4096);
336
		if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
2450 tom.houday 337
			$tmp = explode('=', $buffer, 2);
2316 tom.houday 338
			$conf[trim($tmp[0])] = trim($tmp[1]);
339
		}
340
	}
341
	fclose($file_conf);
318 richard 342
}
2316 tom.houday 343
 
344
// Let's Encrypt actions
345
if ($choix === 'le_issueCert') {
346
	// TODO: check ndd & mail format
347
 
348
	$email      = $_POST['email'];
349
	$domainName = $_POST['domainname'];
350
 
351
	exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --issue --email '.escapeshellarg($email).' --domain '.escapeshellarg($domainName), $output, $exitCode);
1822 raphael.pi 352
 
2316 tom.houday 353
	$cmdResponse = implode("<br>\n", $output);
1822 raphael.pi 354
}
2316 tom.houday 355
if ($choix === 'le_renewCert') {
356
	if ((isset($_POST['recheck'])) && ((!empty($_POST['recheck'])) || (!empty($_POST['recheck_force'])))) {
357
		$forceOpt = (!empty($_POST['recheck_force'])) ? ' --force' : '';
318 richard 358
 
2316 tom.houday 359
		exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --renew' . $forceOpt, $output, $exitCode);
1822 raphael.pi 360
 
2316 tom.houday 361
		$cmdResponse = implode("<br>\n", $output);
362
	} else if ((isset($_POST['cancel'])) && (!empty($_POST['cancel']))) {
363
		file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/challenge=.*/','challenge=', file_get_contents(LETS_ENCRYPT_FILE)));
364
		file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/domainRequest=.*/','domainRequest=', file_get_contents(LETS_ENCRYPT_FILE)));
365
	}
1822 raphael.pi 366
}
367
 
368
 
2316 tom.houday 369
// Read Let's Encrypt configuration file
370
$file_conf_LE = fopen(LETS_ENCRYPT_FILE, 'r');
371
if (!$file_conf_LE) {
372
	exit('Error opening the file '.LETS_ENCRYPT_FILE);
2299 tom.houday 373
}
2316 tom.houday 374
while (!feof($file_conf_LE)) {
375
	$buffer = fgets($file_conf_LE, 4096);
2299 tom.houday 376
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
2450 tom.houday 377
		$tmp = explode('=', $buffer, 2);
2316 tom.houday 378
		$LE_conf[trim($tmp[0])] = trim($tmp[1]);
1822 raphael.pi 379
	}
380
}
2316 tom.houday 381
fclose($file_conf_LE);
382
 
383
 
384
// Fonction de test de connectivité internet
385
function internetTest() {
386
	$host = 'www.google.fr'; # Google Test
387
	$port = '80';
388
 
389
	if (! $sock = @fsockopen($host, $port, $num, $error, 5)) {
390
		return false;
391
	} else {
392
		fclose($sock);
393
		return true;
394
	}
395
}
396
 
397
$internet_connected = InternetTest();
398
if ($internet_connected) {
2404 tom.houday 399
	$ch = curl_init('https://api.ipify.org/');
400
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
401
	$internet_publicIP = curl_exec($ch);
402
	curl_close($ch);
2316 tom.houday 403
} else {
404
	$internet_publicIP = '-.-.-.-';
405
}
406
 
407
 
408
// Network interfaces
409
$interfacesIgnored = ['lo', 'tun[0-9]*', $conf['EXTIF'], $conf['INTIF']];
410
exec("ip -o link show | awk -F': ' '{print $2}' | sed '/^" . implode('\\|', $interfacesIgnored) . "$/d'", $interfacesAvailable);
411
 
412
// TODO: Pending the next version
413
$externalNetworks = [
414
	(object) [
415
		'interface' => $conf['EXTIF'],
416
		'ip'        => $conf['PUBLIC_IP'],
417
		'gateway'   => $conf['GW']
418
	]
419
];
420
$internalNetworks = [
421
	(object) [
422
		'interface' => $conf['INTIF'],
423
		'ip'        => $conf['PRIVATE_IP']
424
	]
425
];
426
 
1740 richard 427
?>
428
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2316 tom.houday 429
<html>
318 richard 430
<head>
2316 tom.houday 431
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
432
	<title><?= $l_network_title ?></title>
433
	<link rel="stylesheet" href="/css/style.css" type="text/css">
434
	<link rel="stylesheet" href="/css/acc.css" type="text/css">
435
	<script src="/js/jquery.min.js"></script>
436
	<script src="/js/jquery.connections.js"></script>
437
	<script type="text/javascript">
438
	function MAC_Control(formulaire){
439
		// MAC control (upper case and '-' separator)
440
		var regex_mac = /^([0-9a-fA-F]{2}(-|:)){5}[0-9a-fA-F]{2}$/;
441
		if (regex_mac.test(document.forms[formulaire].add_mac.value)){
442
			document.forms[formulaire].add_mac.value = document.forms[formulaire].add_mac.value.toUpperCase().replace(/:/g, '-');
443
			return true;
444
		} else {
445
			alert('Invalid MAC address');
446
			return false;
447
		}
1578 richard 448
	}
2316 tom.houday 449
	</script>
450
	<style>
451
	.network-configurator {
452
		width: 100%;
453
	}
454
	.network-configurator > * {
455
		display: inline-block;
456
		vertical-align: top;
457
		text-align: center;
458
	}
459
	.network-configurator > .internet, .network-configurator > .alcasar {
460
		width: 20%;
461
	}
462
	.network-configurator > .externals, .network-configurator > .internals {
463
		width: 30%;
464
	}
465
	.network-configurator .actions {
466
		position: absolute;
467
		background-color: #ddd;
468
		padding: 0 2px;
469
	}
470
	.network-configurator .actions a {
471
		text-decoration: none;
472
	}
473
	.network-configurator .actions a:hover {
474
		font-weight: bold;
475
	}
476
	.network-configurator > .alcasar .actions-externals {
477
		bottom: 0;
478
		left: 0;
479
		border-radius: 0 5px;
480
	}
481
	.network-configurator > .alcasar .actions-internals {
482
		bottom: 0;
483
		right: 0;
484
		border-radius: 5px 0;
485
	}
486
	.network-configurator .actions-network {
487
		top: 0;
488
		right: 0;
489
		border-radius: 0 5px;
490
	}
491
	.network-configurator .network-box {
492
		display: inline-block;
493
		min-height: 100px;
494
		margin: 5px;
495
		padding: 3px;
496
		text-align: left;
497
		background-color: #f7f3ef;
498
		position: relative;
499
		border-radius: 5px;
500
		border: 2px solid grey;
501
	}
502
	.network-configurator .network-connector {
503
		display: inline-block;
504
		position: absolute;
505
		top: 50%;
506
		margin-top: -5px;
507
		margin-left: -5px;
508
		width: 10px;
509
		height: 10px;
510
		border-radius: 5px;
511
		background-color: black;
512
	}
513
	.network-configurator .network-connector[data-connector-direction="left"] {
514
		border-radius: 5px 0px 0px 5px;
515
	}
516
	.network-configurator .network-connector[data-connector-direction="right"] {
517
		border-radius: 0px 5px 5px 0px;
518
	}
519
	.network-configurator div[data-network-type] {
520
		position: relative;
521
	}
522
	</style>
523
	<script>
524
	$(document).ready(function () {
525
		const interfacesAvailable = <?= ((!empty($interfacesAvailable)) ? "['".implode("', '", $interfacesAvailable)."']" : '[]') ?>;
526
 
527
		const wireStyles = {
528
			available: { border: '5px double green' }
2325 tom.houday 529
		};
2316 tom.houday 530
 
531
		// Add external network
532
		$('.network-configurator .add-external-network').click(function (event) {
533
			event.preventDefault();
534
			let options = '';
535
			if (interfacesAvailable.length === 0) {
536
				options = '<option value=""></option>';
537
			} else {
538
				for (let i = 0; i < interfacesAvailable.length; i++) {
539
					options += '<option value="' + interfacesAvailable[i] + '">' + interfacesAvailable[i] + '</option>';
540
				}
541
			}
542
			$('.network-configurator .externals').append(' \
543
				<div data-network-type="external"> \
544
					<div class="network-connector" data-connector-network="internet" data-connector-direction="left"></div> \
545
					<div class="network-box"> \
546
						<div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> \
547
						<label for="ext_interface_X"><?= 'Interface' ?></label> <select name="interface" id="ext_interface_X">' + options + '</select><br> \
548
						<label for="ext_ip_X"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_public" id="ext_ip_X" value="" /><br> \
549
						<label for="ext_gateway_X"><?= $l_ip_router ?></label> <input style="width:120px" type="text" name="ip_gw" id="ext_gateway_X" value="" /> \
550
					</div> \
551
					<div class="network-connector" data-connector-network="external" data-connector-direction="right"></div> \
552
				</div>');
553
			addWire($('div[data-network-type="external"]:last'));
554
		});
555
 
556
		// Add internal network
557
		$('.network-configurator .add-internal-network').click(function (event) {
558
			event.preventDefault();
559
			$('.network-configurator .internals').append(' \
560
					<div data-network-type="internal"> \
561
						<div class="network-connector" data-connector-network="internal" data-connector-direction="left"></div> \
562
						<div class="network-box"> \
563
							<div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> \
564
							<label for="int_interface_X"><?= 'Interface' ?></label> <select name="interface" id="int_interface_X" disabled><option value=""></option></select><br> \
565
							<label for="int_ip_X"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_private" id="int_ip_X" value="" /><br> \
566
						</div> \
567
					</div>');
568
			addWire($('div[data-network-type="internal"]:last'));
569
		});
570
 
571
		// Remove network
572
		$('.network-configurator').on('click', '.remove-network', function (event) {
573
			event.preventDefault();
574
			$(this).parent().parent().parent().fadeOut(200, function() {
575
				const networkType = $(this).data('networkType');
576
				$(this).remove();
577
 
578
				// Update wires
579
				if (networkType === 'external') {
580
					$('div[data-network-type="internet"]>div.network-connector[data-connector-network="internet"]').connections('update');
581
					$('div[data-network-type="alcasar"]>div.network-connector[data-connector-network="external"]').connections('update');
582
				} else if (networkType === 'internal') {
583
					$('div[data-network-type="alcasar"]>div.network-connector[data-connector-network="internal"]').connections('update');
584
				}
585
			});
586
		});
587
 
588
		const addWire = function (network) {
589
			const networkType = network.data('networkType');
590
			if (networkType === 'external') {
591
				$().connections({ from: 'div[data-network-type="internet"]>div.network-connector[data-connector-network="internet"]', to: 'div[data-network-type="external"]>div.network-connector[data-connector-network="internet"]:last', css: wireStyles.available, within: 'div[data-network-type="external"]:last' });
592
				$().connections({ from: 'div[data-network-type="alcasar"]>div.network-connector[data-connector-network="external"]', to: 'div[data-network-type="external"]>div.network-connector[data-connector-network="external"]:last', css: wireStyles.available, within: 'div[data-network-type="external"]:last' });
593
			} else if (networkType === 'internal') {
594
				$().connections({ from: 'div[data-network-type="alcasar"]>div.network-connector[data-connector-network="internal"]', to: 'div[data-network-type="internal"]>div.network-connector[data-connector-network="internal"]:last', css: wireStyles.available, within: 'div[data-network-type="internal"]:last' });
595
			}
2325 tom.houday 596
		};
2316 tom.houday 597
 
2325 tom.houday 598
		window.addEventListener('resize', function () {
599
			$('div.network-connector[data-connector-network]').connections('update');
600
		});
601
 
2316 tom.houday 602
		// Add wires to existing networks
603
		$('div[data-network-type="external"]').add('div[data-network-type="internal"]').each(function (index, element) {
604
			addWire($(this));
2325 tom.houday 605
		});
2316 tom.houday 606
	});
607
	</script>
318 richard 608
</head>
609
<body>
2316 tom.houday 610
	<div class="panel">
611
		<div class="panel-header"><?= $l_network_title ?></div>
612
		<div class="panel-body">
613
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
614
				<div class="network-configurator">
615
					<div class="internet">
616
						<div data-network-type="internet">
617
							<div class="network-box">
618
								<?= $l_internet_legend ?> <img src="/images/state_<?= (($internet_connected) ? 'ok' : 'error') ?>.gif"><br>
619
								<?= $l_ip_public ?> : <?= $internet_publicIP ?><br>
620
								<label for="dns1"><?= $l_ip_dns1 ?></label> : <input style="width:120px" type="text" id="dns1" name="dns1" value="<?= $conf['DNS1'] ?>" /><br>
621
								<label for="dns2"><?= $l_ip_dns2 ?></label> : <input style="width:120px" type="text" id="dns2" name="dns2" value="<?= $conf['DNS2'] ?>" />
622
							</div>
623
							<div class="network-connector" data-connector-network="internet" data-connector-direction="right"></div>
624
						</div>
625
					</div><div class="externals">
626
						<?php foreach ($externalNetworks as $index => $network): ?>
627
							<div data-network-type="external">
628
								<div class="network-connector" data-connector-network="internet" data-connector-direction="left"></div>
629
								<div class="network-box">
630
									<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
631
									<label for="ext_interface_<?= $index ?>"><?= 'Interface' ?></label> <select name="ext_interface[<?= $index ?>]" id="ext_interface_<?= $index ?>" disabled><option value="<?= $network->interface ?>"><?= $network->interface ?></option></select><br>
632
									<label for="ext_ip_<?= $index ?>"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_public" id="ext_ip_<?= $index ?>" value="<?= $network->ip ?>" /><br>
633
									<label for="ext_gateway_<?= $index ?>"><?= $l_ip_router ?></label> <input style="width:120px" type="text" name="ip_gw" id="ext_gateway_<?= $index ?>" value="<?= $network->gateway ?>" />
634
								</div>
635
								<div class="network-connector" data-connector-network="external" data-connector-direction="right"></div>
636
							</div>
637
						<? endforeach; ?>
638
					</div><div class="alcasar">
639
						<div data-network-type="alcasar">
640
							<div class="network-connector" data-connector-network="external" data-connector-direction="left"></div>
641
							<div class="network-box">
642
								<!-- <div class="actions actions-externals">
643
									<div><a href="#" class="add-external-network" title="Ajouter un réseau externe">+</a></div>
644
								</div> -->
645
								<div class="alcasar-logo"><img src="/images/logo-alcasar.png" style="width: 100px;height: 100px;"></div>
646
								<!-- <div class="actions actions-internals">
647
									<div><a href="#" class="add-internal-network" title="Ajouter un réseau interne">+</a></div>
648
									<div><a href="#" class="add-internal-wifi-network">++</a></div>
649
								</div> -->
650
							</div>
651
							<div class="network-connector" data-connector-network="internal" data-connector-direction="right"></div>
652
						</div>
653
					</div><div class="internals">
654
						<?php foreach ($internalNetworks as $network): ?>
655
							<div data-network-type="internal">
656
								<div class="network-connector" data-connector-network="internal" data-connector-direction="left"></div>
657
								<div class="network-box">
658
									<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
659
									<label for="int_interface_<?= $index ?>"><?= 'Interface' ?></label> <select name="int_interface[<?= $index ?>]" id="int_interface_<?= $index ?>" disabled><option value="<?= $network->interface ?>"><?= $network->interface ?></option></select><br>
660
									<label for="int_ip_<?= $index ?>"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_private" id="int_ip_<?= $index ?>" value="<?= $network->ip ?>" /><br>
661
								</div>
662
							</div>
663
						<? endforeach; ?>
664
					</div>
665
				</div>
666
				<hr>
667
				<div style="text-align: center; margin: 5px">
668
					<input type="hidden" name="choix" value="network_change">
669
					<input type="submit" value="<?= $l_apply ?>">
670
				</div>
671
			</form>
672
		</div>
673
	</div>
674
	<br>
675
 
2304 tom.houday 676
<table width="100%" cellspacing="0" cellpadding="0" border="0">
2316 tom.houday 677
	<tr><th><?= $l_dhcp_title?></th></tr>
318 richard 678
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
679
</table>
2304 tom.houday 680
<table width="100%" cellspacing="0" cellpadding="5" border="1">
2316 tom.houday 681
	<tr><td colspan="2" valign="middle" align="left">
682
	<center><h3><?= $l_dhcp_state ?> : <?= ${'l_DHCP_'.$conf['DHCP']} ?></h3></center>
683
	<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
2324 tom.houday 684
		<select name="choix">
2316 tom.houday 685
			<option value="DHCP_Off"<?= ((!strcmp($conf['DHCP'], 'off')) ? ' selected' : '') ?>><?= $l_DHCP_off ?></option>
686
			<option value="DHCP_On"<?= ((!strcmp($conf['DHCP'], 'on')) ? ' selected' : '') ?>><?= $l_DHCP_on ?></option>
687
		</select>
688
		<input type="submit" value="<?= $l_apply ?>">
689
		<br><?= $l_DHCP_off_explain ?>
690
	</form>
691
	</td></tr>
692
 
1822 raphael.pi 693
	<?php
2316 tom.houday 694
	if ($conf['DHCP'] === 'on') {
695
		require('network2.php');
696
	}
1822 raphael.pi 697
	?>
318 richard 698
</table>
2316 tom.houday 699
<br>
2013 raphael.pi 700
 
2304 tom.houday 701
<table width="100%" cellspacing="0" cellpadding="0" border="0">
2316 tom.houday 702
	<tr><th><?= $l_local_dns?></th></tr>
1959 richard 703
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
704
</table>
2304 tom.houday 705
<table width="100%" cellspacing="0" cellpadding="5" border="1">
2316 tom.houday 706
<tr>
707
	<td width="50%" align="center">
708
		<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
709
		<table cellspacing="2" cellpadding="3" border="1">
710
		<tr><th><?= $l_host_name ?></th><th><?= $l_ip_address ?></th><th><?= $l_del ?></th></tr>
711
		<?php
712
		// Read the "dns_local" file
713
		$line_exist = false;
714
		$tab = file(DNS_LOCAL_FILE);
715
		if ($tab) { // not empty
716
			foreach ($tab as $line) {
717
				if (preg_match ('/^address/', $line)) {
718
					$line_exist = true;
719
					$field = explode('/', $line);
720
					$host_name = $field[1];
721
					$ip_addr   = $field[2];
722
					echo "<tr><td>$host_name</td>";
723
					echo "<td>$ip_addr</td>";
724
					echo "<td><input type=\"checkbox\" name=\"$host_name\"></td>";
725
					echo "</tr>";
726
				}
1959 richard 727
			}
728
		}
2316 tom.houday 729
		if (!$line_exist) {
730
			echo '<tr><td colspan="3" style="text-align: center;font-style: italic;">'.$l_empty.'</td></tr>';
731
		}
732
		?>
733
		</table>
734
		<?php if ($line_exist): ?>
735
			<input type="hidden" name="choix" value="del_host">
736
			<input type="submit" value="<?= $l_apply ?>">
737
		<?php endif; ?>
738
		</form>
739
	</td>
740
	<td width="50%" valign="middle" align="center">
741
		<form name="new_host" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
742
		<table cellspacing="2" cellpadding="3" border="1">
743
		<tr>
744
			<th><?= $l_host_name ?></th><th><?= $l_ip_address ?></th><td></td>
745
		</tr>
746
		<tr>
747
			<td>Ex. : my_nas</td><td>Ex. : 192.168.182.10</td><td></td>
748
		</tr>
749
		<tr>
750
			<td><input type="text" name="add_host" size="17"></td>
751
			<td><input type="text" name="add_ip" size="10"><input type="hidden" name="choix" value="new_host"></td>
752
			<td><input type=submit class=button value="<?= $l_add_to_list ?>"></td>
753
		</tr>
754
		</table>
755
		</form>
756
	</td>
757
</tr>
1959 richard 758
</table>
2316 tom.houday 759
<br>
760
 
2304 tom.houday 761
<table width="100%" cellspacing="0" cellpadding="0" border="0">
2316 tom.houday 762
	<tr><th><?= $l_import_cert ?></th></tr>
1710 richard 763
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
764
</table>
2304 tom.houday 765
<table width="100%" cellspacing="0" cellpadding="5" border="1">
766
	<tr>
2324 tom.houday 767
		<td width="50%" valign="top">
768
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
769
				<input type="hidden" name="choix" value="https_login">
2326 tom.houday 770
				<span><?= $l_allow_unsecured_login ?></span><br>
2324 tom.houday 771
				<select name="https_login">
2326 tom.houday 772
					<option value="on"<?=  (($conf['HTTPS_LOGIN'] === 'on')  ? ' selected' : '') ?>><?= $l_no ?></option>
773
					<option value="off"<?= (($conf['HTTPS_LOGIN'] === 'off') ? ' selected' : '') ?>><?= $l_yes ?></option>
2324 tom.houday 774
				</select>
775
				<input type="submit" value="<?= $l_apply ?>"><br>
2326 tom.houday 776
				<span><?= $l_unsecured_login_warning ?></span>
2297 tom.houday 777
			</form>
2324 tom.houday 778
			<br>
779
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
780
				<input type="hidden" name="choix" value="default_cert">
781
				<input type="submit" value="<?= $l_default_cert ?>" <?= (!file_exists('/etc/pki/tls/certs/alcasar.crt.old') || !file_exists('/etc/pki/tls/private/alcasar.key.old')) ? ' disabled' : '' ?>>
782
			</form>
783
		</td>
784
		<td width="50%" valign="top">
2297 tom.houday 785
			<?php
786
			$certificateInfos = openssl_x509_parse(file_get_contents('/etc/pki/tls/certs/alcasar.crt'));
787
 
788
			$cert_expiration_date = date('d-m-Y H:i:s', $certificateInfos['validTo_time_t']);
789
			$domain               = $certificateInfos['subject']['CN'];
790
			$organization         = (isset($certificateInfos['subject']['O'])) ? $certificateInfos['subject']['O'] : '';
791
			$CAdomain             = $certificateInfos['issuer']['CN'];
792
			$CAorganization       = (isset($certificateInfos['issuer']['O'])) ? $certificateInfos['issuer']['O'] : '';
793
			?>
794
			<h3><?= $l_current_certificate ?></h3>
2326 tom.houday 795
			<?= $l_cert_expiration ?> <?= $cert_expiration_date ?><br>
796
			<?= $l_cert_commonname ?> <?= $domain ?><br>
797
			<?= $l_cert_organization ?> <?= $organization ?><br/>
2297 tom.houday 798
			<h4><?=  $l_validated ?></h4>
2326 tom.houday 799
			<?= $l_cert_commonname ?> <?= $CAdomain ?><br>
800
			<?= $l_cert_organization ?> <?= $CAorganization ?><br>
2324 tom.houday 801
		</td>
802
	</tr>
803
	<tr>
804
		<td width="50%" valign="top">
2326 tom.houday 805
			<h3><?= $l_upload_certificate ?></h3>
2324 tom.houday 806
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
807
				<?= $l_private_key;?> <input type="file" name="key"><br>
808
				<?= $l_certificate;?> <input type="file" name="crt"><br>
809
				<?= $l_server_chain;?> <input type="file" name="sc"><br>
810
				<input type="hidden" name="choix" value="import_cert">
811
				<input type="submit" value="<?= $l_import ?>">
2297 tom.houday 812
			</form>
813
		</td>
2304 tom.houday 814
		<td width="50%" valign="top">
815
			<?php
816
			// Get step
817
			if (empty($LE_conf['domainRequest'])) {
818
				$step = 1;
819
			} else if (!empty($LE_conf['challenge'])) {
820
				$step = 2;
821
			} else if (($domain === $LE_conf['domainRequest']) && (empty($LE_conf['challenge']))) {
822
				$step = 3;
823
			} else {
824
				$step = 1;
825
			}
826
			?>
2326 tom.houday 827
			<h3><?= $l_le_integration ?></h3>
2324 tom.houday 828
			<?php if ($step === 1): ?>
2316 tom.houday 829
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
830
					<input type="hidden" name="choix" value="le_issueCert">
2326 tom.houday 831
					<?= $l_le_status ?> <?= $l_disabled ?><br>
832
					<?= $l_le_email ?> <input type="text" name="email" placeholder="adresse@email.com"<?= ((!empty($LE_conf['email'])) ? ' value="'.$LE_conf['email'].'"' : '') ?>><br>
833
					<?= $l_le_domain_name ?> <input type="text" name="domainname" placeholder="alcasar.domain.tld" required><br>
834
					<input type="submit" name="issue" value="<?= $l_send ?>"><br>
2304 tom.houday 835
				</form>
836
			<?php elseif ($step === 2): ?>
2316 tom.houday 837
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
838
					<input type="hidden" name="choix" value="le_renewCert">
2326 tom.houday 839
					<?= $l_le_status ?> <?= $l_pending_validation ?><br>
840
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
841
					<?= $l_le_ask_on ?> <?= date('d-m-Y H:i:s', $LE_conf['dateIssueRequest']) ?><br>
842
					<?= $l_le_dns_entry_txt ?> "<?= '_acme-challenge.'.$LE_conf['domainRequest'] ?>"<br>
843
					<?= $l_le_challenge ?> "<?= $LE_conf['challenge'] ?>"<br>
844
					<input type="submit" name="recheck" value="<?= $l_recheck ?>"> <input type="submit" name="cancel" value="<?= $l_cancel ?>"><br>
2304 tom.houday 845
				</form>
846
			<?php elseif ($step === 3): ?>
2316 tom.houday 847
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
848
					<input type="hidden" name="choix" value="le_renewCert">
2326 tom.houday 849
					<?= $l_le_status ?> <?= $l_enabled ?><br>
850
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
851
					<?= $l_le_api ?>  <?= $LE_conf['dnsapi'] ?><br>
852
					<?= $l_le_next_renewal ?> <?= date('d-m-Y', $LE_conf['dateNextRenewal']) ?><br>
2304 tom.houday 853
					<?php if ($LE_conf['dateNextRenewal'] <= date('U')): ?>
2326 tom.houday 854
						<input type="submit" name="recheck" value="<?= $l_renew ?>"><br>
2304 tom.houday 855
					<?php else: ?>
2326 tom.houday 856
						<input type="submit" name="recheck_force" value="<?= $l_renew_force ?>"><br>
2304 tom.houday 857
					<?php endif; ?>
858
				</form>
859
			<?php endif; ?>
860
			<?php if (isset($cmdResponse)): ?>
861
				<p><?= $cmdResponse ?></p>
862
			<?php endif; ?>
863
		</td>
1710 richard 864
	</tr>
865
</table>
318 richard 866
</body>
867
</html>