Security review follow-up for the opt-in PKG_CACHE path: - PKG_CACHE must be https:// (http is refused). The cache's certificate comes from a name-constrained internal CA (keys/pkg-cache/ca.crt, valid only for 192.168.1.40 / pkg-cache.*). The CA is trusted only by the rewritten repos (dnf sslcacert bundle, apt per-host CaInfo) and only for the duration of the RUN. - epel-release / remi-release are no longer installed straight from a URL. release-install downloads them over HTTPS, checks the package name, imports the signing keys committed in keys/pkg-cache/ and requires `rpm -K` "signatures OK", then installs with localpkg_gpgcheck=1. This applies with and without the cache. - Rewritten repos get gpgcheck=1. Remi and AlmaLinux also get repo_gpgcheck=1, since both sign repomd.xml. EPEL does not publish a repomd signature, so it relies on end-to-end HTTPS. - restore also deletes files it created and any new repo/apt file that still references the cache, then fails the build if a reference remains under /etc/yum.repos.d, /etc/dnf or /etc/apt. - docs: trust model, replay risk, proposed openssl/httpd/ImageMagick minimum-version gates, TLS registry mirror (BuildKit ca= / dockerd certs.d, no insecure-registries). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
2.1 KiB
Docker
53 lines
2.1 KiB
Docker
FROM almalinux/10-base
|
|
|
|
# OPTIONAL internal package cache, e.g. --build-arg PKG_CACHE=https://192.168.1.40
|
|
# (CT130 pkg-cache, https only). Unset = upstream repositories. Release RPMs are
|
|
# GPG-verified against keys/pkg-cache/ either way. Repo files
|
|
# are restored at the end of every RUN, so no layer keeps the cache address.
|
|
# See scripts/pkg-cache-repos.sh.
|
|
ARG PKG_CACHE=
|
|
COPY ./scripts/pkg-cache-repos.sh /usr/local/sbin/pkg-cache-repos.sh
|
|
COPY ./keys/pkg-cache/ /usr/local/share/pkg-cache/
|
|
|
|
# Install Apache and minimal dependencies (no PHP at all)
|
|
RUN /usr/local/sbin/pkg-cache-repos.sh rpm && \
|
|
/usr/local/sbin/pkg-cache-repos.sh release-install epel && \
|
|
/usr/local/sbin/pkg-cache-repos.sh rpm && \
|
|
dnf update -y && \
|
|
dnf install -y httpd mod_ssl openssl iproute cronie procps curl && \
|
|
/usr/local/sbin/pkg-cache-repos.sh restore && \
|
|
dnf clean all && \
|
|
rm -rf /var/cache/dnf /usr/share/doc /usr/share/man /usr/share/locale/*
|
|
|
|
# Copy scripts and set permissions
|
|
COPY ./scripts/detect-memory.sh /scripts/detect-memory.sh
|
|
COPY ./scripts/create-apache-mpm-config.sh /scripts/create-apache-mpm-config.sh
|
|
COPY ./scripts/log-rotate.sh /scripts/log-rotate.sh
|
|
COPY ./scripts/entrypoint-shared-httpd.sh /scripts/entrypoint-shared-httpd.sh
|
|
COPY ./scripts/stop-services.sh /scripts/stop-services.sh
|
|
COPY ./scripts/tune-mpm.sh /scripts/tune-mpm.sh
|
|
RUN chmod +x /scripts/*
|
|
|
|
# Generate self-signed SSL cert (same as main CAC image)
|
|
RUN openssl req -newkey rsa:2048 -nodes \
|
|
-keyout /etc/pki/tls/private/localhost.key \
|
|
-x509 -days 3650 -subj "/CN=localhost" \
|
|
-out /etc/pki/tls/certs/localhost.crt
|
|
|
|
# Copy Apache configs
|
|
COPY ./configs/remote_ip.conf /etc/httpd/conf.d/
|
|
COPY ./configs/default-index.conf /etc/httpd/conf.d/
|
|
|
|
# Create vhosts directory (will be volume-mounted from host)
|
|
RUN mkdir -p /etc/httpd/conf.d/vhosts
|
|
|
|
# Set up cron job for log rotation
|
|
RUN echo "15 */12 * * * root /scripts/log-rotate.sh" >> /etc/crontab
|
|
|
|
EXPOSE 80 443
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
|
|
CMD curl -sfk https://localhost/ping || exit 1
|
|
|
|
ENTRYPOINT [ "/scripts/entrypoint-shared-httpd.sh" ]
|