Skip to content

Commit

Permalink
Fix golang in Dockerfile, update min Go version
Browse files Browse the repository at this point in the history
Ubuntu 23.04 is earliest one with golang 1.19+ in its repositories.
Ubuntu 23.04 requires running python in virtual env.
  • Loading branch information
clenk committed Oct 5, 2023
1 parent 151f311 commit 8b7f394
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:latest
FROM ubuntu:23.04
SHELL ["/bin/bash", "-c"]

ARG TZ="UTC"
Expand All @@ -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 golang-go
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

Expand All @@ -26,6 +32,11 @@ RUN python3 -c "import app; import app.utility.config_generator; app.utility.con
sed -i '/\- atomic/d' conf/local.yml;

# 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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion conf/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ requirements:
go:
command: go version
type: installed_program
version: 1.11
version: 1.19
python:
attr: version
module: sys
Expand Down

0 comments on commit 8b7f394

Please sign in to comment.