Execution
Date
14 Dec 2025 10:04:43 +0000
Duration
00:10:10.66
Controller
aio1.openstack.local
User
root
Versions
Ansible
2.18.6
ara
1.7.4 / 1.7.4
Python
3.13.5
Summary
15
Hosts
603
Tasks
2357
Results
18
Plays
157
Files
0
Records
File: /home/zuul/src/opendev.org/openstack/ansible-hardening/tasks/rhel7stig/apt.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | --- # 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: Ensure debsums is installed ansible.builtin.apt: name: debsums state: present when: security_check_package_checksums | bool - name: Gather debsums report ansible.builtin.shell: "debsums > {{ temp_dir }}/debsums.txt" changed_when: false failed_when: false when: - security_check_package_checksums | bool - not check_mode | bool - name: V-71855 - Get files with invalid checksums (apt) ansible.builtin.shell: "grep -v OK$ {{ temp_dir }}/debsums.txt | awk '{ print $1 }'" register: invalid_checksum_files changed_when: false when: - security_check_package_checksums | bool - not check_mode | bool - ansible_facts['os_family'] | lower == 'debian' tags: - high - V-71855 - name: V-71855 - Create comma-separated list ansible.builtin.set_fact: invalid_checksum_files_violations: "{{ invalid_checksum_files.stdout_lines | default([]) | join(', ') }}" when: - security_check_package_checksums | bool - invalid_checksum_files is defined - invalid_checksum_files.stdout is defined tags: - high - V-71855 - name: V-71855 - The cryptographic hash of system files and commands must match vendor values (apt) ansible.builtin.debug: msg: > The following files have checksums that differ from the checksum provided with their package. Each of these should be verified manually to ensure they have not been modified by an unauthorized user: {{ invalid_checksum_files_violations }} when: - security_check_package_checksums | bool - ansible_facts['os_family'] | lower == 'debian' - invalid_checksum_files is defined - invalid_checksum_files.stdout is defined tags: - high - V-71855 # See the documentation for V-71977 for more details on this check. - name: Search for AllowUnauthenticated in /etc/apt/apt.conf.d/ ansible.builtin.command: grep -r '^[^#].*AllowUnauthenticated \"true\"' /etc/apt/apt.conf.d/ register: gpgcheck_result changed_when: false failed_when: false check_mode: false - name: V-71977 - Package management tool must verify authenticity of packages ansible.builtin.debug: msg: "Remove AllowUnauthenticated from files in /etc/apt/apt.conf.d/ to ensure packages are verified." when: - security_enable_gpgcheck_packages | bool - gpgcheck_result.rc == 0 tags: - high - V-71977 - name: V-71979 - Package management tool must verify authenticity of locally-installed packages ansible.builtin.lineinfile: dest: /etc/dpkg/dpkg.cfg regexp: "^(#)?no-debsig" line: "#no-debsig" state: present when: - security_enable_gpgcheck_packages_local | bool tags: - high - V-71979 - name: V-71987 - Clean requirements/dependencies when removing packages (dpkg) ansible.builtin.lineinfile: dest: /etc/apt/apt.conf.d/security-autoremove regexp: "^(#)?APT::Get::AutomaticRemove" line: "APT{{ '::' }}Get{{ '::' }}AutomaticRemove \"0\";" state: present create: true mode: "0644" when: - security_package_clean_on_remove | bool - ansible_facts['os_family'] | lower == 'debian' tags: - low - packages - V-71987 - name: Enable automatic package updates (apt) ansible.builtin.copy: src: 20auto-upgrades dest: /etc/apt/apt.conf.d/20auto-upgrades mode: "0644" when: - ansible_facts['os_family'] | lower == 'debian' - security_rhel7_automatic_package_updates | bool tags: - packages - cat2 - V-71999 |