mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-04-20 06:02:24 +00:00
update beelzebub for golang 1.23
- harden image
This commit is contained in:
parent
422123139d
commit
521d551b08
3 changed files with 48 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
||||||
FROM golang:1.20-alpine AS builder
|
FROM golang:1.23-alpine AS builder
|
||||||
#
|
#
|
||||||
ENV GO111MODULE=on \
|
ENV GO111MODULE=on \
|
||||||
CGO_ENABLED=0 \
|
CGO_ENABLED=0 \
|
||||||
|
@ -14,26 +14,16 @@ RUN git clone https://github.com/t3chn0m4g3/beelzebub
|
||||||
WORKDIR /root/beelzebub
|
WORKDIR /root/beelzebub
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
RUN go build -o main .
|
RUN go build -o main .
|
||||||
|
RUN sed -i "s#logsPath: ./log#logsPath: ./configurations/log/beelzebub.json#g" /root/beelzebub/configurations/beelzebub.yaml
|
||||||
|
RUN sed -i 's/passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$"/passwordRegex: ".*"/g' /root/beelzebub/configurations/services/ssh-22.yaml
|
||||||
#
|
#
|
||||||
FROM alpine:3.20
|
FROM scratch
|
||||||
#
|
#
|
||||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
COPY --from=builder /root/beelzebub/main /opt/beelzebub/
|
COPY --from=builder /root/beelzebub/main /opt/beelzebub/
|
||||||
COPY --from=builder /root/beelzebub/configurations /opt/beelzebub/configurations
|
COPY --from=builder /root/beelzebub/configurations /opt/beelzebub/configurations
|
||||||
#
|
#
|
||||||
# Setup user, groups and configs
|
|
||||||
RUN <<EOF
|
|
||||||
sed -i "s#logsPath: ./log#logsPath: ./configurations/log/beelzebub.json#g" /opt/beelzebub/configurations/beelzebub.yaml
|
|
||||||
sed -i 's/passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$"/passwordRegex: ".*"/g' /opt/beelzebub/configurations/services/ssh-22.yaml
|
|
||||||
addgroup -g 2000 beelzebub
|
|
||||||
adduser -S -s /bin/ash -u 2000 -D -g 2000 beelzebub
|
|
||||||
mkdir -p /beelzebub/configurations/key \
|
|
||||||
/beelzebub/configurations/log
|
|
||||||
chown beelzebub:beelzebub -R /opt/beelzebub/configurations
|
|
||||||
chmod 0770 -R /opt/beelzebub/configurations
|
|
||||||
EOF
|
|
||||||
#
|
|
||||||
# Start beelzebub
|
# Start beelzebub
|
||||||
WORKDIR /opt/beelzebub
|
WORKDIR /opt/beelzebub
|
||||||
USER beelzebub:beelzebub
|
USER 2000:2000
|
||||||
CMD ["./main"]
|
ENTRYPOINT ["./main"]
|
||||||
|
|
39
docker/beelzebub/Dockerfile.old
Normal file
39
docker/beelzebub/Dockerfile.old
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
FROM golang:1.20-alpine AS builder
|
||||||
|
#
|
||||||
|
ENV GO111MODULE=on \
|
||||||
|
CGO_ENABLED=0 \
|
||||||
|
GOOS=linux
|
||||||
|
#
|
||||||
|
# Install packages
|
||||||
|
RUN apk -U add git
|
||||||
|
#
|
||||||
|
WORKDIR /root
|
||||||
|
#
|
||||||
|
# Build beelzebub
|
||||||
|
RUN git clone https://github.com/t3chn0m4g3/beelzebub
|
||||||
|
WORKDIR /root/beelzebub
|
||||||
|
RUN go mod download
|
||||||
|
RUN go build -o main .
|
||||||
|
#
|
||||||
|
FROM alpine:3.20
|
||||||
|
#
|
||||||
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
|
COPY --from=builder /root/beelzebub/main /opt/beelzebub/
|
||||||
|
COPY --from=builder /root/beelzebub/configurations /opt/beelzebub/configurations
|
||||||
|
#
|
||||||
|
# Setup user, groups and configs
|
||||||
|
RUN <<EOF
|
||||||
|
sed -i "s#logsPath: ./log#logsPath: ./configurations/log/beelzebub.json#g" /opt/beelzebub/configurations/beelzebub.yaml
|
||||||
|
sed -i 's/passwordRegex: "^(root|qwerty|Smoker666|123456|jenkins|minecraft|sinus|alex|postgres|Ly123456)$"/passwordRegex: ".*"/g' /opt/beelzebub/configurations/services/ssh-22.yaml
|
||||||
|
addgroup -g 2000 beelzebub
|
||||||
|
adduser -S -s /bin/ash -u 2000 -D -g 2000 beelzebub
|
||||||
|
mkdir -p /beelzebub/configurations/key \
|
||||||
|
/beelzebub/configurations/log
|
||||||
|
chown beelzebub:beelzebub -R /opt/beelzebub/configurations
|
||||||
|
chmod 0770 -R /opt/beelzebub/configurations
|
||||||
|
EOF
|
||||||
|
#
|
||||||
|
# Start beelzebub
|
||||||
|
WORKDIR /opt/beelzebub
|
||||||
|
USER beelzebub:beelzebub
|
||||||
|
CMD ["./main"]
|
|
@ -19,9 +19,9 @@ services:
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
environment:
|
environment:
|
||||||
LLMMODEL: "ollama"
|
LLM_MODEL: "ollama"
|
||||||
LLMHOST: "http://ollama.local:11434/api/chat"
|
LLM_HOST: "http://ollama.local:11434/api/chat"
|
||||||
OLLAMAMODEL: "openchat"
|
OLLAMA_MODEL: "openchat"
|
||||||
image: "dtagdevsec/beelzebub:24.04"
|
image: "dtagdevsec/beelzebub:24.04"
|
||||||
read_only: true
|
read_only: true
|
||||||
volumes:
|
volumes:
|
||||||
|
|
Loading…
Reference in a new issue