Icinga / icinga-powershell-hyperv

A collection of Hyper-V plugins for the Icinga Powershell Framework
GNU General Public License v2.0
5 stars 0 forks source link

[ScriptBlock] variables which are forbidden in JEA context. #56

Closed CHOOH1992 closed 2 years ago

CHOOH1992 commented 2 years ago

Expected Behavior

After enabling JEA I expected the hyper-v plugins to work fine.

Current Behavior

No plugin was working anymore.

Steps to Reproduce (for bugs)

  1. Install Framework (1.8.0)
  2. Install Plugins (1.8.0)
  3. Install all other available components
  4. Enable JEA with Managed user

Context

This gives out an error: [Error]: Unable to include module "icinga-powershell-hyperv" into JEA profile. The file "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-hyperv\1.0.0\provider\vcomputer\Get-IcingaVirtualComputerInfo.psm1" is using one or more [ScriptBlock] variables which are forbidden in JEA context.

So I tried to manually enable script-blocks: Install-IcingaSecurity -AllowScriptBlocks Did actually not work out as alll checks went into UNKNOWN. [UNKNOWN] Icinga Exception: Unable to start the PowerShell.exe with the provided JEA profile "IcingaForWindows" for CheckCommand:

Also the uninstallation gives out an error (but worked):

[Error]: Failed to remove items from path "C:\Users\icinga". Recurse is "True", Force is "True": "System.UnauthorizedAccessException: Der Zugriff auf den Pfad "C:\Users\icinga\Anwendungsdaten" wurde verweigert.
   bei System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   bei System.IO.FileSystemEnumerableIterator`1.CommonInit()
   bei System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   bei System.IO.DirectoryInfo.EnumerateDirectories()
   bei Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force, Boolean rootOfRemoval)
   bei Microsoft.PowerShell.Commands.FileSystemProvider.RemoveDirectoryInfoItem(DirectoryInfo directory, Boolean recurse, Boolean force, Boolean rootOfRemoval)
   bei Microsoft.PowerShell.Commands.FileSystemProvider.RemoveItem(String path, Boolean recurse)"

Your Environment

Best regards

LordHepipud commented 2 years ago

Hello,

thank you for the issue. I moved it to the Hyper-V plugin collection. This issue is already fixed with v1.1.0, which we hopefully will be releasing soon. Afterwards this problem is gone.