-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add support of parsing authorized_keys
file
#7560
Add support of parsing authorized_keys
file
#7560
Conversation
8f11a87
to
4200e4b
Compare
Can you explain what this changes or adds to the existing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm finding it very hard to absorb how the loops and if blocks work together.
bf5c07a
to
39a9f52
Compare
@directionless is going to resolve conversations above and re-review/approve, but this is slipping to 5.5 milestone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code seems okay to me. Slightly hard to read. @Smjert ?
authorized_keys
file
Would someone else like to take a look at this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generally seems like an improvement. And we can always extend. Let's do it
Currently, the authorized_keys table is populated with an empty column: "algorithm" and other key fields are added to the column "key" alongside the actual key.
I've taken a look at the file format to populate the table correctly:
The file format consists of keys on each line for public-key authentication, and the format is quite simple, unless few exceptions: line starts with '#' or the option zos-key-ring-label is specified.
The line syntax : (options) key-type base64-encoded key (comment)
Options field (optional) are comma-delimited. There are pre-set of options that can be specified. Spaces are not allowed unless within double quotes for example in the Option Command.
Key type field(required) is one of the following options "ssh-dss", "ssh-rsa", "ecdsa-sha2-nistp256", "ecdsa-sha2- nistp384", or "ecdsa-sha2-nistp521" the code consists that one of key type exists to parse the line when key type is unknown, the line is ignored.
Key field(required): base64-encoded key
Comment(optional): it's mainly used to recognize the key origin.
I've refactored the table schema according to the fields above, the parser code, and written some unit tests to check the code with some generic public-key definitions that I've found on the web.
Fixes #7544