Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
- |
|
2 |
# $Id: network.php 2304 2017-06-26 12:56:14Z tom.houdayer $
|
- |
|
3 |
|
2 |
/* written by steweb57 & Rexy */
|
4 |
/* written by steweb57 & Rexy */
|
3 |
|
5 |
|
4 |
/********************
|
6 |
/********************
|
5 |
* READ CONF FILES *
|
7 |
* READ CONF FILES *
|
6 |
*********************/
|
8 |
*********************/
|
7 |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
|
9 |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
|
8 |
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
|
10 |
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
|
9 |
define ("ETHERS_INFO_FILE", "/usr/local/etc/alcasar-ethers-info");
|
11 |
define ("ETHERS_INFO_FILE", "/usr/local/etc/alcasar-ethers-info");
|
10 |
define ("DNS_LOCAL_FILE", "/usr/local/etc/alcasar-dns-name");
|
12 |
define ("DNS_LOCAL_FILE", "/usr/local/etc/alcasar-dns-name");
|
- |
|
13 |
define('LETS_ENCRYPT_FILE', '/usr/local/etc/alcasar-letsencrypt');
|
11 |
$conf_files=array(CONF_FILE,ETHERS_FILE,ETHERS_INFO_FILE,DNS_LOCAL_FILE);
|
14 |
$conf_files=array(CONF_FILE,ETHERS_FILE,ETHERS_INFO_FILE,DNS_LOCAL_FILE, LETS_ENCRYPT_FILE);
|
12 |
$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])$/';
|
15 |
$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])$/';
|
13 |
$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]))$/';
|
16 |
$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]))$/';
|
14 |
$network_modification=0;
|
17 |
$network_modification=0;
|
15 |
foreach ($conf_files as $file){
|
18 |
foreach ($conf_files as $file){
|
16 |
if (!file_exists($file)){
|
19 |
if (!file_exists($file)){
|
Line 35... |
Line 38... |
35 |
$l_ip_dns2 = "DNS2";
|
38 |
$l_ip_dns2 = "DNS2";
|
36 |
$l_dhcp_title = "Service DHCP";
|
39 |
$l_dhcp_title = "Service DHCP";
|
37 |
$l_dhcp_state = "Mode actuel";
|
40 |
$l_dhcp_state = "Mode actuel";
|
38 |
$l_DHCP_on = "actif";
|
41 |
$l_DHCP_on = "actif";
|
39 |
$l_DHCP_off = "inactif";
|
42 |
$l_DHCP_off = "inactif";
|
40 |
$l_DHCP_off_explain = "! Avant d'arrêter le serveur DHCP, vous devez renseigner les paramètres d'un serveur externe (cf. documentation).";
|
43 |
$l_DHCP_off_explain = "/!\\ Avant d'arrêter le serveur DHCP, vous devez renseigner les paramètres d'un serveur externe (cf. documentation).";
|
41 |
$l_static_dhcp_title = "Réservation d'adresses IP statiques";
|
44 |
$l_static_dhcp_title = "Réservation d'adresses IP statiques";
|
42 |
$l_mac_address = "Adresse MAC";
|
45 |
$l_mac_address = "Adresse MAC";
|
43 |
$l_ip_address = "Adresse IP";
|
46 |
$l_ip_address = "Adresse IP";
|
44 |
$l_host_name = "Nom d'hôte";
|
47 |
$l_host_name = "Nom d'hôte";
|
45 |
$l_del = "Supprimer de la liste";
|
48 |
$l_del = "Supprimer de la liste";
|
Line 66... |
Line 69... |
66 |
$l_ip_dns2 = "DNS2";
|
69 |
$l_ip_dns2 = "DNS2";
|
67 |
$l_dhcp_title = "DHCP service";
|
70 |
$l_dhcp_title = "DHCP service";
|
68 |
$l_dhcp_state = "Current mode";
|
71 |
$l_dhcp_state = "Current mode";
|
69 |
$l_DHCP_on = "enabled";
|
72 |
$l_DHCP_on = "enabled";
|
70 |
$l_DHCP_off = "disabled";
|
73 |
$l_DHCP_off = "disabled";
|
71 |
$l_DHCP_off_explain = "! Before disabling the DHCP server, you must write the extern DHCP parameters in the config file (see Documentation)";
|
74 |
$l_DHCP_off_explain = "/!\\ Before disabling the DHCP server, you must write the extern DHCP parameters in the config file (see Documentation)";
|
72 |
$l_static_dhcp_title = "Static IP addresses reservation";
|
75 |
$l_static_dhcp_title = "Static IP addresses reservation";
|
73 |
$l_mac_address = "MAC Address";
|
76 |
$l_mac_address = "MAC Address";
|
74 |
$l_ip_address = "IP Address";
|
77 |
$l_ip_address = "IP Address";
|
75 |
$l_host_name = "Host name";
|
78 |
$l_host_name = "Host name";
|
76 |
$l_del = "Delete from list";
|
79 |
$l_del = "Delete from list";
|
Line 305... |
Line 308... |
305 |
}
|
308 |
}
|
306 |
}
|
309 |
}
|
307 |
</script>
|
310 |
</script>
|
308 |
</head>
|
311 |
</head>
|
309 |
<body>
|
312 |
<body>
|
310 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
313 |
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
311 |
<tr><th><?php echo $l_network_title; ?></th></tr>
|
314 |
<tr><th><?php echo $l_network_title; ?></th></tr>
|
312 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
315 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
313 |
</table>
|
316 |
</table>
|
314 |
<? echo "<form action=".$_SERVER['PHP_SELF']." method='post'>";?>
|
317 |
<? echo "<form action=".$_SERVER['PHP_SELF']." method='post'>";?>
|
315 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
|
318 |
<table width="100%" cellspacing="0" cellpadding="5" border="1">
|
316 |
<tr><td valign="middle" align="left">
|
319 |
<tr><td valign="middle" align="left">
|
317 |
<fieldset>
|
320 |
<fieldset>
|
318 |
<legend><?php echo $l_internet_legend;
|
321 |
<legend><?php echo $l_internet_legend;
|
319 |
if (InternetTest()){
|
322 |
if (InternetTest()){
|
320 |
echo " <img src='/images/state_ok.gif'>";
|
323 |
echo " <img src='/images/state_ok.gif'>";
|
Line 324... |
Line 327... |
324 |
$IP_PUB = "-.-.-.-";}
|
327 |
$IP_PUB = "-.-.-.-";}
|
325 |
?></legend>
|
328 |
?></legend>
|
326 |
<table>
|
329 |
<table>
|
327 |
<tr><td><?php echo $l_ip_public." : ".$IP_PUB;?></td></tr>
|
330 |
<tr><td><?php echo $l_ip_public." : ".$IP_PUB;?></td></tr>
|
328 |
<?php
|
331 |
<?php
|
329 |
echo "<tr><td>".$l_ip_dns1." <input style='width:120px' type='text' name='dns1' value=".$conf["DNS1"]."/></td></tr>";
|
332 |
echo '<tr><td>'.$l_ip_dns1.' <input style="width:120px" type="text" name="dns1" value="'.$conf['DNS1'].'" /></td></tr>';
|
330 |
echo "<tr><td>".$l_ip_dns2." <input style='width:120px' type='text' name='dns2' value=".$conf["DNS2"]."/></td></tr>";
|
333 |
echo '<tr><td>'.$l_ip_dns2.' <input style="width:120px" type="text" name="dns2" value="'.$conf['DNS2'].'" /></td></tr>';
|
331 |
?>
|
334 |
?>
|
332 |
</table>
|
335 |
</table>
|
333 |
</fieldset>
|
336 |
</fieldset>
|
334 |
</td><td>
|
337 |
</td><td>
|
335 |
<fieldset>
|
338 |
<fieldset>
|
336 |
<legend><?php echo $conf["EXTIF"].$l_extif_legend; ?></legend>
|
339 |
<legend><?php echo $conf['EXTIF'].$l_extif_legend; ?></legend>
|
337 |
<table>
|
340 |
<table>
|
338 |
<?php
|
341 |
<?php
|
339 |
echo "<tr><td>".$l_ip_address." <input style='width:150px' type='text' name='ip_public' value=".$conf['PUBLIC_IP']."/></td></tr>";
|
342 |
echo '<tr><td>'.$l_ip_address.' <input style="width:150px" type="text" name="ip_public" value="'.$conf['PUBLIC_IP'].'" /></td></tr>';
|
340 |
echo "<tr><td>".$l_ip_router." <input style='width:120px' type='text' name='ip_gw' value=".$conf['GW']."/></td></tr>";
|
343 |
echo '<tr><td>'.$l_ip_router.' <input style="width:120px" type="text" name="ip_gw" value="'.$conf['GW'].'" /></td></tr>';
|
341 |
?>
|
344 |
?>
|
342 |
</table>
|
345 |
</table>
|
343 |
</fieldset>
|
346 |
</fieldset>
|
344 |
</td><td>
|
347 |
</td><td>
|
345 |
<fieldset>
|
348 |
<fieldset>
|
346 |
<legend><?php echo $conf["INTIF"].$l_intif_legend; ?></legend>
|
349 |
<legend><?php echo $conf['INTIF'].$l_intif_legend; ?></legend>
|
347 |
<table>
|
350 |
<table>
|
348 |
<?php
|
351 |
<?php
|
349 |
echo "<tr><td>".$l_ip_address."</td><td> <input style='width:150px' type='text' name='ip_private' value=".$conf['PRIVATE_IP']." /></td></tr>";
|
352 |
echo '<tr><td>'.$l_ip_address.'</td><td> <input style="width:150px" type="text" name="ip_private" value="'.$conf['PRIVATE_IP'].'" /></td></tr>';
|
350 |
?>
|
353 |
?>
|
351 |
</table>
|
354 |
</table>
|
352 |
</fieldset>
|
355 |
</fieldset>
|
353 |
</td></tr>
|
356 |
</td></tr>
|
354 |
<tr><td colspan="3" align="center">
|
357 |
<tr><td colspan="3" align="center">
|
355 |
<?php echo "<input type='submit' value='$l_apply'>";?>
|
358 |
<?php echo "<input type='submit' value='$l_apply'>";?>
|
356 |
</td></tr>
|
359 |
</td></tr>
|
357 |
</table>
|
360 |
</table>
|
358 |
</form>
|
361 |
</form>
|
359 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
362 |
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
360 |
<tr><th><?php echo $l_dhcp_title;?></th></tr>
|
363 |
<tr><th><?php echo $l_dhcp_title;?></th></tr>
|
361 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
364 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
362 |
</table>
|
365 |
</table>
|
363 |
<table width="100%" border=1 cellspacing=0 cellpadding=0>
|
366 |
<table width="100%" cellspacing="0" cellpadding="5" border="1">
|
364 |
<tr><td colspan="2" valign="middle" align="left">
|
367 |
<tr><td colspan="2" valign="middle" align="left">
|
365 |
<?
|
368 |
<?
|
366 |
$dhcp_state=trim($conf["DHCP"]);
|
369 |
$dhcp_state=trim($conf["DHCP"]);
|
367 |
echo "<CENTER><H3>$l_dhcp_state : ${"l_DHCP_".$dhcp_state}</H3></CENTER>";
|
370 |
echo "<CENTER><H3>$l_dhcp_state : ${"l_DHCP_".$dhcp_state}</H3></CENTER>";
|
368 |
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
|
371 |
echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
|
Line 374... |
Line 377... |
374 |
echo "<br>$l_DHCP_off_explain";
|
377 |
echo "<br>$l_DHCP_off_explain";
|
375 |
|
378 |
|
376 |
echo "</FORM>";
|
379 |
echo "</FORM>";
|
377 |
echo "</td></tr>";
|
380 |
echo "</td></tr>";
|
378 |
if (strncmp($conf["DHCP"],"on",2) == 0) { require ('network2.php');}
|
381 |
if (strncmp($conf["DHCP"],"on",2) == 0) { require ('network2.php');}
|
379 |
else { echo "</TABLE>"; }
|
382 |
else { echo "</table>"; }
|
380 |
$maxsize=100000;
|
383 |
$maxsize=100000;
|
381 |
?>
|
384 |
?>
|
382 |
|
385 |
|
383 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
386 |
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
384 |
<tr><th><?php echo $l_local_dns;?></th></tr>
|
387 |
<tr><th><?php echo $l_local_dns;?></th></tr>
|
385 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
388 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
386 |
</table>
|
389 |
</table>
|
387 |
<table width="100%" border="1" cellspacing="0" cellpadding="0">
|
390 |
<table width="100%" cellspacing="0" cellpadding="5" border="1">
|
388 |
<tr><td colspan=2 align="center">
|
391 |
<tr><td width="50%" align="center">
|
389 |
<?
|
392 |
<?
|
390 |
echo "<FORM action='network.php' method='POST'>";
|
393 |
echo "<FORM action='network.php' method='POST'>";
|
391 |
echo "<table cellspacing=2 cellpadding=3 border=1>";
|
394 |
echo "<table cellspacing=2 cellpadding=3 border=1>";
|
392 |
echo "<tr><th>$l_host_name<th>$l_ip_address<th>$l_del</tr>";
|
395 |
echo "<tr><th>$l_host_name<th>$l_ip_address<th>$l_del</tr>";
|
393 |
// Read the "dns_local" file
|
396 |
// Read the "dns_local" file
|
Line 414... |
Line 417... |
414 |
if ($line_exist)
|
417 |
if ($line_exist)
|
415 |
{
|
418 |
{
|
416 |
echo "<input type='hidden' name='choix' value='del_host'>";
|
419 |
echo "<input type='hidden' name='choix' value='del_host'>";
|
417 |
echo "<input type='submit' value='$l_apply'>";
|
420 |
echo "<input type='submit' value='$l_apply'>";
|
418 |
}
|
421 |
}
|
419 |
echo "</form></td><td valign='middle' align='center'>";
|
422 |
echo "</form></td><td width=\"50%\" valign='middle' align='center'>";
|
420 |
echo "<FORM name='new_host' action='network.php' method='POST'>";
|
423 |
echo "<FORM name='new_host' action='network.php' method='POST'>";
|
421 |
echo "<table cellspacing=2 cellpadding=3 border=1>";
|
424 |
echo "<table cellspacing=2 cellpadding=3 border=1>";
|
422 |
echo "<tr><th>$l_host_name<th>$l_ip_address";
|
425 |
echo "<tr><th>$l_host_name<th>$l_ip_address";
|
423 |
?>
|
426 |
?>
|
424 |
<td></td></tr>
|
427 |
<td></td></tr>
|
Line 428... |
Line 431... |
428 |
<td><? echo "<input type=submit class=button value=\"$l_add_to_list\">"?></td>
|
431 |
<td><? echo "<input type=submit class=button value=\"$l_add_to_list\">"?></td>
|
429 |
</tr></table>
|
432 |
</tr></table>
|
430 |
</form>
|
433 |
</form>
|
431 |
</td></tr>
|
434 |
</td></tr>
|
432 |
</table>
|
435 |
</table>
|
433 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
436 |
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
434 |
<tr><th><?php echo $l_import_cert;?></th></tr>
|
437 |
<tr><th><?php echo $l_import_cert;?></th></tr>
|
435 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
438 |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
|
436 |
</table>
|
439 |
</table>
|
437 |
<table width="100%" border="1" cellspacing="0" cellpadding="0">
|
440 |
<table width="100%" cellspacing="0" cellpadding="5" border="1">
|
438 |
<tr><td>
|
441 |
<tr>
|
- |
|
442 |
<td width="50%">
|
- |
|
443 |
<h3>Importer un certificat existant</h3>
|
439 |
<form method="post" action="network.php" enctype="multipart/form-data">
|
444 |
<form method="post" action="network.php" enctype="multipart/form-data">
|
440 |
<?php echo $l_private_key;?><input type="file" name="key"><br>
|
445 |
<?php echo $l_private_key;?> <input type="file" name="key"><br>
|
441 |
<?php echo $l_certificate;?><input type="file" name="crt"><br>
|
446 |
<?php echo $l_certificate;?> <input type="file" name="crt"><br>
|
442 |
<?php echo $l_server_chain;?><input type="file" name="sc">
|
447 |
<?php echo $l_server_chain;?> <input type="file" name="sc">
|
443 |
<input type="hidden" name="MAX_FILE_SIZE" value=<?php echo $maxsize;?>><br>
|
448 |
<input type="hidden" name="MAX_FILE_SIZE" value=<?php echo $maxsize;?>><br>
|
444 |
<input type="submit" <?php echo "value=\"".$l_import."\""?>>
|
449 |
<input type="submit" <?php echo "value=\"".$l_import."\""?>>
|
445 |
</form>
|
450 |
</form>
|
446 |
|
451 |
|
447 |
<?php
|
452 |
<?php
|
Line 459... |
Line 464... |
459 |
Common name : <?= $domain ?><br>
|
464 |
Common name : <?= $domain ?><br>
|
460 |
Organization : <?= $organization ?><br/>
|
465 |
Organization : <?= $organization ?><br/>
|
461 |
<h4><?= $l_validated ?></h4>
|
466 |
<h4><?= $l_validated ?></h4>
|
462 |
Common name : <?= $CAdomain ?><br>
|
467 |
Common name : <?= $CAdomain ?><br>
|
463 |
Organization : <?= $CAorganization ?><br>
|
468 |
Organization : <?= $CAorganization ?><br>
|
- |
|
469 |
|
464 |
</td><td>
|
470 |
<br>
|
465 |
<form method="post" action="network.php">
|
471 |
<form method="post" action="network.php">
|
466 |
<input type="hidden" name="default">
|
472 |
<input type="hidden" name="default">
|
467 |
<input type="submit" <?php echo "value=\"".$l_default_cert."\""; if(!file_exists("/etc/pki/tls/certs/alcasar.crt.old") || !file_exists("/etc/pki/tls/private/alcasar.key.old")){ echo " disabled";}?>>
|
473 |
<input type="submit" <?php echo "value=\"".$l_default_cert."\""; if(!file_exists("/etc/pki/tls/certs/alcasar.crt.old") || !file_exists("/etc/pki/tls/private/alcasar.key.old")){ echo " disabled";}?>>
|
468 |
</form>
|
474 |
</form>
|
469 |
</td>
|
475 |
</td>
|
- |
|
476 |
<td width="50%" valign="top">
|
- |
|
477 |
<?php
|
- |
|
478 |
// Let's Encrypt actions
|
- |
|
479 |
if ((isset($_POST['action']) && ($_POST['action'] === 'le_issueCert'))) {
|
- |
|
480 |
// TODO: check ndd & mail format
|
- |
|
481 |
|
- |
|
482 |
$email = $_POST['email'];
|
- |
|
483 |
$domainName = $_POST['domainname'];
|
- |
|
484 |
|
- |
|
485 |
exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --issue --email '.escapeshellarg($email).' --domain '.escapeshellarg($domainName), $output, $exitCode);
|
- |
|
486 |
|
- |
|
487 |
$cmdResponse = implode("<br>\n", $output);
|
- |
|
488 |
}
|
- |
|
489 |
if ((isset($_POST['action']) && ($_POST['action'] === 'le_renewCert'))) {
|
- |
|
490 |
if ((isset($_POST['recheck'])) && ((!empty($_POST['recheck'])) || (!empty($_POST['recheck_force'])))) {
|
- |
|
491 |
$forceOpt = (!empty($_POST['recheck_force'])) ? ' --force' : '';
|
- |
|
492 |
|
- |
|
493 |
exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --renew' . $forceOpt, $output, $exitCode);
|
- |
|
494 |
|
- |
|
495 |
$cmdResponse = implode("<br>\n", $output);
|
- |
|
496 |
} else if ((isset($_POST['cancel'])) && (!empty($_POST['cancel']))) {
|
- |
|
497 |
file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/challenge=.*/','challenge=', file_get_contents(LETS_ENCRYPT_FILE)));
|
- |
|
498 |
file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/domainRequest=.*/','domainRequest=', file_get_contents(LETS_ENCRYPT_FILE)));
|
- |
|
499 |
}
|
- |
|
500 |
}
|
- |
|
501 |
|
- |
|
502 |
// Read Let's Encrypt configuration file
|
- |
|
503 |
$file_conf_LE = fopen(LETS_ENCRYPT_FILE, 'r');
|
- |
|
504 |
if (!$file_conf_LE) {
|
- |
|
505 |
exit('Error opening the file '.LETS_ENCRYPT_FILE);
|
- |
|
506 |
}
|
- |
|
507 |
while (!feof($file_conf_LE)) {
|
- |
|
508 |
$buffer = fgets($file_conf_LE, 4096);
|
- |
|
509 |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
|
- |
|
510 |
$tmp = explode('=', $buffer);
|
- |
|
511 |
$LE_conf[trim($tmp[0])] = trim($tmp[1]);
|
- |
|
512 |
}
|
- |
|
513 |
}
|
- |
|
514 |
fclose($file_conf_LE);
|
- |
|
515 |
|
- |
|
516 |
// Get step
|
- |
|
517 |
if (empty($LE_conf['domainRequest'])) {
|
- |
|
518 |
$step = 1;
|
- |
|
519 |
} else if (!empty($LE_conf['challenge'])) {
|
- |
|
520 |
$step = 2;
|
- |
|
521 |
} else if (($domain === $LE_conf['domainRequest']) && (empty($LE_conf['challenge']))) {
|
- |
|
522 |
$step = 3;
|
- |
|
523 |
} else {
|
- |
|
524 |
$step = 1;
|
- |
|
525 |
}
|
- |
|
526 |
?>
|
- |
|
527 |
<h3>Intégration Let's Encrypt</h3>
|
- |
|
528 |
<?php if ($step === 1) : ?>
|
- |
|
529 |
<form method="post" action="network.php">
|
- |
|
530 |
<input type="hidden" name="action" value="le_issueCert">
|
- |
|
531 |
Status : Inactif<br>
|
- |
|
532 |
Email : <input type="text" name="email" placeholder="adresse@email.com"<?= ((!empty($LE_conf['email'])) ? ' value="'.$LE_conf['email'].'"' : '') ?>><br>
|
- |
|
533 |
Nom de domaine : <input type="text" name="domainname" placeholder="alcasar.domain.tld" required><br>
|
- |
|
534 |
<input type="submit" name="issue" value="Envoyer"><br>
|
- |
|
535 |
</form>
|
- |
|
536 |
<?php elseif ($step === 2): ?>
|
- |
|
537 |
<form method="post" action="network.php">
|
- |
|
538 |
<input type="hidden" name="action" value="le_renewCert">
|
- |
|
539 |
Status : En attente de validation<br>
|
- |
|
540 |
Nom de domaine : <?= $LE_conf['domainRequest'] ?><br>
|
- |
|
541 |
Demandé le : <?= date('d-m-Y H:i:s', $LE_conf['dateIssueRequest']) ?><br>
|
- |
|
542 |
Entrée DNS TXT : "<?= '_acme-challenge.'.$LE_conf['domainRequest'] ?>"<br>
|
- |
|
543 |
Challenge : "<?= $LE_conf['challenge'] ?>"<br>
|
- |
|
544 |
<input type="submit" name="recheck" value="Revérifier"> <input type="submit" name="cancel" value="Annuler"><br>
|
- |
|
545 |
</form>
|
- |
|
546 |
<?php elseif ($step === 3): ?>
|
- |
|
547 |
<form method="post" action="network.php">
|
- |
|
548 |
<input type="hidden" name="action" value="le_renewCert">
|
- |
|
549 |
Status : Actif<br>
|
- |
|
550 |
Nom de domaine : <?= $LE_conf['domainRequest'] ?><br>
|
- |
|
551 |
API : <?= $LE_conf['dnsapi'] ?><br>
|
- |
|
552 |
Prochain renouvellement : <?= date('d-m-Y', $LE_conf['dateNextRenewal']) ?><br>
|
- |
|
553 |
<?php if ($LE_conf['dateNextRenewal'] <= date('U')): ?>
|
- |
|
554 |
<input type="submit" name="recheck" value="Renouveller"><br>
|
- |
|
555 |
<?php else: ?>
|
- |
|
556 |
<input type="submit" name="recheck_force" value="Renouveller (forcer)"><br>
|
- |
|
557 |
<?php endif; ?>
|
- |
|
558 |
</form>
|
- |
|
559 |
<?php endif; ?>
|
- |
|
560 |
<?php if (isset($cmdResponse)): ?>
|
- |
|
561 |
<p><?= $cmdResponse ?></p>
|
- |
|
562 |
<?php endif; ?>
|
- |
|
563 |
</td>
|
470 |
</tr>
|
564 |
</tr>
|
471 |
</table>
|
565 |
</table>
|
472 |
</body>
|
566 |
</body>
|
473 |
</html>
|
567 |
</html>
|
474 |
|
568 |
|
Line 476... |
Line 570... |
476 |
if(isset($_POST['default'])){
|
570 |
if(isset($_POST['default'])){
|
477 |
echo "$l_default_cert";
|
571 |
echo "$l_default_cert";
|
478 |
exec("sudo alcasar-importcert.sh -d");
|
572 |
exec("sudo alcasar-importcert.sh -d");
|
479 |
}
|
573 |
}
|
480 |
if(isset($_POST['MAX_FILE_SIZE'])){
|
574 |
if(isset($_POST['MAX_FILE_SIZE'])){
|
481 |
echo "changement";
|
- |
|
482 |
$maxsize = 100000;
|
575 |
$maxsize = 100000;
|
483 |
if(isset($_FILES['key']) && isset($_FILES['crt']) && $_FILES['key']['error'] == 0 && $_FILES['crt']['error'] == 0){
|
576 |
if(isset($_FILES['key']) && isset($_FILES['crt']) && $_FILES['key']['error'] == 0 && $_FILES['crt']['error'] == 0){
|
484 |
$dest = "/tmp/";
|
577 |
$dest = "/tmp/";
|
485 |
if($_FILES['key']['size'] <= $maxsize && $_FILES['crt']['size'] <= $maxsize)
|
578 |
if($_FILES['key']['size'] <= $maxsize && $_FILES['crt']['size'] <= $maxsize)
|
486 |
{
|
579 |
{
|
Line 495... |
Line 588... |
495 |
$keypath = $dest."alcasar.key";
|
588 |
$keypath = $dest."alcasar.key";
|
496 |
$crtpath = $dest."alcasar.crt";
|
589 |
$crtpath = $dest."alcasar.crt";
|
497 |
move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
|
590 |
move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
|
498 |
move_uploaded_file($_FILES['crt']['tmp_name'], $crtpath);
|
591 |
move_uploaded_file($_FILES['crt']['tmp_name'], $crtpath);
|
499 |
exec("sudo alcasar-importcert.sh -i $crtpath -k $keypath -c $scpath");
|
592 |
exec("sudo alcasar-importcert.sh -i $crtpath -k $keypath -c $scpath");
|
- |
|
593 |
if (file_exists($crtpath)) unlink($crtpath);
|
- |
|
594 |
if (file_exists($keypath)) unlink($keypath);
|
- |
|
595 |
if (file_exists($scpath)) unlink($scpath);
|
500 |
}
|
596 |
}
|
501 |
}
|
597 |
}
|
502 |
}
|
598 |
}
|
503 |
}
|
599 |
}
|
504 |
?>
|
600 |
?>
|