openstack-ansible-security/tasks/rhel7stig/kernel.yml
Major Hayden b14056ee44 Don't fail when checking for FIPS
The check for FIPS in the proc filesystem causes the playbook to halt
if the path doesn't exist. This shouldn't happen because the next
task is the one that explains to the deployer that FIPS isn't enabled.

This patch allows the playbook to keep running so the appropriate
debug message can be printed.

Closes-Bug: 1659001
Change-Id: I4023b8e85e61a8e9883045ef488c75e65790035a
2017-01-24 10:03:48 -06:00

95 lines
2.4 KiB
YAML

---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: RHEL-07-020160 - USB mass storage must be disabled.
lineinfile:
dest: /etc/modprobe.d/openstack-ansible-security-disable-usb-storage.conf
line: install usb-storage /bin/true
create: yes
when:
- security_rhel7_disable_usb_storage | bool
tags:
- kernel
- medium
- RHEL-07-020160
- name: Set sysctl configurations
sysctl:
name: "{{ item.name }}"
value: "{{ item.value }}"
state: "{{ item.enabled | ternary('present', 'absent') }}"
reload: yes
with_items: "{{ sysctl_settings_rhel7 }}"
tags:
- medium
- kernel
- RHEL-07-040350
- RHEL-07-040351
- RHEL-07-040380
- RHEL-07-040410
- RHEL-07-040420
- RHEL-07-040421
- RHEL-07-040730
- RHEL-07-040860
- name: Check kdump service
command: systemctl status kdump
register: kdump_service_check
failed_when: kdump_service_check.rc not in [0,3,4]
changed_when: False
check_mode: no
tags:
- kernel
- medium
- RHEL-07-021230
- name: RHEL-07-021230 - Kernel core dumps must be disabled unless needed.
service:
name: kdump
state: stopped
enabled: no
when:
- kdump_service_check.rc not in [3,4]
- security_disable_kdump
tags:
- kernel
- medium
- RHEL-07-021230
- name: Check if FIPS is enabled
command: cat /proc/sys/crypto/fips_enabled
register: fips_check
changed_when: False
failed_when: False
check_mode: no
when:
- ansible_os_family | lower == 'redhat'
tags:
- always
- name: Print a warning if FIPS isn't enabled
debug:
msg: >
FIPS is not enabled at boot time on this server.
The STIG requires FIPS to be enabled at boot time.
when:
- ansible_os_family | lower == 'redhat'
- fips_check is defined
- fips_check.stdout != '1'
tags:
- high
- misc
- RHEL-07-021280