Skip to content

Commit 4a72440

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
initial configs
1 parent ed7d8a7 commit 4a72440

File tree

4 files changed

+78
-3
lines changed

4 files changed

+78
-3
lines changed

build.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ $filesForWindowsPackage = @(
4444
'RunCommandOnSet.exe',
4545
'windowspowershell.dsc.resource.json',
4646
'wmi.dsc.resource.json',
47-
'wmi.resource.ps1'
47+
'wmi.resource.ps1',
48+
'configurations/windows_baseline.dsc.yaml',
49+
'configurations/windows_inventory.dsc.yaml'
4850
)
4951

5052
$filesForLinuxPackage = @(
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# This configuration validates a Windows system against a security baseline configuration
2+
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
3+
metadata:
4+
Microsoft.DSC:
5+
securityContext: Elevated
6+
resources:
7+
- name: Validate the OS is Windows
8+
type: Microsoft.DSC/Assertion
9+
properties:
10+
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
11+
resources:
12+
- name: os
13+
type: Microsoft/OSInfo
14+
properties:
15+
family: Windows
16+
- name: Registry checks
17+
type: Microsoft.DSC/Group
18+
dependsOn:
19+
- "[resourceId('Microsoft.DSC/Assertion','Validate the OS is Windows')]"
20+
properties:
21+
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
22+
resources:
23+
- name: Default RDP port
24+
type: Microsoft.Windows/Registry
25+
metadata:
26+
area: Network Access
27+
severity: Critical
28+
properties:
29+
keyPath: HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
30+
valueName: PortNumber
31+
valueData:
32+
DWord: 3389
33+
- name: Disable SMBv1
34+
type: Microsoft.Windows/Registry
35+
metadata:
36+
area: Network Access
37+
severity: Critical
38+
properties:
39+
keyPath: HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
40+
valueName: SMB1
41+
valueData:
42+
DWord: 0 # Disabled
43+
- name: Disable Windows Search service
44+
type: Microsoft.Windows/Registry
45+
metadata:
46+
area: Services
47+
severity: Critical
48+
properties:
49+
keyPath: HKLM\SYSTEM\CurrentControlSet\Services\WSearch
50+
valueName: Start
51+
valueData:
52+
DWord: 4 # Disabled
53+
- name: Scan Removeable Drives
54+
type: Microsoft.Windows/Registry
55+
metadata:
56+
area: Services
57+
severity: Critical
58+
properties:
59+
keyPath: HKLM\SOFTWARE\Policies\Microsoft\Windows Defender
60+
valueName: DisableRemovableDriveScanning
61+
valueData:
62+
DWord: 0 # Disabled

dsc/examples/wmi_inventory.dsc.yaml renamed to configurations/windows_inventory.dsc.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
22
resources:
3+
- name: Validate the OS is Windows
4+
type: Microsoft.DSC/Assertion
5+
properties:
6+
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
7+
resources:
8+
- name: os
9+
type: Microsoft/OSInfo
10+
properties:
11+
family: Windows
312
- name: WMI
413
type: Microsoft.Windows/WMI
14+
dependsOn:
15+
- "[resourceId('Microsoft.DSC/Assertion','Validate the OS is Windows')]"
516
properties:
617
resources:
718
- name: computer system
@@ -39,4 +50,4 @@ resources:
3950
adaptertype:
4051
netconnectionid:
4152
serviceName:
42-
netconnectionstatus: 2
53+
netconnectionstatus: 2 # Connected

wmi-adapter/Tests/wmi.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Describe 'WMI adapter resource tests' {
4747
}
4848

4949
It 'Example config works' -Skip:(!$IsWindows) {
50-
$configPath = Join-Path $PSScriptRoot '..\..\dsc\examples\wmi_inventory.dsc.yaml'
50+
$configPath = Join-Path $PSScriptRoot '..\..\configurations\windows_inventory.dsc.yaml'
5151
$r = dsc config get -p $configPath
5252
$LASTEXITCODE | Should -Be 0
5353
$r | Should -Not -BeNullOrEmpty

0 commit comments

Comments
 (0)