Skip to content

Commit cb06f97

Browse files
committed
Check if the config file is newer than the current crypto policy file.
This current crypto policy file is set by the update-crypto-policies command, if there is a mismatch, the OVAL will detect and result in fail.
1 parent 3a27805 commit cb06f97

File tree

1 file changed

+19
-1
lines changed
  • linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/ansible

1 file changed

+19
-1
lines changed

linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/ansible/shared.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@
2020
failed_when: false
2121
check_mode: false
2222

23+
- name: "{{{ rule_title }}} - Get mtime of /etc/crypto-policies/config"
24+
ansible.builtin.stat:
25+
path: /etc/crypto-policies/config
26+
register: config_file_stat
27+
changed_when: false
28+
failed_when: false
29+
check_mode: false
30+
31+
- name: "{{{ rule_title }}} - Get mtime of /etc/crypto-policies/state/current"
32+
ansible.builtin.stat:
33+
path: /etc/crypto-policies/state/current
34+
register: current_file_stat
35+
changed_when: false
36+
failed_when: false
37+
check_mode: false
38+
2339
- name: "{{{ rule_title }}} - Verify that Crypto Policy is Set (runtime)"
2440
ansible.builtin.command: /usr/bin/update-crypto-policies --set {{ var_system_crypto_policy }}
25-
when: current_crypto_policy.stdout.strip() != var_system_crypto_policy
41+
when: >
42+
(current_crypto_policy.stdout.strip() != var_system_crypto_policy) or
43+
(config_file_stat.stat.exists and current_file_stat.stat.exists and config_file_stat.stat.mtime > current_file_stat.stat.mtime)

0 commit comments

Comments
 (0)