Repository navigation
fix(keys): keep key enrolment on its own line and across rotation - #12
Open
andreas-byfut wants to merge 1 commit into
Open
andreas-byfut wants to merge 1 commit into
andreas-byfut wants to merge 1 commit into
Conversation
Pushing a key appended it without checking that authorized_keys ended in a newline, so a file without one had the new key glued onto its last entry. The command now adds a newline only when the file ends mid-line, and is built by a testable function. It uses only syntax that both POSIX sh and csh/tcsh accept, since sshd runs it through the account's login shell. The enrolment section's result message, failure flag and switched flag are now rememberSaveable so a rotation no longer drops them. The generated key stays in plain remember because it holds the private key; when a rotation leaves a restored success without it, the section says the key was not kept and must be pushed again.
Owner
|
Thanks. Tested and this works under sh, dash, bash and tcsh. Needs 2 revisions before i can merge however.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
authorized_keysdoesn't end in a newline glued the new key ontothe last entry and corrupted both. The command now adds a newline only when the file ends
mid-line.
enrolmentCommand(key). Tests run it through/bin/shfor missing,empty, newline-terminated, unterminated and already-present files.
account's login shell. It has no
$(…), braces or[ ].(
rememberSaveable).Known limits:
before "Use this key for this host", the section says the key was not kept and must be pushed
again. The earlier key stays in
authorized_keys.Tests:
KeyEnrolmentCommandTest.