1

I am new to Puppet.

What are the steps to generate a DSA key in Puppet and add the public key to authorized keys?

Basically the equivalent of the below Linux statements

$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa

$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
BJ5
  • 512
  • 6
  • 22
  • you may want to do some research before posting a question.. https://docs.puppetlabs.com/references/latest/type.html#exec https://docs.puppetlabs.com/references/latest/type.html#sshauthorizedkey – ptierno Dec 14 '15 at 21:41

3 Answers3

1

As @ptierno mentionned, the puppet documentation has all of the information. The first step is to make and exec ressource to generate the key, then either another exec, or an sshauthorizedkey ressource to install it into the authorized_key for the user.

T0xicCode
  • 4,583
  • 2
  • 37
  • 50
0

I know this is an indirect answer, but I think that you should generate your key manually and simply add it to your server like any other file. If your goal is to be able to rebuild the same machine over and over or if you want several load balanced instances then you would probably want the same key, not a new one.

Henry
  • 7,721
  • 2
  • 38
  • 38
0

There is a module on the forge that will do this for you https://forge.puppet.com/puppet/ssh_keygen

Once you have this installed you can generate an ssh key simple by adding

ssh_keygen { 'john': }

But be careful as it doesn't actually check the users home directory, instead it defaults to /home/john. If you have a different home directory you'll need to pass that in;

ssh_keygen { 'john':
  home => '/var/home'
}
16c7x
  • 500
  • 2
  • 6
  • 1
    An answer is a direct response that sincerely attempts to provide the information/analysis requested by the question. Hence remember link is not an answer. – Kaushik Burkule Nov 01 '19 at 09:27
  • 1
    A link to a solution is welcome, but please ensure your answer is useful without it: add context, some examples and/or code to support your answer and guide someone on how to use the link towards a solution – Ioannis Barakos Nov 01 '19 at 09:44