From f85ddeb2156866fdf25fc369cd8c8715e94106af Mon Sep 17 00:00:00 2001
From: Johannes Meyer
Date: Fri, 7 Nov 2014 14:40:28 +0100
Subject: [PATCH] Do not hardcode the php username dummy in
Icinga\Application\Platform
refs #7163
---
application/views/scripts/form/setup-welcome.phtml | 6 +++---
library/Icinga/Application/Platform.php | 2 --
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/application/views/scripts/form/setup-welcome.phtml b/application/views/scripts/form/setup-welcome.phtml
index 76947fbe6f..47f5c6c865 100644
--- a/application/views/scripts/form/setup-welcome.phtml
+++ b/application/views/scripts/form/setup-welcome.phtml
@@ -65,13 +65,13 @@ $setupTokenPath = rtrim(Icinga::app()->getConfigDir(), '/') . '/setup.token';
); ?>
= t('If you\'ve got the IcingaCLI installed you can do the following:'); ?>
- sudo icingacli setup createConfigDirectory = Platform::getPhpUser(); ?>;
+ sudo icingacli setup createConfigDirectory = ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?>;
sudo icingacli setup generateToken;
= t('In case the IcingaCLI is missing you can create the token manually:'); ?>
- sudo mkdir -m 2775 = dirname($setupTokenPath); ?> && sudo chgrp = Platform::getPhpUser(); ?> = dirname($setupTokenPath); ?>;
- head -c 12 /dev/urandom | base64 | sudo -u '= Platform::getPhpUser(); ?>' tee = $setupTokenPath; ?>;
+ sudo mkdir -m 2775 = dirname($setupTokenPath); ?> && sudo chgrp = ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?> = dirname($setupTokenPath); ?>;
+ head -c 12 /dev/urandom | base64 | sudo -u '= ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?>' tee = $setupTokenPath; ?>;
sudo chmod 0660 = $setupTokenPath; ?>;
= sprintf(
diff --git a/library/Icinga/Application/Platform.php b/library/Icinga/Application/Platform.php
index 6075ba83b4..2592194350 100644
--- a/library/Icinga/Application/Platform.php
+++ b/library/Icinga/Application/Platform.php
@@ -156,8 +156,6 @@ public static function getPhpUser()
$userInfo = posix_getpwuid(posix_geteuid());
return $userInfo['name'];
}
-
- return 'php_username';
}
/**