Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image (ghcr.io/mitre/caldera:5.0.0) does not contain Magma (dist) build files #2949

Open
d3vzer0 opened this issue Apr 15, 2024 · 3 comments
Assignees
Labels

Comments

@d3vzer0
Copy link

d3vzer0 commented Apr 15, 2024

Describe the bug
The docker image (ghcr.io/mitre/caldera:5.0.0) does not contain the Magma plugin (dist) build files. Starting the container will fail with the following error:

ValueError: No directory exists at '/usr/src/app/plugins/magma/dist/assets'

This could be caused by an older Dockerfile being used which does not build Magma plugin's Vue project as part of the docker build process. If I build the container myself using the latest Dockerfile found in the repo, the container will start successfully.

To Reproduce
Steps to reproduce the behavior:

  1. Start a caldera container with docker using docker run ghcr.io/mitre/caldera:5.0.0 or
  2. Start a caldera container with Podman using podman run ghcr.io/mitre/caldera:5.0.0

Expected behavior
The container to start successfully

Screenshots
Screenshot 2024-04-15 at 14 49 43

Desktop (please complete the following information):

  • OS: Rocky Linux
Copy link

Looks like your first issue -- we aim to respond to issues as quickly as possible. In the meantime, check out our documentation here: http://caldera.readthedocs.io/

@d3vzer0
Copy link
Author

d3vzer0 commented Apr 15, 2024

It seems that this issue is related but the changes are not represented in the hosted Docker image itself (yet)

@digoblin
Copy link

digoblin commented May 10, 2024

Hi there, first of all, thank you very much for the project it is very useful.

I was having the same problem starting the docker-compose file and I identified the problem with the volume mount referenced in the docker-compose file, I created a workaround for those that want to use the caldera's git folder as the containers /usr/src/app folder:

The problem I identified is that the docker-compose file, uses the current dir, supposedly the caldera's git folder, as its app folder:

volumes:
      - ./:/usr/src/app

Now the problem with the latest build of the Docker file (f9b0ed2) is that it is using the /usr/src/app folder to install the magma plugin and when a new container is started with the volume mounted like in the docker-compose file, the contents of the plugins/magma/ folder get overridden with the default files of caldera's git folder.

My workaround was to create a ubuntu container with the caldera's github folder mounted inside it, run the instructions of the Dockerfile pertaining the magma plugin installation and thus achieve a permanent plugin installation.

First we create the fix file in the caldera's git folder, fix.sh:

#!/bin/sh
apt-get update && \
apt-get install -y nodejs npm && \
# Directly use npm to install dependencies and build the application
(cd plugins/magma && npm install) && \
(cd plugins/magma && npm run build) && \
# Remove Node.js, npm, and other unnecessary packages
apt-get remove -y nodejs npm && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

now save it and then give it execution permissions:

chmod +x fix.sh

now we create a temporary ubuntu docker container with the caldera folder mounted inside in /app path, and execute the fix.sh script:

docker run --rm -v $PWD:/app ubuntu:23.04 ./app/fix.sh
#    --rm - remove the container once it is done
#   -v mount the current directory ($PWD) in /app inside the container

now the files in plugins/magma/dist folder should be present and we can start the docker-compose project:

docker-compose up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants