TravisFSmith / SweetSecurity

Network Security Monitoring on Raspberry Pi type devices
Apache License 2.0
777 stars 190 forks source link

Debian 8 CFFI failure Kibana import during install #24

Open ThePlexus opened 7 years ago

ThePlexus commented 7 years ago

Starting Kibana Importing Kibana Index Patterns Importing /home/user/sweetsecurity/kibana/patterns/sweet_security_alerts.json Traceback (most recent call last): File "setup.py", line 220, in kibana.install(chosenInterfaceIP) File "/home/user/sweetsecurity/install/kibana.py", line 85, in install importIndexMapping(os.path.join(patternPath, file)) File "/home/user/sweetsecurity/install/kibana.py", line 117, in importIndexMapping from elasticsearch import Elasticsearch File "/usr/local/lib/python2.7/dist-packages/elasticsearch/init.py", line 17, in from .client import Elasticsearch File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/init.py", line 4, in from ..transport import Transport File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py", line 4, in from .connection import Urllib3HttpConnection File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/init.py", line 2, in from .http_requests import RequestsHttpConnection File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_requests.py", line 4, in import requests File "/usr/lib/python2.7/dist-packages/requests/init.py", line 68, in _attach_namespace(urllib3, 'requests.packages') File "/usr/lib/python2.7/dist-packages/requests/init.py", line 63, in _attach_namespace module = import(name) File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 55, in import OpenSSL.SSL File "/usr/local/lib/python2.7/dist-packages/OpenSSL/init.py", line 8, in from OpenSSL import rand, crypto, SSL File "/usr/local/lib/python2.7/dist-packages/OpenSSL/rand.py", line 10, in from OpenSSL._util import ( File "/usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py", line 18, in no_zero_allocator = ffi.new_allocator(should_clear_after_alloc=False) AttributeError: 'FFI' object has no attribute 'new_allocator'

ThePlexus commented 7 years ago

issue seems mroe upstream and generic with CFFI and openSSL python libs. pip --update cffi also reports same broken-ness

workaround: download 1.10.0 from https://pypi.python.org/pypi/cffi and build/install

TravisFSmith commented 7 years ago

Thanks for the workaround, I'll look into if this is something that needs to be added to the installer with changed packages.

Agromahdi123 commented 6 years ago

Python-PIP is also broken and breaks the install in a similar manner when it reaches the Kibana import parts of your python installer. My workaround for that was to use the get-pip.py script and install pip that way, then the installer runs fine.

cloudstrifeedge commented 6 years ago

1. install cffi lib: sudo apt-get install libffi-dev

2. install these packages manually:

sudo pip install elasticsearch
sudo pip install requests
sudo pip install flask-mail
sudo pip install flask_wtf
sudo pip install cryptography --upgrade
sudo pip install pyopenssl --upgrade

if there's no more error, run setup.py again.

as you can see at line 29 & 48 of this file: SweetSecurity/install/packages.py

os.popen('sudo pip install elasticsearch 2>&1').read()
os.popen('sudo pip install requests 2>&1').read()
os.popen('sudo pip install flask-mail 2>&1').read()
os.popen('sudo pip install flask_wtf 2>&1').read()
os.popen('sudo pip install cryptography --upgrade 2>&1').read()
os.popen('sudo pip install pyopenssl --upgrade 2>&1').read()

there's no guarantee to install these packages successfully because they're non-blocking tasks. and there's no log to show the result of installation.

I guess your failure is caused by the dependence issue when packages.py runs

os.popen('sudo pip install cryptography --upgrade 2>&1').read()

or

os.popen('sudo pip install pyopenssl --upgrade 2>&1').read()

and if my memory is correct, libffi-dev is a dependence of cryptography or pyopenssl