diff --git a/config.php.default b/config.php.default index 215a72e8f5..f6b031cd77 100755 --- a/config.php.default +++ b/config.php.default @@ -14,6 +14,10 @@ $config['memcached']['enable'] = FALSE; $config['memcached']['host'] = 'localhost'; $config['memcached']['port'] = 11211; +// This is the user LibreNMS will run as +//Please ensure this user is created and has the correct permissions to your install +$config['user'] = 'librenms'; + ### Locations - it is recommended to keep the default #$config['install_dir'] = "/opt/librenms"; diff --git a/doc/Support/Install Validation.md b/doc/Support/Install Validation.md index ec56217812..6283a99720 100644 --- a/doc/Support/Install Validation.md +++ b/doc/Support/Install Validation.md @@ -11,6 +11,9 @@ So, to try and help with some of the general issues people come across we've put - Checks if you are running the older alerting system. - Checks your rrd directory setup if not running rrdcached. - Checks disk space for where /opt/librenms is installed. + - Checks location to fping + - Tests MySQL strict mode being enabled + - Tests for files not owned by librenms user (if configured) Optionally you can also pass -m and a module name for that to be tested. Current modules are: diff --git a/html/install.php b/html/install.php index 0754dcfaef..8dbfde4c47 100644 --- a/html/install.php +++ b/html/install.php @@ -375,6 +375,10 @@ $config_file = <<<"EOD" \$config\['db_name'\] = '$dbname'; \$config\['db'\]\['extension'\] = "mysqli";// mysql or mysqli +// This is the user LibreNMS will run as +//Please ensure this user is created and has the correct permissions to your install +\$config['user'] = 'librenms'; + ### Memcached config - We use this to store realtime usage \$config\['memcached'\]\['enable'\] = FALSE; \$config\['memcached'\]\['host'\] = "localhost"; diff --git a/validate.php b/validate.php index 0088e9411c..dbfc89c4a3 100755 --- a/validate.php +++ b/validate.php @@ -59,6 +59,25 @@ require_once 'includes/definitions.inc.php'; require_once 'includes/functions.php'; require_once $config['install_dir'].'/includes/alerts.inc.php'; +// Let's test the user configured if we have it +if (isset($config['user'])) { + $tmp_user = $config['user']; + $tmp_dir = $config['install_dir']; + $tmp_log = $config['log_dir']; + $find_result = rtrim(`find $tmp_dir \! -user $tmp_user -not -path $tmp_log`); + if (!empty($find_result)) { + // This isn't just the log directory, let's print the list to the user + $files = explode(PHP_EOL, $find_result); + if (is_array($files)) { + print_fail("We have found some files that are owned by a different user than $tmp_user, this will stop you updating automatically and / or rrd files being updated causing graphs to fail:\n"); + foreach ($files as $file) { + echo "$file\n"; + } + echo "\n"; + } + } +} + // Run test on MySQL $test_db = @mysqli_connect($config['db_host'], $config['db_user'], $config['db_pass'], $config['db_name']); if (mysqli_connect_error()) {