Skip to content

Commit 7f75b72

Browse files
authored
Merge pull request #20 from ansible-lockdown/devel
Linting and Issue fixes
2 parents eeb1222 + a773697 commit 7f75b72

File tree

15 files changed

+4111
-3869
lines changed

15 files changed

+4111
-3869
lines changed

.ansible-lint

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
parseable: true
2+
quiet: true
3+
skip_list:
4+
- '204'
5+
- '305'
6+
- '303'
7+
- '403'
8+
- '306'
9+
- '602'
10+
use_default_rules: true
11+
verbosity: 0

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.env
22
*.log
33
*.retry
4+
.cache
45
.vagrant
56
tests/*redhat-subscription
67
tests/Dockerfile

.yamllint

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
ignore: |
3+
tests/
4+
molecule/
5+
.gitlab-ci.yml
6+
*molecule.yml
7+
8+
extends: default
9+
10+
rules:
11+
indentation:
12+
spaces: 4
13+
truthy: disable
14+
braces:
15+
max-spaces-inside: 1
16+
level: error
17+
brackets:
18+
max-spaces-inside: 1
19+
level: error
20+
line-length: disable

CONTRIBUTING.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
Contributing to MindPoint Group Projects
22
========================================
33

4+
Rules
5+
-----
6+
1) All commits must be GPG signed (details in Signing section)
7+
2) All commits must have Signed-off-by (Signed-off-by: Joan Doe <joan.doe@email.com>) in the commit message (details in Signing section)
8+
3) All work is done in your own branch or own fork
9+
4) Pull requests
10+
a) From within the repo: All pull requests go into the devel branch. There are automated checks for signed commits, signoff in commit message, and functional testing
11+
b) From a forked repo: All pull requests will go into a staging branch within the repo. There are automated checks for signed commits, signoff in commit message, and functional testing when going from staging to devel
12+
5) Be open and nice to each other
13+
14+
Workflow
15+
--------
16+
- Your work is done in your own individual branch. Make sure to to Signed-off and GPG sign all commits you intend to merge
17+
- All community Pull Requests are into the devel branch (from forked repos they go to staging before devel). There are automated checks for GPG signed, Signed-off in commits, and functional tests before being approved. If your pull request comes in from outside of our repo, the pull request will go into a staging branch. There is info needed from our repo for our CI/CD testing.
18+
- Once your changes are merged and a more detailed review is complete, an authorized member will merge your changes into the main branch for a new release
419
Signing your contribution
520
-------------------------
621

README.md

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,65 @@
11
Windows Server 2016 CIS
22
=========
3+
![Release](https://img.shields.io/github/v/release/ansible-lockdown/Windows-2016-CIS?style=plastic)
4+
5+
Configure a Windows Server 2016 system to be [CIS](https://www.cisecurity.org/cis-benchmarks/) v1.2.0 compliant. There are some intrusive tasks that have a toggle in defaults main.yml to disable to automated fix
6+
7+
Caution(s)
8+
-------
9+
This role **will make changes to the system** that could break things. This is not an auditing tool but rather a remediation tool to be used after an audit has been conducted.
10+
11+
This role was developed against a clean install of the Operating System. If you are implementing to an existing system please review this role for any site specific changes that are needed.
12+
13+
To use release version please point to main branch
14+
Based on [CIS Windows Server 2016 Benchmark ](https://community.cisecurity.org/collab/public/index.php).
15+
16+
Documentation
17+
-------------
18+
[Getting Started](https://www.lockdownenterprise.com/docs/getting-started-with-lockdown)<br>
19+
[Customizing Roles](https://www.lockdownenterprise.com/docs/customizing-lockdown-enterprise)<br>
20+
[Per-Host Configuration](https://www.lockdownenterprise.com/docs/per-host-lockdown-enterprise-configuration)<br>
21+
[Getting the Most Out of the Role](https://www.lockdownenterprise.com/docs/get-the-most-out-of-lockdown-enterprise)<br>
22+
[Wiki](https://github.com/ansible-lockdown/Windows-2016-CIS/wiki)<br>
23+
[Repo GitHub Page](https://ansible-lockdown.github.io/Windows-2016-CIS/)<br>
324

4-
Configure a Windows Server 2016 system to be CIS compliant.
525

6-
This role is based on CIS Microsoft Windows Server 2016 RTM: [Version 1.2.0 Rel 1607 released on May 27, 2020] (https://learn.cisecurity.org/l/799323/2020-07-10/zx1v).
726

827
Requirements
928
------------
1029

11-
Windows Server 2016 - Other versions are not supported.
30+
**General:**
31+
- Basic knowledge of Ansible, below are some links to the Ansible documentation to help get started if you are unfamiliar with Ansible
32+
- [Main Ansible documentation page](https://docs.ansible.com)
33+
- [Ansible Getting Started](https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html)
34+
- [Tower User Guide](https://docs.ansible.com/ansible-tower/latest/html/userguide/index.html)
35+
- [Ansible Community Info](https://docs.ansible.com/ansible/latest/community/index.html)
36+
- Functioning Ansible and/or Tower Installed, configured, and running. This includes all of the base Ansible/Tower configurations, needed packages installed, and infrastructure setup.
37+
- Please read through the tasks in this role to gain an understanding of what each control is doing. Some of the tasks are disruptive and can have unintended consiquences in a live production system. Also familiarize yourself with the variables in the defaults/main.yml file or the [Main Variables Wiki Page](https://github.com/ansible-lockdown/Windows-2016-CIS/wiki/Main-Variables).
38+
39+
**Technical Dependencies:**
40+
- Running Ansible/Tower setup (this role is tested against Ansible version 2.9.1 and newer)
41+
- Python3 Ansible run environment
42+
43+
Role Variables
44+
--------------
45+
46+
This role is designed that the end user should not have to edit the tasks themselves. All customizing should be done via the defaults/main.yml file or with extra vars within the project, job, workflow, etc. These variables can be found [here](https://github.com/ansible-lockdown/Windows-2016-CIS/wiki/Main-Variables) in the Main Variables Wiki page. All variables are listed there along with descriptions.
47+
48+
Branches
49+
--------
50+
51+
- **devel** - This is the default branch and the working development branch. Community pull requests will pull into this branch
52+
- **main** - This is the release branch
53+
- **reports** - This is a protected branch for our scoring reports, no code should ever go here
54+
- **gh-pages** - This is the github pages branch
55+
- **all other branches** - Individual community member branches
56+
57+
Community Contribution
58+
----------------------
59+
60+
We encourage you (the community) to contribute to this role. Please read the rules below.
61+
62+
- Your work is done in your own individual branch. Make sure to Signed-off and GPG sign all commits you intend to merge.
63+
- All community Pull Requests are pulled into the devel branch
64+
- Pull Requests into devel will confirm your commits have a GPG signature, Signed-off, and a functional test before being approved
65+
- Once your changes are merged and a more detailed review is complete, an authorized member will merge your changes into the main branch for a new release

Vagrantfile

Lines changed: 0 additions & 25 deletions
This file was deleted.

defaults/main.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
section01_patch: yes
3-
section02_patch: yes
4-
section09_patch: yes
5-
section17_patch: yes
6-
section18_patch: yes
7-
section19_patch: yes
2+
section01_patch: true
3+
section02_patch: true
4+
section09_patch: true
5+
section17_patch: true
6+
section18_patch: true
7+
section19_patch: true
88

99
min_ansible_version: "2.6"
1010

@@ -35,10 +35,10 @@ workaround_for_ssg_benchmark: true
3535
# tweak role to run in a non-privileged container
3636
system_is_container: no
3737

38-
#set to false to skip tasks that either have not been developed or cannot be automated
38+
# set to false to skip tasks that either have not been developed or cannot be automated
3939
is_implemented: false
4040

41-
#set to false to skip long running tasks
41+
# set to false to skip long running tasks
4242
long_running: false
4343

4444
win_skip_for_test: false
@@ -89,8 +89,8 @@ rule_2_2_27: true
8989
rule_2_2_28: true
9090
rule_2_2_29: true
9191
rule_2_2_30: true
92-
rule_2_2_31: true
93-
rule_2_2_32: true
92+
rule_2_2_31: true
93+
rule_2_2_32: true
9494
rule_2_2_33: true
9595
rule_2_2_34: true
9696
rule_2_2_35: true
@@ -439,6 +439,14 @@ rule_19_7_26_1: true
439439
rule_19_7_41_1: true
440440
rule_19_7_45_2_1: true
441441

442+
# Section 2 Variables
443+
# Control 2.3.1.5
444+
# win16cis_admin_username is the name the administrator account will be renamed to
445+
win16cis_admin_username: ChangeThis
446+
447+
# Control 2.3.1.6
448+
# win16cis_guest_username is the name the guest account will be renamed to
449+
win16cis_guest_username: GuestChangeThis
442450

443451
# This SID is the same for standalone, member, domain controller for 'Administrators' group
444452
sedebugprivilege: "*S-1-5-32-544"
@@ -506,4 +514,4 @@ public_firewall_log_path: '%SystemRoot%\System32\logfiles\firewall\publicfw.log'
506514
# 9.3.8
507515
# public_firewall_log_size is the size of the log file
508516
# To conform to CIS stadnards the value should be 16,384 or greater. Value is in KB
509-
public_firewall_log_size: 16,384
517+
public_firewall_log_size: 16,384

meta/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ galaxy_info:
44
description: "Ansible role to apply Windows Server 2016 CIS Benchmark"
55
company: "MindPoint Group"
66
license: MIT
7+
role_name: windows_2016_cis
78
min_ansible_version: 2.6
89

910
platforms:
10-
- name: Windows Server
11+
- name: Windows
1112
versions:
1213
- 2016
1314

site.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55

66
roles:
77
- role: "{{ playbook_dir }}"
8-
system_is_container: "{{ is_container | default(false) }}"

tasks/section01.yml

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
value: "{{ passwordhistorysize }}"
1717
when: rule_1_1_1
1818
tags:
19-
- level1-domaincontroller
20-
- level1-memberserver
21-
- rule_1.1.1
22-
- patch
19+
- level1-domaincontroller
20+
- level1-memberserver
21+
- rule_1.1.1
22+
- patch
2323

2424
- name: "SCORED | 1.1.2 | PATCH | (L1) Ensure 'Maximum password age' is set to '60 or fewer days, but not 0'"
2525
block:
@@ -38,10 +38,10 @@
3838
value: "{{ maximumpasswordage }}"
3939
when: rule_1_1_2
4040
tags:
41-
- level1-domaincontroller
42-
- level1-memberserver
43-
- rule_1.1.2
44-
- patch
41+
- level1-domaincontroller
42+
- level1-memberserver
43+
- rule_1.1.2
44+
- patch
4545

4646
- name: "SCORED | 1.1.3 | AUDIT | (L1) Ensure 'Minimum password age' is set to '1 or more day(s)'"
4747
block:
@@ -60,10 +60,10 @@
6060
value: "{{ minimumpasswordage }}"
6161
when: rule_1_1_3
6262
tags:
63-
- level1-domaincontroller
64-
- level1-memberserver
65-
- rule_1.1.3
66-
- patch
63+
- level1-domaincontroller
64+
- level1-memberserver
65+
- rule_1.1.3
66+
- patch
6767

6868
- name: "SCORED | 1.1.4 | AUDIT | (L1) Ensure 'Minimum password length' is set to '14 or more character(s)'"
6969
block:
@@ -82,10 +82,10 @@
8282
value: "{{ minimumpasswordlength }}"
8383
when: rule_1_1_4
8484
tags:
85-
- level1-domaincontroller
86-
- level1-memberserver
87-
- rule_1.1.4
88-
- patch
85+
- level1-domaincontroller
86+
- level1-memberserver
87+
- rule_1.1.4
88+
- patch
8989

9090
- name: "SCORED | 1.1.5 | PATCH | (L1) Ensure 'Password must meet complexity requirements' is set to 'Enabled'"
9191
win_security_policy:
@@ -94,35 +94,35 @@
9494
value: 1
9595
when: rule_1_1_5
9696
tags:
97-
- level1-domaincontroller
98-
- level1-memberserver
99-
- rule_1.1.5
100-
- patch
97+
- level1-domaincontroller
98+
- level1-memberserver
99+
- rule_1.1.5
100+
- patch
101101

102102
- name: "SCORED | 1.1.6 | PATCH | (L1) Ensure 'Store passwords using reversible encryption' is set to 'Disabled'"
103103
win_security_policy:
104-
section: System Access
105-
key: ClearTextPassword
106-
value: "0"
104+
section: System Access
105+
key: ClearTextPassword
106+
value: "0"
107107
when: rule_1_1_6
108108
tags:
109-
- level1-domaincontroller
110-
- level1-memberserver
111-
- rule_1.1.6
112-
- patch
109+
- level1-domaincontroller
110+
- level1-memberserver
111+
- rule_1.1.6
112+
- patch
113113

114-
#This rule must be applied first to make rule_1.2.1 and rule_1.2.3 applicable
114+
# This rule must be applied first to make rule_1.2.1 and rule_1.2.3 applicable
115115
- name: "SCORED | 1.2.2 | PATCH | (L1) Ensure 'Account lockout threshold' is set to '10 or fewer invalid logon attempt(s), but not 0'"
116116
win_security_policy:
117117
section: System Access
118118
key: LockoutBadCount
119119
value: "{{ lockoutbadcount }}"
120120
when: rule_1_2_2
121121
tags:
122-
- level1-domaincontroller
123-
- level1-memberserver
124-
- rule_1.2.2
125-
- patch
122+
- level1-domaincontroller
123+
- level1-memberserver
124+
- rule_1.2.2
125+
- patch
126126

127127
- name: "SCORED | 1.2.1 | AUDIT | (L1) Ensure 'Account lockout duration' is set to '15 or more minute(s)'"
128128
block:
@@ -136,17 +136,18 @@
136136

137137
- name: "SCORED | 1.2.1 | PATCH | (L1) Ensure 'Account lockout duration' is set to '15 or more minute(s)'"
138138
win_security_policy:
139-
section: System Access
140-
key: LockoutDuration
141-
value: "{{ lockoutduration }}"
139+
section: System Access
140+
key: LockoutDuration
141+
value: "{{ lockoutduration }}"
142142
when:
143-
- rule_1_2_1
144-
- is_implemented #Speelman | added because of this error "Failed to import secedit.ini file from C:\\Users\\vagrant\\AppData\\Local\\Temp\\tmp81F3.tmp
143+
- rule_1_2_1
144+
# Speelman | added because of this error "Failed to import secedit.ini file from C:\\Users\\vagrant\\AppData\\Local\\Temp\\tmp81F3.tmp
145+
- is_implemented
145146
tags:
146-
- level1-domaincontroller
147-
- level1-memberserver
148-
- rule_1.2.1
149-
- patch
147+
- level1-domaincontroller
148+
- level1-memberserver
149+
- rule_1.2.1
150+
- patch
150151

151152
- name: "SCORED | 1.2.3 | AUDIT | (L1) Ensure 'Reset account lockout counter after' is set to '15 or more minute(s)'"
152153
block:
@@ -165,7 +166,7 @@
165166
value: "{{ resetlockoutcount }}"
166167
when: rule_1_2_3
167168
tags:
168-
- level1-domaincontroller
169-
- level1-memberserver
170-
- rule_1.2.3
171-
- patch
169+
- level1-domaincontroller
170+
- level1-memberserver
171+
- rule_1.2.3
172+
- patch

0 commit comments

Comments
 (0)