fix(ssh): remove authorized_keys filename for 2.1.0
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
5 files changed
+7
-47
No files matched your search
@@ -28,14 +28,12 @@
|
||||
- Host: "*"
|
||||
StrictHostKeyChecking: "no"
|
||||
authorized_keys:
|
||||
- filename: alice.pub
|
||||
content: "{{ lookup('ansible.builtin.file', molecule_scenario_directory + '/files/ssh/authorized_keys/molecule.pub', rstrip=false) }}"
|
||||
- content: "{{ lookup('ansible.builtin.file', molecule_scenario_directory + '/files/ssh/authorized_keys/molecule.pub', rstrip=false) }}"
|
||||
command: "/usr/bin/true"
|
||||
envs:
|
||||
- key: EDITOR
|
||||
value: vi
|
||||
- filename: alice-login.pub
|
||||
content: "{{ lookup('ansible.builtin.file', molecule_scenario_directory + '/files/ssh/authorized_keys/molecule.pub', rstrip=false) }}"
|
||||
- content: "{{ lookup('ansible.builtin.file', molecule_scenario_directory + '/files/ssh/authorized_keys/molecule.pub', rstrip=false) }}"
|
||||
private_keys:
|
||||
- filename: alice.ed25519.key
|
||||
content: "{{ lookup('ansible.builtin.file', molecule_scenario_directory + '/files/ssh/private_keys/molecule.ed25519.key', rstrip=false) }}"
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
/home/molecule-alice/.ssh/config: "0644"
|
||||
/home/molecule-alice/.ssh/alice.ed25519.key: "0600"
|
||||
/home/molecule-alice/.ssh/alice.ed25519.key.pub: "0644"
|
||||
/home/molecule-alice/.ssh/alice.pub: "0644"
|
||||
/home/molecule-alice/.ssh/alice-login.pub: "0644"
|
||||
/home/molecule-alice/.forward: "0644"
|
||||
/home/molecule-alice/.netrc: "0600"
|
||||
/home/molecule-alice/.bashrc.d: "0755"
|
||||
@@ -88,28 +86,6 @@
|
||||
- (_alice_keys.results[0].content | b64decode).splitlines() | select('match', '^ssh-ed25519 ') | list | length == 1
|
||||
fail_msg: "the authorized key of molecule-alice does not match the key extracted from its private key"
|
||||
|
||||
- name: Read the configured private and public SSH key files
|
||||
ansible.builtin.slurp:
|
||||
src: "{{ _alice_home }}/.ssh/{{ item }}"
|
||||
loop:
|
||||
- alice.ed25519.key
|
||||
- alice.pub
|
||||
- alice-login.pub
|
||||
no_log: true
|
||||
register: _alice_key_contents
|
||||
|
||||
- name: Assert that SSH key files contain the exact configured content
|
||||
vars:
|
||||
_private_key_content: "{{ lookup('ansible.builtin.file', molecule_scenario_directory + '/files/ssh/private_keys/molecule.ed25519.key', rstrip=false) }}"
|
||||
_public_key_content: "{{ lookup('ansible.builtin.file', molecule_scenario_directory + '/files/ssh/authorized_keys/molecule.pub', rstrip=false) }}"
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- (_alice_key_contents.results[0].content | b64decode) == _private_key_content
|
||||
- (_alice_key_contents.results[1].content | b64decode) == _public_key_content
|
||||
- (_alice_key_contents.results[2].content | b64decode) == _public_key_content
|
||||
- _public_key_content | trim in (_alice_keys.results[0].content | b64decode).splitlines()
|
||||
no_log: true
|
||||
|
||||
- name: Read the user and group database
|
||||
ansible.builtin.getent:
|
||||
database: "{{ item }}"
|
||||
|
||||
Reference in new issue
Block a user