mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 23:29:40 -05:00
Add easier handling to set user permissions
This commit is contained in:
parent
faad535f31
commit
a305318aee
3 changed files with 15 additions and 6 deletions
|
|
@ -421,11 +421,7 @@ function Start-IcingaAgentInstallWizard()
|
||||||
if ($RunInstaller) {
|
if ($RunInstaller) {
|
||||||
if ((Install-IcingaAgent -Version $AgentVersion -Source $PackageSource -AllowUpdates $AllowVersionChanges) -Or $Reconfigure) {
|
if ((Install-IcingaAgent -Version $AgentVersion -Source $PackageSource -AllowUpdates $AllowVersionChanges) -Or $Reconfigure) {
|
||||||
Move-IcingaAgentDefaultConfig;
|
Move-IcingaAgentDefaultConfig;
|
||||||
Set-IcingaAgentServiceUser -User $ServiceUser -Password $ServicePass | Out-Null;
|
Set-IcingaAgentServiceUser -User $ServiceUser -Password $ServicePass -SetPermission | Out-Null;
|
||||||
Set-IcingaAgentServicePermission | Out-Null;
|
|
||||||
Set-IcingaAcl "$Env:ProgramData\icinga2\etc";
|
|
||||||
Set-IcingaAcl "$Env:ProgramData\icinga2\var";
|
|
||||||
Set-IcingaAcl (Get-IcingaCacheDir);
|
|
||||||
Install-IcingaFrameworkService -Path $ServiceBin -User $ServiceUser -Password $ServicePass | Out-Null;
|
Install-IcingaFrameworkService -Path $ServiceBin -User $ServiceUser -Password $ServicePass | Out-Null;
|
||||||
Register-IcingaBackgroundDaemon -Command 'Start-IcingaServiceCheckDaemon';
|
Register-IcingaBackgroundDaemon -Command 'Start-IcingaServiceCheckDaemon';
|
||||||
Install-IcingaAgentBaseFeatures;
|
Install-IcingaAgentBaseFeatures;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ function Set-IcingaAgentServiceUser()
|
||||||
param(
|
param(
|
||||||
[string]$User,
|
[string]$User,
|
||||||
[securestring]$Password,
|
[securestring]$Password,
|
||||||
[string]$Service = 'icinga2'
|
[string]$Service = 'icinga2',
|
||||||
|
[switch]$SetPermission
|
||||||
);
|
);
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($User)) {
|
if ([string]::IsNullOrEmpty($User)) {
|
||||||
|
|
@ -26,6 +27,11 @@ function Set-IcingaAgentServiceUser()
|
||||||
-FlushNewLines $TRUE;
|
-FlushNewLines $TRUE;
|
||||||
|
|
||||||
if ($Output.ExitCode -eq 0) {
|
if ($Output.ExitCode -eq 0) {
|
||||||
|
|
||||||
|
if ($SetPermission) {
|
||||||
|
Set-IcingaUserPermissions;
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host 'Service User successfully updated'
|
Write-Host 'Service User successfully updated'
|
||||||
return $TRUE;
|
return $TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
function Set-IcingaUserPermissions()
|
||||||
|
{
|
||||||
|
Set-IcingaAgentServicePermission | Out-Null;
|
||||||
|
Set-IcingaAcl "$Env:ProgramData\icinga2\etc";
|
||||||
|
Set-IcingaAcl "$Env:ProgramData\icinga2\var";
|
||||||
|
Set-IcingaAcl (Get-IcingaCacheDir);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue