glacier-ng 4.0.0
This commit is contained in:
commit
0cf4829fa5
159 files changed
+33717
No files matched your search
@@ -0,0 +1,67 @@
|
||||
# Arch (glibc) test image, default user `glacier` (uid 1000, in wheel).
|
||||
# Same layout rules as Dockerfile.alpine — read its header:
|
||||
# * /app root-owned, not group/world-writable (gstore -n and syspkg run
|
||||
# as root and refuse code a user could edit);
|
||||
# * /glacier NOT pre-created (`doas /app/gstore -n`, `doas /app/syspkg -n`);
|
||||
# * libglacier-ng built from source here, from the named build context
|
||||
# `libglacier` that run_docker.sh passes.
|
||||
#
|
||||
# ./run_docker.sh Dockerfile.arch
|
||||
|
||||
FROM archlinux:latest AS base
|
||||
RUN pacman-key --init && pacman-key --populate archlinux && \
|
||||
pacman -Syu --noconfirm --needed archlinux-keyring && \
|
||||
pacman -S --noconfirm --needed base-devel libarchive libconfig && \
|
||||
pacman -Scc --noconfirm
|
||||
|
||||
FROM base AS libglacier-build
|
||||
COPY --from=libglacier . /build
|
||||
WORKDIR /build
|
||||
RUN make clean && make
|
||||
|
||||
FROM base
|
||||
RUN pacman -S --noconfirm --needed luajit opendoas git && pacman -Scc --noconfirm
|
||||
|
||||
RUN useradd -m -u 1000 -G wheel glacier && \
|
||||
echo "glacier:password" | chpasswd
|
||||
|
||||
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
|
||||
|
||||
# doas uses the LAST matching rule. 1: this image's dev convenience
|
||||
# (glacier may do anything as root). 2: the rule Everest itself ships —
|
||||
# any wheel user may run exactly `gstore -n`, i.e. create their OWN
|
||||
# /glacier/usr/<uid>. Delete rule 1 to test under the real 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