diff --git a/JEAnalyzer/JEAnalyzer.psd1 b/JEAnalyzer/JEAnalyzer.psd1 index b45f1d8..be5f6dc 100644 --- a/JEAnalyzer/JEAnalyzer.psd1 +++ b/JEAnalyzer/JEAnalyzer.psd1 @@ -4,7 +4,7 @@ # Version number of this module. - ModuleVersion = '1.3.17' + ModuleVersion = '1.3.19' # ID used to uniquely identify this module GUID = '346caa76-534a-4651-88f5-359e85cd71c0' @@ -27,7 +27,7 @@ # Modules that must be imported into the global environment prior to importing # this module RequiredModules = @( - @{ ModuleName = 'PSFramework'; ModuleVersion = '1.8.289' } + @{ ModuleName = 'PSFramework'; ModuleVersion = '1.12.346' } ) # Assemblies that must be loaded prior to importing this module @@ -80,13 +80,13 @@ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. - # Tags = @() + Tags = @('jea') # A URL to the license for this module. - # LicenseUri = '' + LicenseUri = 'https://github.com/PSSecTools/JEAnalyzer/blob/master/LICENSE' # A URL to the main website for this project. - # ProjectUri = '' + ProjectUri = 'https://github.com/PSSecTools/JEAnalyzer' # A URL to an icon representing this module. # IconUri = '' diff --git a/JEAnalyzer/changelog.md b/JEAnalyzer/changelog.md index a2e467c..c5b1a61 100644 --- a/JEAnalyzer/changelog.md +++ b/JEAnalyzer/changelog.md @@ -1,5 +1,10 @@ # Changelog +## 1.3.19 (2025-05-07) + +- Upd: New-JeaModule - better service account validation and processing +- Fix: Install-JeaModule - unexpected error when failing to connect to remote computer + ## 1.3.17 (2023-06-18) - New: Get-JeaEndpoint - Retrieve JEA Endpoints and their capabilities from target computers. diff --git a/JEAnalyzer/en-us/strings.psd1 b/JEAnalyzer/en-us/strings.psd1 index ec1c019..3b8009f 100644 --- a/JEAnalyzer/en-us/strings.psd1 +++ b/JEAnalyzer/en-us/strings.psd1 @@ -15,7 +15,8 @@ 'Export-JeaModule.Role.VisibleCmdlet' = '[Role: {0}] Adding visible Cmdlet: {1}{2}' # $role.Name, $commandName, $parameterText 'Export-JeaModule.Role.VisibleFunction' = '[Role: {0}] Adding visible Function: {1}{2}' # $role.Name, $commandName, $parameterText - 'FileSystem.Directory.Fail' = 'Not a directory: {0}' # , + 'Validate.FileSystem.Directory.Fail' = 'Not a directory: {0}' # , + 'Validate.ServiceAccount' = 'Invalid account name: Must be a valid NTAccount name notation (\samaccountname)' # , 'General.BoundParameters' = 'Bound parameters: {0}' # ($PSBoundParameters.Keys -join ", ") diff --git a/JEAnalyzer/functions/construct/New-JeaModule.ps1 b/JEAnalyzer/functions/construct/New-JeaModule.ps1 index cd34f9c..4b132e7 100644 --- a/JEAnalyzer/functions/construct/New-JeaModule.ps1 +++ b/JEAnalyzer/functions/construct/New-JeaModule.ps1 @@ -81,6 +81,7 @@ [string] $Identity, + [PsfValidateScript('JEAnalyzer.Validate.ServiceAccount', ErrorString = 'JEAnalyzer.Validate.ServiceAccount')] [string] $ServiceAccount, @@ -120,7 +121,7 @@ Company = $Company } if ($Identity) { $module.Roles[$Name] = New-JeaRole -Name $Name -Identity $Identity } - if ($ServiceAccount) { $module.ServiceAccount = $ServiceAccount } + if ($ServiceAccount) { $module.ServiceAccount = $ServiceAccount -replace '\$$' } if ($RequiredModules) { $module.RequiredModules = $RequiredModules } if ($ModulesToImport) { $module.ModulesToImport = $ModulesToImport } foreach ($scriptFile in $PreImport) { $module.PreimportScripts[$scriptFile.Name] = $scriptFile } diff --git a/JEAnalyzer/functions/deploy/Install-JeaModule.ps1 b/JEAnalyzer/functions/deploy/Install-JeaModule.ps1 index 1f4ef6a..2e882b7 100644 --- a/JEAnalyzer/functions/deploy/Install-JeaModule.ps1 +++ b/JEAnalyzer/functions/deploy/Install-JeaModule.ps1 @@ -78,7 +78,7 @@ if ($failedServers) { if ($EnableException) { Stop-PSFFunction -String 'Install-JeaModule.Connections.Failed' -StringValues ($failedServers.TargetObject -join ", ") -Target $failedServers.TargetObject -EnableException $EnableException } - foreach ($failure in $failedServers) { Write-PSFMessage -Level Warning -String 'Install-JeaModule.Connections.Failed' -StringValues $failure.TargetObject -ErrorRecord $_ -Target $failure.TargetObject } + foreach ($failure in $failedServers) { Write-PSFMessage -Level Warning -String 'Install-JeaModule.Connections.Failed' -StringValues $failure.TargetObject -ErrorRecord $failure -Target $failure.TargetObject } } if (-not $sessions) { diff --git a/JEAnalyzer/internal/scriptblock/validateServiceAccount.ps1 b/JEAnalyzer/internal/scriptblock/validateServiceAccount.ps1 new file mode 100644 index 0000000..cf03d58 --- /dev/null +++ b/JEAnalyzer/internal/scriptblock/validateServiceAccount.ps1 @@ -0,0 +1,3 @@ +Set-PSFScriptblock -Name 'JEAnalyzer.Validate.ServiceAccount' -Scriptblock { + $_ -match '^[^\\]+\\[^\\]+$' +} -Global \ No newline at end of file diff --git a/JEAnalyzer/tests/general/strings.Exceptions.ps1 b/JEAnalyzer/tests/general/strings.Exceptions.ps1 index 1f1060f..3cdb6bd 100644 --- a/JEAnalyzer/tests/general/strings.Exceptions.ps1 +++ b/JEAnalyzer/tests/general/strings.Exceptions.ps1 @@ -13,7 +13,7 @@ $exceptions['LegalSurplus'] = @( ) #> $exceptions['LegalSurplus'] = @( - + 'Validate.FileSystem.Directory.Fail' ) $exceptions['NoTextNeeded'] = @( @@ -28,6 +28,9 @@ $exceptions['NoTextNeeded'] = @( 'Validate.Uri.Absolute' 'Validate.Uri.Absolute.File' 'Validate.Uri.Absolute.Https' + + 'FileSystem.Directory.Fail' + 'Validate.FileSystem.Directory.Fail' ) $exceptions \ No newline at end of file