Skip to content

Commit 0b38dbf

Browse files
devnomadicCopilot
andauthored
Add Windows Server 2022 Security Baseline support (#10) (#11)
* Initial plan * Add Windows Server 2022 Security Baseline support * Update OS version check to require Windows 11+ or Windows Server 2022+ * Improve OS version check comment for clarity * Fix URLs * Update paths and checksums for Chocolatey install script * Update runner version to windows-2022 * Update publish-unit-test-result-action to v2 * Update action to use Windows version for publishing results * Revise build status table and fix typos Updated build status section and corrected typos. * Fix typos and update Windows version information Corrected typos and updated Windows version details. --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: devnomadic <14085319+devnomadic@users.noreply.github.com>
1 parent 3b9901c commit 0b38dbf

5 files changed

Lines changed: 36 additions & 27 deletions

File tree

.github/workflows/actions.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
jobs:
1515
Build:
16-
runs-on: windows-latest
16+
runs-on: windows-2022
1717
steps:
1818
- uses: actions/checkout@v2
1919

@@ -31,7 +31,7 @@ jobs:
3131
.\WinSecurityBaseline.Pester.ps1 -OutputFormat "JUnitXml"
3232
3333
- name: Publish Unit Test Results
34-
uses: EnricoMi/publish-unit-test-result-action/composite@v1
34+
uses: EnricoMi/publish-unit-test-result-action/windows@v2
3535
if: always()
3636
with:
3737
files: ${{ github.workspace }}/**/*.xml
@@ -94,4 +94,4 @@ jobs:
9494
- name: Choco Push
9595
shell: pwsh
9696
run: |
97-
choco push --source https://chocolatey.org/ --api-key ${{ secrets.CHOCO_API_KEY }}
97+
choco push --source https://chocolatey.org/ --api-key ${{ secrets.CHOCO_API_KEY }}

ReadMe.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Build Status
2-
[![Build status](https://ci.appveyor.com/api/projects/status/a30xsob1g3xp5jog?svg=true)](https://ci.appveyor.com/project/devnomadic/chocolatey-winsecuritybaseline) [![actions workflow](https://github.com/devnomadic/chocolatey-winsecuritybaseline/actions/workflows/actions.yml/badge.svg)](https://github.com/devnomadic/chocolatey-winsecuritybaseline/actions)
2+
|Appveyor Build|GitHub Build|
3+
|---|---|
4+
|[![Build status](https://ci.appveyor.com/api/projects/status/a30xsob1g3xp5jog?svg=true)](https://ci.appveyor.com/project/devnomadic/chocolatey-winsecuritybaseline) | [![actions workflow](https://github.com/devnomadic/chocolatey-winsecuritybaseline/actions/workflows/actions.yml/badge.svg)](https://github.com/devnomadic/chocolatey-winsecuritybaseline/actions)|
5+
|Win2019 Only|Win2022+|
36

47
# Windows security baselines
58

@@ -11,8 +14,8 @@ C:\choco upgrade winsecuritybaseline
1114
```
1215

1316
**Applies to**
14-
- Windows Server 2016+
15-
- Windows 10
17+
- Windows Server 2022+
18+
- Windows 10+
1619

1720
### Package Specific
1821
#### Package Parameters
@@ -22,11 +25,13 @@ The following package parameters can be set:
2225

2326
#### Package Uninstallation
2427

25-
* Package LGPO settings cannot be uninsalled programticall once installed. This need to be done manually!
28+
* Package LGPO settings cannot be uninstalled programmatically once installed. This needs to be done manually!
2629

2730
#### Package Versions
2831
|Windows Version|Choco Package Version|
2932
|---|---|
33+
|Windows Server 2022 LTSC|22.0.0|
34+
|Windows 10 21H2|22.0.0|
3035
|Windows Server 2019 LTSC - 1803|20.1803|
3136
|Windows 10 LTSC - 1803|20.1803|
3237

WinSecurityBaseline.nuspec

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
33
<metadata>
44
<id>WinSecurityBaseline</id>
5-
<version>20.1803</version>
5+
<version>22.0.0</version>
66
<packageSourceUrl>https://github.com/devnomadic/Chocolatey-WinSecurityBaseline</packageSourceUrl>
77
<owners>devnoadic</owners>
88
<title>WinSecurityBaseline</title>
@@ -13,14 +13,14 @@
1313
<requireLicenseAcceptance>true</requireLicenseAcceptance>
1414
<projectSourceUrl>https://www.microsoft.com/en-us/download/details.aspx?id=55319</projectSourceUrl>
1515
<docsUrl>https://techcommunity.microsoft.com/t5/microsoft-security-baselines/bg-p/Microsoft-Security-Baselines</docsUrl>
16-
<releaseNotes>https://github.com/devnomadic/Chocolatey-WinSecurityBaseline/pull/7</releaseNotes>
17-
<tags>Windows Security Baseline 1809</tags>
16+
<releaseNotes>https://github.com/devnomadic/Chocolatey-WinSecurityBaseline/releases</releaseNotes>
17+
<tags>Windows Security Baseline 2022 Server</tags>
1818
<summary>A security baseline is a group of Microsoft-recommended configuration settings that explains their security impact. These settings are based on feedback from Microsoft security engineering teams, product groups, partners, and customers.</summary>
1919
<description>
2020
# Windows security baselines
2121

2222
**Applies to**
23-
- Windows Server 2016+
23+
- Windows Server 2022+
2424
- Windows 10+
2525

2626
### Package Specific
@@ -31,12 +31,13 @@ The following package parameters can be set:
3131

3232
#### Package Uninstallation
3333

34-
* Package LGPO settings cannot be uninsalled programticall once installed. This need to be done manually!
34+
* Package LGPO settings cannot be uninstalled programmatically once installed. This needs to be done manually!
3535

3636
#### Package Versions
37-
|Windows Version|Choco Package Version|
38-
|Windows Server 2019 LTSC - 1803|20.1803|
39-
|Windows 10 LTSC - 1803|20.1803|
37+
Windows Server 2022 LTSC | 22.0.0
38+
Windows 10 21H2 | 22.0.0
39+
Windows Server 2019 LTSC - 1803 | 20.1803
40+
Windows 10 LTSC - 1803 | 20.1803
4041

4142
## Using security baselines in your organization
4243

@@ -71,4 +72,4 @@ In modern organizations, the security threat landscape is constantly evolving, a
7172
<files>
7273
<file src="tools\**" target="tools" />
7374
</files>
74-
</package>
75+
</package>

tools/chocolateyinstall.ps1

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,27 @@ $arguments = Get-PackageParameters
44

55
$OSVersion = [System.Environment]::OSVersion.Version
66

7-
if($OSVersion.Major -lt 10){
8-
throw "Windows build must be Windows10+ or Server2016+"
7+
# Windows Server 2022 has build 20348, Windows 11 has build 22000+
8+
# This check excludes Windows 10 (builds < 20348) and Windows Server 2019 (build 17763)
9+
if($OSVersion.Major -lt 10 -or $OSVersion.Build -lt 20348){
10+
throw "Windows build must be Windows 11+ or Windows Server 2022+"
911
}
1012

11-
$SecBaseLineUrl = 'https://download.microsoft.com/download/8/5/C/85C25433-A1B0-4FFA-9429-7E023E7DA8D8/Windows%2010%20Version%201809%20and%20Windows%20Server%202019%20Security%20Baseline.zip' # download url, HTTPS preferred
13+
$SecBaseLineUrl = 'https://download.microsoft.com/download/8/5/c/85c25433-a1b0-4ffa-9429-7e023e7da8d8/Windows%20Server%202022%20Security%20Baseline.zip' # download url, HTTPS preferred
1214
$LGPOUrl = 'https://download.microsoft.com/download/8/5/C/85C25433-A1B0-4FFA-9429-7E023E7DA8D8/LGPO.zip'
1315

1416
$SecBaseLinePackageArgs = @{
1517
packageName = $env:ChocolateyPackageName
1618
unzipLocation = "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName"
1719
url = $SecBaseLineUrl
18-
checksum = '575DDAF39EF364EA6DA678E22B0A988EA316EB240F73FBF618092A02647245BC'
20+
checksum = '49590CC694626D171FC934FAFEA6494F13ECD3843086704B7A5B98355909B8E0'
1921
checksumType = 'sha256'
2022
silentArgs = ''
2123
}
2224

2325
$LGPOPackageArgs = @{
2426
packageName = $env:ChocolateyPackageName
25-
unzipLocation = "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\Local_Script\Tools"
27+
unzipLocation = "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\Windows Server-2022-Security-Baseline-FINAL\Scripts\Tools"
2628
url = $LGPOUrl
2729
checksum = 'CB7159D134A0A1E7B1ED2ADA9A3CE8CE8F4DE391D14403D55438AF824247CC55'
2830
checksumType = 'sha256'
@@ -33,10 +35,10 @@ Install-ChocolateyZipPackage @SecBaseLinePackageArgs
3335
Install-ChocolateyZipPackage @LGPOPackageArgs
3436

3537
#If unzip does not place LPGO.exe in tools directory then move it
36-
if (!(Test-Path -Path "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\Local_Script\Tools\LGPO.exe")){
37-
$gci = Get-ChildItem -Path "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\Local_Script\Tools\" -Filter '*LGPO.exe' -Recurse
38+
if (!(Test-Path -Path "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\Windows Server-2022-Security-Baseline-FINAL\Scripts\Tools\LGPO.exe")){
39+
$gci = Get-ChildItem -Path "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\" -Filter '*LGPO.exe' -Recurse
3840
if ($gci){
39-
Move-Item -Path $gci[0].FullName -Destination "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\Local_Script\Tools\$($gci.name)"
41+
Move-Item -Path $gci[0].FullName -Destination "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\Windows Server-2022-Security-Baseline-FINAL\Scripts\Tools\$($gci.name)"
4042
}
4143
else{
4244
throw "Unable to find LGPO.exe"
@@ -55,10 +57,11 @@ else{
5557
$OSType = 'Server'
5658
}
5759

58-
$ScriptInstallerPath = "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\Local_Script\BaselineLocalInstall.ps1"
60+
$ScriptInstallerPath = "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\Windows Server-2022-Security-Baseline-FINAL\Scripts\Baseline-LocalInstall.ps1"
61+
cd "${env:ProgramFiles(x86)}\$env:ChocolateyPackageName\Windows Server-2022-Security-Baseline-FINAL\Scripts\"
5962

6063
if ($OSType -eq 'Server'){
61-
& $ScriptInstallerPath -WS2019NonDomainJoined
64+
& $ScriptInstallerPath -WSNonDomainJoined
6265
}
6366
elseif ($OSType -eq 'Workstation'){
6467
& $ScriptInstallerPath -Win10NonDomainJoined

tools/chocolateyuninstall.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
$packageArgs = @{
44
packageName = $env:ChocolateyPackageName
5-
ZipFileName = 'Windows 10 Version 1809 and Windows Server 2019 Security Baseline.zip'
5+
ZipFileName = 'Windows Server 2022 Security Baseline.zip'
66
}
77

88
Uninstall-ChocolateyZipPackage @packageArgs

0 commit comments

Comments
 (0)