[PUP-4904] puppet describe -s ssh_authorized_key output is really bad Created: 2015/07/20  Updated: 2017/03/09  Resolved: 2016/06/09

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: PUP 3.8.1, PUP 4.2.0
Fix Version/s: PUP 4.6.0

Type: Bug Priority: Normal
Reporter: Ben Ford Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to PUP-4664 The output of {{puppet describe ssh_a... Closed
relates to PUP-7329 'puppet describe' garbles description... Closed
Template:
Acceptance Criteria:

puppet describe -s ssh_authorized_key should not output garbage.

Epic Link: 4.x TechDebt
Story Points: 1
Sprint: Language 2016-06-01, Language 2016-06-15
Release Notes: Bug Fix
Release Notes Summary: The command puppet describe -s ssh_authorized_key
produced garbage output because of long lines of text.

 Description   

root@master:~ # puppet describe -s ssh_authorized_key
 
ssh_authorized_key
==================
Manages SSH authorized keys. Currently only type 2 keys are supported.
In their native habitat, SSH keys usually appear as a single long line. This
resource type requires you to split that line into several attributes. Thus,
a
key that appears in your `~/.ssh/id_rsa.pub` file like this...
    ssh-rsa
...would translate to the following resource:
...would translate to the following resource:
...would translate to the following resource:
...would translate to the following resource:
...would translate to the following resource:
...would translate to the following resource:
...would translate to the following resource:
eMue6b3FtUdTDeyAYoTxrsRo/WnDkS6Pa3YhrFwjtUqXfdaQ==
nick@magpie.puppetlabs.lan
...would translate to the following resource:
    ssh_authorized_key { 'nick@magpie.puppetlabs.lan':
      user => 'nick',
      type => 'ssh-rsa',
      key  =>
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
BmuvPF1Mn3FwaFLjVsMT3GQeMue6b3FtUdTDeyAYoTxrsRo/WnDkS6Pa3YhrFwjtUqXfdaQ==',
    }
To ensure that only the currently approved keys are present, you can purge
unmanaged SSH keys on a per-user basis. Do this with the `user` resource
type's `purge_ssh_keys` attribute:
    user { 'nick':
      ensure         => present,
      purge_ssh_keys => true,
    }
This will remove any keys in `~/.ssh/authorized_keys` that aren't being
managed with `ssh_authorized_key` resources. See the documentation of the
`user` type for more details.
**Autorequires:** If Puppet is managing the user account in which this
SSH key should be installed, the `ssh_authorized_key` resource will
autorequire
that user.
 
 
Parameters
----------
    ensure, key, name, options, target, type, user
 
Providers
---------
    parsed



 Comments   
Comment by Sean Griffin [ 2016/06/09 ]

Looks beautiful now. Tested on ubuntu-1604-x86_64, build sha 115a482333e529eb348f5ec46939f76f34ef7b2d (master)

root@i7p8nu9fm8pnzmy:~# puppet describe -s ssh_authorized_key
 
ssh_authorized_key
==================
Manages SSH authorized keys. Currently only type 2 keys are supported.
In their native habitat, SSH keys usually appear as a single long line. This
resource type requires you to split that line into several attributes. Thus,
a
key that appears in your `~/.ssh/id_rsa.pub` file like this...
    ssh-rsa AAAAB3Nza[...]qXfdaQ== nick@magpie.puppetlabs.lan
...would translate to the following resource:
    ssh_authorized_key { 'nick@magpie.puppetlabs.lan':
      user => 'nick',
      type => 'ssh-rsa',
      key  => 'AAAAB3Nza[...]qXfdaQ== nick@magpie.puppetlabs.lan',
    }
To ensure that only the currently approved keys are present, you can purge
unmanaged SSH keys on a per-user basis. Do this with the `user` resource
type's `purge_ssh_keys` attribute:
    user { 'nick':
      ensure         => present,
      purge_ssh_keys => true,
    }
This will remove any keys in `~/.ssh/authorized_keys` that aren't being
managed with `ssh_authorized_key` resources. See the documentation of the
`user` type for more details.
**Autorequires:** If Puppet is managing the user account in which this
SSH key should be installed, the `ssh_authorized_key` resource will
autorequire
that user.

Generated at Mon Dec 16 05:28:10 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.