bump hellpot to latest master, hardening

This commit is contained in:
t3chn0m4g3 2024-11-28 17:17:25 +01:00
parent adefcca2fc
commit 25d98cbce9

View file

@ -1,4 +1,4 @@
FROM golang:1.21-alpine AS builder FROM golang:1.23-alpine AS builder
# #
# Include dist # Include dist
COPY dist/ /root/dist/ COPY dist/ /root/dist/
@ -13,8 +13,7 @@ RUN apk --no-cache -U add \
cd /root && \ cd /root && \
git clone https://github.com/yunginnanet/HellPot && \ git clone https://github.com/yunginnanet/HellPot && \
cd HellPot && \ cd HellPot && \
git checkout 3673ab0228664fb3acd33102be5c7a5867137eb5 && \ git checkout c48b70110148918255f93df4fa49c675ba5a5754 && \
# git checkout 49433bf499b6af314786cbbc3cb8566cdb18c40c && \
sed -i 's#logFileName := "HellPot"#logFileName := "hellpot"#g' internal/config/logger.go && \ sed -i 's#logFileName := "HellPot"#logFileName := "hellpot"#g' internal/config/logger.go && \
go mod download && \ go mod download && \
go vet -v ./... && \ go vet -v ./... && \
@ -25,17 +24,12 @@ RUN apk --no-cache -U add \
-ldflags "-s -w -X main.version=$VERSION" \ -ldflags "-s -w -X main.version=$VERSION" \
cmd/HellPot/HellPot.go cmd/HellPot/HellPot.go
# #
FROM alpine:3.19 FROM scratch
# #
COPY --from=builder /root/HellPot/HellPot /opt/hellpot/ COPY --from=builder /root/HellPot/HellPot /opt/hellpot/
COPY --from=builder /root/dist/config.toml /opt/hellpot/config/ COPY --from=builder /root/dist/config.toml /opt/hellpot/config/
# #
# Setup user, groups and configs
RUN addgroup -g 2000 hellpot && \
adduser -S -s /bin/ash -u 2000 -D -g 2000 hellpot && \
mkdir -p /var/log/hellpot
#
# Start hellpot # Start hellpot
WORKDIR /opt/hellpot WORKDIR /opt/hellpot
USER hellpot:hellpot USER 2000:2000
CMD ["./HellPot", "-c","config/config.toml"] CMD ["./HellPot", "-c","config/config.toml"]