Use a variable to handle the misc_dir
This commit is contained in:
parent
e137e755c0
commit
a9fdcaf9f2
3 changed files with 58 additions and 26 deletions
|
|
@ -24,39 +24,53 @@ function remove_directory($dir)
|
|||
|
||||
function new_client($name)
|
||||
{
|
||||
//TODO handle if already exist
|
||||
putenv("OPENSSL_CONF=".ONYX. '../misc/openssl.cnf');
|
||||
putenv("TOP_DIR=".ONYX. '../misc/pki');
|
||||
$output = shell_exec(ONYX . "../misc/CA.sh -newclient $name");
|
||||
if (isset($VAR['misc_dir']))
|
||||
$misc_dir = $VAR['misc_dir'];
|
||||
else
|
||||
{
|
||||
erreur("Merci d'ajouter la variable misc_dir dans root.xml");
|
||||
return "admin/home";
|
||||
}
|
||||
|
||||
//TODO handle if already exist
|
||||
putenv("OPENSSL_CONF=$misc_dir/openssl.cnf");
|
||||
putenv("TOP_DIR=$misc_dir/pki");
|
||||
$output = shell_exec("$misc_dir/CA.sh -newclient $name");
|
||||
}
|
||||
|
||||
if (!empty($p[2]))
|
||||
{
|
||||
if (isset($VAR['misc_dir']))
|
||||
$misc_dir = $VAR['misc_dir'];
|
||||
else
|
||||
{
|
||||
erreur("Merci d'ajouter la variable misc_dir dans root.xml");
|
||||
return "admin/home";
|
||||
}
|
||||
|
||||
$misc_dir = $VAR['misc_dir'];
|
||||
|
||||
if ($p[2] == "newca")
|
||||
{
|
||||
//TODO handle if already exist
|
||||
putenv("OPENSSL_CONF=".ONYX. '../misc/openssl.cnf');
|
||||
putenv("TOP_DIR=".ONYX. '../misc/pki');
|
||||
$output = shell_exec(ONYX . '../misc/CA.sh -newca');
|
||||
putenv("OPENSSL_CONF=$misc_dir/openssl.cnf");
|
||||
putenv("TOP_DIR=$misc_dir/pki");
|
||||
$output = shell_exec("$misc_dir/CA.sh -newca");
|
||||
|
||||
//TODO handle the path ?
|
||||
$ca_file = ONYX . '../misc/pki/cacert.crt';
|
||||
$ca_file = "$misc_dir/pki/cacert.crt";
|
||||
//TODO check permission ?
|
||||
if (file_exists($ca_file))
|
||||
{
|
||||
$data = openssl_x509_parse(file_get_contents(ONYX . '../misc/pki/cacert.crt'));
|
||||
$data = openssl_x509_parse(file_get_contents("$misc_dir/pki/cacert.crt"));
|
||||
$template->assign("cert", $data);
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($p[2] == "deleteca")
|
||||
{
|
||||
//TODO handle var path
|
||||
$dir = ONYX . '../misc/pki';
|
||||
|
||||
$dir = "$misc_dir/pki";
|
||||
remove_directory($dir);
|
||||
}
|
||||
}
|
||||
|
||||
//header("Location: /admin/");
|
||||
//exit;
|
||||
header("Location: /admin/");
|
||||
exit;
|
||||
|
|
|
|||
Reference in a new issue