Skip to content

Commit a237419

Browse files
committed
Actually check key type
Don't assume that users won't lie to you. I actually hit this when following the terraform multinode README. My version of openssh will generate ed25519 keys by default and the example command in the README names this id_rsa[1]. This of course ends up locking you out of the system. [1] https://github.com/stackhpc/terraform-kayobe-multinode/blob/a3e72a90c8ce835cc2bb4cbda83e79b0c32afdde/README.rst#L73
1 parent bc83165 commit a237419

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

etc/kayobe/ansible/cis.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@
66
tasks:
77
# TODO: Remove this when Red Hat FIPS policy has been updated to allow ed25519 keys.
88
# https://gitlab.com/gitlab-org/gitlab/-/issues/367429#note_1840422075
9-
- name: Assert that we are using a supported SSH key
10-
assert:
11-
that:
12-
- ssh_key_type != 'ed25519'
13-
fail_msg: FIPS policy does not currently support ed25519 SSH keys on RHEL family systems
14-
when: ansible_facts.os_family == 'RedHat'
9+
- when: ansible_facts.os_family == 'RedHat'
10+
block:
11+
- name: Check type of key using the file command
12+
raw: file {{ ssh_private_key_path }}
13+
delegate_to: localhost
14+
changed_when: false
15+
register: ssh_key_check
16+
17+
- name: Assert that we are using a supported SSH key
18+
assert:
19+
that:
20+
- ssh_key_check.stdout | regex_search('ed25519', ignorecase=true)
21+
fail_msg: FIPS policy does not currently support ed25519 SSH keys on RHEL family systems
1522

1623
- name: Ensure the cron package is installed on ubuntu
1724
package:

0 commit comments

Comments
 (0)