Fixes to bug #5

This commit is contained in:
Ryan Prather 2018-08-28 20:46:48 -04:00
parent d6b6fe159d
commit 9edd6c1c35
3 changed files with 21 additions and 3 deletions

View File

@ -155,7 +155,7 @@ foreach ($xml_files as $key => $file) {
continue; continue;
} }
elseif(!empty(STIG_EXCLUSIONS) && preg_match("/" . STIG_EXCLUSIONS . "/i", $file)) { elseif(!empty(STIG_EXCLUSIONS) && preg_match("/" . STIG_EXCLUSIONS . "/i", $file)) {
unlink($file); unlink(TMP . "/stigs/xml/$file");
$log->debug("Skipping $file due to matching STIG exclusion"); $log->debug("Skipping $file due to matching STIG exclusion");
continue; continue;
} }

View File

@ -101,16 +101,26 @@ function save_Database($params)
$php = null; $php = null;
$mysql = null; $mysql = null;
if (strtolower(substr(PHP_OS, 0, 3)) == 'lin') { if (strtolower(substr(PHP_OS, 0, 3)) == 'lin') {
$res = [];
exec("which php", $res);
if (file_exists('/bin/php')) { if (file_exists('/bin/php')) {
$php = realpath("/bin/php"); $php = realpath("/bin/php");
} }
elseif (is_array($res) && isset($res[0]) && file_exists($res[0])) {
$php = realpath($res[0]);
}
else { else {
die(json_encode(['error' => 'Cannot find the PHP executable'])); die(json_encode(['error' => 'Cannot find the PHP executable']));
} }
$res = [];
exec("which mysql", $res);
if (file_exists('/bin/mysql')) { if (file_exists('/bin/mysql')) {
$mysql = realpath('/bin/mysql'); $mysql = realpath('/bin/mysql');
} }
elseif (is_array($res) && isset($res[0]) && file_exists($res[0])) {
$mysql = realpath($res[0]);
}
else { else {
die(json_encode(['error' => 'Cannot find the MySQL executable'])); die(json_encode(['error' => 'Cannot find the MySQL executable']));
} }

View File

@ -51,6 +51,14 @@ if (!is_writable(dirname(__FILE__) . "/config.inc")) {
die("Sagacity needs write access to the config.inc file in the document root"); die("Sagacity needs write access to the config.inc file in the document root");
} }
if(!is_writable(dirname(__FILE__) . "/inc")) {
die("Sagacity needs write access to the /inc directory to create the encrypted password file");
}
if(!file_exists(dirname(__FILE__) . "/logs")) {
mkdir(dirname(__FILE__) . "/logs");
}
if (!function_exists('openssl_encrypt')) { if (!function_exists('openssl_encrypt')) {
print <<<EOO print <<<EOO
The PHP OpenSSL module is not install or enabled.<br /> The PHP OpenSSL module is not install or enabled.<br />
@ -596,14 +604,14 @@ EOL;
<div class='right'> <div class='right'>
<label class='label'>TMP Path:</label> <label class='label'>TMP Path:</label>
<input type='text' id='tmp-path' value='<?php print realpath(getcwd() . "/tmp"); ?>' title='Absolute path to the temporary storage folder' /><br /> <input type='text' id='tmp-path' value='<?php print realpath(getcwd()) . DIRECTORY_SEPARATOR . "tmp"; ?>' title='Absolute path to the temporary storage folder' /><br />
<?php <?php
$log_path = null; $log_path = null;
if (strtolower(substr(PHP_OS, 0, 3)) == 'lin') { if (strtolower(substr(PHP_OS, 0, 3)) == 'lin') {
$log_path = "/var/log/sagacity"; $log_path = "/var/log/sagacity";
} }
else { else {
$log_path = realpath(getcwd()) . "\logs"; $log_path = realpath(getcwd()) . DIRECTORY_SEPARATOR . "logs";
} }
?> ?>