docker-misp icon indicating copy to clipboard operation
docker-misp copied to clipboard

Python Cryptography required Rust by default - Blocking new versions

Open coolacid opened this issue 5 years ago • 9 comments

https://github.com/pyca/cryptography/issues/5806

Need to think about the best way to handle this as quickly as possible so we can get latest build out the door.

Simple solution might be to just pre-build the wheel of a 3.3.x version. (Currently 3.3.2)

coolacid avatar Feb 10 '21 21:02 coolacid

Unless I am misunderstanding the issue, it is a pretty easy fix.

According to the documentation of the Cryptography module:

The Rust available in current Debian stable and some Ubuntu versions is older than the minimum supported version. Ubuntu 18.04 and 20.04 are sufficiently new, but otherwise please see the Rust installation instructions for information about installing a newer Rust

You can get around the problem by installing the following dependencies: sudo apt-get install build-essential libssl-dev libffi-dev python3-dev cargo

antoinethebuilder avatar Feb 16 '21 19:02 antoinethebuilder

From my understanding the rust build available in Debian is to old to build the required rust items.

Also, all builds happen in the build image, not in the main image, and right now while trying to get this resolved, the main image is still trying to build the latest, even though I pre-build a version of crypto.

coolacid avatar Feb 16 '21 22:02 coolacid

I hope this is the right spot where to put this, since I don't want to open a new issue on this already "hot" matter.

I had to install scrapy, which requires cryptography, on an Ubuntu server 18.04, and run in this issue. I tried all the suggested things: updating pip, installing rust and so on... but it kept not working, although, as above mentioned, it should work out of the box.

What I found out is that the failure was happening only because I was trying to install in a venv (as recommended by the scrapy team). I tried system wide installation, and worked like a charm. I don't know why this is the case, I just wanted to point out the problem for the maintainers.

keyiyek avatar Feb 16 '21 23:02 keyiyek

@keyiyek Thanks - However, that wouldn't be related to this project. I suggest maybe looking for scrapy's issue tracker?

coolacid avatar Feb 16 '21 23:02 coolacid

@coolacid sorry, I didn't explain properly. I got the error both as a scrapy dependency, and as a standalone package.

(scrapy-venv) sauron@Sauron-01:~$ pip3 install cryptography
Collecting cryptography
  Using cached https://files.pythonhosted.org/packages/fa/2d/2154d8cb773064570f48ec0b60258a4522490fcb115a6c7c9423482ca993/cryptography-3.4.6.tar.gz
    Complete output from command python setup.py egg_info:
    
            =============================DEBUG ASSISTANCE==========================
            If you are seeing an error here please try the following to
            successfully install cryptography:
    
            Upgrade to the latest pip and try again. This will fix errors for most
            users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
            =============================DEBUG ASSISTANCE==========================
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-hjrqbvmt/cryptography/setup.py", line 14, in <module>
        from setuptools_rust import RustExtension
    ModuleNotFoundError: No module named 'setuptools_rust'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-hjrqbvmt/cryptography/

while root@Sauron-01:~# python3 -m pip install cryptography worked (that being python 3.6, because python3.9 -m pip install cryptography had issues as well)

Sorry I can't be more precise, I spent a couple of hours throwing commands in different ways (root, no root, venv, no venv...) and I haven't kept track of all the results, but basically I was always getting something similar to the above.

keyiyek avatar Feb 17 '21 00:02 keyiyek

Again, thank you, but I'm not sure that has anything todo with this MISP Docker build.

coolacid avatar Feb 17 '21 00:02 coolacid

sorry, didn't realise I followed a link out of the cryptography project. Sorry again

keyiyek avatar Feb 17 '21 00:02 keyiyek

No problem, hope you find the right fit for the issue.

coolacid avatar Feb 17 '21 00:02 coolacid

Regarding this issue - I put 6da2a69d4054a7bfc152e0250cbe1e99e9c64e04 in as a work around. Forces installing a 3.3.x version for now until I have some time to get the rust version working.

coolacid avatar Feb 17 '21 00:02 coolacid