euca-bundle-image occasionally chokes on bad RNG output

Bug #904062 reported by Garrett Holmstrom
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
euca2ools
Confirmed
Low
Unassigned

Bug Description

When the encryption code in euca-bundle-image generates a key and IV to use when encrypting the image, the random number generating algorithm occasionally yields a value that causes an exception when that value is handed to unhexlify:

Traceback (most recent call last):
  File "/usr/bin/euca-bundle-image", line 231, in <module>
    main()
  File "/usr/bin/euca-bundle-image", line 209, in main
    encrypted_file, key, iv, bundled_size = euca.encrypt_image(tgz_file)
  File "/usr/lib/python2.6/dist-packages/euca2ools/__init__.py", line 610, in encrypt_image
    k=EVP.Cipher(alg='aes_128_cbc', key=unhexlify(key), iv=unhexlify(iv), op=1)
TypeError: Odd-length string

Currently, when this occurs, the program terminates unsuccessfully. Because this happens very rarely, I will change this behavior to print a short warning that contains the unusable key and IV, ask the user to report those values in this bug, and then retry encryption with a new key and IV so the command can return successfully.

Future users: if you see a message such as the following when you run euca-bundle-image, please report the "k" and "iv" values it indicates in a comment on this bug:

WARNING: retrying encryption to work around a rare RNG bug
Please report the following values to Eucalyptus Systems at
https://bugs.launchpad.net/bugs/904062 to help diagnose
this issue.
k: 0x9680c0e4f42daa742eed12fabdbf52598dL
iv: 0xe8fe9e11b31baa00434394c1f2fff2ed39L

affects: eucalyptus → euca2ools
description: updated
Revision history for this message
Garrett Holmstrom (gholms) wrote :
Changed in euca2ools:
status: New → Confirmed
Revision history for this message
Andy Grimm (agrimm) wrote :

This issue is now being tracked upstream at http://eucalyptus.atlassian.net/browse/TOOLS-103

Please watch that issue for further updates.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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