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

Add docker stuff #2057

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: docker image

on:
push:
branches: ["master"]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build ./docker --file docker/Dockerfile --tag capev2:$(date +%s)
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
services:
cape-db:
image: postgres:bookworm
hostname: cape-db
restart: always
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: cape
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- /docker/pg-data:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready", "-d", "cape" ]
interval: 1s
timeout: 60s
retries: 5
start_period: 80s

cape-server:
build: ./docker/
hostname: cape-server
links:
- cape-db
depends_on:
cape-db:
condition: service_healthy
ports:
- "127.0.0.1:2042:2042" # result server
- "127.0.0.1:8000:8000" # web ui
volumes:
- ./docker/conf:/cape/conf
22 changes: 22 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.11-bookworm

RUN apt-get update ; \
apt-get upgrade -y ; \
apt-get install -y git libgraphviz-dev tcpdump

COPY pcap.sh pcap.sh

RUN useradd -ms /bin/bash cape

COPY install.sh install.sh
RUN bash install.sh

WORKDIR /cape

RUN bash conf/copy_configs.sh
RUN chown -R cape:cape /cape

COPY run.sh run.sh

USER cape
ENTRYPOINT ["bash", "run.sh"]
12 changes: 12 additions & 0 deletions docker/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

git clone https://github.com/nbdy/CAPEv2 cape
cd cape
bash extra/libvirt_installer.sh
bash extra/yara_installer.sh

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r extra/optional_dependencies.txt
pip install -U flare-floss
6 changes: 6 additions & 0 deletions docker/pcap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

groupadd pcap
usermod -a -G pcap cape
chgrp pcap /usr/bin/tcpdump
setcap cap_net_raw,cap_net_admin=eip /usr/bin/tcpdump
8 changes: 8 additions & 0 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

source venv/bin/activate
python cuckoo.py &

cd web
python manage.py migrate
python manage.py runserver
2 changes: 1 addition & 1 deletion extra/optional_dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ urlextract==1.5.0
pdfminer==20191125
pg_activity
python-tlsh
pyattck = "7.1.2"
pyattck==7.1.2
1,694 changes: 904 additions & 790 deletions poetry.lock

Large diffs are not rendered by default.

1,371 changes: 731 additions & 640 deletions requirements.txt

Large diffs are not rendered by default.