Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency version checks fail for offline install #614

Closed
General-Fault opened this issue May 5, 2020 · 1 comment
Closed

Dependency version checks fail for offline install #614

General-Fault opened this issue May 5, 2020 · 1 comment

Comments

@General-Fault
Copy link

General-Fault commented May 5, 2020

Describe the bug
Import-Module fails when PowerSTIG and/or dependencies are installed from a local or private repository.
The problem is that when installed through an offline NuGet package, the version number in the folder name ay be missing the build number if it is "0". For example, AccessControlDsc 1.4 is placed in "C:\Program Files\WindowsPowerShell\Modules\AccessControlDsc\1.4.0" however the PowerSTIG dependency check fails if it is not located in C:\Program Files\WindowsPowerShell\Modules\AccessControlDsc\1.4.0.0" (note the extra ".0" in the version number).

To Reproduce

  1. Create a local repository
    Register-PSRepository -Name TestRepo -SourceLocation C:\TestRepo -InstallationPolicy Trusted

  2. Download the PowerSTIG package from PowerShell Gallery (https://www.powershellgallery.com/packages/PowerSTIG/) and copy to the local repository.

  3. Download the PowerSTIG dependencies as NuGet packages and place them in the local repository.
    https://www.powershellgallery.com/packages/AuditPolicyDsc/1.2.0.0
    https://www.powershellgallery.com/packages/AuditSystemDsc/1.1.0
    https://www.powershellgallery.com/packages/AccessControlDSC/1.4.0.0
    https://www.powershellgallery.com/packages/ComputerManagementDsc/6.2.0.0
    https://www.powershellgallery.com/packages/FileContentDsc/1.1.0.108
    https://www.powershellgallery.com/packages/GPRegistryPolicyDsc/1.2.0
    https://www.powershellgallery.com/packages/PSDscResources/2.10.0.0
    https://www.powershellgallery.com/packages/SecurityPolicyDsc/2.4.0.0
    https://www.powershellgallery.com/packages/SqlServerDsc/13.3.0
    https://www.powershellgallery.com/packages/WindowsDefenderDsc/1.0.0.0
    https://www.powershellgallery.com/packages/xDnsServer/1.11.0.0
    https://www.powershellgallery.com/packages/xWebAdministration/2.5.0.0

  4. Install PowerSTIG from the local repository (see also PowerShell package cannot be found in offline repository (package missing PSModule tag) #610 )

  5. Execute 'Import-Module PowerSTIG'. The import fails with the error indicating that a dependency could not be found.

  6. Navigate to the module install directory for the dependency named in the error (in the first case it will be AccessConrolDsc located at: "C:\Program Files\WindowsPowerShell\Modules\AccessControlDsc". Rename the subfolder from "1.4.0" to "1.4.0.0"

  7. Repeat steps 5 and 6 until import-module succeeds.

Expected behavior
Module should be imported.

Screenshots
PowerSTIG-ImportFail

Additional context
This is part of an effort to secure systems installed for the DoD that are public accessible but air-gapped.

@General-Fault General-Fault changed the title Dependency Version Check fails for offline install Dependency version checks fail for offline install May 5, 2020
@General-Fault
Copy link
Author

This is a problem with the package provider.
PowerShell/DscResources#508

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant