Hardcode the access mode to use when creating directories

refs #7163
This commit is contained in:
Johannes Meyer 2014-11-12 09:18:19 +01:00
parent 4974f582d3
commit ca66480ba7
5 changed files with 8 additions and 13 deletions

View File

@ -124,12 +124,7 @@ class MonitoringWizard extends Wizard implements SetupWizard
$pageData = $this->getPageData();
$setup = new Setup();
$setup->addStep(
new MakeDirStep(
array($this->getConfigDir() . '/modules/monitoring'),
$pageData['setup_general_config']['global_filemode']
)
);
$setup->addStep(new MakeDirStep(array($this->getConfigDir() . '/modules/monitoring'), 0775));
$setup->addStep(
new BackendStep(array(

View File

@ -20,13 +20,13 @@ class ConfigCommand extends Command
*
* OPTIONS:
*
* --mode The access mode to use. Default is: 2775
* --mode The access mode to use. Default is: 2770
* --path The path to the configuration directory. If omitted the default is used.
*
* EXAMPLES:
*
* icingacli setup config createDirectory apache
* icingacli setup config createDirectory apache --mode 2770
* icingacli setup config createDirectory apache --mode 2775
* icingacli setup config createDirectory apache --path /some/path
*/
public function createDirectoryAction()
@ -43,7 +43,7 @@ class ConfigCommand extends Command
return true;
}
$mode = octdec($this->params->get('mode', '2775'));
$mode = octdec($this->params->get('mode', '2770'));
if (false === mkdir($path)) {
$this->fail(sprintf($this->translate('Unable to create path: %s'), $path));
return false;

View File

@ -71,7 +71,7 @@ $cliPath = realpath(Icinga::app()->getApplicationDir() . '/../bin/icingacli');
</div>
<p><?= mt('setup', 'In case the IcingaCLI is missing you can create the token manually:'); ?></p>
<div class="code">
<span>su <?= ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?> && mkdir -m 2775 <?= dirname($setupTokenPath); ?>;</span>
<span>su <?= ($user = Platform::getPhpUser()) !== null ? $user : 'your_webserver_group'; ?> && mkdir -m 2770 <?= dirname($setupTokenPath); ?>;</span>
<span>head -c 12 /dev/urandom | base64 | tee <?= $setupTokenPath; ?>;</span>
<span>chmod 0660 <?= $setupTokenPath; ?>;</span>
</div>

View File

@ -16,12 +16,12 @@ class MakeDirStep extends Step
/**
* @param array $paths
* @param string $dirmode
* @param int $dirmode
*/
public function __construct($paths, $dirmode)
{
$this->paths = $paths;
$this->dirmode = octdec($dirmode) | octdec('111'); // Make sure that the directories can be traversed
$this->dirmode = $dirmode;
$this->errors = array();
}

View File

@ -355,7 +355,7 @@ class WebWizard extends Wizard implements SetupWizard
$configDir . '/preferences',
$configDir . '/enabledModules'
),
$pageData['setup_general_config']['global_filemode']
0775
)
);