Skip to content

Commit e039e8e

Browse files
authored
Merge pull request #88 from ansible-lockdown/benchmark_v4.0.0
Benchmark v4.0.0
2 parents 5f8a2e2 + 2864706 commit e039e8e

15 files changed

Lines changed: 155 additions & 96 deletions

.github/.DS_Store

-6 KB
Binary file not shown.

.github/workflows/devel_pipeline_validation.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ jobs:
3131
- uses: actions/first-interaction@main
3232
with:
3333
repo-token: ${{ secrets.GITHUB_TOKEN }}
34-
pr-message: |-
35-
Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
36-
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
34+
issue_message: |-
35+
Congrats on opening your first issue and thank you for taking the time to help improve Ansible-Lockdown!
36+
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
37+
pr_message: |-
38+
Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
39+
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
3740
3841
build-azure-windows:
3942
# Use the AWS self-hosted runner
@@ -60,7 +63,7 @@ jobs:
6063
steps:
6164
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
6265
- name: Clone ${{ github.event.repository.name }}
63-
uses: actions/checkout@v4
66+
uses: actions/checkout@v6.0.2
6467
with:
6568
ref: ${{ github.event.pull_request.head.sha }}
6669

@@ -76,7 +79,7 @@ jobs:
7679
7780
# Pull In OpenTofu Code For Windows Azure
7881
- name: Clone IaC Repository
79-
uses: actions/checkout@v4
82+
uses: actions/checkout@v6.0.2
8083
with:
8184
repository: ansible-lockdown/github_windows_IaC
8285
path: .github/workflows/github_windows_IaC

.github/workflows/devel_pipeline_validation_gpo.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ jobs:
3131
- uses: actions/first-interaction@main
3232
with:
3333
repo-token: ${{ secrets.GITHUB_TOKEN }}
34-
pr-message: |-
35-
Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
36-
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
34+
issue_message: |-
35+
Congrats on opening your first issue and thank you for taking the time to help improve Ansible-Lockdown!
36+
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
37+
pr_message: |-
38+
Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
39+
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
3740
3841
build-azure-windows-gpo:
3942
# Use the AWS self-hosted runner
@@ -60,7 +63,7 @@ jobs:
6063
steps:
6164
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
6265
- name: Clone ${{ github.event.repository.name }}
63-
uses: actions/checkout@v4
66+
uses: actions/checkout@v6.0.2
6467
with:
6568
ref: ${{ github.event.pull_request.head.sha }}
6669

@@ -76,7 +79,7 @@ jobs:
7679
7780
# Pull In OpenTofu Code For Windows Azure
7881
- name: Clone IaC Repository
79-
uses: actions/checkout@v4
82+
uses: actions/checkout@v6.0.2
8083
with:
8184
repository: ansible-lockdown/github_windows_IaC
8285
path: .github/workflows/github_windows_IaC

.github/workflows/main_pipeline_validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
steps:
5050
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
5151
- name: Clone ${{ github.event.repository.name }}
52-
uses: actions/checkout@v4
52+
uses: actions/checkout@v6.0.2
5353
with:
5454
ref: ${{ github.event.pull_request.head.sha }}
5555

@@ -65,7 +65,7 @@ jobs:
6565
6666
# Pull In OpenTofu Code For Windows Azure
6767
- name: Clone IaC Repository
68-
uses: actions/checkout@v4
68+
uses: actions/checkout@v6.0.2
6969
with:
7070
repository: ansible-lockdown/github_windows_IaC
7171
path: .github/workflows/github_windows_IaC

.github/workflows/main_pipeline_validation_gpo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
steps:
5050
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
5151
- name: Clone ${{ github.event.repository.name }}
52-
uses: actions/checkout@v4
52+
uses: actions/checkout@v6.0.2
5353
with:
5454
ref: ${{ github.event.pull_request.head.sha }}
5555

@@ -65,7 +65,7 @@ jobs:
6565
6666
# Pull In OpenTofu Code For Windows Azure
6767
- name: Clone IaC Repository
68-
uses: actions/checkout@v4
68+
uses: actions/checkout@v6.0.2
6969
with:
7070
repository: ansible-lockdown/github_windows_IaC
7171
path: .github/workflows/github_windows_IaC

.github/workflows/update_galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818
- name: Checkout V4
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v6.0.2
2020

2121
- name: Update Galaxy
2222
uses: ansible-actions/ansible-galaxy-action@main

ChangeLog.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# ChangeLog
22

3+
## Release 4.1.0
4+
5+
April 2026
6+
- Updated the cloud based system check for manual overrides. New variable now in the defualt main. Please read the comments for the new variable.
7+
- Updated 18.10.57.3.10.1 variable accept anything between 1 and 900000 in Hardening & GPO.
8+
- Updated Section 2 GPO for win_skip_for_test controls. Read comments in default/main.
9+
- Issues Addressed:
10+
- [#2](https://github.com/ansible-lockdown/Windows-2025-CIS/issues/2) - Thanks @davidstanaway
11+
- [#7](https://github.com/ansible-lockdown/Windows-2025-CIS/issues/7) - Thanks @R2J2 (Updated When Statement to take into account Bool now)
12+
- [#86](https://github.com/ansible-lockdown/Windows-2022-CIS/issues/86) - Thanks @git-cgallagher (Windows 2022 Issue Added Here To Update 2025)
13+
- [#84](https://github.com/ansible-lockdown/Windows-2022-CIS/issues/84) - Thanks @Randriy-bulynko (Windows 2022 Issue Added Here To Update 2025)
14+
- [#87](https://github.com/ansible-lockdown/Windows-2022-CIS/issues/87) - Thanks @Randriy-bulynko (Windows 2022 Issue Added Here To Update 2025)
15+
- [#83](https://github.com/ansible-lockdown/Windows-2022-CIS/issues/83) - Thanks @exu-g (Windows 2022 Issue Added Here To Update 2025)
16+
- PR's Addressed:
17+
- [#3](https://github.com/ansible-lockdown/Windows-2025-CIS/pull/3) - Thanks @MatthieuLeboeuf
18+
319
September 2025
420
- Updated When For Control 18.4.6
521
- Updated Title 2.3.10.10

defaults/main.yml

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,26 +102,58 @@ win22cis_section19: true
102102
# errors due to missing features or incompatible syntax in earlier versions of Ansible.
103103
min_ansible_version: "2.16"
104104

105-
# win_skip_for_test is the setting that will skip tasks that may cause changes that will affect the system.
106-
# Controls that will be skipped:
107-
# win22cis_rule_2_2_26 - Breaks Local Admin Connection
108-
# win22cis_rule_2_2_27 - Breaks Local Admin Connection
109-
# win22cis_rule_2_3_1_3 - Rename default administrator account
110-
# win22cis_rule_9_3_4 - Enables Firewall Public Rules *Breaks Reboot*
111-
# win22cis_rule_18_10_89_1_1 - Disables WinRM Allow Client Basic Auth
112-
# win22cis_rule_18_10_89_1_2 - Disables Client Ensure Allow unencrypted traffic is set to Disabled Control.
113-
# win22cis_rule_18_10_89_1_3 - Ensure Disallow Digest authentication is set to Enabled
114-
# win22cis_rule_18_10_89_2_1 - Disables WinRM Allow Service Basic Auth
115-
# win22cis_rule_18_10_89_2_2 - Disables Remote Server Management through WinRM
116-
# win22cis_rule_18_10_89_2_3 - Disables Service Ensure Allow unencrypted traffic is set to Disabled Control.
117-
# win22cis_rule_18_10_90_1 - Disables Remote Shell Access
118-
win_skip_for_test: true
119-
120105
# Changes will be made that will require a system reboot.
121106
# The following option will allow whether or not to skip the reboot.
122107
# Default: true
123108
skip_reboot: true
124109

110+
# ╔═══════════════════════════════════════════════════════════════════════════════╗
111+
# ║ win_skip_for_test ║
112+
# ║ ║
113+
# ║ Skips tasks that may cause disruptive changes to the system during testing. ║
114+
# ║ ║
115+
# ║ NOTE: When set to true, the corresponding GPO entries for the controls ║
116+
# ║ listed below will also not be created. This applies to both the Ansible ║
117+
# ║ remediation path and the GPO creation path. ║
118+
# ║ ║
119+
# ║ Controls that will be skipped: ║
120+
# ║ win22cis_rule_2_2_26 - Breaks Local Admin Connection ║
121+
# ║ win22cis_rule_2_2_27 - Breaks Local Admin Connection ║
122+
# ║ win22cis_rule_2_3_1_3 - Rename default administrator account ║
123+
# ║ win22cis_rule_9_3_4 - Enables Firewall Public Rules *Breaks Reboot* ║
124+
# ║ win22cis_rule_18_10_89_1_1 - Disables WinRM Allow Client Basic Auth ║
125+
# ║ win22cis_rule_18_10_89_1_2 - Disables Client Allow Unencrypted Traffic ║
126+
# ║ win22cis_rule_18_10_89_1_3 - Disallow Digest Authentication ║
127+
# ║ win22cis_rule_18_10_89_2_1 - Disables WinRM Allow Service Basic Auth ║
128+
# ║ win22cis_rule_18_10_89_2_2 - Disables Remote Server Management via WinRM ║
129+
# ║ win22cis_rule_18_10_89_2_3 - Disables Service Allow Unencrypted Traffic ║
130+
# ║ win22cis_rule_18_10_90_1 - Disables Remote Shell Access ║
131+
# ╚═══════════════════════════════════════════════════════════════════════════════╝
132+
win_skip_for_test: true
133+
134+
# ╔═══════════════════════════════════════════════════════════════════════════════╗
135+
# ║ Hosted Virtual System Override ║
136+
# ║ ║
137+
# ║ By default, the role auto-detects whether the target is a cloud-based ║
138+
# ║ hosted virtual system (Azure, AWS, GCE, DigitalOcean, etc.). ║
139+
# ║ ║
140+
# ║ The auto-detection when condition covers the most common combinations of ║
141+
# ║ ansible_virtualization_type and ansible_system_vendor, however the number ║
142+
# ║ of possible hypervisor/cloud combinations makes it impossible to account ║
143+
# ║ for every environment. Known cases where auto-detection has produced ║
144+
# ║ incorrect results include VMware vSphere on-prem, AWS GovCloud EC2, and ║
145+
# ║ standalone (non-domain) VMware instances where virtualization_type ║
146+
# ║ returns 'NA'. In these cases the secedit lockout control order (1.2.1-1.2.4) ║
147+
# ║ will fail with 'The parameter is incorrect' from secedit. ║
148+
# ║ ║
149+
# ║ If you encounter this error, set the override below to force the correct ║
150+
# ║ order for your environment manually. ║
151+
# ║ ║
152+
# ║ true = treat as hosted/cloud virtual system ║
153+
# ║ false = treat as bare-metal or local VM ║
154+
# ╚═══════════════════════════════════════════════════════════════════════════════╝
155+
# hosted_virtual_system_override: true
156+
125157
# These variables correspond with the CIS rule IDs or paragraph numbers defined in
126158
# the CIS benchmark documents.
127159
# PLEASE NOTE: These work in coordination with the section # group variables and tags.
@@ -347,7 +379,6 @@ win22cis_rule_18_1_1_2: true
347379
win22cis_rule_18_1_2_2: true
348380
win22cis_rule_18_1_3: true
349381
win22cis_rule_18_4_1: true
350-
# win22cis_rule_18_4_2: true
351382
win22cis_rule_18_4_2: true
352383
win22cis_rule_18_4_3: true
353384
win22cis_rule_18_4_4: true
@@ -827,10 +858,10 @@ win22cis_ldap_client_integrity: 1
827858
# Log\Microsoft\Windows\NTLM). Configuring this setting to Deny All also conforms to the benchmark.
828859
# The recommended state for this setting is: Audit All.
829860
# Note: Possible Valid Settings
830-
# 1 - Deny All
831-
# 2 - Audit All
832-
# Default: 2
833-
win22cis_restrict_sending_ntlm_traffic: 2
861+
# 1 - Audit All
862+
# 2 - Deny All
863+
# Default: 1
864+
win22cis_restrict_sending_ntlm_traffic: 1
834865

835866
# 2.3.17.2
836867
# win22cis_consent_prompt_behavior_admin is the policy setting controls the behavior of the elevation prompt for administrators.
@@ -1052,7 +1083,7 @@ win22cis_remote_encryption_protection_aggressiveness: 1
10521083
# win22cis_idle_rdp_session_disconnect_time is the setting that allows you to specify the maximum amount of time that an active Remote Desktop
10531084
# Services session can be idle (without user input) before it is automatically disconnected.
10541085
# The recommended state for this setting is: Enabled: 15 minutes or less, but not Never (0).
1055-
# 1 min = 60000, 5 min = 300000, 10 min = 600000, 15 min = 900000
1086+
# This now accepts any value between 1 and 900000.
10561087
# Default: 900000
10571088
win22cis_idle_rdp_session_disconnect_time: 900000
10581089

tasks/ansible_hardening/prelim.yml

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,46 +29,56 @@
2929
# Current list is elastic and will be updated as we test more cloud based services.
3030
# Current testing is working in Azure using Hyper-V. We are currently using this for reference:
3131
# https://github.com/ansible/ansible/blob/905131fc76a07cf89dbc8d33e7a4910da3f10a16/lib/ansible/module_utils/facts/virtual/linux.py#L205
32-
- name: PRELIM | Set Fact If Cloud-Based System.
32+
- name: "PRELIM | Set Fact If Cloud-Based System (auto-detect)."
3333
when:
34+
- hosted_virtual_system_override is not defined
3435
- not ansible_virtualization_type == 'VMware' or
3536
(ansible_system_vendor == 'Microsoft Corporation' and
3637
ansible_virtualization_type in ['Hyper-V', 'hvm', 'kvm'])
3738
tags: always
3839
ansible.builtin.set_fact:
3940
prelim_win22cis_cloud_based_system: true
4041

41-
- name: PRELIM | Obtain Then Load Default And User Hives
42+
- name: "PRELIM | Set Fact If Cloud-Based System (manual override)."
43+
when: hosted_virtual_system_override is defined
44+
tags: always
45+
ansible.builtin.set_fact:
46+
prelim_win22cis_cloud_based_system: "{{ hosted_virtual_system_override }}"
47+
48+
# ╔═══════════════════════════════════════════════════════════════════════════════╗
49+
# ║ PRELIM | Section 19 HKU Scope (Per CIS Specification) ║
50+
# ║ ║
51+
# ║ Section 19 targets domain-joined interactive users only. The correct ║
52+
# ║ source is HKEY_USERS subkeys already loaded in the registry by Windows ║
53+
# ║ at logon — no manual NTUSER.DAT loading is required or recommended. ║
54+
# ║ ║
55+
# ║ Per CIS, include only subkeys where: ║
56+
# ║ - SID begins with S-1-5-21-* (domain interactive users) ║
57+
# ║ - Does NOT end with _Classes ║
58+
# ║ - Is NOT .DEFAULT, S-1-5-18, S-1-5-19, or S-1-5-20 ║
59+
# ║ - Is NOT an NT SERVICE SID (S-1-5-80-*) ║
60+
# ║ ║
61+
# ║ If no users are currently logged on, section 19 is not considered out of ║
62+
# ║ compliance per CIS. Tasks will simply loop over an empty list. ║
63+
# ╚═══════════════════════════════════════════════════════════════════════════════╝
64+
- name: "PRELIM | Obtain Current Interactive User Hives"
4265
when: win22cis_section19
4366
tags: always
4467
block:
45-
- name: PRELIM | Obtain Then Load Default And User Hives | Load default user hive (Account that all new users get created from profile)
46-
ansible.windows.win_shell: REG LOAD HKU\DEFAULT C:\Users\Default\NTUSER.DAT
47-
changed_when: false
48-
failed_when: false
49-
50-
- name: PRELIM | Obtain Then Load Default And User Hives | Pull all username and SIDs
51-
ansible.windows.win_shell: Get-CimInstance -Class Win32_UserAccount -Filter "SID LIKE 'S-1-5-%'" | ForEach-Object { $_.Name + " " + $_.SID }
52-
changed_when: false
53-
failed_when: false
54-
register: prelim_all_users
55-
56-
- name: PRELIM | Obtain Then Load Default And User Hives | Create results list fact for username and SIDs
57-
ansible.builtin.set_fact:
58-
prelim_username_and_sid_results_list: "{{ prelim_all_users.stdout_lines | map('split', ' ') | list }}"
59-
60-
- name: PRELIM | Obtain Then Load Default And User Hives | Load all user hives from username and SIDs list
61-
ansible.windows.win_shell: REG LOAD HKU\{{ item.1 }} C:\Users\{{ item.0 }}\NTUSER.DAT
62-
changed_when: false
63-
failed_when: false
64-
loop: "{{ prelim_username_and_sid_results_list }}"
65-
66-
- name: PRELIM | Obtain Then Load Default And User Hives | Retrieve current users SIDs from HKEY_USERS
67-
ansible.windows.win_shell: (Get-ChildItem "REGISTRY::HKEY_USERS").name | Where-Object {$_ -notlike "*_classes"}
68+
- name: PRELIM | Obtain Current Interactive User Hives | Retrieve live domain user SIDs from HKEY_USERS
69+
vars:
70+
hku_script: |
71+
$users = (Get-ChildItem 'REGISTRY::HKEY_USERS').Name
72+
$users | Where-Object {
73+
$_ -match 'S-1-5-21-' -and
74+
$_ -notlike '*_Classes' -and
75+
$_ -notmatch 'S-1-5-18|S-1-5-19|S-1-5-20' -and
76+
$_ -notmatch 'S-1-5-80-'
77+
} | ForEach-Object { $_ -replace 'HKEY_USERS\\', '' }
78+
ansible.windows.win_shell: "{{ hku_script }}"
6879
changed_when: false
69-
failed_when: false
7080
register: prelim_current_users_loaded_hku
7181

72-
- name: PRELIM | Obtain Then Load Default And User Hives | Create list fact for current users SIDs from HKEY_USERS
82+
- name: PRELIM | Obtain Current Interactive User Hives | Set list fact for live user SIDs
7383
ansible.builtin.set_fact:
74-
prelim_hku_loaded_list: "{{ prelim_current_users_loaded_hku.stdout | regex_replace('HKEY_USERS\\\\', '') | split }}"
84+
prelim_hku_loaded_list: "{{ prelim_current_users_loaded_hku.stdout_lines }}"

tasks/ansible_hardening/section02.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@
635635
when:
636636
- win22cis_rule_2_2_21
637637
- prelim_win22cis_is_domain_controller
638-
- not win_skip_for_test
638+
- not (win_skip_for_test | bool)
639639
tags:
640640
- level1-domaincontroller
641641
- rule_2.2.21
@@ -790,7 +790,7 @@
790790
when:
791791
- win22cis_rule_2_2_26
792792
- prelim_win22cis_is_domain_controller
793-
- not win_skip_for_test
793+
- not (win_skip_for_test | bool)
794794
tags:
795795
- level1-domaincontroller
796796
- rule_2.2.26
@@ -822,7 +822,7 @@
822822
when:
823823
- win22cis_rule_2_2_27
824824
- prelim_win22cis_is_domain_member
825-
- not win_skip_for_test
825+
- not (win_skip_for_test | bool)
826826
tags:
827827
- level1-memberserver
828828
- rule_2.2.27
@@ -1604,7 +1604,7 @@
16041604
- name: "2.3.1.3 | PATCH | Configure Accounts Rename administrator account"
16051605
when:
16061606
- win22cis_rule_2_3_1_3
1607-
- not win_skip_for_test
1607+
- not (win_skip_for_test | bool)
16081608
tags:
16091609
- level1-domaincontroller
16101610
- level1-memberserver

0 commit comments

Comments
 (0)