Import-Module icinga-powershell-framework fails in ContranedLanguage powershell when Applocker is enabled
@LordHepipud ci sta già lavorando.
Dal 10/5/2023.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
I am trying to setup the Icinga for Windows with the PowerShell Framework on an Domain managed system.
Do to policy reason the Icinga agent has to run as an domain user and I have configured icinga agent like that (following the instruction.
When I run an powershell as that icinga service user to debug some stuff and try to import the icinga-powershell-framework module I get an error
Import-Module : This module uses the dot-source operator while exporting functions using wildcard characters, and this
is disallowed when the system is under application verification enforcement.
I guess this is caused due to the fact that AppLocker is active on the system and the user is not an Adminstrator and gets an PowerShell with ContrainedLanguage LanguageMode
Expected Behavior
I would like to be able to do an Import-Module icinga-powershell-framework as an normal user even when AppLocker is enabled.
Current Behavior
Failure to do an Import-Module icinga-powershell-framework
PS C:\Windows\system32> Import-Module icinga-powershell-framework
The pipeline has been stopped.
+ CategoryInfo : OperationStopped: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : PipelineStoppedImport-Module : The module to process 'icinga-powershell-framework.psm1', listed in field 'ModuleToProcess/RootModule'
of module manifest 'C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\icinga-powershell-framework.
psd1' was not processed because no valid module was found in any module directory.
At line:1 char:1
- Import-Module icinga-powershell-framework
+ CategoryInfo : ResourceUnavailable: (icinga-powershell-framework:String) [Import-Module], PSInvalidOper ationException + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommandImport-Module : This module uses the dot-source operator while exporting functions using wildcard characters, and this
is disallowed when the system is under application verification enforcement.
At line:1 char:1
- Import-Module icinga-powershell-framework
+ CategoryInfo : SecurityError: (:) [Import-Module], PSSecurityException + FullyQualifiedErrorId : Modules_SystemLockDown_CannotUseDotSourceWithWildCardFunctionExport,Microsoft.PowerShell .Commands.ImportModuleCommand
Possible Solution
Steps to Reproduce (for bugs)
- System with AppLocker enabled somehow (details are beyond my capabilities
- Run PowerShell as normal user.
- Verify LanguageMode is ConstrainedLanguage by displaying $ExecutionContext.SessionState.LanguageMode
- Try to do an Import-Module icinga-powershell-framework
Context
I am trying to setup Icinga agent on an system where I will manage it but won't have Administrator access but can run stuff as the icinga service user
Your Environment
- PowerShell Version used (
$PSVersionTable.PSVersion):
Major Minor Build Revision
5 1 19041 2673
- Operating System and version (
Get-IcingaWindowsInformation Win32_OperatingSystem | Select-Object Version, BuildNumber, Caption):
Version BuildNumber Caption
10.0.19045 19045 Microsoft Windows 10 Enterprise
- Lingua principale
- PowerShell
- Stelle
- 86
- Fork
- 34
- Merge medio
- 4g 11h
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Icinga/icinga-powershell-framework
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 70/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
Icinga/icinga-powershell-framework#883 · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100