Patch ansible remediation for postfix_network_listening_disabled rule#14394
Conversation
|
Skipping CI for Draft Pull Request. |
|
This datastream diff is auto generated by the check Click here to see the full diffansible remediation for rule 'xccdf_org.ssgproject.content_rule_postfix_network_listening_disabled' differs.
--- xccdf_org.ssgproject.content_rule_postfix_network_listening_disabled
+++ xccdf_org.ssgproject.content_rule_postfix_network_listening_disabled
@@ -20,9 +20,34 @@
tags:
- always
-- name: Gather list of packages
- ansible.builtin.package_facts:
- manager: auto
+- name: Make changes to Postfix configuration file
+ block:
+
+ - name: Check for duplicate values
+ ansible.builtin.lineinfile:
+ path: /etc/postfix/main.cf
+ create: false
+ regexp: (?i)^inet_interfaces\s*=\s*.*$
+ state: absent
+ check_mode: true
+ changed_when: false
+ register: dupes
+
+ - name: Deduplicate values from /etc/postfix/main.cf
+ ansible.builtin.lineinfile:
+ path: /etc/postfix/main.cf
+ create: false
+ regexp: (?i)^inet_interfaces\s*=\s*.*$
+ state: absent
+ when: dupes.found is defined and dupes.found > 1
+
+ - name: Insert correct line to /etc/postfix/main.cf
+ ansible.builtin.lineinfile:
+ path: /etc/postfix/main.cf
+ create: false
+ regexp: (?i)^inet_interfaces\s*=\s*.*$
+ line: inet_interfaces = {{ var_postfix_inet_interfaces }}
+ state: present
when:
- '"kernel-core" in ansible_facts.packages'
- '"postfix" in ansible_facts.packages'
@@ -39,29 +64,3 @@
- no_reboot_needed
- postfix_network_listening_disabled
- restrict_strategy
-
-- name: Make changes to Postfix configuration file
- ansible.builtin.lineinfile:
- path: /etc/postfix/main.cf
- create: false
- regexp: (?i)^inet_interfaces\s*=\s.*
- line: inet_interfaces = {{ var_postfix_inet_interfaces }}
- state: present
- insertafter: ^inet_interfaces\s*=\s.*
- when:
- - '"kernel-core" in ansible_facts.packages'
- - '"postfix" in ansible_facts.packages'
- - '"postfix" in ansible_facts.packages'
- tags:
- - CCE-82174-4
- - NIST-800-53-CM-6(a)
- - NIST-800-53-CM-7(a)
- - NIST-800-53-CM-7(b)
- - PCI-DSSv4-1.4
- - PCI-DSSv4-1.4.2
- - low_complexity
- - low_disruption
- - medium_severity
- - no_reboot_needed
- - postfix_network_listening_disabled
- - restrict_strategy |
…e file with desired config
c324a3f to
27b19ee
Compare
|
@teacup-on-rockingchair: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@jan-cerny can you please take a look at this one |
Can anyone else from the @ComplianceAsCode/trusted-developers take a look at this, since obviously @jan-cerny is busy and it has been 2 months since this review is pending? |
Sorry for the delay. I assume we were waiting on @svet-se since they were assigned to it. |
Description:
Rationale:
Fixes