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 441... |
Line 439... |
441 |
return false;
|
439 |
return false;
|
442 |
}
|
440 |
}
|
443 |
}
|
441 |
}
|
444 |
</script>
|
442 |
</script>
|
445 |
<style>
|
443 |
<style>
|
446 |
.network-configurator {
|
444 |
.network-configurator {
|
447 |
width: 100%;
|
445 |
width: 100%;
|
448 |
}
|
446 |
}
|
449 |
.network-configurator > * {
|
447 |
.network-configurator > * {
|
450 |
display: inline-block;
|
448 |
display: inline-block;
|
451 |
vertical-align: top;
|
449 |
vertical-align: top;
|
452 |
text-align: center;
|
450 |
text-align: center;
|
453 |
}
|
451 |
}
|
454 |
.network-configurator > .internet, .network-configurator > .alcasar {
|
452 |
.network-configurator > .internet, .network-configurator > .alcasar {
|
455 |
width: 20%;
|
453 |
width: 20%;
|
456 |
}
|
454 |
}
|
457 |
.network-configurator > .externals, .network-configurator > .internals {
|
455 |
.network-configurator > .externals, .network-configurator > .internals {
|
458 |
width: 30%;
|
456 |
width: 30%;
|
459 |
}
|
457 |
}
|
460 |
.network-configurator .actions {
|
458 |
.network-configurator .actions {
|
461 |
position: absolute;
|
459 |
position: absolute;
|
462 |
background-color: #ddd;
|
460 |
background-color: #ddd;
|
463 |
padding: 0 2px;
|
461 |
padding: 0 2px;
|
464 |
}
|
462 |
}
|
465 |
.network-configurator .actions a {
|
463 |
.network-configurator .actions a {
|
466 |
text-decoration: none;
|
464 |
text-decoration: none;
|
467 |
}
|
465 |
}
|
468 |
.network-configurator .actions a:hover {
|
466 |
.network-configurator .actions a:hover {
|
469 |
font-weight: bold;
|
467 |
font-weight: bold;
|
470 |
}
|
468 |
}
|
471 |
.network-configurator > .alcasar .actions-externals {
|
469 |
.network-configurator > .alcasar .actions-externals {
|
472 |
bottom: 0;
|
470 |
bottom: 0;
|
473 |
left: 0;
|
471 |
left: 0;
|
474 |
border-radius: 0 5px;
|
472 |
border-radius: 0 5px;
|
475 |
}
|
473 |
}
|
476 |
.network-configurator > .alcasar .actions-internals {
|
474 |
.network-configurator > .alcasar .actions-internals {
|
477 |
bottom: 0;
|
475 |
bottom: 0;
|
478 |
right: 0;
|
476 |
right: 0;
|
479 |
border-radius: 5px 0;
|
477 |
border-radius: 5px 0;
|
480 |
}
|
478 |
}
|
481 |
.network-configurator .actions-network {
|
479 |
.network-configurator .actions-network {
|
482 |
top: 0;
|
480 |
top: 0;
|
483 |
right: 0;
|
481 |
right: 0;
|
484 |
border-radius: 0 5px;
|
482 |
border-radius: 0 5px;
|
485 |
}
|
483 |
}
|
486 |
.network-configurator .network-box {
|
484 |
.network-configurator .network-box {
|
487 |
display: inline-block;
|
485 |
display: inline-block;
|
488 |
min-height: 100px;
|
486 |
min-height: 100px;
|
489 |
margin: 5px;
|
487 |
margin: 5px;
|
490 |
padding: 3px;
|
488 |
padding: 3px;
|
491 |
text-align: left;
|
489 |
text-align: left;
|
492 |
background-color: #f7f3ef;
|
490 |
background-color: #f7f3ef;
|
493 |
position: relative;
|
491 |
position: relative;
|
494 |
border-radius: 5px;
|
492 |
border-radius: 5px;
|
495 |
border: 2px solid grey;
|
493 |
border: 2px solid grey;
|
496 |
}
|
494 |
}
|
497 |
.network-configurator .network-connector {
|
495 |
.network-configurator .network-connector {
|
498 |
display: inline-block;
|
496 |
display: inline-block;
|
499 |
position: absolute;
|
497 |
position: absolute;
|
500 |
top: 50%;
|
498 |
top: 50%;
|
501 |
margin-top: -5px;
|
499 |
margin-top: -5px;
|
502 |
margin-left: -5px;
|
500 |
margin-left: -5px;
|
503 |
width: 10px;
|
501 |
width: 10px;
|
504 |
height: 10px;
|
502 |
height: 10px;
|
505 |
border-radius: 5px;
|
503 |
border-radius: 5px;
|
506 |
background-color: black;
|
504 |
background-color: black;
|
507 |
}
|
505 |
}
|
508 |
.network-configurator .network-connector[data-connector-direction="left"] {
|
506 |
.network-configurator .network-connector[data-connector-direction="left"] {
|
509 |
border-radius: 5px 0px 0px 5px;
|
507 |
border-radius: 5px 0px 0px 5px;
|
510 |
}
|
508 |
}
|
511 |
.network-configurator .network-connector[data-connector-direction="right"] {
|
509 |
.network-configurator .network-connector[data-connector-direction="right"] {
|
512 |
border-radius: 0px 5px 5px 0px;
|
510 |
border-radius: 0px 5px 5px 0px;
|
513 |
}
|
511 |
}
|
514 |
.network-configurator div[data-network-type] {
|
512 |
.network-configurator div[data-network-type] {
|
515 |
position: relative;
|
513 |
position: relative;
|
516 |
}
|
514 |
}
|
517 |
</style>
|
515 |
</style>
|
518 |
<script>
|
516 |
<script>
|
519 |
$(document).ready(function () {
|
517 |
$(document).ready(function () {
|
520 |
const interfacesAvailable = <?= ((!empty($interfacesAvailable)) ? "['".implode("', '", $interfacesAvailable)."']" : '[]') ?>;
|
518 |
const interfacesAvailable = <?= ((!empty($interfacesAvailable)) ? "['".implode("', '", $interfacesAvailable)."']" : '[]') ?>;
|
521 |
|
519 |
|
Line 600... |
Line 598... |
600 |
});
|
598 |
});
|
601 |
});
|
599 |
});
|
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">
|
- |
|
610 |
<div class="network-box">
|
- |
|
611 |
<?= $l_internet_legend ?> <img src="/images/state_<?= (($internet_connected) ? 'ok' : 'error') ?>.gif"><br>
|
- |
|
612 |
<?= $l_ip_public ?> : <?= $internet_publicIP ?><br>
|
- |
|
613 |
<label for="dns1"><?= $l_ip_dns1 ?></label> : <input style="width:120px" type="text" id="dns1" name="dns1" value="<?= $conf['DNS1'] ?>" /><br>
|
- |
|
614 |
<label for="dns2"><?= $l_ip_dns2 ?></label> : <input style="width:120px" type="text" id="dns2" name="dns2" value="<?= $conf['DNS2'] ?>" />
|
- |
|
615 |
</div>
|
- |
|
616 |
<div class="network-connector" data-connector-network="internet" data-connector-direction="right"></div>
|
- |
|
617 |
</div>
|
- |
|
618 |
</div><div class="externals">
|
- |
|
619 |
<?php foreach ($externalNetworks as $index => $network): ?>
|
- |
|
620 |
<div data-network-type="external">
|
- |
|
621 |
<div class="network-connector" data-connector-network="internet" data-connector-direction="left"></div>
|
612 |
<div class="network-box">
|
622 |
<div class="network-box">
|
613 |
<?= $l_internet_legend ?> <img src="/images/state_<?= (($internet_connected) ? 'ok' : 'error') ?>.gif"><br>
|
623 |
<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
|
614 |
<?= $l_ip_public ?> : <?= $internet_publicIP ?><br>
|
624 |
<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>
|
615 |
<label for="dns1"><?= $l_ip_dns1 ?></label> : <input style="width:120px" type="text" id="dns1" name="dns1" value="<?= $conf['DNS1'] ?>" /><br>
|
625 |
<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>
|
616 |
<label for="dns2"><?= $l_ip_dns2 ?></label> : <input style="width:120px" type="text" id="dns2" name="dns2" value="<?= $conf['DNS2'] ?>" />
|
626 |
<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 ?>" />
|
617 |
</div>
|
627 |
</div>
|
618 |
<div class="network-connector" data-connector-network="internet" data-connector-direction="right"></div>
|
628 |
<div class="network-connector" data-connector-network="external" data-connector-direction="right"></div>
|
619 |
</div>
|
629 |
</div>
|
- |
|
630 |
<? endforeach; ?>
|
620 |
</div><div class="externals">
|
631 |
</div><div class="alcasar">
|
621 |
<?php foreach ($externalNetworks as $index => $network): ?>
|
- |
|
622 |
<div data-network-type="external">
|
632 |
<div data-network-type="alcasar">
|
623 |
<div class="network-connector" data-connector-network="internet" data-connector-direction="left"></div>
|
633 |
<div class="network-connector" data-connector-network="external" data-connector-direction="left"></div>
|
624 |
<div class="network-box">
|
634 |
<div class="network-box">
|
- |
|
635 |
<!-- <div class="actions actions-externals">
|
625 |
<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
|
636 |
<div><a href="#" class="add-external-network" title="Ajouter un réseau externe">+</a></div>
|
- |
|
637 |
</div> -->
|
626 |
<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>
|
638 |
<div class="alcasar-logo"><img src="/images/logo-alcasar.png" style="width: 100px;height: 100px;"></div>
|
- |
|
639 |
<!-- <div class="actions actions-internals">
|
627 |
<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>
|
640 |
<div><a href="#" class="add-internal-network" title="Ajouter un réseau interne">+</a></div>
|
628 |
<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 ?>" />
|
641 |
<div><a href="#" class="add-internal-wifi-network">++</a></div>
|
- |
|
642 |
</div> -->
|
629 |
</div>
|
643 |
</div>
|
630 |
<div class="network-connector" data-connector-network="external" data-connector-direction="right"></div>
|
644 |
<div class="network-connector" data-connector-network="internal" data-connector-direction="right"></div>
|
631 |
</div>
|
645 |
</div>
|
632 |
<? endforeach; ?>
|
646 |
</div><div class="internals">
|
633 |
</div><div class="alcasar">
|
647 |
<?php foreach ($internalNetworks as $network): ?>
|
634 |
<div data-network-type="alcasar">
|
648 |
<div data-network-type="internal">
|
635 |
<div class="network-connector" data-connector-network="external" data-connector-direction="left"></div>
|
649 |
<div class="network-connector" data-connector-network="internal" data-connector-direction="left"></div>
|
636 |
<div class="network-box">
|
650 |
<div class="network-box">
|
637 |
<!-- <div class="actions actions-externals">
|
- |
|
638 |
<div><a href="#" class="add-external-network" title="Ajouter un réseau externe">+</a></div>
|
651 |
<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
|
639 |
</div> -->
|
- |
|
640 |
<div class="alcasar-logo"><img src="/images/logo-alcasar.png" style="width: 100px;height: 100px;"></div>
|
652 |
<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>
|
641 |
<!-- <div class="actions actions-internals">
|
- |
|
642 |
<div><a href="#" class="add-internal-network" title="Ajouter un réseau interne">+</a></div>
|
653 |
<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>
|
643 |
<div><a href="#" class="add-internal-wifi-network">++</a></div>
|
- |
|
644 |
</div> -->
|
- |
|
645 |
</div>
|
654 |
</div>
|
646 |
<div class="network-connector" data-connector-network="internal" data-connector-direction="right"></div>
|
- |
|
647 |
</div>
|
655 |
</div>
|
648 |
</div><div class="internals">
|
- |
|
649 |
<?php foreach ($internalNetworks as $network): ?>
|
- |
|
650 |
<div data-network-type="internal">
|
- |
|
651 |
<div class="network-connector" data-connector-network="internal" data-connector-direction="left"></div>
|
- |
|
652 |
<div class="network-box">
|
- |
|
653 |
<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
|
- |
|
654 |
<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>
|
- |
|
655 |
<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>
|
- |
|
656 |
</div>
|
- |
|
657 |
</div>
|
- |
|
658 |
<? endforeach; ?>
|
656 |
<? endforeach; ?>
|
659 |
</div>
|
- |
|
660 |
</div>
|
- |
|
661 |
<hr>
|
- |
|
662 |
<div style="text-align: center; margin: 5px">
|
- |
|
663 |
<input type="hidden" name="choix" value="network_change">
|
- |
|
664 |
<input type="submit" value="<?= $l_apply ?>">
|
- |
|
665 |
</div>
|
657 |
</div>
|
666 |
</form>
|
658 |
</div>
|
- |
|
659 |
<hr>
|
- |
|
660 |
<div style="text-align: center; margin: 5px">
|
- |
|
661 |
<input type="hidden" name="choix" value="network_change">
|
- |
|
662 |
<input type="submit" value="<?= $l_apply ?>">
|
667 |
</div>
|
663 |
</div>
|
- |
|
664 |
</form>
|
668 |
</div>
|
665 |
</div>
|
669 |
<br>
|
666 |
</div>
|
670 |
|
667 |
<br>
|
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>
|
812 |
<br>
|
- |
|
813 |
</td></tr>
|
802 |
</div>
|
814 |
</table>
|
803 |
</div>
|
815 |
<br>
|
804 |
<br>
|
816 |
|
- |
|
817 |
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
805 |
<div class="panel">
|
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>
|