diff --git a/Dockerfile b/Dockerfile index 8fa852e95..446957dda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:latest +FROM ubuntu:23.04 SHELL ["/bin/bash", "-c"] ARG TZ="UTC" @@ -12,12 +12,18 @@ ADD . . RUN if [ -z "$(ls plugins/stockpile)" ]; then echo "stockpile plugin not downloaded - please ensure you recursively cloned the caldera git repository and try again."; exit 1; fi RUN apt-get update && \ - apt-get -y install python3 python3-pip git curl + apt-get -y install python3 python3-pip python3-venv git curl golang-go + #WIN_BUILD is used to enable windows build in sandcat plugin ARG WIN_BUILD=false RUN if [ "$WIN_BUILD" = "true" ] ; then apt-get -y install mingw-w64; fi +# Set up python virtualenv +ENV VIRTUAL_ENV=/opt/venv/caldera +RUN python3 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + # Install pip requirements RUN pip3 install --no-cache-dir -r requirements.txt @@ -25,13 +31,12 @@ RUN pip3 install --no-cache-dir -r requirements.txt RUN python3 -c "import app; import app.utility.config_generator; app.utility.config_generator.ensure_local_config();"; \ sed -i '/\- atomic/d' conf/local.yml; -# Install golang -RUN curl -L https://go.dev/dl/go1.17.6.linux-amd64.tar.gz -o go1.17.6.linux-amd64.tar.gz -RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.6.linux-amd64.tar.gz; -ENV PATH="${PATH}:/usr/local/go/bin" -RUN go version; - # Compile default sandcat agent binaries, which will download basic golang dependencies. + +# Install Go dependencies +WORKDIR /usr/src/app/plugins/sandcat/gocat +RUN go mod tidy && go mod download + WORKDIR /usr/src/app/plugins/sandcat # Fix line ending error that can be caused by cloning the project in a Windows environment diff --git a/README.md b/README.md index aba8319ab..2be0916ba 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Next, install the PIP requirements: ```Bash pip3 install -r requirements.txt ``` -**Super-power your Caldera server installation! [Install GoLang (1.17+)](https://go.dev/doc/install)** +**Super-power your Caldera server installation! [Install GoLang (1.19+)](https://go.dev/doc/install)** Finally, start the server. ```Bash diff --git a/conf/default.yml b/conf/default.yml index 4a4ba1ce9..5fd4da373 100644 --- a/conf/default.yml +++ b/conf/default.yml @@ -45,7 +45,7 @@ requirements: go: command: go version type: installed_program - version: 1.11 + version: 1.19 python: attr: version module: sys