sous-chefs / users

Development repository for the users cookbook
https://supermarket.chef.io/cookbooks/users
Apache License 2.0
138 stars 217 forks source link

Multiline ssh keys #128

Closed adecarolis closed 8 years ago

adecarolis commented 8 years ago

1.7.0 allowed multiline ssh keys using JSON arrays:

 $ cat cookbooks/users/templates/default/private_key.erb
<% Array(@private_key).each do |key| %>
<%= key %>
<% end -%>

On the other hand, 2.0.1 is simply putting out the JSON string:

 $ cat cookbooks/users/templates/default/private_key.erb
<%= @private_key %>

This applies to both private_key.erb and public_key.erb, but not to authorized_keys.erb. It breaks backwards compatibility and makes it difficult to create multiline keys.

How is one supposed to do this in 2.0.1?

Thanks

iennae commented 8 years ago

I checked the template in https://github.com/chef-cookbooks/users/releases/tag/v1.7.0, and it looks like the template hasn't changed. Is this perhaps something that was modified locally? I notice that https://github.com/chef-cookbooks/users/blob/master/templates/default/authorized_keys.erb totally has that style of template.

adecarolis commented 8 years ago

I double checked. You are right... my local 1.7.0 had been modified. Thank you for pointing this out.

iennae commented 8 years ago

Well if it's a feature that is helpful, would be great to know :) It sounds like it's useful, just wanted to make sure I understood the change.

adecarolis commented 8 years ago

Well, I believe it is useful. In facts I was about to override those templates in a wrapper cookbook. My problem is that we use private keys that are multiline. JSON, oh the other hand, does not allow multiline strings. The template you currently have in [authorized_keys.erb](https://github.com/chef-cookbooks/users/blob/master/templates/default/authorized_keys.erb does) solves the multiline problem applying this pattern. I need exactly the same thing for the other two files.