glacier-ng 4.0.0
This commit is contained in:
commit
0cf4829fa5
159 files changed
+33717
No files matched your search
@@ -0,0 +1,80 @@
|
||||
# Alpine test image, default user `glacier` (uid 1000, in wheel).
|
||||
#
|
||||
# Build/run with: ./run_docker.sh (Dockerfile.alpine is the default)
|
||||
#
|
||||
# Layout rules this image has to respect (see PACKAGE_SCOPES.txt §1):
|
||||
# * /app is root-owned and not group/world-writable. gstore -n and
|
||||
# syspkg run as root and refuse to load code from anything a user
|
||||
# could edit — so the source tree can't be handed to `glacier`.
|
||||
# * /glacier is NOT pre-created or chown'd. `doas /app/gstore -n`
|
||||
# creates /glacier/usr/1000 (owned by glacier); `doas /app/syspkg -n`
|
||||
# creates /glacier/sys. A user-owned /glacier/usr is refused.
|
||||
# * The .so's checked into lib/glacier/ are host (glibc) builds and
|
||||
# won't load on musl, so libglacier-ng is built from source here,
|
||||
# from the named build context `libglacier` (run_docker.sh passes it).
|
||||
|
||||
FROM alpine:latest AS libglacier-build
|
||||
|
||||
RUN apk add --no-cache build-base luajit-dev libarchive-dev libconfig-dev linux-headers
|
||||
|
||||
COPY --from=libglacier . /build
|
||||
WORKDIR /build
|
||||
RUN make clean && make
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk update && apk add build-base git lua-dev luajit-dev doas libarchive-static libarchive-dev libconfig-dev linux-headers valgrind gdb
|
||||
RUN apk add --no-cache shadow
|
||||
RUN adduser -D -u 1000 glacier && \
|
||||
echo "glacier:password" | chpasswd && \
|
||||
addgroup glacier wheel
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
COPY --from=libglacier-build /build/build/lib/shared/libglacier_*.so /app/lib/glacier/
|
||||
COPY --from=libglacier-build /build/build/bin/gsandbox /app/lib/glacier/
|
||||
RUN chown -R root:root /app && chmod -R go-w /app
|
||||
RUN install -Dm644 /app/etc/glacier/glacier.conf /etc/glacier/glacier.conf
|
||||
|
||||
# A TEST signing key, so base packages can be installed here: syspkg
|
||||
# requires their sidecar signed by a key listed for base in
|
||||
# /etc/glacier/repos.conf (REPO_DESIGN.txt section 7). Its secret half is
|
||||
# in the image, so never trust it anywhere else. Sign with
|
||||
# `tests/mkpkg -k /root/glacier-test.sec ... base` (or gbuild -k; gbuild
|
||||
# finds gsha256sum and gsign on PATH). grepo is there too.
|
||||
COPY --from=libglacier-build /build/build/bin/gsign /build/build/bin/gsha256sum /build/build/bin/grepo /usr/local/bin/
|
||||
RUN mkdir -p /etc/glacier/keys && \
|
||||
gsign -G -p /etc/glacier/keys/glacier-test.pub -s /root/glacier-test.sec -c glacier-test >/dev/null && \
|
||||
printf 'repos = (\n\t{ name = "base"; keys = [ "glacier-test" ]; }\n);\n' > /etc/glacier/repos.conf && \
|
||||
chmod 644 /etc/glacier/repos.conf
|
||||
|
||||
RUN chmod 4755 /bin/su
|
||||
RUN chmod 4755 /usr/bin/doas
|
||||
RUN passwd -d root
|
||||
|
||||
# doas uses the LAST rule that matches.
|
||||
# 1. glacier may run anything as root (this image's dev convenience,
|
||||
# same as before) — needed for `doas /app/syspkg ...`.
|
||||
# 2. The rule Everest itself would ship: any wheel user may run
|
||||
# exactly `gstore -n` as root (no other arguments), so they can
|
||||
# create their OWN /glacier/usr/<uid> but can't name another UID.
|
||||
# With rule 1 present it adds nothing for glacier; delete rule 1 to
|
||||
# test glacier under the real, restricted setup.
|
||||
RUN printf '%s\n' \
|
||||
'permit nopass glacier' \
|
||||
'permit nopass :wheel as root cmd /app/gstore args -n' \
|
||||
> /etc/doas.conf && chmod 0400 /etc/doas.conf
|
||||
|
||||
RUN printf '%s\n' \
|
||||
'# Per-user links first, then system-scope (non-base) links. Not' \
|
||||
'# conditional on the dirs existing: /glacier is only created later,' \
|
||||
'# by syspkg -n / gstore -n, and a missing PATH entry is harmless.' \
|
||||
'GLACIER_LINKS="/glacier/usr/$(id -u)/links"' \
|
||||
'GLACIER_SYS_LINKS="/glacier/sys/links"' \
|
||||
'export PATH="$GLACIER_LINKS/bin:$GLACIER_SYS_LINKS/bin:$PATH"' \
|
||||
'export LD_LIBRARY_PATH="$GLACIER_LINKS/lib:$GLACIER_SYS_LINKS/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"' \
|
||||
> /etc/profile.d/glacier.sh
|
||||
|
||||
USER glacier
|
||||
|
||||
CMD ["/bin/sh", "-l"]
|
||||
Reference in new issue
Block a user