Patrowl / PatrowlEngines

PatrOwl - Open Source, Free and Scalable Security Operations Orchestration Platform
https://www.patrowl.io
GNU Affero General Public License v3.0
244 stars 71 forks source link

Patrowl-leaks container fails to build #194

Closed bLackCat-79 closed 2 years ago

bLackCat-79 commented 2 years ago

Using legacy 'setup.py install' for cffi, since package 'wheel' is not installed. Installing collected packages: PatrowlEnginesUtils, wrapt, werkzeug, twitter, PyJWT, pycparser, MarkupSafe, itsdangerous, gunicorn, click, Jinja2, deprecated, cffi, pynacl, flask, PyGithub Running setup.py install for cffi: started Running setup.py install for cffi: finished with status 'error' error: subprocess-exited-with-error

× Running setup.py install for cffi did not run successfully. │ exit code: 1 ╰─> [65 lines of output] Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable Package 'libffi', required by 'virtual:world', not found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containinglibffi.pc' to the PKG_CONFIG_PATH environment variable Package 'libffi', required by 'virtual:world', not found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable Package 'libffi', required by 'virtual:world', not found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containinglibffi.pc' to the PKG_CONFIG_PATH environment variable Package 'libffi', required by 'virtual:world', not found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable Package 'libffi', required by 'virtual:world', not found

      No working compiler found, or bogus compiler options passed to
      the compiler from Python's standard "distutils" module.  See
      the error messages above.  Likely, the problem is not related
      to CFFI but generic to the setup.py of any Python package that
      tries to compile C code.  (Hints: on OS/X 10.8, for errors about
      -mno-fused-madd see http://stackoverflow.com/questions/22313407/
      Otherwise, see https://wiki.python.org/moin/CompLangPython or
      the IRC channel #python on irc.libera.chat.)

      Trying to continue anyway.  If you are trying to install CFFI from
      a build done in a different context, you can ignore this warning.

  running install
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/cffi
  copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/__init__.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/verifier.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/cparser.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/api.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/error.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/commontypes.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/model.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/lock.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/recompiler.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/_embedding.h -> build/lib.linux-x86_64-3.9/cffi
  copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.9/cffi
  running build_ext
  building '_cffi_backend' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/c
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.9/c/_cffi_backend.o
  error: command 'gcc' failed: No such file or directory
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure

× Encountered error while trying to install package. ╰─> cffi

note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.

bLackCat-79 commented 2 years ago

I modified the dockerfile to (added libffi-dev and py3-cffi:

FROM alpine:latest MAINTAINER Patrowl.io "getsupport@patrowl.io" LABEL Name="Patrowl\ Data\ Leaks\ (Patrowl engine)" Version="1.4.26"

Install dependencies

RUN apk add --update \ python3 \ python3-dev \ py3-pip \ libffi-dev \ py3-cffi \ && rm -rf /var/cache/apk/*

Create the target repo

RUN mkdir -p /opt/patrowl-engines/owl_leaks/results

Set the working directory to /opt/

WORKDIR /opt/patrowl-engines/owl_leaks

Copy the current directory contents into the container at /

COPY init.py . COPY engine-owl_leaks.py . COPY requirements.txt . COPY owl_leaks.json.sample owl_leaks.json COPY VERSION .

Install python modules

RUN pip3 install --upgrade pip RUN pip3 install --trusted-host pypi.python.org -r requirements.txt

TCP port exposed by the container (NAT)

EXPOSE 5012

Run app.py when the container launches

CMD ["python3", "engine-owl_leaks.py", "--port=5012", "--host=0.0.0.0", "--access-logfile", "-"]

CMD ["gunicorn", "engine-owl_leaks:app", "-b", "0.0.0.0:5012", "--access-logfile", "-"]