Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-334

Unable to login on Linode instances with driver generated password

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: Compute
    • Labels:
      None

      Description

      Hi,

      When creating instances with Debian 7 images on Linode provider, I was unable to login using generated password, I review API calls and seems ok to me, so I opened a ticket with Linode support team.

      This is the response from support:

      == start here ==

      I have determined the source of the issue you are experiencing. If you decode the encoded string you're sending for the root password, you'll notice that there is actually a newline (%0A) on the end of it:

      >>> import urllib
      >>> urllib2.unquote('bPJ%2FY%2BTy%2FCU%3D%0A')
      'bPJ/Y+Ty/CU=\n'

      If you take that string and test it with crypt, you'll see that it does in fact match if the newline is included:

      >>> import crypt
      >>> crypt.crypt('bPJ/Y+Ty/CU=', '$1$e5348d91$X/u/q7slmZPgFioKx0aFm.')
      '$1$e5348d91$s4hfTTBRN31kfxDYbC5bF0'
      >>> crypt.crypt('bPJ/Y+Ty/CU=\n', '$1$e5348d91$X/u/q7slmZPgFioKx0aFm.')
      '$1$e5348d91$X/u/q7slmZPgFioKx0aFm.'

      As you can see, the newline on the end of the password is included in the hash and a normal login session doesn't capture a newline as part of the password. The quick fix is to strip the newline off before encoding the password to send in the URL, like so:

      root = binascii.b2a_base64(os.urandom(8)).decode('ascii').strip()

      Making that change should fix your ability to log in using a password after deploying a new Linode. Let us know if you need further assistance.

      == ends here ==

      Tested and worked!. Just adding newline strip on root password generator.

      Hope that helps
      Regards
      Juan Carlos Moreno

        Activity

        Hide
        juancarlos.moreno@ackstorm.es Juan Carlos Moreno added a comment -

        Thanks Tomaz!

        Show
        juancarlos.moreno@ackstorm.es Juan Carlos Moreno added a comment - Thanks Tomaz!
        Hide
        kami Tomaz Muraus added a comment -

        Fixed merged into trunk and 0.12.x. Thanks!

        Show
        kami Tomaz Muraus added a comment - Fixed merged into trunk and 0.12.x. Thanks!
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1489200 from Tomaz Muraus
        [ https://svn.apache.org/r1489200 ]

        Fix a bug in the Linode driver and remove extra newline which is added
        when generating a random root password in create_node.

        Contributed by Juan Carlos Moreno, part of LIBCLOUD-334.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1489200 from Tomaz Muraus [ https://svn.apache.org/r1489200 ] Fix a bug in the Linode driver and remove extra newline which is added when generating a random root password in create_node. Contributed by Juan Carlos Moreno, part of LIBCLOUD-334 .
        Hide
        kami Tomaz Muraus added a comment -

        Good catch, thanks.

        I just verified it and yes, binascii.b2a_base64 includes a ending newline (http://docs.python.org/2/library/binascii.html#binascii.b2a_base64).

        I will work on getting a fix into master shortly.

        Show
        kami Tomaz Muraus added a comment - Good catch, thanks. I just verified it and yes, binascii.b2a_base64 includes a ending newline ( http://docs.python.org/2/library/binascii.html#binascii.b2a_base64 ). I will work on getting a fix into master shortly.

          People

          • Assignee:
            kami Tomaz Muraus
            Reporter:
            juancarlos.moreno@ackstorm.es Juan Carlos Moreno
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development