Possibility to generate and delete the root CA in the admin panel
This commit is contained in:
parent
38f1886972
commit
c5c54f3b1a
5 changed files with 110 additions and 6 deletions
42
onyx/include/admin/certificate.php
Normal file
42
onyx/include/admin/certificate.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
if (!defined('ONYX')) exit;
|
||||
|
||||
if (isset($_GET['generate']))
|
||||
{
|
||||
//TODO handle if already exist
|
||||
putenv("OPENSSL_CONF=".ONYX. '../misc/openssl.cnf');
|
||||
putenv("TOP_DIR=".ONYX. '../misc/fic_pki');
|
||||
$output = shell_exec(ONYX . '../misc/CA.sh -newca 2> toto');
|
||||
$template->assign("output", $output);
|
||||
}
|
||||
|
||||
function remove_directory($dir)
|
||||
{
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object)
|
||||
{
|
||||
if ($object != "." && $object != "..")
|
||||
{
|
||||
if (filetype($dir."/".$object) == "dir")
|
||||
remove_directory($dir."/".$object);
|
||||
else
|
||||
unlink($dir."/".$object);
|
||||
}
|
||||
}
|
||||
reset($objects);
|
||||
rmdir($dir);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['delete']))
|
||||
{
|
||||
//TODO handle var path
|
||||
$dir = ONYX . '../misc/fic_pki';
|
||||
|
||||
remove_directory($dir);
|
||||
}
|
||||
|
||||
return "admin/home";
|
||||
Reference in a new issue