Jira (FACT-1833) SSH host key without comment adds trailing newline

14 views
Skip to first unread message

Olav Morken (JIRA)

unread,
Mar 12, 2018, 9:55:03 AM3/12/18
to puppe...@googlegroups.com
Olav Morken created an issue
 
Facter / Bug FACT-1833
SSH host key without comment adds trailing newline
Issue Type: Bug Bug
Affects Versions: FACT 3.10.0, FACT 3.6.9
Assignee: Unassigned
Created: 2018/03/12 6:54 AM
Priority: Normal Normal
Reporter: Olav Morken

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.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Olav Morken (JIRA)

unread,
Mar 12, 2018, 9:56:02 AM3/12/18
to puppe...@googlegroups.com
Olav Morken updated an issue
Change By: Olav Morken
If the SSH host public key file does not contain a comment, the public key will contain a trailing newline.

For example:

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

 

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

 
{noformat}

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

 

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.

Olav Morken (JIRA)

unread,
Mar 12, 2018, 9:56:03 AM3/12/18
to puppe...@googlegroups.com
Olav Morken updated an issue
If the SSH host public key file does not contain a comment, the public key will contain a trailing newline.

For example:

 
{noformat}$ echo 'ssh-rsa public-key' >/etc/ssh/ssh_host_rsa_key.pub
$ facter ssh
{
  rsa => {
    key => "public-key
"
  }
}{noformat}
If the key contains a comment, we do not get the trailing newline:

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

$ facter ssh
{
 rsa => {
    key => "public-key"
  }
}{noformat}
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.

Scott McClellan (JIRA)

unread,
Mar 20, 2018, 5:10:02 PM3/20/18
to puppe...@googlegroups.com

Scott McClellan (JIRA)

unread,
Mar 20, 2018, 5:11:02 PM3/20/18
to puppe...@googlegroups.com

Brian McNally (JIRA)

unread,
Nov 19, 2019, 7:34:04 PM11/19/19
to puppe...@googlegroups.com
Brian McNally commented on Bug FACT-1833
 
Re: SSH host key without comment adds trailing newline

Thanks for such a clear description of this problem Olav. I've spent some time banging my head against the wall with this bug as well. Can we get this fixed, Puppet? This was reported over 18 months ago and still hasn't been assigned to anyone for fixing.

Josh Cooper (JIRA)

unread,
Nov 20, 2019, 1:53:05 PM11/20/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
Team: Platform OS Night's Watch

Austin Boyd (JIRA)

unread,
Feb 18, 2020, 6:21:04 AM2/18/20
to puppe...@googlegroups.com
Austin Boyd updated an issue
Change By: Austin Boyd
Zendesk Ticket IDs: 35920
Zendesk Ticket Count: 1

Mihai Buzgau (JIRA)

unread,
Feb 18, 2020, 10:51:05 AM2/18/20
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: NW - 2020-03-03

Mihai Buzgau (JIRA)

unread,
Feb 19, 2020, 5:46:03 AM2/19/20
to puppe...@googlegroups.com

Ciprian Badescu (JIRA)

unread,
Feb 20, 2020, 10:03:09 AM2/20/20
to puppe...@googlegroups.com

Ciprian Badescu (JIRA)

unread,
Feb 26, 2020, 7:29:06 AM2/26/20
to puppe...@googlegroups.com
Ciprian Badescu updated an issue
Change By: Ciprian Badescu
Release Notes Summary: correctly displays ssh host key fact in the case the host key file does no contain a comment
Release Notes: Bug Fix

Mihai Buzgau (Jira)

unread,
Mar 3, 2020, 5:26:03 AM3/3/20
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Fix Version/s: FACT 3.11.12
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Mihai Buzgau (Jira)

unread,
Mar 3, 2020, 5:27:03 AM3/3/20
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Fix Version/s: FACT 3.14.9
Reply all
Reply to author
Forward
0 new messages