Subversion Repositories ALCASAR

Rev

Rev 2809 | Rev 2817 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log

Rev 2809 Rev 2813
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: network.php 2809 2020-04-12 17:35:46Z rexy $
2
# $Id: network.php 2813 2020-04-26 21:26:32Z rexy $
3
 
3
 
4
// written by steweb57, Rexy & Tom HOUDAYER
4
// written by steweb57, Rexy & Tom HOUDAYER
5
 
5
 
6
/********************
6
/********************
7
*  READ CONF FILES  *
7
*  READ CONF FILES  *
Line 64... Line 64...
64
	$l_add_to_list		= "Ajouter";
64
	$l_add_to_list		= "Ajouter";
65
	$l_apply		= "Appliquer les changements";
65
	$l_apply		= "Appliquer les changements";
66
	$l_local_dns		= "Résolution local de nom (DNS)";
66
	$l_local_dns		= "Résolution local de nom (DNS)";
67
	$l_import_cert		= "Import de certificat";
67
	$l_import_cert		= "Import de certificat";
68
	$l_private_key		= "Clé privée (.key) :";
68
	$l_private_key		= "Clé privée (.key) :";
69
	$l_certificate		= "Certificat (.crt) :";
69
	$l_certificate		= "Certificat (.crt ou .cer) :";
70
	$l_server_chain		= "Chaîne de certification (si nécéssaire : .crt) :";
70
	$l_server_chain		= "Chaîne de certification (.crt, .cer ou .pem) :";
71
	$l_default_cert		= "Revenir au certificat d'origine";
71
	$l_default_cert		= "Revenir au certificat d'origine :";
72
	$l_import		= "Importer";
72
	$l_import		= "Importer";
73
	$l_current_certificate  = "Certificat actuel";
73
	$l_current_certificate  = "Certificat actuel";
74
	$l_validated		= "Validé par :";
74
	$l_validated		= "Validé par :";
75
	$l_empty		= "Vide";
75
	$l_empty		= "Vide";
76
	$l_yes			= "Oui";
76
	$l_yes			= "Oui";
77
	$l_no			= "Non";
77
	$l_no			= "Non";
78
	$l_ssl_title		= "Chiffrer les flux d'authentification entre les utilisateurs et ALCASAR";
78
	$l_ssl_title		= "Chiffrer les flux d'authentification entre les utilisateurs et ALCASAR";
79
	$l_cert_expiration	= "Date d'expiration :";
79
	$l_cert_expiration	= "Date d'expiration :";
80
	$l_cert_commonname	= "Nom commun :";
80
	$l_cert_commonname	= "Nom commun :";
81
	$l_cert_organization	= "Organisation :";
81
	$l_cert_organization	= "Organisation :";
82
	$l_upload_certificate	= "Importer un certificat";
82
	$l_upload_certificate	= "Importer un certificat officiel";
83
	$l_le_integration	= "Intégration Let's Encrypt";
83
	$l_le_integration	= "Intégrer un certificat Let's Encrypt";
84
	$l_le_status		= "Status :";
84
	$l_le_status		= "Status :";
85
	$l_disabled		= "Inactif";
85
	$l_disabled		= "Inactif";
86
	$l_pending_validation	= "En attente de validation";
86
	$l_pending_validation	= "En attente de validation";
87
	$l_enabled		= "Actif";
87
	$l_enabled		= "Actif";
88
	$l_le_email		= "Email :";
88
	$l_le_email		= "Email :";
Line 95... Line 95...
95
	$l_cancel		= "Annuler";
95
	$l_cancel		= "Annuler";
96
	$l_le_api		= "API :";
96
	$l_le_api		= "API :";
97
	$l_le_next_renewal	= "Prochain renouvellement :";
97
	$l_le_next_renewal	= "Prochain renouvellement :";
98
	$l_renew		= "Renouveller";
98
	$l_renew		= "Renouveller";
99
	$l_renew_force		= "Renouveller (forcer)";
99
	$l_renew_force		= "Renouveller (forcer)";
-
 
100
	$l_previous_LE_cert	= "Revenir au certificat Let's Encrypt :";
100
} else {			// English
101
} else {			// English
101
	$l_network_title	= "Network configuration";
102
	$l_network_title	= "Network configuration";
102
	$l_internet_legend	= "INTERNET";
103
	$l_internet_legend	= "INTERNET";
103
	$l_ip_mask		= "Mask";
104
	$l_ip_mask		= "Mask";
104
	$l_ip_router		= "Gateway";
105
	$l_ip_router		= "Gateway";
Line 119... Line 120...
119
	$l_add_to_list		= "Add";
120
	$l_add_to_list		= "Add";
120
	$l_apply		= "Apply changes";
121
	$l_apply		= "Apply changes";
121
	$l_local_dns		= "Local name resolution (DNS";
122
	$l_local_dns		= "Local name resolution (DNS";
122
	$l_import_cert		= "Certificate import";
123
	$l_import_cert		= "Certificate import";
123
	$l_private_key		= "Private key (.key) :";
124
	$l_private_key		= "Private key (.key) :";
124
	$l_certificate		= "Certificate (.crt) :";
125
	$l_certificate		= "Certificate (.crt or .cer) :";
125
	$l_server_chain		= "Server-chain (if necessary : .crt) :";
126
	$l_server_chain		= "Server-chain (.crt, .cer or .pem) :";
126
	$l_default_cert		= "Back to default certificate";
127
	$l_default_cert		= "Back to default certificate :";
127
	$l_import		= "Import";
128
	$l_import		= "Import";
128
	$l_current_certificate  = "Current certificate";
129
	$l_current_certificate  = "Current certificate";
129
	$l_validated		= "Validated by :";
130
	$l_validated		= "Validated by :";
130
	$l_empty		= "Empty";
131
	$l_empty		= "Empty";
131
	$l_yes			= "Yes";
132
	$l_yes			= "Yes";
132
	$l_no			= "No";
133
	$l_no			= "No";
133
	$l_ssl_title		= "Cipher authentication flows between users and ALCASAR";
134
	$l_ssl_title		= "Cipher authentication flows between users and ALCASAR";
134
	$l_cert_expiration	= "Expiration date:";
135
	$l_cert_expiration	= "Expiration date:";
135
	$l_cert_commonname	= "Common name:";
136
	$l_cert_commonname	= "Common name:";
136
	$l_cert_organization	= "Organization:";
137
	$l_cert_organization	= "Organization:";
137
	$l_upload_certificate	= "Importer un certificat";
138
	$l_upload_certificate	= "Import an officlal certificate";
138
	$l_le_integration	= "Let's Encrypt integration";
139
	$l_le_integration	= "Integrate a Let's Encrypt certificate";
139
	$l_le_status		= "Status:";
140
	$l_le_status		= "Status:";
140
	$l_disabled		= "Disabled";
141
	$l_disabled		= "Disabled";
141
	$l_pending_validation	= "Pending validation";
142
	$l_pending_validation	= "Pending validation";
142
	$l_enabled		= "Enabled";
143
	$l_enabled		= "Enabled";
143
	$l_le_email		= "Email:";
144
	$l_le_email		= "Email:";
Line 150... Line 151...
150
	$l_cancel		= "Cancel";
151
	$l_cancel		= "Cancel";
151
	$l_le_api		= "API:";
152
	$l_le_api		= "API:";
152
	$l_le_next_renewal	= "Next renewal:";
153
	$l_le_next_renewal	= "Next renewal:";
153
	$l_renew		= "Renew";
154
	$l_renew		= "Renew";
154
	$l_renew_force		= "Renew (force)";
155
	$l_renew_force		= "Renew (force)";
-
 
156
	$l_previous_LE_cert	= "Back to the Let's Encrypt certificate :";
155
}
157
}
156
 
158
 
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])$/';
159
$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]))$/';
160
$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]))$/';
159
$reg_mac     = '/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/';
161
$reg_mac     = '/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/';
Line 253... Line 255...
253
			}
255
			}
254
		}
256
		}
255
		header('Location: '.$_SERVER['PHP_SELF']);
257
		header('Location: '.$_SERVER['PHP_SELF']);
256
		exit();
258
		exit();
257
 
259
 
258
	case 'default_cert':	// Restore default certificate
260
	case 'set_default_cert':
259
		exec('sudo alcasar-importcert.sh -d');
261
		exec('sudo alcasar-importcert.sh -d');
260
		break;
262
		break;
-
 
263
	case 'set_last_LE_cert':
-
 
264
		exec('sudo alcasar-letsencrypt.sh --install-cert');
261
 
265
		break;
262
	case 'import_cert':	// Import certificate
266
	case 'import_cert':	// Import certificate
263
		$maxsize = 100000;
267
		$maxsize = 100000;
264
		if (isset($_FILES['key']) && isset($_FILES['crt']) && ($_FILES['key']['error'] == 0) && ($_FILES['crt']['error'] == 0)) {
268
		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) {
269
			if ($_FILES['key']['size'] <= $maxsize && $_FILES['crt']['size'] <= $maxsize) {
266
				if (pathinfo($_FILES['key']['name'])['extension'] == 'key' && ((pathinfo($_FILES['crt']['name'])['extension'] == 'crt') || (pathinfo($_FILES['crt']['name'])['extension'] == 'cer'))) {
270
				if (pathinfo($_FILES['key']['name'])['extension'] == 'key' && ((pathinfo($_FILES['crt']['name'])['extension'] == 'crt') || (pathinfo($_FILES['crt']['name'])['extension'] == 'cer'))) {
267
					$dest = '/tmp/';
271
					$dest = '/tmp/';
268
					$scpath = '';
272
					$scpath = '';
269
					if (isset($_FILES['sc']) && ((pathinfo($_FILES['sc']['name'])['extension'] == 'crt') || (pathinfo($_FILES['sc']['name'])['extension'] == 'cer'))) {
273
					if (isset($_FILES['sc']) && ((pathinfo($_FILES['sc']['name'])['extension'] == 'crt') || (pathinfo($_FILES['sc']['name'])['extension'] == 'cer') || (pathinfo($_FILES['sc']['name']['extension'] == 'pem')))){
270
						$scpath = $dest.'server-chain.crt';
274
						$scpath = $dest.'server-chain.pem';
271
						move_uploaded_file($_FILES['sc']['tmp_name'], $scpath);
275
						move_uploaded_file($_FILES['sc']['tmp_name'], $scpath);
272
					}
276
					}
273
					$keypath = $dest.'alcasar.key';
277
					$keypath = $dest.'alcasar.key';
274
					$crtpath = $dest.'alcasar.crt';
278
					$crtpath = $dest.'alcasar.crt';
275
					move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
279
					move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
Line 338... Line 342...
338
}
342
}
339
 
343
 
340
// Let's Encrypt actions
344
// Let's Encrypt actions
341
if ($choix === 'le_issueCert') {
345
if ($choix === 'le_issueCert') {
342
	// TODO: check ndd & mail format
346
	// TODO: check ndd & mail format
343
 
-
 
344
	$email      = $_POST['email'];
347
	$email      = $_POST['email'];
345
	$domainName = $_POST['domainname'];
348
	$domainName = $_POST['domainname'];
346
 
-
 
347
	exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --issue --email '.escapeshellarg($email).' --domain '.escapeshellarg($domainName), $output, $exitCode);
349
	exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --issue --email '.escapeshellarg($email).' --domain '.escapeshellarg($domainName), $output, $exitCode);
348
 
-
 
349
	$cmdResponse = implode("<br>\n", $output);
350
	$cmdResponse = implode("<br>\n", $output);
350
}
351
}
351
if ($choix === 'le_renewCert') {
352
if ($choix === 'le_renewCert') {
352
	if ((isset($_POST['recheck'])) && ((!empty($_POST['recheck'])) || (!empty($_POST['recheck_force'])))) {
353
	if ((isset($_POST['recheck'])) && ((!empty($_POST['recheck'])) || (!empty($_POST['recheck_force'])))) {
353
		$forceOpt = (!empty($_POST['recheck_force'])) ? ' --force' : '';
354
		$forceOpt = (!empty($_POST['recheck_force'])) ? ' --force' : '';
Line 359... Line 360...
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('/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
		file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/domainRequest=.*/','domainRequest=', file_get_contents(LETS_ENCRYPT_FILE)));
361
	}
362
	}
362
}
363
}
363
 
364
 
364
 
-
 
365
// Read Let's Encrypt configuration file
365
// Read Let's Encrypt configuration file
366
$file_conf_LE = fopen(LETS_ENCRYPT_FILE, 'r');
366
$file_conf_LE = fopen(LETS_ENCRYPT_FILE, 'r');
367
if (!$file_conf_LE) {
367
if (!$file_conf_LE) {
368
	exit('Error opening the file '.LETS_ENCRYPT_FILE);
368
	exit('Error opening the file '.LETS_ENCRYPT_FILE);
369
}
369
}
Line 374... Line 374...
374
		$LE_conf[trim($tmp[0])] = trim($tmp[1]);
374
		$LE_conf[trim($tmp[0])] = trim($tmp[1]);
375
	}
375
	}
376
}
376
}
377
fclose($file_conf_LE);
377
fclose($file_conf_LE);
378
 
378
 
379
 
-
 
380
// Fonction de test de connectivité internet
379
// Fonction de test de connectivité internet
381
function internetTest() {
380
function internetTest() {
382
	$host = 'www.google.fr'; # Google Test
381
	$host = 'www.google.fr'; # Google Test
383
	$port = '80';
382
	$port = '80';
384
 
383
 
Line 398... Line 397...
398
	curl_close($ch);
397
	curl_close($ch);
399
} else {
398
} else {
400
	$internet_publicIP = '-.-.-.-';
399
	$internet_publicIP = '-.-.-.-';
401
}
400
}
402
 
401
 
403
 
-
 
404
// Network interfaces
402
// Network interfaces
405
$interfacesIgnored = ['lo', 'tun[0-9]*', $conf['EXTIF'], $conf['INTIF']];
403
$interfacesIgnored = ['lo', 'tun[0-9]*', $conf['EXTIF'], $conf['INTIF']];
406
exec("ip -o link show | awk -F': ' '{print $2}' | sed '/^" . implode('\\|', $interfacesIgnored) . "$/d'", $interfacesAvailable);
404
exec("ip -o link show | awk -F': ' '{print $2}' | sed '/^" . implode('\\|', $interfacesIgnored) . "$/d'", $interfacesAvailable);
407
 
405
 
408
// TODO: Pending the next version
406
// TODO: Pending the next version
Line 419... Line 417...
419
		'ip'        => $conf['PRIVATE_IP']
417
		'ip'        => $conf['PRIVATE_IP']
420
	]
418
	]
421
];
419
];
422
 
420
 
423
?>
421
?>
424
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
422
<!DOCTYPE HTML>
425
<html>
423
<html>
426
<head>
424
<head>
427
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
425
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
428
	<title><?= $l_network_title ?></title>
426
	<title><?= $l_network_title ?></title>
429
	<link rel="stylesheet" href="/css/style.css" type="text/css">
427
	<link rel="stylesheet" href="/css/style.css" type="text/css">
Line 602... Line 600...
602
	</script>
600
	</script>
603
</head>
601
</head>
604
<body>
602
<body>
605
	<div class="panel">
603
<div class="panel">
606
		<div class="panel-header"><?= $l_network_title ?></div>
604
	<div class="panel-header"><?= $l_network_title ?></div>
607
		<div class="panel-body">
605
	<div class="panel-row">
608
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
606
		<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
609
				<div class="network-configurator">
607
			<div class="network-configurator">
610
					<div class="internet">
608
				<div class="internet">
611
						<div data-network-type="internet">
609
					<div data-network-type="internet">
612
							<div class="network-box">
610
						<div class="network-box">
Line 665... Line 663...
665
				</div>
663
			</div>
666
			</form>
664
		</form>
667
		</div>
665
	</div>
668
	</div>
666
</div>
669
	<br>
667
<br>
670
 
-
 
671
<table width="100%" cellspacing="0" cellpadding="0" border="0">
668
<div class="panel">
672
	<tr><th><?= $l_static_dhcp_title?></th></tr>
669
	<div class="panel-header"><?= $l_static_dhcp_title ?></div>
673
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
-
 
674
</table>
670
</div>
675
<table width="100%" cellspacing="0" cellpadding="5" border="1">
671
<table width="100%" cellspacing="0" cellpadding="5" border="1">
676
	<tr><td width="50%" align="center" valign="middle">
672
	<tr><td width="50%" align="center" valign="middle">
677
		<form action="network.php" method="POST">
673
		<form action="network.php" method="POST">
678
		<table cellspacing="2" cellpadding="3" border="1">
674
		<table cellspacing="2" cellpadding="3" border="1">
679
		<tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info<th><?= $l_del ?></th></tr>
675
		<tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info<th><?= $l_del ?></th></tr>
Line 728... Line 724...
728
			</tr></table>
724
			</tr></table>
729
		</form>
725
		</form>
730
	</td></tr>
726
	</td></tr>
731
</table>
727
</table>
732
<br>
728
<br>
733
 
-
 
734
<table width="100%" cellspacing="0" cellpadding="0" border="0">
729
<div class="panel">
735
	<tr><th><?= $l_local_dns ?></th></tr>
730
	<div class="panel-header"><?= $l_local_dns ?></div>
736
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
-
 
737
</table>
731
</div>
738
<table width="100%" cellspacing="0" cellpadding="5" border="1">
732
<table width="100%" cellspacing="0" cellpadding="5" border="1">
739
	<tr>
733
	<tr>
740
		<td width="50%" align="center">
734
		<td width="50%" align="center">
741
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
735
			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
742
			<table cellspacing="2" cellpadding="3" border="1">
736
			<table cellspacing="2" cellpadding="3" border="1">
Line 792... Line 786...
792
			</form>
786
			</form>
793
		</td>
787
		</td>
794
	</tr>
788
	</tr>
795
</table>
789
</table>
796
<br>
790
<br>
797
 
-
 
798
<table width="100%" cellspacing="0" cellpadding="0" border="0">
791
<div class="panel">
799
	<tr><th><?= $l_ssl_title ?></th></tr>
792
	<div class="panel-header"><?= $l_ssl_title ?></div>
800
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
-
 
801
</table>
-
 
802
<table width="100%" cellspacing="0" cellpadding="5" border="1">
-
 
803
	<tr><td valign="middle" align="left">
793
	<div class="panel-row">
804
		<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
794
		<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
805
		<input type="hidden" name="choix" value="https_login">
795
		<input type="hidden" name="choix" value="https_login">
806
		<select name="https_login">
796
		<select name="https_login">
807
			<option value="on"<?=  (($conf['HTTPS_LOGIN'] === 'on')  ? ' selected' : '') ?>><?= $l_yes ?></option>
797
			<option value="on"<?=  (($conf['HTTPS_LOGIN'] === 'on')  ? ' selected' : '') ?>><?= $l_yes ?></option>
808
			<option value="off"<?= (($conf['HTTPS_LOGIN'] === 'off') ? ' selected' : '') ?>><?= $l_no ?></option>
798
			<option value="off"<?= (($conf['HTTPS_LOGIN'] === 'off') ? ' selected' : '') ?>><?= $l_no ?></option>
809
		</select>
799
		</select>
810
		<input type="submit" value="<?= $l_apply ?>"><br>
800
		<input type="submit" value="<?= $l_apply ?>"><br>
811
		</form>
801
		</form>
-
 
802
	</div>
-
 
803
</div>
812
		<br>
804
<br>
813
	</td></tr>
-
 
814
</table>
805
<div class="panel">
815
<br>
-
 
816
 
-
 
817
<table width="100%" cellspacing="0" cellpadding="0" border="0">
-
 
818
	<tr><th><?= $l_import_cert ?></th></tr>
806
	<div class="panel-header"><?= $l_import_cert ?></div>
819
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
-
 
820
</table>
-
 
821
<table width="100%" cellspacing="0" cellpadding="5" border="1">
807
	<div class="panel-row">
822
	<tr>
-
 
823
		<td width="50%" valign="top">
808
		<div class="panel-cell">
824
			<?php
809
			<?php
825
			$certificateInfos = openssl_x509_parse(file_get_contents('/etc/pki/tls/certs/alcasar.crt'));
810
			$certificateInfos = openssl_x509_parse(file_get_contents('/etc/pki/tls/certs/alcasar.crt'));
826
 
-
 
827
			$cert_expiration_date = date('d-m-Y H:i:s', $certificateInfos['validTo_time_t']);
811
			$cert_expiration_date = date('d-m-Y H:i:s', $certificateInfos['validTo_time_t']);
828
			$domain               = $certificateInfos['subject']['CN'];
812
			$domain               = $certificateInfos['subject']['CN'];
829
			$organization         = (isset($certificateInfos['subject']['O'])) ? $certificateInfos['subject']['O'] : '';
813
			$organization         = (isset($certificateInfos['subject']['O'])) ? $certificateInfos['subject']['O'] : '';
830
			$CAdomain             = $certificateInfos['issuer']['CN'];
814
			$CAdomain             = $certificateInfos['issuer']['CN'];
831
			$CAorganization       = (isset($certificateInfos['issuer']['O'])) ? $certificateInfos['issuer']['O'] : '';
815
			$CAorganization       = (isset($certificateInfos['issuer']['O'])) ? $certificateInfos['issuer']['O'] : '';
832
			?>
816
			?>
833
			<h3><?= $l_current_certificate ?></h3>
817
			<h3><?= $l_current_certificate ?></h3>
834
			<?= $l_cert_expiration ?> <?= $cert_expiration_date ?><br>
-
 
835
			<?= $l_cert_commonname ?> <?= $domain ?><br>
818
			<b><?= $l_cert_commonname ?></b> <?= $domain ?><br>
836
			<?= $l_cert_organization ?> <?= $organization ?><br/>
819
			<b><?= $l_cert_expiration ?></b> <?= $cert_expiration_date ?><br>
837
			<h4><?=  $l_validated ?></h4>
-
 
838
			<?= $l_cert_commonname ?> <?= $CAdomain ?><br>
820
			<b><?= $l_cert_organization ?></b> <?= $organization ?><br>
839
			<?= $l_cert_organization ?> <?= $CAorganization ?><br>
821
			<b><?= $l_validated ?></b> <?= $CAdomain ?> (<?= $CAorganization ?>)<br>
840
		</td>
822
		</div>
841
		<td width="50%" valign="center">
823
		<div class="panel-cell">
-
 
824
			<?
-
 
825
			if (file_exists('/etc/pki/tls/certs/alcasar.crt.old') && file_exists('/etc/pki/tls/private/alcasar.key.old')){ // An old default certificate exist ?
842
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
826
				echo "<form method=\"post\" action=\"".htmlspecialchars($_SERVER['PHP_SELF'])."\">\n";
843
				<input type="hidden" name="choix" value="default_cert">
827
				echo "\t\t\t\t<input type=\"hidden\" name=\"choix\" value=\"set_default_cert\">\n";
-
 
828
				echo "\t\t\t\t<input type=\"submit\" value=\"$l_default_cert\"> (alcasar.localdomain)<br>\n";
-
 
829
				echo "\t\t\t</form>\n";}
844
				<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' : '' ?>>
830
			if (!empty($LE_conf['domainRequest']) && ($domain != $LE_conf['domainRequest'])) { // A Let's encrypt certificate exist & it's not the active one ?
-
 
831
				echo "\t\t\t<form method=\"post\" action=\"".htmlspecialchars($_SERVER['PHP_SELF'])."\">\n";
-
 
832
				echo "\t\t\t\t<input type=\"hidden\" name=\"choix\" value=\"set_last_LE_cert\">\n";
-
 
833
				echo "\t\t\t\t<input type=\"submit\" value=\"".$l_previous_LE_cert."\"> (".$LE_conf['domainRequest'].")\n";
845
			</form>
834
				echo "\t\t\t</form>\n";}
846
		</td>
835
			?>
847
	</tr>
836
		</div>
848
	<tr>
837
	</div>
-
 
838
	<div class="panel-row">
849
		<td width="50%" valign="top">
839
		<div class="panel-cell">
850
			<h3><?= $l_upload_certificate ?></h3>
840
			<h3><?= $l_upload_certificate ?></h3>
851
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
841
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
852
				<?= $l_private_key;?> <input type="file" name="key"><br>
842
				<?= $l_private_key;?> <input type="file" name="key"><br>
853
				<?= $l_certificate;?> <input type="file" name="crt"><br>
843
				<?= $l_certificate;?> <input type="file" name="crt"><br>
854
				<?= $l_server_chain;?> <input type="file" name="sc"><br>
844
				<?= $l_server_chain;?> <input type="file" name="sc"><br>
855
				<input type="hidden" name="choix" value="import_cert">
845
				<input type="hidden" name="choix" value="import_cert">
856
				<input type="submit" value="<?= $l_import ?>">
846
				<input type="submit" value="<?= $l_import ?>">
857
			</form>
847
			</form>
858
		</td>
848
		</div>
859
		<td width="50%" valign="top">
849
		<div class="panel-cell">
860
			<?php
850
			<?php
861
			// Get step
851
			// Get step
862
			if (empty($LE_conf['domainRequest'])) {
852
			if (empty($LE_conf['domainRequest'])) {
863
				$step = 1;
853
				$step = 1;
864
			} else if (!empty($LE_conf['challenge'])) {
854
			} else if (!empty($LE_conf['challenge'])) {
Line 903... Line 893...
903
				</form>
893
				</form>
904
			<?php endif; ?>
894
			<?php endif; ?>
905
			<?php if (isset($cmdResponse)): ?>
895
			<?php if (isset($cmdResponse)): ?>
906
				<p><?= $cmdResponse ?></p>
896
				<p><?= $cmdResponse ?></p>
907
			<?php endif; ?>
897
			<?php endif; ?>
908
		</td>
898
		</div>
909
	</tr>
899
	</div>
910
</table>
900
</div>
911
</body>
901
</body>
912
</html>
902
</html>