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

        Attachments

          Activity

            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: