Skip to content

Exported keys with multiple algorithms overwrite each other #103

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

Open
raybellis opened this issue Feb 28, 2025 · 0 comments
Open

Exported keys with multiple algorithms overwrite each other #103

raybellis opened this issue Feb 28, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@raybellis
Copy link

raybellis commented Feb 28, 2025

I'm using the following code on each system to generate an exported resource of SSH host keys for selected algorithms (pulled from facter) with the intention to build a fully populated /etc/ssh/ssh_known_hosts file on my bastion hosts:

  $fqdn = $facts['networking']['fqdn']
  $keys = $facts['ssh']

  unless empty($keys) {
    ['ecdsa', 'ed25519', 'rsa'].each |$type| {

      $t = $keys[$type]['type']
      $k = $keys[$type]['key']

      unless empty($keys[$type]) {
        @@sshkey { "${fqdn}_${t}":
          name => $fqdn,
          type => $t,
          key  => $k,
        }
      }
    }
  }

When I collect these resources with:

    Sshkey <<| |>>

the (up to) three resources per system overwrite each other, and only one of the keys ends up in the ssh_known_hosts file.

Curiously the key type is seen by Puppet, yet the file parsing doesn't seem to allow for it (keys elided):

/Stage[main]/myclass/Sshkey[myhost@ssh-ed25519]/key: key changed A to B
/Stage[main]/myclass/Sshkey[myhost@ssh-rsa]/key: key changed B to C
/Stage[main]/myclass/Sshkey[myhost@ecdsa-sha2-nistp256]/key: key changed C to A

A further side effect is that the three key change messages appear on every puppet run.

This seems to be a bug, unless I'm doing something wrong myself?

The systems are Puppet 8.10.0, Puppet Server 8.7.0, PuppetDB 8.8.1, all running on FreeBSD 14.2. I've tested with the latest release 2.5.1 of this module.

@raybellis raybellis added the bug Something isn't working label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant