VectorLinux
September 18, 2014, 09:31:24 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: OpenSSL / Python Issues: Unsupported hash types (md5, sha, etc)...  (Read 6479 times)
Rytz
Member
*
Posts: 59



« on: April 22, 2013, 07:35:25 am »

Greetings:

I'm currently not at home with access to the box in question so I'll do my best to describe the situation.

I was trying to do some python stuff over the weekend.  I needed to install setuptools to install a python lib.  When I try to run the egg setup for setuptools, I get a bunch of errors regarding unsupported hash types (all of the hash types that are listed in "/usr/lib/python2.7/hashlib.py" give an error as unsupported).

Same issue as reported here:
http://www.gossamer-threads.com/lists/python/python/961392

Another related thread:
http://stackoverflow.com/questions/11433108/unsupported-hash-type-when-installing-plone

I have the latest openssl / libssl installed.  I've tried building and installing from scratch.  I also tried reinstalling python2.7 from scratch.  Still get the hash type errors.

Most of the stuff on the net says this is a problem with a borked python installation or with openssl-dev not being installed.  In regards to openssl-dev, there doesn't seem to be a separate package for "-dev" (for slackware at least).

Question: is there a separate package / installation for openssl-dev somewhere for slackware or should the standard openssl package include the "-dev" materials?

Has anyone else experienced "unsupported hash type" issues with python?  Seems really strange considering Python is supposed to use it's own implementation of the hash types if OpenSSL is not used.  Maybe an environment variable not set?

I'm currently running Light 7.

Thanks.
« Last Edit: April 22, 2013, 08:07:47 am by Rytz » Logged

~ Rytz
rbistolfi
Packager
Vectorian
****
Posts: 2283


« Reply #1 on: April 22, 2013, 09:48:37 am »

Hello,

There is no separated package for the openssl development files.
I am using setuptools from the repo and it seems to work fine.
What code raises that exception? Can you paste the literal traceback?
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
Rytz
Member
*
Posts: 59



« Reply #2 on: April 22, 2013, 09:54:34 am »

Hello,

There is no separated package for the openssl development files.
I am using setuptools from the repo and it seems to work fine.
What code raises that exception? Can you paste the literal traceback?
Hi rbistolfi:

I'm not near that box right now but I can paste it later tonight.

When you say you got it from the repo, do you mean you got it from here?:
https://pypi.python.org/pypi/setuptools

I didn't try building setuptools from the source yet but I would think the egg would be sufficient enough.

I'm running python 2.7 too, btw.
Logged

~ Rytz
rbistolfi
Packager
Vectorian
****
Posts: 2283


« Reply #3 on: April 22, 2013, 10:25:15 am »

...
When you say you got it from the repo, do you mean you got it from here?:
https://pypi.python.org/pypi/setuptools

I didn't try building setuptools from the source yet but I would think the egg would be sufficient enough.

I mean this vector package: http://vectorlinux.osuosl.org/veclinux-7.0/extra/d/setuptools-0.6c11-i586-1vl70.txz
In any case we may have a bogus python build, because indeed the egg should work fine. Hopefuly the traceback will tell us whats worng and how can we fix the problem.

Cheers!
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
Rytz
Member
*
Posts: 59



« Reply #4 on: April 22, 2013, 10:38:19 am »

I mean this vector package: http://vectorlinux.osuosl.org/veclinux-7.0/extra/d/setuptools-0.6c11-i586-1vl70.txz
In any case we may have a bogus python build, because indeed the egg should work fine. Hopefuly the traceback will tell us whats worng and how can we fix the problem.

Cheers!
Hmm, if the default installation of Python 2.7 on Light was bad somehow, should building and installing python (same version) from scratch fix that?
Logged

~ Rytz
rbistolfi
Packager
Vectorian
****
Posts: 2283


« Reply #5 on: April 22, 2013, 02:14:23 pm »

I mean this vector package: http://vectorlinux.osuosl.org/veclinux-7.0/extra/d/setuptools-0.6c11-i586-1vl70.txz
In any case we may have a bogus python build, because indeed the egg should work fine. Hopefuly the traceback will tell us whats worng and how can we fix the problem.

Cheers!
Hmm, if the default installation of Python 2.7 on Light was bad somehow, should building and installing python (same version) from scratch fix that?

I dont think so. I think we should take a look at the traceback and try to determine the origin of the problem. If there is an issue with the package a fix will be released as an update.
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
Rytz
Member
*
Posts: 59



« Reply #6 on: April 22, 2013, 04:22:33 pm »

Here's the result from running the setuptools egg (as root).  I inserted an extra traceback in hashlib.py at the error spot.
"/usr/lib/python2.7/md5.py*" has md5.py, md5.pyc, and md5.pyo.

Code:
$ ./setuptools-0.6c11-py2.7.egg
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "/usr/lib/python2.7/hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 21, in <module>
  File "/setuptools-0.6c11-py2.7.egg/setuptools/package_index.py", line 10, in <module>
  File "/usr/lib/python2.7/md5.py", line 10, in <module>
    from hashlib import md5
ImportError: cannot import name md5
Logged

~ Rytz
Rytz
Member
*
Posts: 59



« Reply #7 on: April 22, 2013, 04:28:20 pm »

Ok so I just changed my "/usr/lib/md5.py" from:

Code:
from hashlib import md5

... to ...

Code:
import md5

... and I was able to run the egg.  Strange.  Any thoughts?  I'm not a Python programmer Smiley.

I'm guessing the other hash types still failed though.
« Last Edit: April 22, 2013, 04:41:23 pm by Rytz » Logged

~ Rytz
rbistolfi
Packager
Vectorian
****
Posts: 2283


« Reply #8 on: April 22, 2013, 05:12:40 pm »

Ok so I just changed my "/usr/lib/md5.py" from:

Code:
from hashlib import md5

... to ...

Code:
import md5

... and I was able to run the egg.  Strange.  Any thoughts?  I'm not a Python programmer Smiley.

I'm guessing the other hash types still failed though.

Yeah there is an issue with the python package.
This is whats happening, when you run

Code:
import md5

A pure python implementation of md5 is imported:

Code:
>>> import md5
>>> md5.__file__
'/usr/lib/python2.7/md5.pyc'


The hashlib library (new in python 2.5) will try to find a native implementation in the system instead:

Code:
>>> import hashlib
>>> hashlib.md5
<built-in function openssl_md5>

In your case, the openssl implementation of md5 is not being found. Could be that openssl support in python has been disabled at compile time (that would be a bug in our VL package) or that pyopenssl was compiled in a separated package. I will try to install 7.0 and look around. You can check available packages with gslapt or slapt-get from command line. My guess is that both setuptools and pyopenssl should be in the repository.
For checking the ssl module in python you can do:

Code:
import ssl

Or directly from the shell "python -m ssl" (no output would mean it worked)


I will try to check the 7.0 build ASAP.

HTH, Rodrigo
Logged

"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!
Rytz
Member
*
Posts: 59



« Reply #9 on: April 22, 2013, 05:17:08 pm »

Thanks rbistolfi.

I'll do some more investigation on my end and report back as well.
Logged

~ Rytz
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!