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
1

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

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'
}

2 Comments

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.
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.