|
85 | 85 | - name: | |
86 | 86 | "MEDIUM | RHEL-08-010040 | PATCH | RHEL 8 must display the Standard Mandatory DoD Notice and Consent Banner before granting local or remote access to the system via a ssh logon. | Set banner message"" |
87 | 87 | "MEDIUM | RHEL-08-010060 | PATCH | RHEL 8 must display the Standard Mandatory DoD Notice and Consent Banner before granting local or remote access to the system via a command line user logon. | Set banner message"" |
88 | | - copy: |
| 88 | + copy: # noqa: template-instead-of-copy |
89 | 89 | dest: "{{ item }}" |
90 | 90 | content: "{{ rhel8stig_logon_banner }}" |
91 | 91 | owner: root |
|
133 | 133 | - banner |
134 | 134 |
|
135 | 135 | - name: "MEDIUM | RHEL-08-010050 | PATCH | RHEL 8 must display the Standard Mandatory DoD Notice and Consent Banner before granting local or remote access to the system via a graphical user logon." |
136 | | - copy: |
| 136 | + copy: # noqa: template-instead-of-copy |
137 | 137 | dest: /etc/dconf/db/local.d/01-banner-message |
138 | 138 | content: | |
139 | 139 | [org/gnome/login-screen] |
140 | 140 | banner-message-text='{{ rhel8stig_logon_banner | replace(newline, "\n") }}' |
| 141 | + banner-message-enable=true |
141 | 142 | mode: '0644' |
142 | 143 | owner: root |
143 | 144 | group: root |
|
293 | 294 | - name: | |
294 | 295 | "MEDIUM | RHEL-08-010141 | PATCH | RHEL 8 operating systems booted with United Extensible Firmware Interface (UEFI) must require a unique superusers name upon booting into single-user mode and maintenance." |
295 | 296 | "MEDIUM | RHEL-08-010149 | PATCH | RHEL 8 operating systems booted with a BIOS must require a unique superusers name upon booting into single-user and maintenance modes." |
296 | | - lineinfile: |
297 | | - dest: "{{ rhel8stig_grub_cfg_path | dirname }}/grub.cfg" |
298 | | - regexp: "{{ item.regexp }}" |
299 | | - line: "{{ item.line }}" |
300 | | - insertafter: "{{ item.insertafter }}" |
| 297 | + template: |
| 298 | + src: 01_users.j2 |
| 299 | + dest: /etc/grub.d/01_users |
| 300 | + owner: root |
| 301 | + group: root |
| 302 | + mode: 0644 |
301 | 303 | notify: confirm grub2 user cfg |
302 | | - with_items: |
303 | | - - { regexp: '^set superusers', line: 'set superusers="{{ rhel8stig_boot_superuser }}"', insertafter: '### BEGIN /etc/grub.d/01_users ###' } |
304 | | - - { regexp: '^export superusers', line: 'export superusers', insertafter: '^set superusers' } |
305 | | - - { regexp: '^password_pbkdf2', line: 'password_pbkdf2 {{ rhel8stig_boot_superuser }} ${GRUB2_PASSWORD}', insertafter: '^export superusers' } |
306 | | - loop_control: |
307 | | - label: "{{ item.line }}" |
308 | 304 | when: |
309 | 305 | - rhel_08_010141 or |
310 | 306 | rhel_08_010149 |
|
772 | 768 | - ssh |
773 | 769 |
|
774 | 770 | - name: | |
775 | | - "MEDIUM | RHEL-08-010290 | PATCH | The RHEL 8 SSH daemon must be configured to use only Message Authentication Codes (MACs) employing FIPS 140-2 validated cryptographic hash algorithms." |
776 | | - "MEDIUM | RHEL-08-010291 | PATCH | The RHEL 8 operating system must implement DoD-approved encryption to protect the confidentiality of SSH connections." |
777 | | - block: |
778 | | - - name: | |
779 | | - "MEDIUM | RHEL-08-010290 | AUDIT | The RHEL 8 SSH daemon must be configured to use only Message Authentication Codes (MACs) employing FIPS 140-2 validated cryptographic hash algorithms. | Get current FIPS mode state" |
780 | | - "MEDIUM | RHEL-08-010291 | AUDIT | The RHEL 8 operating system must implement DoD-approved encryption to protect the confidentiality of SSH connections. | Get current FIPS mode state" |
781 | | - command: fips-mode-setup --check |
782 | | - changed_when: false |
783 | | - failed_when: rhel_08_010290_pre_fips_check.stdout is not defined |
784 | | - register: rhel_08_010290_pre_fips_check |
785 | | -
|
786 | | - - name: | |
787 | | - "MEDIUM | RHEL-08-010290 | PATCH | The RHEL 8 SSH daemon must be configured to use only Message Authentication Codes (MACs) employing FIPS 140-2 validated cryptographic hash algorithms. | Enable FIPS" |
788 | | - "MEDIUM | RHEL-08-010291 | PATCH | The RHEL 8 operating system must implement DoD-approved encryption to protect the confidentiality of SSH connections. | Enable FIPS" |
789 | | - command: fips-mode-setup --enable |
790 | | - register: rhel_08_010290_fips_enable |
791 | | - notify: change_requires_reboot |
792 | | - when: '"disabled" in rhel_08_010290_pre_fips_check.stdout' |
793 | | -
|
794 | | - - name: | |
795 | | - "MEDIUM | RHEL-08-010290 | PATCH | The RHEL 8 SSH daemon must be configured to use only Message Authentication Codes (MACs) employing FIPS 140-2 validated cryptographic hash algorithms. | Add ssh ciphers" |
796 | | - "MEDIUM | RHEL-08-010291 | PATCH | The RHEL 8 operating system must implement DoD-approved encryption to protect the confidentiality of SSH connections. | Add ssh ciphers" |
797 | | - lineinfile: |
798 | | - path: /etc/crypto-policies/back-ends/opensshserver.config |
799 | | - regexp: '^CRYPTO_POLICY=' |
800 | | - line: CRYPTO_POLICY='{{ rhel8stig_ssh_server_crypto_settings }}' |
801 | | - notify: change_requires_reboot |
| 771 | + "MEDIUM | RHEL-08-010290 | PATCH | The RHEL 8 SSH daemon must be configured to use only Message Authentication Codes (MACs) employing FIPS 140-2 validated cryptographic hash algorithms. | Add ssh ciphers" |
| 772 | + "MEDIUM | RHEL-08-010291 | PATCH | The RHEL 8 operating system must implement DoD-approved encryption to protect the confidentiality of SSH connections. | Add ssh ciphers" |
| 773 | + lineinfile: |
| 774 | + path: /etc/crypto-policies/back-ends/opensshserver.config |
| 775 | + regexp: '^CRYPTO_POLICY=' |
| 776 | + line: CRYPTO_POLICY='{{ rhel8stig_ssh_server_crypto_settings }}' |
| 777 | + notify: change_requires_reboot |
802 | 778 | when: |
803 | 779 | - rhel_08_010290 or |
804 | 780 | rhel_08_010291 |
|
872 | 848 | - name: "MEDIUM | RHEL-08-010295 | PATCH | The RHEL 8 operating system must implement DoD-approved TLS encryption in the GnuTLS package" |
873 | 849 | lineinfile: |
874 | 850 | path: /etc/crypto-policies/back-ends/gnutls.config |
875 | | - regexp: '^(.*\+VERS-ALL:)' |
| 851 | + regexp: '^(.*)\+VERS-ALL:' |
876 | 852 | line: '\1{{ rhel8stig_gnutls_encryption }}' |
877 | 853 | backrefs: true |
878 | 854 | create: true |
|
2484 | 2460 | when: |
2485 | 2461 | - rhel_08_010740 |
2486 | 2462 | - (item.uid >= rhel8stig_interactive_uid_start | int) |
| 2463 | + - (item.uid >= rhel8stig_interactive_uid_stop | int) |
2487 | 2464 | tags: |
2488 | 2465 | - skip_ansible_lint |
2489 | 2466 | - RHEL-08-010740 |
|
2557 | 2534 | file: |
2558 | 2535 | path: "{{ item }}" |
2559 | 2536 | mode: "{{ rhel8stig_local_int_perm }}" |
2560 | | - with_items: |
2561 | | - - "{{ rhel_08_stig_interactive_homedir_inifiles }}" |
| 2537 | + with_items: "{{ rhel_08_stig_interactive_homedir_inifiles }}" |
2562 | 2538 | when: |
2563 | 2539 | - rhel_08_010770 |
2564 | 2540 | - rhel8stig_disruption_high |
|
3123 | 3099 | setype: faillog_t |
3124 | 3100 | state: present |
3125 | 3101 | register: add_faillock_secontext |
3126 | | - when: faillock_dir.changed |
3127 | 3102 |
|
3128 | 3103 | - name: | |
3129 | 3104 | "MEDIUM | RHEL-08-020027 | RHEL 8 systems, versions 8.2 and above, must configure SELinux context type to allow the use of a non-default faillock tally directory. |
|
3220 | 3195 | - name: "MEDIUM | RHEL-08-020040 | PATCH | RHEL 8 must enable a user session lock until that user re-establishes access using established identification and authentication procedures for command line sessions. | Configure tmux" |
3221 | 3196 | lineinfile: |
3222 | 3197 | path: /etc/tmux.conf |
3223 | | - regexp: '^set \-g' |
| 3198 | + regexp: '^set -g lock-command' |
3224 | 3199 | line: "set -g lock-command vlock" |
3225 | 3200 | create: true |
3226 | 3201 | owner: root |
|
5938 | 5913 | with_items: |
5939 | 5914 | - "{{ rhel8stig_white_list_services }}" |
5940 | 5915 |
|
| 5916 | + - name: "MEDIUM | RHEL-08-040090 | PATCH | A RHEL 8 firewall must employ a deny-all, allow-by-exception policy for allowing connections to other systems. | Target Drop | 2.10+" |
| 5917 | + firewalld: |
| 5918 | + zone: "{{ rhel8stig_custom_firewall_zone }}" |
| 5919 | + permanent: true |
| 5920 | + state: enabled |
| 5921 | + target: DROP |
| 5922 | + when: ansible_version.full is version_compare('2.10.0 | int', '>=') |
| 5923 | + |
| 5924 | + - name: "MEDIUM | RHEL-08-040090 | PATCH | A RHEL 8 firewall must employ a deny-all, allow-by-exception policy for allowing connections to other systems. | Target Drop | 2.9" |
| 5925 | + block: |
| 5926 | + - name: "MEDIUM | RHEL-08-040090 | PATCH | A RHEL 8 firewall must employ a deny-all, allow-by-exception policy for allowing connections to other systems. | current setting" |
| 5927 | + shell: "firewall-cmd --list-all --zone={{ rhel8stig_custom_firewall_zone }} | grep 'target: DROP'" |
| 5928 | + changed_when: false |
| 5929 | + failed_when: false |
| 5930 | + register: rhel8stig-target_drop_set |
| 5931 | + |
| 5932 | + - name: "MEDIUM | RHEL-08-040090 | PATCH | A RHEL 8 firewall must employ a deny-all, allow-by-exception policy for allowing connections to other systems. | Target Drop | 2.9" |
| 5933 | + shell: firewall-cmd --permanent --zone={{ rhel8stig_custom_firewall_zone }} --set-target=DROP |
| 5934 | + when: |
| 5935 | + - rhel8stig-target_drop_set.rc != 0 |
| 5936 | + when: ansible_version.full is version_compare('2.10 | int', '<') |
| 5937 | + |
5941 | 5938 | - name: "MEDIUM | RHEL-08-040090 | PATCH | A RHEL 8 firewall must employ a deny-all, allow-by-exception policy for allowing connections to other systems. | Reload zones" |
5942 | 5939 | command: firewall-cmd --reload |
5943 | 5940 | changed_when: rhel_08_040090_zone_reload.rc == 0 |
|
0 commit comments