From 9edd6c1c353b3f0cfda383089b861da658acf630 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Tue, 28 Aug 2018 20:46:48 -0400 Subject: [PATCH] Fixes to bug #5 --- exec/background_stigs.php | 2 +- exec/installer.php | 10 ++++++++++ setup.php | 12 ++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/exec/background_stigs.php b/exec/background_stigs.php index 03c3637..7d01cdb 100644 --- a/exec/background_stigs.php +++ b/exec/background_stigs.php @@ -155,7 +155,7 @@ foreach ($xml_files as $key => $file) { continue; } 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"); continue; } diff --git a/exec/installer.php b/exec/installer.php index 7e00965..22937ce 100644 --- a/exec/installer.php +++ b/exec/installer.php @@ -101,16 +101,26 @@ function save_Database($params) $php = null; $mysql = null; if (strtolower(substr(PHP_OS, 0, 3)) == 'lin') { + $res = []; + exec("which php", $res); if (file_exists('/bin/php')) { $php = realpath("/bin/php"); } + elseif (is_array($res) && isset($res[0]) && file_exists($res[0])) { + $php = realpath($res[0]); + } else { die(json_encode(['error' => 'Cannot find the PHP executable'])); } + $res = []; + exec("which mysql", $res); if (file_exists('/bin/mysql')) { $mysql = realpath('/bin/mysql'); } + elseif (is_array($res) && isset($res[0]) && file_exists($res[0])) { + $mysql = realpath($res[0]); + } else { die(json_encode(['error' => 'Cannot find the MySQL executable'])); } diff --git a/setup.php b/setup.php index febbbf6..e9a7a96 100644 --- a/setup.php +++ b/setup.php @@ -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"); } +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')) { print << @@ -596,14 +604,14 @@ EOL;
-
+