Search code examples
pythonyoctomitmproxy

Mitmproxy and installation with yocto recipes


I want to install the third-party tool called Mitmproxy in an embedded Linux environment with a low footprint, e.g. a Raspberry PI.

Rather than install using a standard Raspbian OS, I want to customize the install with Yocto and define the packages. This involves writing recipes to customize the packages that are installed. A good example at a high leve is described here.

Unfortunately this involves appending various Python3 packages as well pip-mitmproxy as well as all the dependencies of pip-mitmproxy in the local.conf file, e.g.

IMAGE_INSTALL_append = " python3" 
IMAGE_INSTALL_append = " pip-mitmproxy" 

Different recipe files need to be added in this case.

The challenge that I've found is getting the right versions of all the dependencies. I looked import pkg_resources but it doesn't seem to give me everything. Is there another recommended approach perhaps by looking at the source code.


Solution

  • I created Python venv on normal Linux Mint so pip freeze shows me empty list

    After installing mitmproxy I run again pip freeze and it shows me

    blinker==1.4
    Brotli==1.0.7
    certifi==2020.6.20
    cffi==1.14.1
    click==7.1.2
    cryptography==2.9.2
    Flask==1.1.2
    h11==0.9.0
    h2==3.2.0
    hpack==3.0.0
    hyperframe==5.2.0
    itsdangerous==1.1.0
    Jinja2==2.11.2
    kaitaistruct==0.8
    ldap3==2.7
    MarkupSafe==1.1.1
    mitmproxy==5.2
    passlib==1.7.2
    protobuf==3.11.3
    publicsuffix2==2.20191221
    pyasn1==0.4.8
    pycparser==2.20
    pyOpenSSL==19.1.0
    pyparsing==2.4.7
    pyperclip==1.8.0
    ruamel.yaml==0.16.10
    ruamel.yaml.clib==0.2.0
    six==1.15.0
    sortedcontainers==2.1.0
    tornado==6.0.4
    urwid==2.0.1
    Werkzeug==1.0.1
    wsproto==0.15.0
    zstandard==0.13.0
    

    But it is hard to say if it needs some C/C++ libraries for this.

    For example pyOpenSSL will need library OpenSSL but I can't find it in setup.py or setup.cfg. There is only information about openssl-devel which means it may need openssl.

    It seems the only way is to install and run it to see error messages :)