ssh_import_id doesn't like carriage return (^M)

Bug #651698 reported by Mathias Gug
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ssh-import-id (Ubuntu)
Fix Released
Low
Dustin Kirkland 

Bug Description

Binary package hint: cloud-init

Running ami-60699c09 with the following user-data:

#cloud-config
ssh_import_id: [mathiaz, james-page]

Only the first login (mathiaz) is added to the ubuntu authorized_keys. The second login (james-page) is not added to the authorized_key file.

Revision history for this message
Scott Moser (smoser) wrote :

mathiaz's error was due to james-page keys not being considered valid by ssh-import-id.
The final hex characters in his currently uploaded keys are:
0d0a 0d0a

I think the proper fix to ssh-import-id is:
--- ssh-import-id 2010-07-22 10:02:11.000000000 -0400
+++ ssh-import-id 2010-09-29 23:18:36.956997685 -0400
@@ -68,8 +68,8 @@
 validate_keys() {
   # Prune blank lines, join lines that don't have a '= ',
   # remove invalid characters
- sed -i -e '/^$/d' \
- -e ':join /=[ ]/!{ N; s/\n// ; b join }' \
+ sed -i -e '/^$/d' -e '/^\r/d' \
+ -e ':join /=[ ]/!{ N; s/[\n\r]// ; b join }' \
          -e 's/[^a-zA-Z0-9@: .\/=+-]//g' "$1"
   # Count lines
   lines=$(wc -l < "${1}")

affects: cloud-init (Ubuntu) → openssh (Ubuntu)
Changed in openssh (Ubuntu):
importance: Undecided → Low
status: New → Confirmed
Mathias Gug (mathiaz)
Changed in openssh (Ubuntu):
status: Confirmed → Triaged
Scott Moser (smoser)
summary: - Second login to ssh_import_id in cloud-config doesn't get added to
- authorized_keys file
+ ssh_import_id doesn't like carriage return (^M)
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

+1 on the patch; please apply and upload, Scott.

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Let's get this queued for an SRU, if we can't make it into RC/GA.

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Colin, any opinion here? Could we get this queued into an SRU for Maverick?

Revision history for this message
Colin Watson (cjwatson) wrote : Re: [Bug 651698] Re: ssh_import_id doesn't like carriage return (^M)

Upload it and we'll review it for final release.

Changed in openssh (Ubuntu):
assignee: nobody → Dustin Kirkland (kirkland)
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Moving this over to ssh-import-id.

affects: openssh (Ubuntu) → ssh-import-id (Ubuntu)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ssh-import-id - 2.2-0ubuntu1

---------------
ssh-import-id (2.2-0ubuntu1) natty; urgency=low

  [ Scott Moser ]
  * use getopt, send 'info' to stderr, add '--output', LP: #688574
    - support '--help'
    - add '--output' or '-o' option to write downloaded and
      verified data to a named file (supporting '-' for stdout) rather
      that writing to users .ssh/authorized_keys
    - send 'info' output to standard error rather than standard out
      This is required to deal with '--output -'
  * remove carriage returns from key strings (LP: #651698)

  [ Dustin Kirkland ]
  * ssh-import-id.1: updated to reflect smoser's changes
  * debian/install, ssh_import_id, ssh-import-id: allow for URL to be
    admin-configurable, to point to other SSH public key stores besides
    Launchpad.net
  * ssh-import-id.1: document /etc/ssh/ssh_import_id
 -- Dustin Kirkland <email address hidden> Wed, 05 Jan 2011 08:59:28 -0600

Changed in ssh-import-id (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.