Skip to content

Commit 2654214

Browse files
committed
test: use crypto policy DEFAULT:PQ to enable PQC on el9.7 and later
Have to enable crypto policy DEFAULT:PQ in order to use post quantum crypto on el9.7 and later. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
1 parent 64f8b42 commit 2654214

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/tests_certificate_existing.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,34 @@
1818
- name: Check if cockpit is new enough (at least 257) to support existing certificates
1919
when: ansible_facts.packages['cockpit-ws'][0].version | int >= 257
2020
block:
21+
- name: Check if the managed node needs crypto-policies to be able to use PQC
22+
when:
23+
- __cockpit_is_rh_distro | bool
24+
- (ansible_facts["distribution"] == "RedHat" and ansible_facts["distribution_version"] is version("9.7", ">=")
25+
and ansible_facts["distribution_version"] is version("10", "<"))
26+
or (ansible_facts["distribution"] != "RedHat" and
27+
ansible_facts['distribution_major_version'] is version("9", "=="))
28+
block:
29+
# calling role with null will just return the current policy
30+
- name: Get current crypto policy
31+
include_role:
32+
name: fedora.linux_system_roles.crypto_policies
33+
vars:
34+
crypto_policies_policy: null
35+
36+
- name: Set variables needed for support and cleanup
37+
set_fact:
38+
# We need to reset this after the test is done
39+
__crypto_policies_policy: "{{ crypto_policies_active | d('') }}"
40+
41+
# https://issues.redhat.com/browse/RHEL-107877
42+
# rhel 9.7 and later, or EL9 other than RHEL, needs crypto-policies to be able to use PQC
43+
- name: Ensure managed node is able to use PQC
44+
include_role:
45+
name: fedora.linux_system_roles.crypto_policies
46+
vars:
47+
crypto_policies_policy: DEFAULT:PQ
48+
2149
- name: Create test certificate key
2250
command: openssl ecparam -name secp521r1 -genkey -out /etc/myserver.key
2351
args:
@@ -73,5 +101,12 @@
73101
- always
74102
- tests::cleanup
75103

104+
- name: Reset crypto policies
105+
include_role:
106+
name: fedora.linux_system_roles.crypto_policies
107+
vars:
108+
crypto_policies_policy: "{{ __crypto_policies_policy }}"
109+
when: __crypto_policies_policy | d("") | length > 0
110+
76111
- name: Cleanup
77112
include_tasks: tasks/cleanup.yml

0 commit comments

Comments
 (0)