mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
Added support for specifying user in config and then validating install
This commit is contained in:
parent
74b293ef06
commit
4cc9482dbe
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
19
validate.php
19
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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user