From 7c45cd5f6937e21df7d23cc099f19e6f23ea627e Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Tue, 9 Oct 2018 06:21:34 -0500 Subject: [PATCH] Check and report the correct directories (#9310) DO NOT DELETE THIS TEXT #### Please note > Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting. - [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/) #### Testers If you would like to test this pull request then please run: `./scripts/github-apply `, i.e `./scripts/github-apply 5926` After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert. --- LibreNMS/Validations/User.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/LibreNMS/Validations/User.php b/LibreNMS/Validations/User.php index 40d85b23a6..74ce2fc572 100644 --- a/LibreNMS/Validations/User.php +++ b/LibreNMS/Validations/User.php @@ -63,18 +63,20 @@ class User extends BaseValidation // Let's test the user configured if we have it if (Config::has('user')) { $dir = Config::get('install_dir'); + $log_dir = Config::get('log_dir', "$dir/logs"); + $rrd_dir = Config::get('rrd_dir', "$dir/rrd"); // generic fix $fix = "sudo chown -R $lnms_username:$lnms_groupname $dir\n" . - "sudo setfacl -d -m g::rwx $dir/rrd $dir/logs $dir/bootstrap/cache/ $dir/storage/\n" . - "sudo chmod -R ug=rwX $dir/rrd $dir/logs $dir/bootstrap/cache/ $dir/storage/\n"; + "sudo setfacl -d -m g::rwx $rrd_dir $log_dir $dir/bootstrap/cache/ $dir/storage/\n" . + "sudo chmod -R ug=rwX $rrd_dir $log_dir $dir/bootstrap/cache/ $dir/storage/\n"; $find_result = rtrim(`find $dir \! -user $lnms_username -o \! -group $lnms_groupname 2> /dev/null`); if (!empty($find_result)) { // Ignore files created by the webserver $ignore_files = array( - "$dir/logs/error_log", - "$dir/logs/access_log", + "$log_dir/error_log", + "$log_dir/access_log", "$dir/bootstrap/cache/", "$dir/storage/framework/cache/", "$dir/storage/framework/sessions/", @@ -106,8 +108,8 @@ class User extends BaseValidation // check folder permissions $folders = [ - 'rrd' => Config::get('rrd_dir'), - 'log' => Config::get('log_dir'), + 'rrd' => $rrd_dir, + 'log' => $log_dir, 'bootstrap' => "$dir/bootstrap/cache/", 'storage' => "$dir/storage/", 'cache' => "$dir/storage/framework/cache/",