Subversion Repositories ALCASAR

Rev

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