Skip to content

Commit fe50d2a

Browse files
authored
Merge pull request #34 from ansible-lockdown/devel
Devel to main Signed-off-by: George Nalen <georgen@mindpointgroup.com>
2 parents cf84c5c + ed4dc79 commit fe50d2a

16 files changed

Lines changed: 600 additions & 219 deletions

.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: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
ignore: |
3+
tests/
4+
molecule/
5+
.github/
6+
.gitlab-ci.yml
7+
*molecule.yml
8+
9+
extends: default
10+
11+
rules:
12+
indentation:
13+
# Requiring 4 space indentation
14+
spaces: 4
15+
# Requiring consistent indentation within a file, either indented or not
16+
indent-sequences: consistent
17+
truthy: disable
18+
braces:
19+
max-spaces-inside: 1
20+
level: error
21+
brackets:
22+
max-spaces-inside: 1
23+
level: error
24+
line-length: disable

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Requirements
1212

1313
RHEL 8 or CentOS 8 - Other versions are not supported.
1414

15-
1615
Dependencies
1716
------------
1817

@@ -25,10 +24,12 @@ The following packages must be installed on the controlling host/host where ansi
2524

2625
Package 'python-xmltodict' is required if you enable the OpenSCAP tool installation and run a report. Packages python(2)-passlib and python-jmespath are required for tasks with custom filters or modules. These are all required on the controller host that executes Ansible.
2726

28-
2927
Role Variables
3028
--------------
3129

30+
- some found below
31+
- please refer to defaults/main.yml for a full breakdown
32+
3233
| Name | Default Value | Description |
3334
|-------------------|---------------------|----------------------|
3435
| `rhel8stig_oscap_scan` | `no` | Install and run an OpenSCAP report before and after the application of this role |
@@ -56,6 +57,12 @@ Role Variables
5657
| `rhel8stig_password_complexity.maxrepeat` | `3` | Maximum number of allowed same consecutive characters in a new password. |
5758
| `rhel8stig_password_complexity.maxclassrepeat` | `4` | Maximum number of allowed same consecutive characters in the same **class** in the new password. |
5859
| `rhel8stig_password_complexity.minlen` | `15` | Minimum number of characters in a new password. |
60+
| `rhel8stig_sssd_conf` | [see defaults/main.yml](./defaults/main.yml) | Default location for sssd.conf |
61+
| `rhel8stig_sssd_domain` | testing.test | Domain to be used in sssd |
62+
| `rhel8stig_sssd.certmap` | certmap/{{ rhel8stig_sssd_domain }}/rule_name | certmap rule for sssd |
63+
| `rhel8stig_sssd.matchrule` | =.*EDIPI@mil | match rule in relationship to domain e.g. CN etc |
64+
| `rhel8stig_sssd.maprule` | (userCertificate;binary={cert!bin}) | map cert auth requirements into sssd rule |
65+
| `rhel8stig_sssd.domains` | testing.test | comma seperated list of domains using sssd |
5966
| `rhel8stig_shell_session_timeout` | `file: /etc/profile` `timeout: 600` | Dictionary of session timeout setting and file (TMOUT setting can be set in multiple files) |
6067
| `rhel8stig_interactive_uid_start` | `1000` | Interactive user start point (UID_MIN) from /etc/login.defs |
6168
| `rhel8stig_ntp_server_name: server.name` | `server.name` | The NTP Server Name |
@@ -64,9 +71,10 @@ Role Variables
6471
| `rhel8stig_sshd_compression` | `no` | The Compression parameter in /etc/ssh/sshd_config needs to be set to no or delayed |
6572
| `rhel8stig_path_to_sshkey` | `/root/.ssh/` | Custom path to the ssh key |
6673
| `rhel8stig_hashing_rounds` | `5000` | The rounds parameter goes into pamd configs and needs to be set to now lower than 5000 |
67-
| `rhel8stig_dns_servers` | `9.9.9.9 and 149.112.112.112` | To conform to STIG standards you need two DNS servers, parameter is in list form |
74+
| `rhel8stig_dns_servers` | `8.8.8.8 and 8.8.4.4` | To conform to STIG standards you need two DNS servers, parameter is in list form |
6875
| `rhel8stig_nfs_mounts` | `vars` | NFS file system mounts pull automatcially with prelim task |
6976
| `rhel8stig_nfs_mounts_query` | `[?starts_with(fstype, 'nfs')].mount` | The query for mounts |
77+
| `rhel8stig_skip_reboot` | `false` | Whether or not to skip the reboot |
7078

7179

7280
Example Playbook
@@ -78,4 +86,3 @@ Example Playbook
7886
when:
7987
- ansible_os_family == 'RedHat'
8088
- ansible_distribution_major_version | version_compare('8', '=')
81-

defaults/main.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ rhel8stig_system_is_container: false
3838
# system_is_ec2 toggle will disable tasks that fail on Amazon EC2 instances. Set true to skip and false to run tasks
3939
system_is_ec2: false
4040

41+
# Whether to skip the reboot
42+
rhel8stig_skip_reboot: false
43+
4144
# These variables correspond with the STIG IDs defined in the STIG and allows you to enable/disable specific rules.
4245
# PLEASE NOTE: These work in coordination with the cat1, cat2, cat3 group variables. You must enable an entire group
4346
# in order for the variables below to take effect.
@@ -515,6 +518,15 @@ rhel8stig_password_complexity:
515518
minlen: 15
516519
dictcheck: 1
517520

521+
# rhel_08_010400 or rhel_08_020090 or rhel_08_020250 or rhel_08_020290
522+
rhel8stig_sssd_conf: /etc/sssd/sssd.conf
523+
rhel8stig_sssd_domain: testing.test
524+
rhel8stig_sssd:
525+
certmap: "certmap/{{ rhel8stig_sssd_domain }}/rule_name"
526+
matchrule: "=.*EDIPI@mil"
527+
maprule: (userCertificate;binary={cert!bin})
528+
domains: "{{ rhel8stig_sssd_domain }}"
529+
518530
# RHEL-08-020070
519531
# Session timeout setting file (TMOUT setting can be set in multiple files)
520532
# Timeout value is in seconds. (60 seconds * 10 = 600)
@@ -567,7 +579,7 @@ rhel8stig_audisp_disk_full_action: single
567579
# rhel8stig_audisp_network_failure_action optoins are syslog, halt, and single
568580
rhel8stig_audisp_network_failure_action: single
569581

570-
# RHEL-08-030060
582+
# RHEL-08-030060
571583
# rhel8stig_auditd_disk_full_action options are SYSLOG, HALT, and SINGLE to fit STIG standards
572584
rhel8stig_auditd_disk_full_action: HALT
573585

@@ -625,7 +637,7 @@ rhel8stig_auditd_failure_flag: "{{ rhel8stig_availability_override | ternary(1,
625637
# REHL-08-010020
626638
rhel8stig_boot_part: "{{ rhel_08_boot_part.stdout }}"
627639

628-
#
640+
#
629641
rhel8stig_machine_uses_uefi: "{{ rhel_08_sys_firmware_efi.stat.exists }}"
630642
rhel8stig_grub_cfg_path: "{{ rhel8stig_machine_uses_uefi | ternary('/boot/efi/EFI/' ~ (ansible_distribution | lower) ~ '/grub.cfg', '/boot/grub2/grub.cfg') }}"
631643
rhel8stig_grub_cfg_path_invalid: "{{ (not rhel8stig_machine_uses_uefi) | ternary('/boot/efi/EFI/' ~ (ansible_distribution | lower) ~ '/grub.cfg', '/boot/grub2/grub.cfg') }}"
@@ -638,15 +650,25 @@ rhel8stig_nfs_mounts: "{{ ansible_mounts | to_json | from_json | json_query(rhel
638650
rhel8stig_nfs_mounts_query: "[?starts_with(fstype, 'nfs')].mount"
639651

640652
# RHEL-08-010680
641-
rhel8stig_dns_servers:
653+
# This can be managed using a template ensure settings are correct
654+
rhel8_stig_use_resolv_template: false
655+
rhel8_stig_resolv_domain: example.com
656+
rhel8_stig_resolv_search:
657+
# - 'example.com'
658+
# - 'blah'
659+
rhel8_stig_resolv_options:
660+
# - 'rotate 2'
661+
# - 'timeout:1'
662+
663+
rhel8stig_dns_servers: # The order needs to be set as expected. If you have 3 you will need to amend playbook (not ideal)
642664
- 8.8.8.8
643665
- 8.8.4.4
644666

645667
rhel8stig_int_gid: 1000
646668

647669
# RHEL-08-010130
648670
# The rounds parameter goes into the password sufficient pam_unix.so element of the password-auth and system-auth files. The value shoudl be set no lower than 5000
649-
rhel8stig_hashing_rounds: 5000
671+
rhel8stig_hashing_rounds: 5000
650672

651673
# RHEL-08-010100
652674
rhel8stig_path_to_sshkey: "/root/.ssh/"
@@ -673,7 +695,7 @@ rhel8stig_custom_firewall_zone: "new_fw_zone"
673695

674696
# RHEL-08-040090
675697
# rhel8stig_white_list_services is the services that you want to allow through initially for teh new firewall zone
676-
# http and ssh need to be enabled for the role to run.
698+
# http and ssh need to be enabled for the role to run.
677699
rhel8stig_white_list_services:
678700
- http
679701
- https
@@ -698,4 +720,4 @@ rhel8stig_gnutls_encryption: "-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1
698720

699721
# RHEL-08-020070
700722
# This is the value for the tmux lock after setting. To conform to STIG standards value needs to be set to 900 or less
701-
rhel8stig_tmux_lock_after_time: 900
723+
rhel8stig_tmux_lock_after_time: 900

handlers/main.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
service:
1717
name: sssd
1818
state: restarted
19+
when:
20+
- "'sssd' in ansible_facts.packages"
1921

2022
- name: restart snmpd
2123
service:
@@ -48,6 +50,9 @@
4850
src: "{{ rhel8stig_grub_cfg_path | dirname }}/{{ item }}"
4951
dest: "{{ rhel8stig_grub_cfg_path_invalid | dirname }}/{{ item }}"
5052
remote_src: yes
53+
owner: root
54+
group: root
55+
mode: 0755
5156
with_items:
5257
- grub.cfg
5358
- user.cfg
@@ -107,7 +112,10 @@
107112

108113
- name: dconf update
109114
command: dconf update
110-
when: rhel8stig_has_dconf_command
115+
when:
116+
- "'dconf' in ansible_facts.packages"
117+
- rhel8stig_always_configure_dconf
118+
111119

112120
- name: prereport score
113121
debug:
@@ -122,4 +130,5 @@
122130
- name: reboot system
123131
shell: sleep 3; reboot
124132
async: 15
125-
poll: 0
133+
poll: 0
134+
when: not rhel8stig_skip_reboot

meta/main.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
---
22
galaxy_info:
3-
author: "Sam Doran, Josh Springer, Daniel Shepherd, James Cassell, Mike Renfro, DFed, George Nalen"
3+
author: "Sam Doran, Josh Springer, Daniel Shepherd, James Cassell, Mike Renfro, DFed, George Nalen, Mark Bolwell"
44
description: "Apply the DISA RHEL 8 STIG"
55
company: "MindPoint Group"
66
license: MIT
7-
min_ansible_version: 2.8.0
8-
7+
role_name: rhel8_stig
8+
min_ansible_version: 2.9.0
99
platforms:
1010
- name: EL
1111
versions:
1212
- 8
13-
1413
galaxy_tags:
1514
- system
1615
- security
1716
- stig
1817
- hardening
19-
2018
dependencies: []

site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
- role: "{{ playbook_dir }}"
99
rhel8cis_system_is_container: "{{ is_container | default(false) }}"
1010
rhel8cis_skip_for_travis: false
11-
rhel8cis_oscap_scan: yes
11+
rhel8cis_oscap_scan: yes

tasks/audit_oscap_scan_after.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
ignore_errors: true
1212
changed_when: false
1313
failed_when: false
14+
tags:
15+
- skip_ansible_lint
1416

1517
- name: Get the second scan result from the XML
1618
slurp:

tasks/audit_oscap_scan_before.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
ignore_errors: true
4040
changed_when: false
4141
failed_when: false
42+
tags:
43+
- skip_ansible_lint
4244

4345
- name: Get the scan result from the XML
4446
slurp:

0 commit comments

Comments
 (0)