Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1833

SSH host key without comment adds trailing newline

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • FACT 3.6.9, FACT 3.10.0
    • FACT 3.11.12, FACT 3.14.9
    • None
    • None
    • Night's Watch
    • 2
    • NW - 2020-03-04
    • Needs Assessment
    • 35920
    • 1
    • Bug Fix
    • correctly displays ssh host key fact in the case the host key file does no contain a comment
    • Needs Assessment

    Description

      If the SSH host public key file does not contain a comment, the public key will contain a trailing newline.

      For example:

      $ echo 'ssh-rsa public-key' >/etc/ssh/ssh_host_rsa_key.pub
      $ facter ssh
      {
        rsa => {
          key => "public-key
      "
        }
      }

      If the key contains a comment, we do not get the trailing newline:

      $ echo 'ssh-rsa public-key comment' >/etc/ssh/ssh_host_rsa_key.pub
      $ facter ssh
      {
        rsa => {
          key => "public-key"
        }
      }

      The trailing newline causes issues when using the resulting fact directly in a sshkey resource, where the trailing newline makes Puppet think the resource is changed on every run.

      Attachments

        Activity

          People

            ciprian.badescu Ciprian Badescu
            olavmo Olav Morken
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support