From 36015f4fc2507e26d8407bd2ab85659238192706 Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Tue, 20 Feb 2024 14:11:40 +0100 Subject: [PATCH] Fixes JEA installer to exclude domain from user name length check --- doc/100-General/10-Changelog.md | 4 ++++ lib/core/jea/Install-IcingaJeaProfile.psm1 | 6 ++++-- lib/core/windows/Install-IcingaSecurity.psm1 | 6 ++++-- lib/core/windows/New-IcingaWindowsUser.psm1 | 6 ++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/doc/100-General/10-Changelog.md b/doc/100-General/10-Changelog.md index 35f0bcf..1265a03 100644 --- a/doc/100-General/10-Changelog.md +++ b/doc/100-General/10-Changelog.md @@ -11,6 +11,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic [Issues and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/28) +### Bugfixes + +* [#683](https://github.com/Icinga/icinga-powershell-framework/pull/683) Fixes JEA installer to exclude domain from user name length check, which can easily exceed the Windows 20 digits username limit + ### Enhancements * [#679](https://github.com/Icinga/icinga-powershell-framework/pull/679) Adds a new data provider for fetching process information of Windows systems, while sorting all objects based on a process name and their process id diff --git a/lib/core/jea/Install-IcingaJeaProfile.psm1 b/lib/core/jea/Install-IcingaJeaProfile.psm1 index 43a37e0..dcbd8a1 100644 --- a/lib/core/jea/Install-IcingaJeaProfile.psm1 +++ b/lib/core/jea/Install-IcingaJeaProfile.psm1 @@ -13,9 +13,11 @@ function Install-IcingaJEAProfile() return; } + $IcingaUserInfo = Split-IcingaUserDomain -User $IcingaUser; + # Max length for the user name - if ($IcingaUser.Length -gt 20) { - Write-IcingaConsoleError 'The specified user name "{0}" is too long. The maximum character limit is 20 digits.' -Objects $IcingaUser; + if ($IcingaUserInfo.User.Length -gt 20) { + Write-IcingaConsoleError 'The specified user name "{0}" is too long. The maximum character limit is 20 digits.' -Objects $IcingaUserInfo.User; return; } diff --git a/lib/core/windows/Install-IcingaSecurity.psm1 b/lib/core/windows/Install-IcingaSecurity.psm1 index 770fb1e..a78f301 100644 --- a/lib/core/windows/Install-IcingaSecurity.psm1 +++ b/lib/core/windows/Install-IcingaSecurity.psm1 @@ -17,9 +17,11 @@ function Install-IcingaSecurity() return; } + $IcingaUserInfo = Split-IcingaUserDomain -User $IcingaUser; + # Max length for the user name - if ($IcingaUser.Length -gt 20) { - Write-IcingaConsoleError 'The specified user name "{0}" is too long. The maximum character limit is 20 digits.' -Objects $IcingaUser; + if ($IcingaUserInfo.User.Length -gt 20) { + Write-IcingaConsoleError 'The specified user name "{0}" is too long. The maximum character limit is 20 digits.' -Objects $IcingaUserInfo.User; return; } diff --git a/lib/core/windows/New-IcingaWindowsUser.psm1 b/lib/core/windows/New-IcingaWindowsUser.psm1 index 1e53aab..f2520e0 100644 --- a/lib/core/windows/New-IcingaWindowsUser.psm1 +++ b/lib/core/windows/New-IcingaWindowsUser.psm1 @@ -13,9 +13,11 @@ function New-IcingaWindowsUser() }; } + $IcingaUserInfo = Split-IcingaUserDomain -User $IcingaUser; + # Max length for the user name - if ($IcingaUser.Length -gt 20) { - Write-IcingaConsoleError 'The specified user name "{0}" is too long. The maximum character limit is 20 digits.' -Objects $IcingaUser; + if ($IcingaUserInfo.User.Length -gt 20) { + Write-IcingaConsoleError 'The specified user name "{0}" is too long. The maximum character limit is 20 digits.' -Objects $IcingaUserInfo.User; return @{ 'User' = $null;