forked from dsccommunity/xBitlocker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update resource module to standard (dsccommunity#15)
- Changes to xBitlocker - Added Codecov support. - Updated appveyor.yml to use the one in template. - Added folders for future unit and integration tests. - Added Visual Studio Code formatting settings. - Added .gitignore file. - Added markdown lint rules. - Fixed encoding on README.md. - Added `PowerShellVersion = '4.0'`, and updated copyright information, in the module manifest.
- Loading branch information
Showing
10 changed files
with
380 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
codecov: | ||
notify: | ||
require_ci_to_pass: no | ||
|
||
comment: | ||
layout: "reach, diff" | ||
behavior: default | ||
|
||
coverage: | ||
range: 50..80 | ||
round: down | ||
precision: 0 | ||
|
||
status: | ||
project: | ||
default: | ||
# Set the overall project code coverage requirement to 70% | ||
target: 70 | ||
patch: | ||
default: | ||
# Set the pull request requirement to not regress overall coverage by more than 5% | ||
# and let codecov.io set the goal for the code changed in the patch. | ||
target: auto | ||
threshold: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DSCResource.Tests | ||
.vs | ||
.vscode | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"default": true, | ||
"MD029": { | ||
"style": "one" | ||
}, | ||
"MD013": true, | ||
"MD024": false, | ||
"MD034": false, | ||
"no-hard-tabs": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"powershell.codeFormatting.openBraceOnSameLine": false, | ||
"powershell.codeFormatting.newLineAfterOpenBrace": false, | ||
"powershell.codeFormatting.newLineAfterCloseBrace": true, | ||
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true, | ||
"powershell.codeFormatting.whitespaceBeforeOpenParen": true, | ||
"powershell.codeFormatting.whitespaceAroundOperator": true, | ||
"powershell.codeFormatting.whitespaceAfterSeparator": true, | ||
"powershell.codeFormatting.ignoreOneLineBlock": false, | ||
"powershell.codeFormatting.preset": "Custom", | ||
"files.trimTrailingWhitespace": true, | ||
"files.insertFinalNewline": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
[![Build status](https://ci.appveyor.com/api/projects/status/wi5i60tojfd7056b/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/xbitlocker/branch/master) | ||
|
||
# xBitlocker | ||
|
||
The **xBitlocker** module is a part of the Windows PowerShell Desired State Configuration (DSC) Resource Kit, which is a collection of DSC Resources produced by the PowerShell Team. | ||
This module contains the **xBLAutoBitlocker, xBLBitlocker, xBLTpm** resources. | ||
This DSC Module allows you to configure Bitlocker on a single disk, configure a TPM chip, or automatically enable Bitlocker on multiple disks. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
## Branches | ||
|
||
### master | ||
|
||
[![Build status](https://ci.appveyor.com/api/projects/status/wi5i60tojfd7056b/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/xBitlocker/branch/master) | ||
[![codecov](https://codecov.io/gh/PowerShell/xBitlocker/branch/master/graph/badge.svg)](https://codecov.io/gh/PowerShell/xBitlocker/branch/master) | ||
|
||
This is the branch containing the latest release - | ||
no contributions should be made directly to this branch. | ||
|
||
### dev | ||
|
||
[![Build status](https://ci.appveyor.com/api/projects/status/wi5i60tojfd7056b/branch/dev?svg=true)](https://ci.appveyor.com/project/PowerShell/xBitlocker/branch/dev) | ||
[![codecov](https://codecov.io/gh/PowerShell/xBitlocker/branch/dev/graph/badge.svg)](https://codecov.io/gh/PowerShell/xBitlocker/branch/dev) | ||
|
||
This is the development branch | ||
to which contributions should be proposed by contributors as pull requests. | ||
This development branch will periodically be merged to the master branch, | ||
and be released to [PowerShell Gallery](https://www.powershellgallery.com/). | ||
|
||
## Contributing | ||
Please check out common DSC Resources [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md). | ||
|
||
|
@@ -17,9 +36,9 @@ To install **xBitlocker** module | |
|
||
* Unzip the content under $env:ProgramFiles\WindowsPowerShell\Modules folder | ||
|
||
To confirm installation: | ||
To confirm installation: | ||
|
||
* Run **Get-DSCResource** to see that **xBLAutoBitlocker, xBLBitlocker, xBLTpm** are among the DSC Resources listed | ||
* Run **Get-DSCResource** to see that **xBLAutoBitlocker, xBLBitlocker, xBLTpm** are among the DSC Resources listed | ||
|
||
## Requirements | ||
|
||
|
@@ -40,68 +59,78 @@ It does not work on Operating System drives. | |
**xBLAutoBitlocker** has the following properties. | ||
Where no description is listed, properties correspond directly to [Enable-Bitlocker](http://technet.microsoft.com/en-us/library/jj649837.aspx) parameters. | ||
|
||
* *DriveType:The type of volume, as reported by Get-Volume, to auto apply Bitlocker to | ||
* *DriveType:The type of volume, as reported by Get-Volume, to auto apply Bitlocker to | ||
* *PrimaryProtector:The primary protector type to be used for AutoBitlocker. | ||
Valid values are: "AdAccountOrGroupProtector", "PasswordProtector", "Pin", "RecoveryKeyProtector", "RecoveryPasswordProtector", "StartupKeyProtector", or "TpmProtector" | ||
* MinDiskCapacityGB:If specified, only disks this size or greater will auto apply Bitlocker | ||
* AutoUnlock:Whether volumes should be enabled for auto unlock using Enable-BitlockerAutoUnlock | ||
* AdAccountOrGroup | ||
* AdAccountOrGroupProtector | ||
* EncryptionMethod | ||
* HardwareEncryption | ||
* Password | ||
* PasswordProtector | ||
* Pin | ||
* RecoveryKeyPath | ||
* RecoveryKeyProtector | ||
* RecoveryPasswordProtector | ||
* Service | ||
* SkipHardwareTest | ||
* StartupKeyPath | ||
* StartupKeyProtector | ||
* TpmProtector | ||
* UsedSpaceOnly | ||
Valid values are: "AdAccountOrGroupProtector", "PasswordProtector", "Pin", "RecoveryKeyProtector", "RecoveryPasswordProtector", "StartupKeyProtector", or "TpmProtector" | ||
* MinDiskCapacityGB:If specified, only disks this size or greater will auto apply Bitlocker | ||
* AutoUnlock:Whether volumes should be enabled for auto unlock using Enable-BitlockerAutoUnlock | ||
* AdAccountOrGroup | ||
* AdAccountOrGroupProtector | ||
* EncryptionMethod | ||
* HardwareEncryption | ||
* Password | ||
* PasswordProtector | ||
* Pin | ||
* RecoveryKeyPath | ||
* RecoveryKeyProtector | ||
* RecoveryPasswordProtector | ||
* Service | ||
* SkipHardwareTest | ||
* StartupKeyPath | ||
* StartupKeyProtector | ||
* TpmProtector | ||
* UsedSpaceOnly | ||
|
||
**xBLBitlocker** has the following properties. | ||
Where no description is listed, properties correspond directly to [Enable-Bitlocker](http://technet.microsoft.com/en-us/library/jj649837.aspx) parameters. | ||
|
||
* *MountPoint:The MountPoint name as reported in Get-BitLockerVolume | ||
* *MountPoint:The MountPoint name as reported in Get-BitLockerVolume | ||
* *PrimaryProtector:The primary protector type to be used for AutoBitlocker. | ||
Valid values are: "AdAccountOrGroupProtector", "PasswordProtector", "Pin", "RecoveryKeyProtector", "RecoveryPasswordProtector", "StartupKeyProtector", or "TpmProtector" | ||
* AutoUnlock:Whether volumes should be enabled for auto unlock using Enable-BitlockerAutoUnlock | ||
Valid values are: "AdAccountOrGroupProtector", "PasswordProtector", "Pin", "RecoveryKeyProtector", "RecoveryPasswordProtector", "StartupKeyProtector", or "TpmProtector" | ||
* AutoUnlock:Whether volumes should be enabled for auto unlock using Enable-BitlockerAutoUnlock | ||
* AllowImmediateReboot:Whether the computer can be immediately rebooted after enabling Bitlocker on an OS drive. | ||
Defaults to false. | ||
|
||
* AdAccountOrGroup | ||
* AdAccountOrGroupProtector | ||
* EncryptionMethod | ||
* HardwareEncryption | ||
* Password | ||
* PasswordProtector | ||
* Pin | ||
* RecoveryKeyPath | ||
* RecoveryKeyProtector | ||
* RecoveryPasswordProtector | ||
* Service | ||
* SkipHardwareTest | ||
* StartupKeyPath | ||
* StartupKeyProtector | ||
* TpmProtector | ||
* UsedSpaceOnly | ||
* AdAccountOrGroup | ||
* AdAccountOrGroupProtector | ||
* EncryptionMethod | ||
* HardwareEncryption | ||
* Password | ||
* PasswordProtector | ||
* Pin | ||
* RecoveryKeyPath | ||
* RecoveryKeyProtector | ||
* RecoveryPasswordProtector | ||
* Service | ||
* SkipHardwareTest | ||
* StartupKeyPath | ||
* StartupKeyProtector | ||
* TpmProtector | ||
* UsedSpaceOnly | ||
|
||
**xBLTpm** is used to initialize a TPM chip using [Initialize-TPM](http://technet.microsoft.com/en-us/library/jj603112.aspx). | ||
**xBLTpm** has the following properties. | ||
|
||
* *Identity:Not actually used, so could be anything | ||
* AllowClear:Indicates that the provisioning process clears the TPM, if necessary, to move the TPM closer to complying with Windows Server® 2012 standards | ||
* *Identity:Not actually used, so could be anything | ||
* AllowClear:Indicates that the provisioning process clears the TPM, if necessary, to move the TPM closer to complying with Windows Server® 2012 standards | ||
* AllowPhysicalPresence:Indicates that the provisioning process may send physical presence commands that require a user to be present in order to continue. | ||
|
||
* AllowImmediateReboot:Whether the computer can rebooted immediately after initializing the TPM | ||
* AllowImmediateReboot:Whether the computer can rebooted immediately after initializing the TPM | ||
|
||
## Versions | ||
|
||
### Unreleased | ||
|
||
* Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. | ||
* Added Codecov support. | ||
* Updated appveyor.yml to use the one in template. | ||
* Added folders for future unit and integration tests. | ||
* Added Visual Studio Code formatting settings. | ||
* Added .gitignore file. | ||
* Added markdown lint rules. | ||
* Fixed encoding on README.md. | ||
* Added `PowerShellVersion = '4.0'`, and updated copyright information, in the | ||
module manifest. | ||
|
||
### 1.1.0.0 | ||
|
||
|
@@ -116,10 +145,10 @@ Defaults to false. | |
|
||
### 1.0.0.0 | ||
|
||
* Initial release with the following resources | ||
* xBLAutoBitlocker | ||
* xBLBitlocker | ||
* xBLTpm | ||
* Initial release with the following resources | ||
* xBLAutoBitlocker | ||
* xBLBitlocker | ||
* xBLTpm | ||
|
||
## Examples | ||
|
||
|
@@ -132,4 +161,4 @@ The example code for ConfigureBitlockerOnOSDrive is located in [`ConfigureBitloc | |
|
||
Enables Bitlocker on an Operating System drive, and automatically enables Bitlocker on all drives of type 'Fixed'. | ||
The example code for ConfigureBitlockerAndAutoBitlocker is located in [`ConfigureBitlockerAndAutoBitlocker.ps1`](Examples/ConfigureBitlockerAndAutoBitlocker/ConfigureBitlockerAndAutoBitlocker.ps1). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<# | ||
.Synopsis | ||
DSC Configuration Template for DSC Resource Integration tests. | ||
.DESCRIPTION | ||
To Use: | ||
1. Copy to \Tests\Integration\ folder and rename <ResourceName>.config.ps1 (e.g. MSFT_Firewall.config.ps1) | ||
2. Customize TODO sections. | ||
.NOTES | ||
#> | ||
|
||
# Integration Test Config Template Version: 1.0.1 | ||
|
||
# TODO: Modify ResourceName (e.g. MSFT_Firewall_config) | ||
configuration <ResourceName>_config { | ||
# TODO: Modify ModuleName (e.g. NetworkingDsc) | ||
Import-DscResource -ModuleName '<ModuleName>' | ||
node localhost { | ||
# TODO: Modify ResourceFriendlyName (e.g. Firewall_Integration_Test) | ||
<ResourceFriendlyName> Integration_Test { | ||
# TODO: Fill Configuration Code Here | ||
} | ||
} | ||
} | ||
|
||
# TODO: (Optional): Add More Configuration Templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<# | ||
.Synopsis | ||
Template for creating DSC Resource Integration Tests | ||
.DESCRIPTION | ||
To Use: | ||
1. Copy to \Tests\Integration\ folder and rename <ResourceName>.Integration.tests.ps1 (e.g. MSFT_Firewall.Integration.tests.ps1) | ||
2. Customize TODO sections. | ||
3. Create test DSC Configuration file <ResourceName>.config.ps1 (e.g. MSFT_Firewall.config.ps1) from integration_config_template.ps1 file. | ||
.NOTES | ||
Code in HEADER, FOOTER and DEFAULT TEST regions are standard and may be moved into | ||
DSCResource.Tools in Future and therefore should not be altered if possible. | ||
#> | ||
|
||
# TODO: Customize these parameters... | ||
$script:DSCModuleName = '<ModuleName>' # Example NetworkingDsc | ||
$script:DSCResourceName = '<ResourceName>' # Example MSFT_Firewall | ||
|
||
#region HEADER | ||
# Integration Test Template Version: 1.2.1 | ||
[String] $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) | ||
if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` | ||
(-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) | ||
{ | ||
& git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests')) | ||
} | ||
|
||
Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force | ||
$TestEnvironment = Initialize-TestEnvironment ` | ||
-DSCModuleName $script:DSCModuleName ` | ||
-DSCResourceName $script:DSCResourceName ` | ||
-TestType Integration | ||
|
||
#endregion | ||
|
||
# TODO: Other Init Code Goes Here... | ||
|
||
# Using try/finally to always cleanup. | ||
try | ||
{ | ||
#region Integration Tests | ||
$configFile = Join-Path -Path $PSScriptRoot -ChildPath "$($script:DSCResourceName).config.ps1" | ||
. $configFile | ||
|
||
Describe "$($script:DSCResourceName)_Integration" { | ||
#region DEFAULT TESTS | ||
It 'Should compile and apply the MOF without throwing' { | ||
{ | ||
& "$($script:DSCResourceName)_Config" -OutputPath $TestDrive | ||
|
||
$startDscConfigurationParameters = @{ | ||
Path = $TestDrive | ||
ComputerName = 'localhost' | ||
Wait = $true | ||
Verbose = $true | ||
Force = $true | ||
ErrorAction = 'Stop' | ||
} | ||
|
||
Start-DscConfiguration @startDscConfigurationParameters | ||
} | Should -Not -Throw | ||
} | ||
|
||
It 'Should be able to call Get-DscConfiguration without throwing' { | ||
{ | ||
Get-DscConfiguration -Verbose -ErrorAction Stop | ||
} | Should -Not -Throw | ||
} | ||
#endregion | ||
|
||
It 'Should have set the resource and all the parameters should match' { | ||
# TODO: Validate the Config was Set Correctly Here... | ||
} | ||
} | ||
#endregion | ||
|
||
} | ||
finally | ||
{ | ||
#region FOOTER | ||
|
||
Restore-TestEnvironment -TestEnvironment $TestEnvironment | ||
|
||
#endregion | ||
|
||
# TODO: Other Optional Cleanup Code Goes Here... | ||
} |
Oops, something went wrong.