Skip to content

Commit a43d371

Browse files
authored
Merge pull request #77 from ansible-lockdown/devel
v1r3 release to main
2 parents 685267a + 83dcd8a commit a43d371

34 files changed

Lines changed: 714 additions & 408 deletions

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ci:
88

99
repos:
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.6.0
11+
rev: v5.0.0
1212
hooks:
1313
# Safety
1414
- id: detect-aws-credentials
@@ -36,12 +36,12 @@ repos:
3636
- id: detect-secrets
3737

3838
- repo: https://github.com/gitleaks/gitleaks
39-
rev: v8.18.4
39+
rev: v8.23.3
4040
hooks:
4141
- id: gitleaks
4242

4343
- repo: https://github.com/ansible-community/ansible-lint
44-
rev: v24.7.0
44+
rev: v25.1.1
4545
hooks:
4646
- id: ansible-lint
4747
name: Ansible-lint

Changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Ubuntu22CIS
1+
# RHEL9STIG
22

33
## 1.2.1 Based on STIG V1R2 Jan24 2024
44

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# MIT License
1+
MIT License
22

3-
Copyright (c) 2023 Mindpoint Group / Lockdown Enterprise / Lockdown Enterprise Releases
3+
Copyright (c) 2025 Mindpoint Group - A Tyto Athene Company / Ansible Lockdown
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Configure a RHEL9 based system to be complaint with Disa STIG
44

5-
This role is based on RHEL 9 DISA STIG: [Version 1, Rel 2 released on Jan 24, 2024](https://dl.dod.cyber.mil/wp-content/uploads/stigs/U_RHEL_9_V1R2_STIG.zip).
5+
This role is based on RHEL 9 DISA STIG: [Version 1, Rel 3 released on Apr 24, 2024](https://dl.dod.cyber.mil/wp-content/uploads/stigs/U_RHEL_9_V1R3_STIG.zip).
66

7-
## Initial Relase from STIG, still many items that not quite aligned in the documentation
7+
## Initial Release from STIG, still many items that not quite aligned in the documentation
88

99
---
1010

defaults/main.yml

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22

33
## metadata for Audit benchmark
4-
benchmark_version: 'v1r2'
4+
benchmark_version: 'v1r3'
55

66
## Benchmark name used by audting control role
77
# The audit variable found at the base
@@ -42,6 +42,13 @@ container_vars_file: is_container.yml
4242
# system_is_ec2 toggle will disable tasks that fail on Amazon EC2 instances. Set true to skip and false to run tasks
4343
system_is_ec2: false
4444

45+
# Connecting user, due to the way many users work differently this is to try and assist the use of connecting user if required
46+
# This is useful when part of kickstart build or running as root and not defining the ansible_user option
47+
# used @ RHEL-09-411015
48+
rhel9stig_default_user: root
49+
rhel9stig_connecting_user: "{{ ansible_env.SUDO_USER | default(rhel9stig_default_user) }}"
50+
rhel9stig_playbook_user: "{{ ansible_user | default(rhel9stig_connecting_user) }}"
51+
4552
# Whether to skip the reboot
4653
skip_reboot: true
4754

@@ -323,7 +330,6 @@ rhel_09_255045: true
323330
rhel_09_255055: true
324331
rhel_09_255060: true
325332
rhel_09_255065: true
326-
rhel_09_255070: true
327333
rhel_09_255075: true
328334
rhel_09_255080: true
329335
rhel_09_255085: true
@@ -597,12 +603,16 @@ rhel_09_653120: true
597603

598604
### CONTROLS
599605

600-
## Grahical/Gnome interface required
601-
rhel9stig_gui: false
606+
## Graphical/Gnome interface approved to be present
607+
rhel9stig_gui_approved: false
608+
609+
# If gui not installed
610+
rhel9stig_gui: "{{ rhel_09_gnome_present.stat.exists | default(false) }}"
602611

603612
## SSHD
604613
rhel9stig_sshd_config_file: /etc/ssh/sshd_config
605614
rhel9stig_ssh_required: true
615+
rhel9stig_sshd_config_maxlogins: 10
606616
rhel9stig_sshd_config:
607617
banner_file: /etc/issue
608618
ciphers: "{{ rhel9stig_dod_ciphers }}"
@@ -617,8 +627,7 @@ rhel9stig_sshd_config:
617627
kerbauth: 'no'
618628
lastlog: 'yes'
619629
loglevel: VERBOSE
620-
macs_clients: "{{ rhel9stig_dod_macs_clients }}"
621-
macs_server: "{{ rhel9stig_dod_macs_server }}"
630+
macs: "{{ rhel9stig_dod_macs }}"
622631
pubkeyauth: 'yes'
623632
permitroot: 'no'
624633
privsep: sandbox
@@ -718,6 +727,17 @@ rhel9stig_time_synchronization_servers:
718727
- '1.us.pool.ntp.mil'
719728
rhel9stig_chrony_server_options: "iburst maxpoll 16" # Max Settings is maxpoll 16
720729

730+
## fapolicy
731+
# Allow adding of fapolicy rules uses whitelist below
732+
rhel9stig_add_fapolicy_policy: false
733+
734+
# rhel9stig_fapolicy_white_list is the whitelist for fapolicyd
735+
rhel9stig_fapolicy_white_list:
736+
- '# Allow Ansible'
737+
- "allow perm=any trust=1 : dir={{ ansible_env.PWD }}/.ansible/"
738+
- 'allow perm=any trust=1 : dir=/root/.ansible/'
739+
- 'allow perm=any trust=1 : dir=/tmp/ansible/'
740+
721741
## DNS
722742
# Please adjust accordingly for ipv4 or ipv6
723743
rhel9stig_dns_ip4_servers:
@@ -740,9 +760,9 @@ rhel9stig_postfix_client_conf: permit_mynetworks,reject
740760
### ACCOUNTS and AUTH ###
741761
## PAM and password settings
742762
rhel9stig_pass:
743-
max_days: '60'
744-
min_days: '1'
745-
minlen: '15'
763+
max_days: 60
764+
min_days: 1
765+
minlen: 15
746766

747767
rhel9stig_user_inactive_days: '35'
748768

@@ -778,13 +798,13 @@ rhel9stig_pam:
778798
rounds: '5000'
779799

780800
rhel9stig_pwquality:
781-
dcredit: '-1'
782-
dictcheck: '1'
783-
difok: '8'
784-
lcredit: '-1'
785-
maxclassrepeat: '4'
786-
maxrepeat: '3'
787-
minclass: '4'
801+
dcredit: -1
802+
dictcheck: 1
803+
difok: 8
804+
lcredit: -1
805+
maxclassrepeat: 4
806+
maxrepeat: 3
807+
minclass: 4
788808
ocredit: -1
789809
ucredit: -1
790810

@@ -822,7 +842,7 @@ rhel9stig_remotelog_server:
822842
# Ensure this matches the filesystem where the audit logs are stored.
823843
# It will affect checks for control RHEL-09-653030
824844

825-
rhel9stig_audit_log_filesystem: /var/log/audit
845+
rhel9stig_audit_log_filesystem: '/var/log/audit'
826846
rhel9stig_audit_conf:
827847
action_mail_acct: root
828848
admin_space_left: 5%

galaxy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ license:
3333
# requirements as 'namespace' and 'name'
3434
tags:
3535
- ansible-lockdown
36-
- mindpointgroup
3736
- stig
3837
- disa
3938
- devsecops
4039
- rhel7
4140
- rhel7-stig
4241
- rhel8
4342
- rhel8-stig
43+
- rhel9
44+
- rhel9-stig
4445
- ubuntu18
4546
- ubuntu18-stig
4647
- ubuntu20

handlers/main.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
ansible.builtin.systemd:
55
daemon_reload: true
66

7-
- name: Change_requires_reboot
8-
ansible.builtin.set_fact:
9-
reboot_required: true
10-
117
- name: Sshd_restart
128
ansible.builtin.systemd:
139
name: sshd
@@ -82,20 +78,34 @@
8278
name: rsyslog.service
8379
state: restarted
8480

81+
# Must be prior to fapolicyd restart
82+
- name: Generate fapolicyd rules
83+
ansible.builtin.shell: fagenrules --load
84+
85+
- name: Restart fapolicyd
86+
ansible.builtin.service:
87+
name: fapolicyd
88+
state: restarted
89+
8590
## Auditd tasks note order for handlers to run
8691

8792
- name: Auditd_immutable_check
8893
ansible.builtin.shell: grep -c "^-e 2" /etc/audit/rules.d/audit.rules
8994
changed_when: false
95+
failed_when: auditd_immutable_check.rc not in [ 0, 1 ]
9096
register: auditd_immutable_check
9197

9298
- name: Audit_immutable_fact
9399
when:
94-
- auditd_immutable_check.stdout == '1'
100+
- auditd_immutable_check.stdout >= '1'
95101
notify: change_requires_reboot
96102
ansible.builtin.debug:
97103
msg: "Reboot required for auditd to apply new rules as immutable set"
98104

105+
- name: Change_requires_reboot
106+
ansible.builtin.set_fact:
107+
change_requires_reboot: true
108+
99109
- name: Restart_auditd
100110
tags:
101111
- skip_ansible_lint

meta/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ galaxy_info:
66
license: MIT
77
role_name: rhel9_stig
88
namespace: mindpointgroup
9-
min_ansible_version: 2.15.1
9+
min_ansible_version: 2.12.1
1010
platforms:
1111
- name: EL
1212
versions:

tasks/Cat1/RHEL-09-2xxxxx.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,18 @@
5252
- NIST800-53R4_AC-6
5353
notify: Systemd_daemon_reload
5454
block:
55-
- name: HIGH | RHEL-09-211050 | PATCH | The systemd Ctrl-Alt-Delete burst key sequence in RHEL 9 must be disabled | systemctl disable
56-
ansible.builtin.systemd:
57-
enabled: false
58-
masked: true
59-
name: ctrl-alt-del.target
60-
state: stopped
61-
6255
- name: HIGH | RHEL-09-211050 | PATCH | The systemd Ctrl-Alt-Delete burst key sequence in RHEL 9 must be disabled | Create symlink to /dev/null
6356
ansible.builtin.file:
6457
dest: /etc/systemd/system/ctrl-alt-del.target
6558
src: /dev/null
6659
state: link
6760

61+
- name: HIGH | RHEL-09-211050 | PATCH | The systemd Ctrl-Alt-Delete burst key sequence in RHEL 9 must be disabled | systemctl disable
62+
ansible.builtin.systemd:
63+
masked: true
64+
name: ctrl-alt-del.target
65+
state: stopped
66+
6867
- name: HIGH | RHEL-09-212020 | PATCH | RHEL 9 must require a unique superusers name upon booting into single-user and maintenance modes.
6968
when:
7069
- rhel_09_212020
@@ -182,19 +181,19 @@
182181

183182
- name: HIGH | RHEL-09-215060 | PATCH | RHEL 9 must not have a Trivial File Transfer Protocol (TFTP) server package installed.
184183
when:
185-
- "'tftp' in ansible_facts.packages"
184+
- "'tftp-server' in ansible_facts.packages"
186185
- rhel_09_215060
187186
tags:
188187
- RHEL-09-215060
189188
- CAT1
190189
- CCI-000366
191190
- SRG-OS-000480-GPOS-00227
192-
- SV-257835r925492_rule
191+
- SV-257835r952171_rule
193192
- V-257835
194193
- NIST800-53R4_CM-6
195194
- tftp
196195
ansible.builtin.package:
197-
name: tftp
196+
name: tftp-server
198197
state: absent
199198

200199
- name: HIGH | RHEL-09-231190 | AUDIT | All RHEL 9 local disk partitions must implement cryptographic mechanisms to prevent unauthorized disclosure or modification
@@ -323,7 +322,7 @@
323322
- SRG-OS-000106-GPOS-00053
324323
- SRG-OS-000480-GPOS-00229
325324
- SRG-OS-000480-GPOS-00227
326-
- SV-257984r943034_rule
325+
- SV-257984r952179_rule
327326
- V-257984
328327
- NIST800-53R4_CM-6
329328
- NIST800-53R4_IA-2
@@ -343,7 +342,7 @@
343342
- CAT1
344343
- CCI-000877
345344
- SRG-OS-000125-GPOS-00065
346-
- SV-257986r943038_rule
345+
- SV-257986r952183_rule
347346
- V-257986
348347
- NIST800-53R4_MA-4
349348
- ssh

tasks/Cat1/RHEL-09-4xxxxx.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22

3-
- name: HIGH | RHEL-09-0411100 | The root account must be the only account having unrestricted access to RHEL 9 system.
3+
- name: HIGH | RHEL-09-411100 | The root account must be the only account having unrestricted access to RHEL 9 system.
44
when:
55
- rhel_09_411100
66
tags:
@@ -15,13 +15,13 @@
1515
vars:
1616
warn_control_id: "HIGH | RHEL-09-411100"
1717
block:
18-
- name: HIGH | RHEL-09-0411100 | AUDIT | The root account must be the only account having unrestricted access to RHEL 9 system.
18+
- name: HIGH | RHEL-09-411100 | AUDIT | The root account must be the only account having unrestricted access to RHEL 9 system.
1919
ansible.builtin.shell: "cat /etc/passwd | awk -F: '($3 == 0 && $1 != \"root\") {i++;print $1 } END {exit i}'"
2020
changed_when: false
2121
check_mode: false
2222
register: rhel9stig_uid_zero_accounts_except_root
2323

24-
- name: HIGH | RHEL-09-0411100 | WARN | The root account must be the only account having unrestricted access to RHEL 9 system.
24+
- name: HIGH | RHEL-09-411100 | WARN | The root account must be the only account having unrestricted access to RHEL 9 system.
2525
when:
2626
- rhel9stig_uid_zero_accounts_except_root is defined
2727
- rhel9stig_uid_zero_accounts_except_root.stdout | length > 0

0 commit comments

Comments
 (0)