Major Hayden 0a7a9932a0 Security: Add tasks for RHEL-07-010020
This patch adds tasks which check for files that have been modified
since their packages were installed. This can sometimes be sign
of compromise.

Any files failing checksum validation are displayed for the deployer
to review.

Implements: blueprint security-rhel7-stig
Change-Id: I5ccc375ecb08e51c51dab80b47a190050731f700
2016-10-20 15:44:31 +00:00

68 lines
1.7 KiB
YAML

---
# Copyright 2015, 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: Create temporary directory to hold any temporary files
command: "mktemp -d"
register: mktemp_result
changed_when: False
when:
- not check_mode | bool
- name: Set a fact for the temporary directory
set_fact:
temp_dir: "{{ mktemp_result.stdout }}"
changed_when: False
when:
- not check_mode | bool
# Multiple tasks will need the output of RPM verification, so let's do the
# lookup one time and then grep over the output in subsequent tasks.
- name: Verify all installed RPM packages
shell: "rpm -Va > {{ temp_dir }}/rpmverify.txt"
args:
warn: no
failed_when: False
changed_when: False
when:
- not check_mode | bool
- ansible_os_family | lower == 'redhat'
tags:
- always
- skip_ansible_lint
- include: apt.yml
when:
- ansible_os_family | lower == 'debian'
tags:
- apt
- include: file_perms.yml
tags:
- file_perms
- include: rpm.yml
when:
- ansible_os_family | lower == 'redhat'
tags:
- rpm
- name: Remove the temporary directory
file:
path: "{{ temp_dir }}"
state: absent
changed_when: False
when:
- not check_mode | bool