Issue #2352 has been reported by Kjetil Torgrim Homme.

----------------------------------------
Bug #2352: ssh_authorized_key can create files it can't parse
http://projects.reductivelabs.com/issues/2352

Author: Kjetil Torgrim Homme
Status: Unreviewed
Priority: Normal
Assigned to: 
Category: 
Target version: 
Complexity: Easy
Affected version: 0.24.8
Keywords: 


I have put all the keys in individual text files, and used template() to fetch 
the value and pass to ssh_authorized_key's key attribute.  The problem with 
this is that my text files contains a trailing newline[1], and this newline was 
copied verbatim into the resulting file, so it became

ssh-rsa AAAAB3NzaC1y.......ojH2ZMvF+Efw==
 kjeti...@puppet

That is, it was split across two lines.  On the next run, ssh_authorized_key 
aborts since the file contains a syntax error...[2]

In any case, Puppet should never generate files it can't handle, so there are 
two options IMHO:

  1) strip whitespace from key before writing it to file.  drop the resource 
processing if it's not valid base64.
  2) drop the resource processing if it's not valid base64.

I think my usecase of putting the keys in individual files is common enough 
that whitespace trimming should be done.  It would also allow splitting inline 
values into multi-line strings.

Workaround: use regsubst() to remove the newline from the templated value.

[1] I really don't like text files with no terminating newline, it makes diff 
slightly unhappy etc.
[2] The parser is very fickle in general, it bombs on empty lines, too.  Please 
fix that when you're at it, not worth a separate issue I think :)


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to