forked from ansible-lockdown/RHEL9-CIS
updated
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
398bc5bd0c
commit
c6caa90059
36 changed files with 2584 additions and 2078 deletions
108
tasks/section_5/cis_5.6.x.yml
Normal file
108
tasks/section_5/cis_5.6.x.yml
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
---
|
||||
|
||||
- name: "5.6.2 | PATCH | Ensure system accounts are secured"
|
||||
block:
|
||||
- name: "5.6.2 | Ensure system accounts are secured | Set nologin"
|
||||
user:
|
||||
name: "{{ item.id }}"
|
||||
shell: /usr/sbin/nologin
|
||||
with_items:
|
||||
- "{{ rhel9cis_passwd }}"
|
||||
when:
|
||||
- item.id != "root"
|
||||
- item.id != "sync"
|
||||
- item.id != "shutdown"
|
||||
- item.id != "halt"
|
||||
- rhel9cis_int_gid | int < item.gid
|
||||
- item.shell != " /bin/false"
|
||||
- item.shell != " /usr/sbin/nologin"
|
||||
loop_control:
|
||||
label: "{{ item.id }}"
|
||||
|
||||
- name: "5.6.2 | PATCH | Ensure system accounts are secured | Lock accounts"
|
||||
user:
|
||||
name: "{{ item.id }}"
|
||||
password_lock: true
|
||||
with_items:
|
||||
- "{{ rhel9cis_passwd }}"
|
||||
when:
|
||||
- item.id != "halt"
|
||||
- item.id != "shutdown"
|
||||
- item.id != "sync"
|
||||
- item.id != "root"
|
||||
- rhel9cis_int_gid | int < item.gid
|
||||
- item.shell != " /bin/false"
|
||||
- item.shell != " /usr/sbin/nologin"
|
||||
loop_control:
|
||||
label: "{{ item.id }}"
|
||||
when:
|
||||
- rhel9cis_rule_5_6_2
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
- automated
|
||||
- patch
|
||||
- accounts
|
||||
- rule_5.6.2
|
||||
|
||||
- name: "5.6.3 | PATCH | Ensure default user shell timeout is 900 seconds or less"
|
||||
blockinfile:
|
||||
create: yes
|
||||
mode: 0644
|
||||
dest: "{{ item.dest }}"
|
||||
state: "{{ item.state }}"
|
||||
marker: "# {mark} ANSIBLE MANAGED"
|
||||
block: |
|
||||
# Set session timeout - CIS ID RHEL-08-5.4.5
|
||||
TMOUT={{ rhel9cis_shell_session_timeout.timeout }}
|
||||
export TMOUT
|
||||
readonly TMOUT
|
||||
with_items:
|
||||
- { dest: "{{ rhel9cis_shell_session_timeout.file }}", state: present }
|
||||
- { dest: /etc/profile, state: "{{ (rhel9cis_shell_session_timeout.file == '/etc/profile') | ternary('present', 'absent') }}" }
|
||||
when:
|
||||
- rhel9cis_rule_5_6_3
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
- automated
|
||||
- patch
|
||||
- accounts
|
||||
- rule_5.6.3
|
||||
|
||||
- name: "5.6.4 | PATCH | Ensure default group for the root account is GID 0"
|
||||
command: usermod -g 0 root
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
when:
|
||||
- rhel9cis_rule_5_6_4
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
- automated
|
||||
- patch
|
||||
- accounts
|
||||
- rule_5.6.4
|
||||
|
||||
- name: "5.6.5 | PATCH | Ensure default user umask is 027 or more restrictive"
|
||||
block:
|
||||
- name: "5.6.5 | PATCH | Ensure default user umask is 027 or more restrictive | Set umask for /etc/bashrc"
|
||||
replace:
|
||||
path: /etc/bashrc
|
||||
regexp: '(^\s+umask) 0[012][0-6]'
|
||||
replace: '\1 027'
|
||||
|
||||
- name: "5.6.5 | PATCH | Ensure default user umask is 027 or more restrictive | Set umask for /etc/profile"
|
||||
replace:
|
||||
path: /etc/profile
|
||||
regexp: '(^\s+umask) 0[012][0-6]'
|
||||
replace: '\1 027'
|
||||
when:
|
||||
- rhel9cis_rule_5_6_5
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
- automated
|
||||
- patch
|
||||
- accounts
|
||||
- rule_5.6.5
|
||||
Loading…
Add table
Add a link
Reference in a new issue