puppetlabs / puppetlabs/puppetlabs-sshkeys_core

ssh_authorized_keys should not use the key 'comment' as a unique identifier (name)

Open
#96 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ruby
Stars
3
Forks
34
PR merge metrics
No merged PRs in 30d

Description

Describe the Bug

Currently the ssh authorized keys provider uses the 'comment' section from an SSH public key as the 'name'. However, this implies that these comment strings must be unique, while SSH itself imposes no such restriction: in fact, it often happens that users generate both an RSA and a DSA key, which by default will have the same comment.

A better 'name' for a key would perhaps be its fingerprint. There is a very small chance of collisions, but using the comment as 'name' is certain to generate collisions (for me it already has). Otherwise, the key-string itself should perhaps be the 'name' as this is certainly unique.

If a user just changes the 'name' of the key in the Puppet manifest, then the other problem is that Puppet (only looking at the 'name', not the contents of the key) fails to realize that a key is already in place so you end up with duplicates. The current implementation doesn't really manage authorized_keys, it only manages the comment section and has no knowledge of the actual key.

Expected Behavior

Using the key fingerprint would require Puppet to be able to actually extract the fingerprint from the key and would be a non-trivial change.

Steps to Reproduce

N/A

Environment

N/A

Additional Context

This was originally filed as MODULES-7604. It is similar to https://github.com/puppetlabs/puppetlabs-sshkeys_core/issues/95

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the ssh_authorized_keys provider and reviewing how it uses the SSH key comment as the name. Compare the related issue, puppetlabs/puppetlabs-sshkeys_core#95, and investigate fingerprint or key-string identity. Done should mean keys with identical comments do not collide and renaming a manifest entry does not create duplicates.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
authentication, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.