Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't ./bin/cowrie start (cannot import name certificate_transparency) #618

Closed
ogre2007 opened this issue Nov 4, 2017 · 9 comments
Closed
Labels

Comments

@ogre2007
Copy link

ogre2007 commented Nov 4, 2017

There is my error. Ubuntu 14. I were doing all stuff by INSTALL.MD (except pip install --upgrade setup tools, becouse w/o it i cant install requirements.txt

  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/plugin.py", line 171, in getCache
    provider = pluginModule.load()
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/python/modules.py", line 392, in load
    return self.pathEntry.pythonPath.moduleLoader(self.name)
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/python/reflect.py", line 308, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/python/reflect.py", line 255, in _importAndCheckStack
    reraise(excValue, excTraceback)
  File "/home/cowrie/cowrie/twisted/plugins/cowrie_plugin.py", line 55, in <module>
    import cowrie.ssh.factory
  File "/home/cowrie/cowrie/cowrie/ssh/factory.py", line 12, in <module>
    from twisted.conch.ssh import factory
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/ssh/factory.py", line 18, in <module>
    from twisted.conch.ssh import (_kex, transport, userauth, connection)
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/ssh/transport.py", line 345, in <module>
    class SSHTransportBase(protocol.Protocol):
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/ssh/transport.py", line 469, in SSHTransportBase
    supportedCiphers = _getSupportedCiphers()
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/ssh/transport.py", line 335, in _getSupportedCiphers
    backend=default_backend(),
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 15, in default_backend
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 16, in <module>
    from cryptography import utils, x509
  File "/home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/cryptography/x509/__init__.py", line 7, in <module>
    from cryptography.x509 import certificate_transparency
exceptions.ImportError: cannot import name certificate_transparency

@ogre2007
Copy link
Author

ogre2007 commented Nov 4, 2017

As i can see, there is some problem with cryptography library (no x509 in dir(cryptography)) (or not, i'm not sure)

(cowrie-env)cowrie@ip:~/cowrie$ ./bin/cowrie start --debug     
Activating virtualenv "cowrie-env"                                           
Starting cowrie: [twistd   --umask 0077 --pidfile var/run/cowrie.pid -l log/cowrie.log cowrie --debug]...
Jumping into debugger for post-mortem of exception 'cannot import name certificate_transparency':
> /home/cowrie/cowrie/cowrie-env/local/lib/python2.7/site-packages/cryptography/x509/__init__.py(7)<module>()
-> from cryptography.x509 import certificate_transparency
(Pdb) import cryptography                                                    
(Pdb) dir(cryptography)
['__about__', '__all__', '__author__', '__builtins__', '__copyright__', '__doc__', '__email__', '__file__', 
'__license__', '__name__', '__package__', '__path__', '__summary__', '__title__', '__uri__', 
'__version__', 'absolute_import', 'division', 'exceptions', 'hazmat', 'print_function', 'sys', 'utils', 'warnings']

But as you can see, it installed properly. How can i solve this issue?

(cowrie-env)cowrie@ip:~/cowrie/cowrie-env/local/lib/python2.7/site-packages/cryptography/x509$ ls                                            
base.py                       extensions.py     __init__.py   oid.py         
base.pyc                      extensions.pyc    __init__.pyc  oid.pyc
certificate_transparency.py   general_name.py   name.py
certificate_transparency.pyc  general_name.pyc  name.pyc
(cowrie-env)cowrie@ip:~/cowrie/cowrie-env/local/lib/python2.7/site-packages/cryptography/x509$             

@ogre2007
Copy link
Author

ogre2007 commented Nov 4, 2017

solved this, you should add upgrading pip commands in INSTALL.MD too..

@micheloosterhof
Copy link
Member

Hi! It seems this requires a change in the INSTALL.md, reopening.
How did you solve this exactly?

pip upgrade pip?

@ttepatti
Copy link

ttepatti commented Nov 7, 2017

Hey there! Just wanted to let you know I was able to solve this by appending --upgrade to the command for installing the packages in requirements.txt

Per the Debian Install Instructions:

pip install -r requirements.txt

should be changed to:

pip install --upgrade -r requirements.txt

This forced pip to upgrade all of the required packages before installing them, instantly fixing all of the errors I had.

@chitreshbb
Copy link

Cannot resolve the issue.

I'm trying to run it on AWS lambda with latest versions, it's still not working.
I'm using the latest pip version (pip 9.0.1 from /local/lib/python2.7/site-packages (python 2.7))
and using latest cryptography version "cryptography==2.1.4" as of 26th Dec 2017.

@R3e @ttepatti @micheloosterhof did you guys solve this?

@micheloosterhof
Copy link
Member

@chitreshbb please open a new issue and post your exact error and steps you've followed to install the dependencies please.

@futex
Copy link

futex commented Jan 24, 2019

I have the same problem, have you solve it?

pip install --upgrade -r requirements.txt

Have no effect on my installation

@israellev
Copy link

israellev commented Sep 8, 2019

I have the same issue and the upgrade did't solve it.
!! File "C:\Users\user\Desktop\projects\water-io-dashboard\modules\nexmo_base.py", line 21, in __init__ jwt = self.__generate_jwt(self._APPLICATION_ID, private_key) !! File "C:\Users\user\Desktop\projects\water-io-dashboard\modules\nexmo_base.py", line 31, in __generate_jwt return jwt.encode(payload, private_key, algorithm="RS256") !! File "C:\Users\user\Desktop\projects\water-io-dashboard\lib\jwt\api_jwt.py", line 56, in encode json_payload, key, algorithm, headers, json_encoder !! File "C:\Users\user\Desktop\projects\water-io-dashboard\lib\jwt\api_jws.py", line 97, in encode key = alg_obj.prepare_key(key) !! File "C:\Users\user\Desktop\projects\water-io-dashboard\lib\jwt\algorithms.py", line 167, in prepare_key key = load_pem_private_key(key, password=None, backend=default_backend()) !! File "C:\Users\user\Desktop\projects\water-io-dashboard\lib\cryptography\hazmat\backends\__init__.py", line 15, in default_backend from cryptography.hazmat.backends.openssl.backend import backend !! File "C:\Users\user\Desktop\projects\water-io-dashboard\lib\cryptography\hazmat\backends\openssl\__init__.py", line 7, in <module> from cryptography.hazmat.backends.openssl.backend import backend !! File "C:\Users\user\Desktop\projects\water-io-dashboard\lib\cryptography\hazmat\backends\openssl\backend.py", line 18, in <module> from cryptography import utils, x509 !! File "C:\Users\user\Desktop\projects\water-io-dashboard\lib\cryptography\x509\__init__.py", line 7, in <module> from cryptography.x509 import certificate_transparency

my requirements are:

requests_toolbelt==0.9.1 argon2pure==1.3 google-auth==1.6.3 google-cloud-error-reporting==0.31.0 google-cloud-storage==1.16.1 cryptography==2.7 PyJWT==1.4.0

@micheloosterhof
Copy link
Member

hi @israellev your issue does not seem to be related to Cowrie so we can't help you here. sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants