center-for-threat-informed-defense / tram

TRAM is an open-source platform designed to advance research into automating the mapping of cyber threat intelligence reports to MITRE ATT&CK®.
https://ctid.mitre-engenuity.org/our-work/tram/
Apache License 2.0
436 stars 93 forks source link

I tried pulling and following the install and I got a few errors, this is how i fixed. #207

Closed dougjpsantos closed 6 months ago

dougjpsantos commented 10 months ago

I got a few errors while following the instructions, but it was all related to the docker pip install, it should be >4.4.0.


silicon@cloudy:~/research/MITRE_CTID$ ls tram workbench silicon@cloudy:~/research/MITRE_CTID$ cd tram/ silicon@cloudy:~/research/MITRE_CTID/tram$ ls CONTRIBUTING.md data docker Dockerfile LICENSE.txt Makefile model-development NOTICE.txt pyproject.toml README.md requirements src tests tox.ini user_notebooks silicon@cloudy:~/research/MITRE_CTID/tram$ cd docker/ silicon@cloudy:~/research/MITRE_CTID/tram/docker$ ls docker-compose.yml Dockerfile.nginx entrypoint.sh nginx-tram.conf README.md silicon@cloudy:~/research/MITRE_CTID/tram/docker$ docker-compose up Traceback (most recent call last): File "/usr/bin/docker-compose", line 33, in sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')()) File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 81, in main command_func() File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 200, in perform_command project = project_from_options('.', options) File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 60, in project_from_options return get_project( File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 152, in get_project client = get_client( File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 41, in get_client client = docker_client( File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 143, in docker_client if not context.is_docker_host(): AttributeError: 'Context' object has no attribute 'is_docker_host' silicon@cloudy:~/research/MITRE_CTID/tram/docker$ vi /usr/lib/python3/dist-packages/compose/cli/docker_client.py silicon@cloudy:~/research/MITRE_CTID/tram/docker$ pip list -bash: /usr/local/bin/pip: /usr/bin/python: bad interpreter: No such file or directory silicon@cloudy:~/research/MITRE_CTID/tram/docker$ pip3 list Package Version


aioftp 0.20.1 aiohttp 3.8.4 aiohttp-apispec 2.2.3 aiohttp-jinja2 1.5 aiohttp-security 0.4.0 aiohttp-session 2.9.0 aiosignal 1.3.1 alabaster 0.7.13 apispec 3.3.2 apturl 0.5.2 asn1crypto 1.4.0 async-timeout 4.0.2 asyncssh 2.11.0 attrs 21.2.0 Babel 2.12.1 blinker 1.4 Brlapi 0.8.3 certifi 2020.6.20 chardet 4.0.0 charset-normalizer 3.1.0 chrome-gnome-shell 0.0.0 click 8.0.3 colorama 0.4.4 command-not-found 0.3 cryptography 3.4.8 cssselect2 0.7.0 cupshelpers 1.0 dbus-python 1.2.18 defer 1.0.6 dirhash 0.2.0 distro 1.7.0 distro-info 1.1+ubuntu0.1 dnspython 2.1.0 docker 4.2.0 docker-compose 1.29.2 dockerpty 0.4.1 docopt 0.6.2 docutils 0.16 donut-shellcode 0.9.2 frozenlist 1.3.3 gpg 1.16.0 httplib2 0.20.2 idna 3.3 imagesize 1.4.1 importlib-metadata 4.6.4 iotop 0.6 jeepney 0.7.1 Jinja2 3.0.3 jsonschema 3.2.0 keyring 23.5.0 keyrings.alt 4.1.0 language-selector 0.1 launchpadlib 1.10.16 lazr.restfulclient 0.14.4 lazr.uri 1.0.6 ldap3 2.8.1 libvirt-python 8.0.0 louis 3.20.0 lxml 4.9.2 macaroonbakery 1.3.1 Mako 1.1.3 Markdown 3.3.3 markdown-it-py 2.2.0 MarkupSafe 2.0.1 marshmallow 3.5.1 marshmallow-enum 1.5.1 mdit-py-plugins 0.3.5 mdurl 0.1.2 more-itertools 8.10.0 multidict 6.0.4 myst-parser 0.18.0 netifaces 0.11.0 oauthlib 3.2.0 olefile 0.46 packaging 23.1 pathspec 0.11.1 pexpect 4.8.0 Pillow 9.0.1 pip 22.0.2 protobuf 3.12.4 ptyprocess 0.7.0 pyasn1 0.5.0 pycairo 1.20.1 pycryptodomex 3.11.0 pycups 2.0.1 Pygments 2.11.2 PyGObject 3.42.1 PyJWT 2.3.0 pymacaroons 0.13.0 PyNaCl 1.5.0 pyparsing 2.4.7 PyQt5 5.15.6 PyQt5-sip 12.9.1 pyRFC3339 1.1 pyrsistent 0.18.1 python-apt 2.4.0+ubuntu2 python-dateutil 2.8.1 python-debian 0.1.43+ubuntu1.1 python-dotenv 0.19.2 pytz 2022.1 pyxdg 0.27 PyYAML 5.4.1 reportlab 3.6.12 requests 2.25.1 requests-toolbelt 0.9.1 requests-unixsocket 0.2.0 scantree 0.0.1 SecretStorage 3.3.1 setuptools 59.6.0 simplejson 3.17.6 six 1.16.0 snowballstemmer 2.2.0 Sphinx 5.1.1 sphinx-rtd-theme 0.4.3 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.1 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.5 ssh-import-id 5.11 svglib 1.0.1 systemd-python 234 texttable 1.6.4 tinycss2 1.2.1 typing_extensions 4.6.3 ubuntu-advantage-tools 8001 ubuntu-drivers-common 0.0.0 ufw 0.36.1 unattended-upgrades 0.1 urllib3 1.26.5 usb-creator 0.3.7 vboxapi 1.0 wadllib 1.3.6 webargs 5.5.3 webencodings 0.5.1 websocket-client 1.2.3 websockets 11.0.3 wheel 0.37.1 xdg 5 xkit 0.0.0 yarl 1.9.2 zipp 1.0.0 zope.interface 5.4.0 silicon@cloudy:~/research/MITRE_CTID/tram/docker$ pip3 list | grep docker docker 4.2.0 docker-compose 1.29.2 dockerpty 0.4.1 silicon@cloudy:~/research/MITRE_CTID/tram/docker$ pip3 install docker==4.2.2 Defaulting to user installation because normal site-packages is not writeable Collecting docker==4.2.2 Downloading docker-4.2.2-py2.py3-none-any.whl (144 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 144.1/144.1 KB 4.1 MB/s eta 0:00:00 Requirement already satisfied: six>=1.4.0 in /usr/lib/python3/dist-packages (from docker==4.2.2) (1.16.0) Requirement already satisfied: requests!=2.18.0,>=2.14.2 in /usr/lib/python3/dist-packages (from docker==4.2.2) (2.25.1) Requirement already satisfied: websocket-client>=0.32.0 in /usr/lib/python3/dist-packages (from docker==4.2.2) (1.2.3) Installing collected packages: docker Successfully installed docker-4.2.2 silicon@cloudy:~/research/MITRE_CTID/tram/docker$ docker-compose up Traceback (most recent call last): File "/usr/bin/docker-compose", line 33, in sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')()) File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 81, in main command_func() File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 200, in perform_command project = project_from_options('.', options) File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 60, in project_from_options return get_project( File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 152, in get_project client = get_client( File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 41, in get_client client = docker_client( File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 170, in docker_client client = APIClient(use_ssh_client=not use_paramiko_ssh, **kwargs) TypeError: APIClient.init() got an unexpected keyword argument 'use_ssh_client' silicon@cloudy:~/research/MITRE_CTID/tram/docker$ ^C silicon@cloudy:~/research/MITRE_CTID/tram/docker$ pip install docker==4.4.0 -bash: /usr/local/bin/pip: /usr/bin/python: bad interpreter: No such file or directory silicon@cloudy:~/research/MITRE_CTID/tram/docker$ pip3 install docker==4.4.0 Defaulting to user installation because normal site-packages is not writeable Collecting docker==4.4.0 Downloading docker-4.4.0-py2.py3-none-any.whl (146 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 146.7/146.7 KB 4.8 MB/s eta 0:00:00 Requirement already satisfied: requests!=2.18.0,>=2.14.2 in /usr/lib/python3/dist-packages (from docker==4.4.0) (2.25.1) Requirement already satisfied: six>=1.4.0 in /usr/lib/python3/dist-packages (from docker==4.4.0) (1.16.0) Requirement already satisfied: websocket-client>=0.32.0 in /usr/lib/python3/dist-packages (from docker==4.4.0) (1.2.3) Installing collected packages: docker Attempting uninstall: docker Found existing installation: docker 4.2.2 Uninstalling docker-4.2.2: Successfully uninstalled docker-4.2.2 Successfully installed docker-4.4.0 silicon@cloudy:~/research/MITRE_CTID/tram/docker$ docker-compose up Creating network "docker_default" with the default driver Creating volume "docker_tram" with default driver Creating volume "docker_tram_static" with default driver Pulling tram (ghcr.io/center-for-threat-informed-defense/tram:latest)... latest: Pulling from center-for-threat-informed-defense/tram 7007490126ef: Pull complete a209e8ef0a6b: Pull complete cb6dc70f0404: Pull complete 4f4fb700ef54: Pull complete 37199b5e9852: Pull complete 6679e58e0d33: Pull complete 131a45dbd0a1: Pull complete a807c0d6e396: Pull complete 61743360266b: Pull complete d90096e271c9: Pull complete Digest: sha256:a52ebbb8782884e78336b2710a2a795cf2e87fa413ca337381b1a7de358e8f83 Status: Downloaded newer image for ghcr.io/center-for-threat-informed-defense/tram:latest Pulling nginx (ghcr.io/center-for-threat-informed-defense/tram-nginx:latest)... latest: Pulling from center-for-threat-informed-defense/tram-nginx 59bf1c3509f3: Pull complete f3322597df46: Pull complete d09cf91cabdc: Pull complete 3a97535ac2ef: Pull complete 919ade35f869: Pull complete 40e5d2fe5bcd: Pull complete acbd57f34cd9: Pull complete Digest: sha256:96c6092040851f3240f1044238664aa0fc81a0bf9070c4fed08eb5999568f197 Status: Downloaded newer image for ghcr.io/center-for-threat-informed-defense/tram-nginx:latest Creating docker_nginx_1 ... done Creating docker_tram_1 ... done Attaching to docker_nginx_1, docker_tram_1 nginx_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration nginx_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh nginx_1 | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf nginx_1 | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh nginx_1 | /docker-entrypoint.sh: Configuration complete; ready for start up nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: using the "epoll" event method nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: nginx/1.21.5 nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: built by gcc 10.3.1 20211027 (Alpine 10.3.1_git20211027) nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: OS: Linux 5.15.0-89-generic nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: start worker processes nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: start worker process 31 nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: start worker process 32 nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: start worker process 33 nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: start worker process 34 nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: start worker process 35 nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: start worker process 36 nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: start worker process 37 nginx_1 | 2023/12/05 22:30:02 [notice] 1#1: start worker process 38 tram_1 | No changes detected in app 'tram' tram_1 | Operations to perform: tram_1 | Apply all migrations: admin, auth, contenttypes, database, sessions, tram tram_1 | Running migrations: tram_1 | No migrations to apply. tram_1 | Superuser created. tram_1 | [2023-12-05 22:30:12 +0000] [43] [INFO] Starting gunicorn 20.1.0 tram_1 | [2023-12-05 22:30:12 +0000] [43] [INFO] Listening at: http://0.0.0.0:8000 (43) tram_1 | [2023-12-05 22:30:12 +0000] [43] [INFO] Using worker: sync tram_1 | [2023-12-05 22:30:12 +0000] [46] [INFO] Booting worker with pid: 46 tram_1 | [2023-12-05 22:30:15] INFO [tram.ml.base] BERTClassifierModel loaded from init tram_1 | [2023-12-05 22:30:15] INFO [tram.management.commands.pipeline] Running ML Pipeline with Model: bert ^CGracefully stopping... (press Ctrl+C again to force) Stopping docker_tram_1 ... Stopping docker_nginx_1 ... done ^Z [1]+ Stopped docker-compose up silicon@cloudy:~/research/MITRE_CTID/tram/docker$ docker-compose up & [2] 8289 Starting docker_tram_1 ... done Starting docker_nginx_1 ... done Attaching to docker_nginx_1, docker_tram_1 nginx_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration nginx_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh nginx_1 | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf nginx_1 | 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh nginx_1 | /docker-entrypoint.sh: Configuration complete; ready for start up nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: using the "epoll" event method nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: nginx/1.21.5 nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: built by gcc 10.3.1 20211027 (Alpine 10.3.1_git20211027) nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: OS: Linux 5.15.0-89-generic nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: start worker processes nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: start worker process 30 nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: start worker process 31 nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: start worker process 32 nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: start worker process 33 nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: start worker process 34 nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: start worker process 35 nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: start worker process 36 nginx_1 | 2023/12/05 22:30:40 [notice] 1#1: start worker process 37

mehaase commented 10 months ago

Thank you for this info @dougjpsantos. What OS are you on? I didn't run into this particular issue, but I installed Docker on MacOS using Homebrew. On the latest version of Docker, compose is built-in and does not need to be installed separately, e.g. you can run docker compose <...> instead of docker-compose <...>. So I'm curious what platform and where did you install Docker from? That will help me figure out how to improve the instructions.

mehaase commented 6 months ago

Closing due to inactivity.