4
0
Fork 0

consistent lineinfile usage

Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
Mark Bolwell 2022-04-06 16:58:03 +01:00
parent 02d686f920
commit 82d1d18504
No known key found for this signature in database
GPG key ID: F734FDFC154B83FB
12 changed files with 41 additions and 76 deletions

View file

@ -4,7 +4,7 @@
block: block:
- name: "1.1.1.1 | PATCH | Ensure mounting of cramfs filesystems is disabled | Edit modprobe config" - name: "1.1.1.1 | PATCH | Ensure mounting of cramfs filesystems is disabled | Edit modprobe config"
lineinfile: lineinfile:
dest: /etc/modprobe.d/CIS.conf path: /etc/modprobe.d/CIS.conf
regexp: "^(#)?install cramfs(\\s|$)" regexp: "^(#)?install cramfs(\\s|$)"
line: "install cramfs /bin/true" line: "install cramfs /bin/true"
create: yes create: yes
@ -29,7 +29,7 @@
block: block:
- name: "1.1.1.2 | PATCH | Ensure mounting of squashfs filesystems is disabled | Edit modprobe config" - name: "1.1.1.2 | PATCH | Ensure mounting of squashfs filesystems is disabled | Edit modprobe config"
lineinfile: lineinfile:
dest: /etc/modprobe.d/CIS.conf path: /etc/modprobe.d/CIS.conf
regexp: "^(#)?install squashfs(\\s|$)" regexp: "^(#)?install squashfs(\\s|$)"
line: "install squashfs /bin/true" line: "install squashfs /bin/true"
create: yes create: yes
@ -54,7 +54,7 @@
block: block:
- name: "1.1.1.3 | PATCH | Ensure mounting of udf filesystems is disable | Edit modprobe config" - name: "1.1.1.3 | PATCH | Ensure mounting of udf filesystems is disable | Edit modprobe config"
lineinfile: lineinfile:
dest: /etc/modprobe.d/CIS.conf path: /etc/modprobe.d/CIS.conf
regexp: "^(#)?install udf(\\s|$)" regexp: "^(#)?install udf(\\s|$)"
line: "install udf /bin/true" line: "install udf /bin/true"
create: yes create: yes

View file

@ -21,7 +21,7 @@
block: block:
- name: "1.1.10 | PATCH | Disable USB Storage | Edit modprobe config" - name: "1.1.10 | PATCH | Disable USB Storage | Edit modprobe config"
lineinfile: lineinfile:
dest: /etc/modprobe.d/CIS.conf path: /etc/modprobe.d/CIS.conf
regexp: "^(#)?install usb-storage(\\s|$)" regexp: "^(#)?install usb-storage(\\s|$)"
line: "install usb-storage /bin/true" line: "install usb-storage /bin/true"
create: yes create: yes

View file

@ -17,7 +17,7 @@
- name: "1.8.2 | PATCH | Ensure GDM login banner is configured" - name: "1.8.2 | PATCH | Ensure GDM login banner is configured"
lineinfile: lineinfile:
dest: "{{ item.file }}" path: "{{ item.file }}"
regexp: "{{ item.regexp }}" regexp: "{{ item.regexp }}"
line: "{{ item.line }}" line: "{{ item.line }}"
state: present state: present

View file

@ -26,10 +26,9 @@
- name: "2.1.2 | PATCH | Ensure chrony is configured | modify /etc/sysconfig/chronyd | 1" - name: "2.1.2 | PATCH | Ensure chrony is configured | modify /etc/sysconfig/chronyd | 1"
lineinfile: lineinfile:
dest: /etc/sysconfig/chronyd path: /etc/sysconfig/chronyd
regexp: "^(#)?OPTIONS" regexp: "^(#)?OPTIONS"
line: "OPTIONS=\"-u chrony\"" line: "OPTIONS=\"-u chrony\""
state: present
create: yes create: yes
mode: 0644 mode: 0644
when: when:

View file

@ -285,7 +285,7 @@
- name: "2.2.17 | PATCH | Ensure mail transfer agent is configured for local-only mode" - name: "2.2.17 | PATCH | Ensure mail transfer agent is configured for local-only mode"
lineinfile: lineinfile:
dest: /etc/postfix/main.cf path: /etc/postfix/main.cf
regexp: "^(#)?inet_interfaces" regexp: "^(#)?inet_interfaces"
line: "inet_interfaces = loopback-only" line: "inet_interfaces = loopback-only"
notify: restart postfix notify: restart postfix

View file

@ -332,7 +332,6 @@
- name: "3.4.2.11 | PATCH | Ensure nftables rules are permanent" - name: "3.4.2.11 | PATCH | Ensure nftables rules are permanent"
lineinfile: lineinfile:
path: /etc/sysconfig/nftables.conf path: /etc/sysconfig/nftables.conf
state: present
insertafter: EOF insertafter: EOF
line: include "/etc/nftables/inet-{{ rhel9cis_nft_tables_tablename }}" line: include "/etc/nftables/inet-{{ rhel9cis_nft_tables_tablename }}"
when: when:

View file

@ -2,10 +2,9 @@
- name: "4.1.2.1 | PATCH | Ensure audit log storage size is configured" - name: "4.1.2.1 | PATCH | Ensure audit log storage size is configured"
lineinfile: lineinfile:
dest: /etc/audit/auditd.conf path: /etc/audit/auditd.conf
regexp: "^max_log_file( |=)" regexp: "^max_log_file( |=)"
line: "max_log_file = {{ rhel9cis_max_log_file_size }}" line: "max_log_file = {{ rhel9cis_max_log_file_size }}"
state: present
notify: restart auditd notify: restart auditd
when: when:
- rhel9cis_rule_4_1_2_1 - rhel9cis_rule_4_1_2_1
@ -19,10 +18,9 @@
- name: "4.1.2.2 | PATCH | Ensure audit logs are not automatically deleted" - name: "4.1.2.2 | PATCH | Ensure audit logs are not automatically deleted"
lineinfile: lineinfile:
dest: /etc/audit/auditd.conf path: /etc/audit/auditd.conf
regexp: "^max_log_file_action" regexp: "^max_log_file_action"
line: "max_log_file_action = {{ rhel9cis_auditd['max_log_file_action'] }}" line: "max_log_file_action = {{ rhel9cis_auditd['max_log_file_action'] }}"
state: present
notify: restart auditd notify: restart auditd
when: when:
- rhel9cis_rule_4_1_2_2 - rhel9cis_rule_4_1_2_2
@ -36,10 +34,9 @@
- name: "4.1.2.3 | PATCH | Ensure system is disabled when audit logs are full" - name: "4.1.2.3 | PATCH | Ensure system is disabled when audit logs are full"
lineinfile: lineinfile:
dest: /etc/audit/auditd.conf path: /etc/audit/auditd.conf
regexp: "{{ item.regexp }}" regexp: "{{ item.regexp }}"
line: "{{ item.line }}" line: "{{ item.line }}"
state: present
notify: restart auditd notify: restart auditd
with_items: with_items:
- { regexp: '^admin_space_left_action', line: 'admin_space_left_action = {{ rhel9cis_auditd.admin_space_left_action }}' } - { regexp: '^admin_space_left_action', line: 'admin_space_left_action = {{ rhel9cis_auditd.admin_space_left_action }}' }

View file

@ -32,10 +32,9 @@
# This is counter to control 4.2.2.5?? # This is counter to control 4.2.2.5??
- name: "4.2.1.3 | PATCH | Ensure journald is configured to send logs to rsyslog" - name: "4.2.1.3 | PATCH | Ensure journald is configured to send logs to rsyslog"
lineinfile: lineinfile:
dest: /etc/systemd/journald.conf path: /etc/systemd/journald.conf
regexp: "^#ForwardToSyslog=|^ForwardToSyslog=" regexp: "^#ForwardToSyslog=|^ForwardToSyslog="
line: ForwardToSyslog=yes line: ForwardToSyslog=yes
state: present
when: when:
- rhel9cis_rule_4_2_1_3 - rhel9cis_rule_4_2_1_3
- rhel9cis_preferred_log_capture == "rsyslog" - rhel9cis_preferred_log_capture == "rsyslog"
@ -48,7 +47,7 @@
- name: "4.2.1.4 | PATCH | Ensure rsyslog default file permissions configured" - name: "4.2.1.4 | PATCH | Ensure rsyslog default file permissions configured"
lineinfile: lineinfile:
dest: /etc/rsyslog.conf path: /etc/rsyslog.conf
regexp: '^\$FileCreateMode' regexp: '^\$FileCreateMode'
line: '$FileCreateMode 0640' line: '$FileCreateMode 0640'
notify: restart rsyslog notify: restart rsyslog

View file

@ -97,10 +97,9 @@
- name: "4.2.2.3 | PATCH | Ensure journald is configured to compress large log files" - name: "4.2.2.3 | PATCH | Ensure journald is configured to compress large log files"
lineinfile: lineinfile:
dest: /etc/systemd/journald.conf path: /etc/systemd/journald.conf
regexp: "^#Compress=|^Compress=" regexp: "^#Compress=|^Compress="
line: Compress=yes line: Compress=yes
state: present
when: when:
- rhel9cis_rule_4_2_2_3 - rhel9cis_rule_4_2_2_3
tags: tags:
@ -113,10 +112,9 @@
- name: "4.2.2.4 | PATCH | Ensure journald is configured to write logfiles to persistent disk" - name: "4.2.2.4 | PATCH | Ensure journald is configured to write logfiles to persistent disk"
lineinfile: lineinfile:
dest: /etc/systemd/journald.conf path: /etc/systemd/journald.conf
regexp: "^#Storage=|^Storage=" regexp: "^#Storage=|^Storage="
line: Storage=persistent line: Storage=persistent
state: present
when: when:
- rhel9cis_rule_4_2_2_4 - rhel9cis_rule_4_2_2_4
tags: tags:
@ -130,10 +128,9 @@
# This is counter to control 4.2.1.3?? # This is counter to control 4.2.1.3??
- name: "4.2.2.5 | PATCH | Ensure journald is not configured to send logs to rsyslog" - name: "4.2.2.5 | PATCH | Ensure journald is not configured to send logs to rsyslog"
lineinfile: lineinfile:
dest: /etc/systemd/journald.conf path: /etc/systemd/journald.conf
regexp: "^ForwardToSyslog=" regexp: "^ForwardToSyslog="
line: "#ForwardToSyslog=yes" line: "#ForwardToSyslog=yes"
state: present
notify: restart systemd_journal_upload notify: restart systemd_journal_upload
when: when:
- rhel9cis_rule_4_2_2_5 - rhel9cis_rule_4_2_2_5

View file

@ -83,8 +83,7 @@
block: block:
- name: "5.2.4 | PATCH | Ensure SSH access is limited | Add line to sshd_config for allowusers" - name: "5.2.4 | PATCH | Ensure SSH access is limited | Add line to sshd_config for allowusers"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^AllowUsers" regexp: "^AllowUsers"
line: AllowUsers {{ rhel9cis_sshd['allowusers'] }} line: AllowUsers {{ rhel9cis_sshd['allowusers'] }}
validate: sshd -t -f %s validate: sshd -t -f %s
@ -93,8 +92,7 @@
- name: "5.2.4 | PATCH | Ensure SSH access is limited | Add line to sshd_config for allowgroups" - name: "5.2.4 | PATCH | Ensure SSH access is limited | Add line to sshd_config for allowgroups"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^AllowGroups" regexp: "^AllowGroups"
line: AllowGroups {{ rhel9cis_sshd['allowgroups'] }} line: AllowGroups {{ rhel9cis_sshd['allowgroups'] }}
validate: sshd -t -f %s validate: sshd -t -f %s
@ -103,8 +101,7 @@
- name: "5.2.4 | PATCH | Ensure SSH access is limited | Add line to sshd_config for denyusers" - name: "5.2.4 | PATCH | Ensure SSH access is limited | Add line to sshd_config for denyusers"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^DenyUsers" regexp: "^DenyUsers"
line: DenyUsers {{ rhel9cis_sshd['denyusers'] }} line: DenyUsers {{ rhel9cis_sshd['denyusers'] }}
validate: sshd -t -f %s validate: sshd -t -f %s
@ -113,8 +110,7 @@
- name: "5.2.4 | PATCH | Ensure SSH access is limited | Add line to sshd_config for denygroups" - name: "5.2.4 | PATCH | Ensure SSH access is limited | Add line to sshd_config for denygroups"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^DenyGroups" regexp: "^DenyGroups"
line: DenyGroups {{ rhel9cis_sshd['denygroups'] }} line: DenyGroups {{ rhel9cis_sshd['denygroups'] }}
validate: sshd -t -f %s validate: sshd -t -f %s
@ -132,8 +128,7 @@
- name: "5.2.5 | PATCH | Ensure SSH LogLevel is appropriate" - name: "5.2.5 | PATCH | Ensure SSH LogLevel is appropriate"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#LogLevel|^LogLevel" regexp: "^#LogLevel|^LogLevel"
line: 'LogLevel {{ rhel9cis_ssh_loglevel }}' line: 'LogLevel {{ rhel9cis_ssh_loglevel }}'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -149,8 +144,7 @@
- name: "5.2.6 | PATCH | Ensure SSH PAM is enabled" - name: "5.2.6 | PATCH | Ensure SSH PAM is enabled"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#UsePAM|^UsePAM" regexp: "^#UsePAM|^UsePAM"
line: 'UsePAM yes' line: 'UsePAM yes'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -166,8 +160,7 @@
- name: "5.2.7 | PATCH | Ensure SSH root login is disabled" - name: "5.2.7 | PATCH | Ensure SSH root login is disabled"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#PermitRootLogin|^PermitRootLogin" regexp: "^#PermitRootLogin|^PermitRootLogin"
line: 'PermitRootLogin no' line: 'PermitRootLogin no'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -183,8 +176,7 @@
- name: "5.2.8 | PATCH | Ensure SSH HostbasedAuthentication is disabled" - name: "5.2.8 | PATCH | Ensure SSH HostbasedAuthentication is disabled"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#HostbasedAuthentication|^HostbasedAuthentication" regexp: "^#HostbasedAuthentication|^HostbasedAuthentication"
line: 'HostbasedAuthentication no' line: 'HostbasedAuthentication no'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -200,8 +192,7 @@
- name: "5.2.9 | PATCH | Ensure SSH PermitEmptyPasswords is disabled" - name: "5.2.9 | PATCH | Ensure SSH PermitEmptyPasswords is disabled"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#PermitEmptyPasswords|^PermitEmptyPasswords" regexp: "^#PermitEmptyPasswords|^PermitEmptyPasswords"
line: 'PermitEmptyPasswords no' line: 'PermitEmptyPasswords no'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -217,8 +208,7 @@
- name: "5.2.10 | PATCH | Ensure SSH PermitUserEnvironment is disabled" - name: "5.2.10 | PATCH | Ensure SSH PermitUserEnvironment is disabled"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#PermitUserEnvironment|^PermitUserEnvironment" regexp: "^#PermitUserEnvironment|^PermitUserEnvironment"
line: 'PermitUserEnvironment no' line: 'PermitUserEnvironment no'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -234,8 +224,7 @@
- name: "5.2.11 | PATCH | Ensure SSH IgnoreRhosts is enabled" - name: "5.2.11 | PATCH | Ensure SSH IgnoreRhosts is enabled"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#IgnoreRhosts|^IgnoreRhosts" regexp: "^#IgnoreRhosts|^IgnoreRhosts"
line: 'IgnoreRhosts yes' line: 'IgnoreRhosts yes'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -251,8 +240,7 @@
- name: "5.2.12 | PATCH | Ensure SSH X11 forwarding is disabled" - name: "5.2.12 | PATCH | Ensure SSH X11 forwarding is disabled"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#X11Forwarding|^X11Forwarding" regexp: "^#X11Forwarding|^X11Forwarding"
line: 'X11Forwarding no' line: 'X11Forwarding no'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -268,8 +256,7 @@
- name: "5.2.13 | PATCH | Ensure SSH AllowTcpForwarding is disabled" - name: "5.2.13 | PATCH | Ensure SSH AllowTcpForwarding is disabled"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#AllowTcpForwarding|^AllowTcpForwarding" regexp: "^#AllowTcpForwarding|^AllowTcpForwarding"
line: 'AllowTcpForwarding no' line: 'AllowTcpForwarding no'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -300,8 +287,7 @@
- name: "5.2.15 | PATCH | Ensure SSH warning banner is configured" - name: "5.2.15 | PATCH | Ensure SSH warning banner is configured"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: '^Banner' regexp: '^Banner'
line: 'Banner /etc/issue.net' line: 'Banner /etc/issue.net'
when: when:
@ -316,8 +302,7 @@
- name: "5.2.16 | PATCH | Ensure SSH MaxAuthTries is set to 4 or less" - name: "5.2.16 | PATCH | Ensure SSH MaxAuthTries is set to 4 or less"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: '^(#)?MaxAuthTries \d' regexp: '^(#)?MaxAuthTries \d'
line: 'MaxAuthTries 4' line: 'MaxAuthTries 4'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -333,8 +318,7 @@
- name: "5.2.17 | PATCH | Ensure SSH MaxStartups is configured" - name: "5.2.17 | PATCH | Ensure SSH MaxStartups is configured"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#MaxStartups|^MaxStartups" regexp: "^#MaxStartups|^MaxStartups"
line: 'MaxStartups 10:30:60' line: 'MaxStartups 10:30:60'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -350,8 +334,7 @@
- name: "5.2.18 | PATCH | Ensure SSH MaxSessions is set to 10 or less" - name: "5.2.18 | PATCH | Ensure SSH MaxSessions is set to 10 or less"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#MaxSessions|^MaxSessions" regexp: "^#MaxSessions|^MaxSessions"
line: 'MaxSessions {{ rhel9cis_ssh_maxsessions }}' line: 'MaxSessions {{ rhel9cis_ssh_maxsessions }}'
validate: sshd -t -f %s validate: sshd -t -f %s
@ -367,8 +350,7 @@
- name: "5.2.19 | PATCH | Ensure SSH LoginGraceTime is set to one minute or less" - name: "5.2.19 | PATCH | Ensure SSH LoginGraceTime is set to one minute or less"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: "^#LoginGraceTime|^LoginGraceTime" regexp: "^#LoginGraceTime|^LoginGraceTime"
line: "LoginGraceTime {{ rhel9cis_sshd['logingracetime'] }}" line: "LoginGraceTime {{ rhel9cis_sshd['logingracetime'] }}"
validate: sshd -t -f %s validate: sshd -t -f %s
@ -386,16 +368,14 @@
block: block:
- name: "5.2.20 | PATCH | Ensure SSH Idle Timeout Interval is configured | Add line in sshd_config for ClientAliveInterval" - name: "5.2.20 | PATCH | Ensure SSH Idle Timeout Interval is configured | Add line in sshd_config for ClientAliveInterval"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: '^ClientAliveInterval' regexp: '^ClientAliveInterval'
line: "ClientAliveInterval {{ rhel9cis_sshd['clientaliveinterval'] }}" line: "ClientAliveInterval {{ rhel9cis_sshd['clientaliveinterval'] }}"
validate: sshd -t -f %s validate: sshd -t -f %s
- name: "5.2.20 | PATCH | Ensure SSH Idle Timeout Interval is configured | Ensure SSH ClientAliveCountMax set to <= 3" - name: "5.2.20 | PATCH | Ensure SSH Idle Timeout Interval is configured | Ensure SSH ClientAliveCountMax set to <= 3"
lineinfile: lineinfile:
state: present path: /etc/ssh/sshd_config
dest: /etc/ssh/sshd_config
regexp: '^ClientAliveCountMax' regexp: '^ClientAliveCountMax'
line: "ClientAliveCountMax {{ rhel9cis_sshd['clientalivecountmax'] }}" line: "ClientAliveCountMax {{ rhel9cis_sshd['clientalivecountmax'] }}"
validate: sshd -t -f %s validate: sshd -t -f %s

View file

@ -16,9 +16,8 @@
- name: "5.3.2 | PATCH | Ensure sudo commands use pty" - name: "5.3.2 | PATCH | Ensure sudo commands use pty"
lineinfile: lineinfile:
dest: /etc/sudoers path: /etc/sudoers
line: "Defaults use_pty" line: "Defaults use_pty"
state: present
validate: '/usr/sbin/visudo -cf %s' validate: '/usr/sbin/visudo -cf %s'
when: when:
- rhel9cis_rule_5_3_2 - rhel9cis_rule_5_3_2
@ -32,10 +31,9 @@
- name: "5.3.3 | PATCH | Ensure sudo log file exists" - name: "5.3.3 | PATCH | Ensure sudo log file exists"
lineinfile: lineinfile:
dest: /etc/sudoers path: /etc/sudoers
regexp: '^Defaults logfile=' regexp: '^Defaults logfile='
line: 'Defaults logfile="{{ rhel9cis_sudolog_location }}"' line: 'Defaults logfile="{{ rhel9cis_sudolog_location }}"'
state: present
validate: '/usr/sbin/visudo -cf %s' validate: '/usr/sbin/visudo -cf %s'
when: when:
- rhel9cis_rule_5_3_3 - rhel9cis_rule_5_3_3
@ -122,8 +120,7 @@
block: block:
- name: "5.3.7 | PATCH | Ensure access to the su command is restricted | Setting pam_wheel to use_uid" - name: "5.3.7 | PATCH | Ensure access to the su command is restricted | Setting pam_wheel to use_uid"
lineinfile: lineinfile:
state: present path: /etc/pam.d/su
dest: /etc/pam.d/su
regexp: '^(#)?auth\s+required\s+pam_wheel\.so' regexp: '^(#)?auth\s+required\s+pam_wheel\.so'
line: 'auth required pam_wheel.so use_uid {% if rhel9cis_sugroup is defined %}group={{ rhel9cis_sugroup }}{% endif %}' line: 'auth required pam_wheel.so use_uid {% if rhel9cis_sugroup is defined %}group={{ rhel9cis_sugroup }}{% endif %}'

View file

@ -2,8 +2,7 @@
- name: "5.6.1.1 | PATCH | Ensure password expiration is 365 days or less" - name: "5.6.1.1 | PATCH | Ensure password expiration is 365 days or less"
lineinfile: lineinfile:
state: present path: /etc/login.defs
dest: /etc/login.defs
regexp: '^PASS_MAX_DAYS' regexp: '^PASS_MAX_DAYS'
line: "PASS_MAX_DAYS {{ rhel9cis_pass['max_days'] }}" line: "PASS_MAX_DAYS {{ rhel9cis_pass['max_days'] }}"
when: when:
@ -18,8 +17,7 @@
- name: "5.6.1.2 | PATCH | Ensure minimum days between password changes is 7 or more" - name: "5.6.1.2 | PATCH | Ensure minimum days between password changes is 7 or more"
lineinfile: lineinfile:
state: present path: /etc/login.defs
dest: /etc/login.defs
regexp: '^PASS_MIN_DAYS' regexp: '^PASS_MIN_DAYS'
line: "PASS_MIN_DAYS {{ rhel9cis_pass['min_days'] }}" line: "PASS_MIN_DAYS {{ rhel9cis_pass['min_days'] }}"
when: when:
@ -34,8 +32,7 @@
- name: "5.6.1.3 | PATCH | Ensure password expiration warning days is 7 or more" - name: "5.6.1.3 | PATCH | Ensure password expiration warning days is 7 or more"
lineinfile: lineinfile:
state: present path: /etc/login.defs
dest: /etc/login.defs
regexp: '^PASS_WARN_AGE' regexp: '^PASS_WARN_AGE'
line: "PASS_WARN_AGE {{ rhel9cis_pass['warn_age'] }}" line: "PASS_WARN_AGE {{ rhel9cis_pass['warn_age'] }}"
when: when: