Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ensure authorized_keys management works with multiple hosts #165

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

richm
Copy link
Contributor

@richm richm commented Aug 17, 2023

Cause: There was a race condition if multiple hosts tried to add a key
to the authorized_keys file on kdump_ssh_server at the same time.

Consequence: A key added by one host could be overwritten by a key
added by another host.

Fix: Use the lineinfile module to manage the file - this will ensure
that checking for an existing key, and writing the new key, is done
in one atomic operation on only one host at a time.

Result: A host cannot overwrite the value from another host, and adding
keys is idempotent.

NOTE: You can use the play keyword serial: 1 to workaround this issue
at the play level.

Signed-off-by: Rich Megginson [email protected]

Cause: There was a race condition if multiple hosts tried to add a key
to the authorized_keys file on kdump_ssh_server at the same time.

Consequence: A key added by one host could be overwritten by a key
added by another host.

Fix: Use the lineinfile module to manage the file - this will ensure
that checking for an existing key, and writing the new key, is done
in one atomic operation on only one host at a time.

Result: A host cannot overwrite the value from another host, and adding
keys is idempotent.

NOTE: You can use the play keyword `serial: 1` to workaround this issue
at the play level.

Signed-off-by: Rich Megginson <[email protected]>
@richm
Copy link
Contributor Author

richm commented Aug 17, 2023

[citest]

@richm richm merged commit 29c49b9 into linux-system-roles:main Aug 17, 2023
@richm richm deleted the use-lineinfile-for-auth-keys branch August 17, 2023 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant