Fixed password expiration on Windows based images

This commit is contained in:
dotneft 2022-08-17 12:41:22 +03:00 committed by Alexey Pustovalov
parent 19acd6dad4
commit 33388a5d56
2 changed files with 4 additions and 2 deletions

View File

@ -46,7 +46,8 @@ RUN Set-Location -Path $env:SystemDrive\.; `
New-Item -ItemType directory -Path $env:ZBX_HOME\modules | Out-Null; ` New-Item -ItemType directory -Path $env:ZBX_HOME\modules | Out-Null; `
New-Item -ItemType directory -Path $env:ZBX_HOME\buffer | Out-Null; ` New-Item -ItemType directory -Path $env:ZBX_HOME\buffer | Out-Null; `
` `
net user /add zabbix; ` net accounts /MaxPWAge:unlimited; `
net user /add zabbix /expire:never /passwordreq:no; `
$acl = Get-Acl -Path $env:ZBX_HOME; ` $acl = Get-Acl -Path $env:ZBX_HOME; `
$ace = New-Object Security.AccessControl.FileSystemAccessRule ('zabbix', 'Modify', 'ContainerInherit, ObjectInherit', 'InheritOnly', 'Allow'); ` $ace = New-Object Security.AccessControl.FileSystemAccessRule ('zabbix', 'Modify', 'ContainerInherit, ObjectInherit', 'InheritOnly', 'Allow'); `
$acl.AddAccessRule($ace); ` $acl.AddAccessRule($ace); `

View File

@ -46,7 +46,8 @@ RUN Set-Location -Path $env:SystemDrive\.; `
New-Item -ItemType directory -Path $env:ZBX_HOME\modules | Out-Null; ` New-Item -ItemType directory -Path $env:ZBX_HOME\modules | Out-Null; `
New-Item -ItemType directory -Path $env:ZBX_HOME\buffer | Out-Null; ` New-Item -ItemType directory -Path $env:ZBX_HOME\buffer | Out-Null; `
` `
net user /add zabbix; ` net accounts /MaxPWAge:unlimited; `
net user /add zabbix /expire:never /passwordreq:no; `
$acl = Get-Acl -Path $env:ZBX_HOME; ` $acl = Get-Acl -Path $env:ZBX_HOME; `
$ace = New-Object Security.AccessControl.FileSystemAccessRule ('zabbix', 'Modify', 'ContainerInherit, ObjectInherit', 'InheritOnly', 'Allow'); ` $ace = New-Object Security.AccessControl.FileSystemAccessRule ('zabbix', 'Modify', 'ContainerInherit, ObjectInherit', 'InheritOnly', 'Allow'); `
$acl.AddAccessRule($ace); ` $acl.AddAccessRule($ace); `