From 0489fef31d9f0bc90f3d538995cbeb4c50e35fa2 Mon Sep 17 00:00:00 2001 From: chen21019 <19357113+chen21019@users.noreply.github.com> Date: Thu, 12 Nov 2026 16:36:01 +0800 Subject: [PATCH] Update HAProxy to 3.4.7 with AWS-LC 5.14.0 --- .github/workflows/codeql-verification.yml | 6 +- .github/workflows/release.yml | 11 ++-- .github/workflows/security-release-gate.yml | 11 ++-- Dockerfile.dapper | 12 ++-- README.md | 25 +++------ package/haproxy/Dockerfile | 49 +++++++++++++++-- package/haproxy/alpine-apk.lock | 10 ++-- scripts/record-haproxy-sbom.py | 43 +++++++++++++++ scripts/supply-chain-check | 11 +++- scripts/verify-haproxy-runtime | 61 +++++++++++++++++++++ 10 files changed, 188 insertions(+), 51 deletions(-) create mode 100644 scripts/record-haproxy-sbom.py create mode 100644 scripts/verify-haproxy-runtime diff --git a/.github/workflows/codeql-verification.yml b/.github/workflows/codeql-verification.yml index 01109a6..d866f87 100644 --- a/.github/workflows/codeql-verification.yml +++ b/.github/workflows/codeql-verification.yml @@ -48,12 +48,12 @@ jobs: shell: bash run: | set -euo pipefail - archive="$RUNNER_TEMP/go1.27.3.linux-amd64.tar.gz" + archive="$RUNNER_TEMP/go1.27.4.linux-amd64.tar.gz" curl --fail --silent --show-error --location \ --output "$archive" \ - 'https://go.dev/dl/go1.27.3.linux-amd64.tar.gz' + 'https://go.dev/dl/go1.27.4.linux-amd64.tar.gz' printf '%s %s\n' \ - '65efbc80fdc1fa2cd2631cad5b481777a68e8725f34e89f50fc6ac714e379b40' \ + '7226736c2339719cda28fbf3a54d71aa63bcefe376e98cef00034268dab24840' \ "$archive" | sha256sum --check tar -C "$RUNNER_TEMP" -xzf "$archive" "$RUNNER_TEMP/go/bin/go" version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1edb400..1f69f68 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,11 +45,11 @@ jobs: shell: bash run: | set -euo pipefail - archive="$RUNNER_TEMP/go1.27.3.linux-amd64.tar.gz" + archive="$RUNNER_TEMP/go1.27.4.linux-amd64.tar.gz" curl --fail --silent --show-error --location --output "$archive" \ - 'https://go.dev/dl/go1.27.3.linux-amd64.tar.gz' + 'https://go.dev/dl/go1.27.4.linux-amd64.tar.gz' printf '%s %s\n' \ - '65efbc80fdc1fa2cd2631cad5b481777a68e8725f34e89f50fc6ac714e379b40' \ + '7226736c2339719cda28fbf3a54d71aa63bcefe376e98cef00034268dab24840' \ "$archive" | sha256sum --check tar -C "$RUNNER_TEMP" -xzf "$archive" printf '%s\n' "$RUNNER_TEMP/go/bin" >> "$GITHUB_PATH" @@ -72,8 +72,7 @@ jobs: grep -Fxq "$SERVICE_IMAGE" dist/images controller_version="$(docker run --rm --entrypoint /usr/bin/lb-controller "$SERVICE_IMAGE" --version)" grep -F "$GITHUB_REF_NAME" <<< "$controller_version" >/dev/null - haproxy_version="$(docker run --rm --entrypoint /usr/sbin/haproxy "$SERVICE_IMAGE" -vv)" - grep -F 'HAProxy version 3.4.3' <<< "$haproxy_version" >/dev/null + bash scripts/verify-haproxy-runtime "$SERVICE_IMAGE" - name: Scan and create release SBOMs shell: bash @@ -108,6 +107,8 @@ jobs: -v "$PWD/$release_dir:/release" -v "$cache:/root/.cache/trivy" "$TRIVY_IMAGE" image \ --skip-db-update --offline-scan --format cyclonedx \ --output "/release/load-balancer-controller-${VERSION}-service.cdx.json" "$SERVICE_IMAGE" + python3 scripts/record-haproxy-sbom.py "$SERVICE_IMAGE" \ + "$release_dir/load-balancer-controller-${VERSION}-service.cdx.json" python3 - "$release_dir" "$VERSION" <<'PY' import json, pathlib, sys diff --git a/.github/workflows/security-release-gate.yml b/.github/workflows/security-release-gate.yml index dd3f6c6..905bfde 100644 --- a/.github/workflows/security-release-gate.yml +++ b/.github/workflows/security-release-gate.yml @@ -33,11 +33,11 @@ jobs: shell: bash run: | set -euo pipefail - archive="$RUNNER_TEMP/go1.27.3.linux-amd64.tar.gz" + archive="$RUNNER_TEMP/go1.27.4.linux-amd64.tar.gz" curl --fail --silent --show-error --location --output "$archive" \ - 'https://go.dev/dl/go1.27.3.linux-amd64.tar.gz' + 'https://go.dev/dl/go1.27.4.linux-amd64.tar.gz' printf '%s %s\n' \ - '65efbc80fdc1fa2cd2631cad5b481777a68e8725f34e89f50fc6ac714e379b40' \ + '7226736c2339719cda28fbf3a54d71aa63bcefe376e98cef00034268dab24840' \ "$archive" | sha256sum --check tar -C "$RUNNER_TEMP" -xzf "$archive" export PATH="$RUNNER_TEMP/go/bin:$PATH" @@ -95,9 +95,7 @@ jobs: grep -Fxq "$SERVICE_IMAGE" dist/images docker run --rm --entrypoint /usr/bin/lb-controller "$SERVICE_IMAGE" --version \ | grep -Fq "security-${GITHUB_SHA}" - docker run --rm --entrypoint /usr/sbin/haproxy "$SERVICE_IMAGE" -vv \ - | tee evidence/haproxy-version.txt - grep -Fq 'HAProxy version 3.4.3' evidence/haproxy-version.txt + bash scripts/verify-haproxy-runtime "$SERVICE_IMAGE" | tee evidence/haproxy-version.txt test "$(docker image inspect --format '{{.Config.User}}' "$SERVICE_IMAGE")" = '10001:10001' - name: Scan binary and runtime image @@ -119,6 +117,7 @@ jobs: -v "$PWD/evidence:/evidence" -v "$cache:/root/.cache/trivy" "$TRIVY_IMAGE" image \ --skip-db-update --offline-scan --format cyclonedx \ --output /evidence/image.cdx.json "$SERVICE_IMAGE" + python3 scripts/record-haproxy-sbom.py "$SERVICE_IMAGE" evidence/image.cdx.json python3 - <<'PY' import json from pathlib import Path diff --git a/Dockerfile.dapper b/Dockerfile.dapper index 1dfa24b..8002cc9 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -3,13 +3,13 @@ FROM docker:29.7.2-cli@sha256:000bb62ff495f986c9f5578eb67cc2cb98b91138eda81d7762 FROM ubuntu:26.04@sha256:2260313b31c8c011cd2eebe728008efac1b3982be73eb71348ea2648d2c0e09b COPY ubuntu-apt.lock /licenses/ubuntu-apt.lock -ADD --checksum=sha256:5b6326f1932cfd7be57130561dc78192f09ed9f58bfbe6606ed0c50510c3b6cd https://archive.ubuntu.com/ubuntu/pool/main/c/ca-certificates/ca-certificates_20260816ubuntu0.26.04.1_all.deb /tmp/ca-certificates.deb +ADD --checksum=sha256:a7e3bf769aec16ba21ca39cba180d6d311dafcbae68346a05f137c5cc26c9ca6 https://security.ubuntu.com/ubuntu/pool/main/c/ca-certificates/ca-certificates_20260816ubuntu0.26.04.2_all.deb /tmp/ca-certificates.deb ARG DAPPER_HOST_ARCH=amd64 ARG DOCKER_BUILDX_VERSION=0.36.1 -ARG GO_VERSION=1.27.3 -ARG GO_LINUX_AMD64_SHA256=65efbc80fdc1fa2cd2631cad5b481777a68e8725f34e89f50fc6ac714e379b40 -ARG GO_LINUX_ARM64_SHA256=a06e99309dbcbdca1a8ccd2282c3ee146e55930886e26b4f1193269587165f49 +ARG GO_VERSION=1.27.4 +ARG GO_LINUX_AMD64_SHA256=7226736c2339719cda28fbf3a54d71aa63bcefe376e98cef00034268dab24840 +ARG GO_LINUX_ARM64_SHA256=3392582988a273a87ab5043ee1b2c9c17a2c3c00580bf9326c47a2e0aaaeac92 ENV DEBIAN_FRONTEND=noninteractive ENV HOST_ARCH=${DAPPER_HOST_ARCH} \ @@ -25,7 +25,7 @@ ADD --checksum=sha256:9d806b46f6dc429f156c5c53e6e2ec5bfc89302f9a441483b3249211e1 ADD --checksum=sha256:0a7ea8a52834f9b3de0f11758924f80f7a6ebcbb4b02a55ba4f457503569f55f https://security.ubuntu.com/ubuntu/pool/main/p/python3.14/python3.14-minimal_3.14.4-1ubuntu0.2_amd64.deb /opt/python-abi-security/python3.14-minimal.deb ADD --checksum=sha256:cad2456bf3cb57cb18d2c82b48b549e5b4ac6eee9b3e14e65334209387e3d0ae https://security.ubuntu.com/ubuntu/pool/universe/p/python3.14/python3.14-venv_3.14.4-1ubuntu0.2_amd64.deb /opt/python-abi-security/python3.14-venv.deb COPY scripts/install-python-abi-security /usr/local/bin/install-python-abi-security -ADD --checksum=sha256:5b6326f1932cfd7be57130561dc78192f09ed9f58bfbe6606ed0c50510c3b6cd https://archive.ubuntu.com/ubuntu/pool/main/c/ca-certificates/ca-certificates_20260816ubuntu0.26.04.1_all.deb /opt/pasturestack-ca-certificates.deb +ADD --checksum=sha256:a7e3bf769aec16ba21ca39cba180d6d311dafcbae68346a05f137c5cc26c9ca6 https://security.ubuntu.com/ubuntu/pool/main/c/ca-certificates/ca-certificates_20260816ubuntu0.26.04.2_all.deb /opt/pasturestack-ca-certificates.deb RUN set -eux; \ . /licenses/ubuntu-apt.lock; \ rm -f /etc/apt/sources.list /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources; \ @@ -57,7 +57,7 @@ RUN set -eux; \ bash /usr/local/bin/install-python-abi-security && \ dpkg -i /opt/pasturestack-ca-certificates.deb && \ update-ca-certificates --fresh && \ - test "$(dpkg-query -W -f='${Version}' ca-certificates)" = '20260816ubuntu0.26.04.1' && \ + test "$(dpkg-query -W -f='${Version}' ca-certificates)" = '20260816ubuntu0.26.04.2' && \ test ! -e /usr/share/ca-certificates/mozilla/emSign_ECC_Root_CA_-_G3.crt && \ rm -f /opt/pasturestack-ca-certificates.deb && \ { \ diff --git a/README.md b/README.md index 3b4524a..5a9844d 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,10 @@ This branch contains the compatibility runtime used by PastureStack Server to op ## Runtime image -The maintained runtime release for PastureStack HAProxy load-balancer services is `v0.9.33`: +The maintained runtime release for PastureStack HAProxy load-balancer services is `v0.9.34`. It uses HAProxy 3.4.7 with AWS-LC 5.14.0 and Lua 5.4. ```text -ghcr.io/pasturestack/load-balancer-service:v0.9.33 -``` - -Pin deployments to its published manifest digest: - -```text -ghcr.io/pasturestack/load-balancer-service@sha256:2c02ac4da2cab5308f68baca04a007b82cd192bccbd7bc38232bd210dc2c02ac +ghcr.io/pasturestack/load-balancer-service:v0.9.34 ``` The image is intended to be managed by PastureStack Server, not started by itself: @@ -23,15 +17,10 @@ the control plane supplies metadata, API credentials, service links, port rules, and health-check configuration. Selecting this release does not itself upgrade an existing Server installation or its load-balancer services. -[Release v0.9.33](https://github.com/PastureStack/load-balancer-controller/releases/tag/v0.9.33) -includes the controller archive, source and image SBOMs, checksums, and build -provenance. Protected CI, race tests, source contracts, image/version checks, -source/image vulnerability scans, and attestations passed for the published -artifact. The runtime uses Go 1.27.3 and zlib 1.3.2-r1. - -Native PastureStack lifecycle and traffic acceptance, including dependent-service -state transitions, remains pending; the build and supply-chain checks are not a -claim that this platform-level acceptance has passed. +The [release page](https://github.com/PastureStack/load-balancer-controller/releases/tag/v0.9.34) +provides the manifest digest, controller archive, SBOMs, checksums, and build +provenance. HAProxy links AWS-LC statically. Runtime tools such as curl +use Alpine's OpenSSL packages. ## Compatibility @@ -118,4 +107,4 @@ The root [`LICENSE`](LICENSE) remains authoritative. PastureStack does not claim ## October 2026 security maintenance -Maintained Go builds select the patched Go 1.27.3 compiler without raising the existing Go language requirement. Ubuntu build/runtime stages apply the checksum-pinned `ca-certificates 20260816ubuntu0.26.04.1` security package after their frozen APT baseline; the final trust store and installed version are verified. Release artifacts must pass the repository's existing checks before publication. +Maintained Go builds select the patched Go 1.27.4 compiler without raising the existing Go language requirement. Ubuntu build/runtime stages apply the checksum-pinned `ca-certificates 20260816ubuntu0.26.04.2` security package after their frozen APT baseline; the final trust store and installed version are verified. Release artifacts must pass the repository's existing checks before publication. diff --git a/package/haproxy/Dockerfile b/package/haproxy/Dockerfile index df0d059..3c9c712 100644 --- a/package/haproxy/Dockerfile +++ b/package/haproxy/Dockerfile @@ -1,12 +1,18 @@ ARG ALPINE_IMAGE=docker.io/library/alpine:3.24@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b +ARG HAPROXY_VERSION=3.4.7 +ARG HAPROXY_SHA256=ccfd342f3724c2cd659574044d788f44e20b212467c6bd5edbbfc517a2775dca +ARG AWS_LC_VERSION=5.14.0 +ARG AWS_LC_SHA256=8895a9d2434e875e009e652a1015f9c2c275261634c7132253ca5aa60d266888 FROM ${ALPINE_IMAGE} AS haproxy-builder COPY alpine-apk.lock /licenses/alpine-apk.lock -ARG HAPROXY_VERSION=3.4.3 +ARG HAPROXY_VERSION +ARG HAPROXY_SHA256 ARG HAPROXY_SERIES=3.4 -ARG HAPROXY_SHA256=7fa666d36d198275999e2a68dda44d3d37960f2f7aed3a595fb811f4fd0515b5 +ARG AWS_LC_VERSION +ARG AWS_LC_SHA256 RUN set -eux; \ . /licenses/alpine-apk.lock; \ @@ -14,13 +20,33 @@ RUN set -eux; \ "musl=${ALPINE_MUSL_VERSION}" \ "musl-utils=${ALPINE_MUSL_VERSION}" \ "build-base=${ALPINE_BUILD_BASE_VERSION}" \ + "cmake=${ALPINE_CMAKE_VERSION}" \ "ca-certificates=${ALPINE_CA_CERTIFICATES_VERSION}" \ "curl=${ALPINE_CURL_VERSION}" \ "linux-headers=${ALPINE_LINUX_HEADERS_VERSION}" \ "lua5.4-dev=${ALPINE_LUA5_4_DEV_VERSION}" \ - "openssl-dev=${ALPINE_OPENSSL_DEV_VERSION}" \ "pcre2-dev=${ALPINE_PCRE2_DEV_VERSION}" \ - "zlib-dev=${ALPINE_ZLIB_DEV_VERSION}"; \ + "zlib-dev=${ALPINE_ZLIB_DEV_VERSION}" + +# Use the upstream generated assembly from the verified release archive. +# A private static link leaves the distribution TLS libraries available to curl. +RUN set -eux; \ + curl -fsSL --retry 5 --retry-all-errors --retry-delay 2 --connect-timeout 10 --max-time 300 \ + -o /tmp/aws-lc.tar.gz "https://codeload.github.com/aws/aws-lc/tar.gz/refs/tags/v${AWS_LC_VERSION}"; \ + echo "${AWS_LC_SHA256} /tmp/aws-lc.tar.gz" | sha256sum -c -; \ + mkdir /tmp/aws-lc; \ + tar xzf /tmp/aws-lc.tar.gz -C /tmp/aws-lc --strip-components=1; \ + cmake -S /tmp/aws-lc -B /tmp/aws-lc-build \ + -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/aws-lc -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DBUILD_TOOL=OFF -DDISABLE_GO=ON -DDISABLE_PERL=ON; \ + cmake --build /tmp/aws-lc-build --parallel "$(nproc)"; \ + cmake --install /tmp/aws-lc-build; \ + test -s /opt/aws-lc/lib/libssl.a; \ + test -s /opt/aws-lc/lib/libcrypto.a; \ + install -D -m 0644 /tmp/aws-lc/LICENSE /native-licenses/aws-lc/LICENSE; \ + rm -rf /tmp/aws-lc /tmp/aws-lc-build /tmp/aws-lc.tar.gz + +RUN set -eux; \ curl -fsSL --retry 5 --retry-all-errors --retry-delay 2 --connect-timeout 10 --max-time 300 \ -o /tmp/haproxy.tar.gz "https://www.haproxy.org/download/${HAPROXY_SERIES}/src/haproxy-${HAPROXY_VERSION}.tar.gz"; \ echo "${HAPROXY_SHA256} /tmp/haproxy.tar.gz" | sha256sum -c -; \ @@ -28,6 +54,9 @@ RUN set -eux; \ make -C "/tmp/haproxy-${HAPROXY_VERSION}" -j"$(nproc)" \ TARGET=linux-musl \ USE_OPENSSL=1 \ + USE_OPENSSL_AWSLC=1 \ + SSL_INC=/opt/aws-lc/include \ + SSL_LIB=/opt/aws-lc/lib \ USE_PCRE2=1 \ USE_PCRE2_JIT=1 \ USE_ZLIB=1 \ @@ -36,6 +65,7 @@ RUN set -eux; \ LUA_INC=/usr/include/lua5.4 \ LUA_LIB=/usr/lib/lua5.4; \ make -C "/tmp/haproxy-${HAPROXY_VERSION}" install-bin; \ + install -D -m 0644 "/tmp/haproxy-${HAPROXY_VERSION}/LICENSE" /native-licenses/haproxy/LICENSE; \ mkdir -p /usr/local/share/haproxy/errors; \ cp -a "/tmp/haproxy-${HAPROXY_VERSION}"/examples/errorfiles/*.http /usr/local/share/haproxy/errors/ @@ -45,12 +75,20 @@ COPY alpine-apk.lock /licenses/alpine-apk.lock ARG PASTURESTACK_IMAGE_VERSION=dev ARG SOURCE_REVISION=unknown +ARG HAPROXY_VERSION +ARG HAPROXY_SHA256 +ARG AWS_LC_VERSION +ARG AWS_LC_SHA256 LABEL org.opencontainers.image.source="https://github.com/PastureStack/load-balancer-controller" \ org.opencontainers.image.description="PastureStack HAProxy load-balancer service compatibility image." \ org.opencontainers.image.licenses="Apache-2.0" \ org.opencontainers.image.version="${PASTURESTACK_IMAGE_VERSION}" \ - org.opencontainers.image.revision="${SOURCE_REVISION}" + org.opencontainers.image.revision="${SOURCE_REVISION}" \ + org.pasturestack.haproxy.version="${HAPROXY_VERSION}" \ + org.pasturestack.haproxy.source-sha256="${HAPROXY_SHA256}" \ + org.pasturestack.aws-lc.version="${AWS_LC_VERSION}" \ + org.pasturestack.aws-lc.source-sha256="${AWS_LC_SHA256}" RUN set -eux; \ . /licenses/alpine-apk.lock; \ @@ -77,6 +115,7 @@ RUN set -eux; \ COPY --from=haproxy-builder /usr/local/sbin/haproxy /usr/sbin/haproxy COPY --from=haproxy-builder /usr/local/share/haproxy/errors /etc/haproxy/errors +COPY --from=haproxy-builder /native-licenses/ /usr/share/licenses/ RUN set -eux; \ addgroup -g 10001 -S haproxy; \ diff --git a/package/haproxy/alpine-apk.lock b/package/haproxy/alpine-apk.lock index 9241fdd..c18d3df 100644 --- a/package/haproxy/alpine-apk.lock +++ b/package/haproxy/alpine-apk.lock @@ -4,19 +4,19 @@ ALPINE_BASH_VERSION='5.3.9-r1' ALPINE_BUILD_BASE_VERSION='0.5-r4' ALPINE_MUSL_VERSION='1.2.6-r3' ALPINE_CA_CERTIFICATES_VERSION='20261020-r0' -ALPINE_CURL_VERSION='8.22.0-r0' +ALPINE_CMAKE_VERSION='4.2.3-r0' +ALPINE_CURL_VERSION='8.23.0-r0' ALPINE_LIBCRYPTO3_VERSION='3.5.9-r0' ALPINE_LIBCAP_UTILS_VERSION='2.78-r0' ALPINE_LIBSSL3_VERSION='3.5.9-r0' ALPINE_LINUX_HEADERS_VERSION='7.0.0-r1' ALPINE_LUA5_4_DEV_VERSION='5.4.8-r0' ALPINE_LUA5_4_LIBS_VERSION='5.4.8-r0' -ALPINE_OPENSSL_DEV_VERSION='3.5.9-r0' ALPINE_PCRE2_DEV_VERSION='10.49-r0' ALPINE_PCRE2_VERSION='10.49-r0' ALPINE_PROCPS_NG_VERSION='4.0.6-r0' -ALPINE_RSYSLOG_VERSION='8.2604.0-r0' +ALPINE_RSYSLOG_VERSION='8.2608.0-r0' ALPINE_SU_EXEC_VERSION='0.3-r0' ALPINE_TINI_VERSION='0.19.0-r3' -ALPINE_ZLIB_VERSION='1.3.2-r1' -ALPINE_ZLIB_DEV_VERSION='1.3.2-r1' +ALPINE_ZLIB_VERSION='1.4-r0' +ALPINE_ZLIB_DEV_VERSION='1.4-r0' diff --git a/scripts/record-haproxy-sbom.py b/scripts/record-haproxy-sbom.py new file mode 100644 index 0000000..8374d6f --- /dev/null +++ b/scripts/record-haproxy-sbom.py @@ -0,0 +1,43 @@ +"""Record the source-built HAProxy and its statically linked AWS-LC.""" +import json +from pathlib import Path +import re +import subprocess +import sys +from tempfile import TemporaryDirectory + +image, filename = sys.argv[1:] +labels = json.loads(subprocess.check_output(['docker', 'image', 'inspect', '-f', '{{json .Config.Labels}}', image])) +path = Path(filename) +bom = json.loads(path.read_text(encoding='utf-8')) +root = bom['metadata']['component']['bom-ref'] +components = bom['components'] +dependencies = bom['dependencies'] +references = [] +for name, kind, purl, source in ( + ('haproxy', 'application', 'pkg:generic/haproxy', 'https://www.haproxy.org/download/3.4/src/haproxy-{version}.tar.gz'), + ('aws-lc', 'library', 'pkg:github/aws/aws-lc', 'https://codeload.github.com/aws/aws-lc/tar.gz/refs/tags/v{version}'), +): + version = labels[f'org.pasturestack.{name}.version'] + digest = labels[f'org.pasturestack.{name}.source-sha256'] + assert re.fullmatch(r'\d+\.\d+\.\d+', version) and re.fullmatch(r'[0-9a-f]{64}', digest) + reference = f'{purl}@{version}' + references.append(reference) + assert all(component.get('bom-ref') != reference for component in components) + components.append({'type': kind, 'name': name, 'version': version, 'purl': reference, + 'bom-ref': reference, 'externalReferences': [{ + 'type': 'distribution', 'url': source.format(version=version), + 'hashes': [{'alg': 'SHA-256', 'content': digest}], + }]}) +haproxy, aws_lc = references +root_dependency = next((entry for entry in dependencies if entry['ref'] == root), None) +if root_dependency is None: + root_dependency = {'ref': root, 'dependsOn': []} + dependencies.append(root_dependency) +root_dependency.setdefault('dependsOn', []).append(haproxy) +dependencies.extend([{'ref': haproxy, 'dependsOn': [aws_lc]}, {'ref': aws_lc, 'dependsOn': []}]) +# Trivy runs in Docker and owns the file. The runner owns its parent directory. +with TemporaryDirectory(dir=path.parent) as workdir: + updated = Path(workdir) / path.name + updated.write_text(json.dumps(bom, indent=2, ensure_ascii=False) + '\n', encoding='utf-8') + updated.replace(path) diff --git a/scripts/supply-chain-check b/scripts/supply-chain-check index 7ba5347..625137c 100755 --- a/scripts/supply-chain-check +++ b/scripts/supply-chain-check @@ -16,16 +16,21 @@ require_text go.mod 'github.com/gorilla/websocket v1.5.3' require_text go.mod 'github.com/sirupsen/logrus v1.10.2' require_text go.mod 'github.com/urfave/cli/v3 v3.11.0' require_text go.mod 'golang.org/x/sys v0.47.0' -require_text Dockerfile.dapper 'ARG GO_VERSION=1.27.3' +require_text Dockerfile.dapper 'ARG GO_VERSION=1.27.4' require_text Dockerfile.dapper 'FROM docker:29.7.2-cli@sha256:000bb62ff495f986c9f5578eb67cc2cb98b91138eda81d7762d5371eb8a497fe AS docker-cli' -require_text package/haproxy/Dockerfile 'ARG HAPROXY_VERSION=3.4.3' +require_text package/haproxy/Dockerfile 'ARG HAPROXY_VERSION=3.4.7' +require_text package/haproxy/Dockerfile 'ARG HAPROXY_SHA256=ccfd342f3724c2cd659574044d788f44e20b212467c6bd5edbbfc517a2775dca' +require_text package/haproxy/Dockerfile 'ARG AWS_LC_VERSION=5.14.0' +require_text package/haproxy/Dockerfile 'ARG AWS_LC_SHA256=8895a9d2434e875e009e652a1015f9c2c275261634c7132253ca5aa60d266888' +require_text package/haproxy/Dockerfile 'USE_OPENSSL_AWSLC=1' +require_text package/haproxy/Dockerfile 'LUA_INC=/usr/include/lua5.4' require_text package/haproxy/Dockerfile 'ARG ALPINE_IMAGE=docker.io/library/alpine:3.24@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b' require_text package/haproxy/Dockerfile '"libcrypto3=${ALPINE_LIBCRYPTO3_VERSION}"' require_text package/haproxy/Dockerfile '"libssl3=${ALPINE_LIBSSL3_VERSION}"' require_text package/haproxy/alpine-apk.lock "ALPINE_LIBCRYPTO3_VERSION='3.5.9-r0'" require_text package/haproxy/alpine-apk.lock "ALPINE_LIBSSL3_VERSION='3.5.9-r0'" require_text package/haproxy/Dockerfile '"zlib=${ALPINE_ZLIB_VERSION}"' -require_text package/haproxy/alpine-apk.lock "ALPINE_ZLIB_VERSION='1.3.2-r1'" +require_text package/haproxy/alpine-apk.lock "ALPINE_ZLIB_VERSION='1.4-r0'" require_text package/haproxy/Dockerfile 'TARGET=linux-musl' require_text package/haproxy/Dockerfile '"tini=${ALPINE_TINI_VERSION}"' require_text .github/workflows/security-release-gate.yml 'TRIVY_IMAGE: ghcr.io/aquasecurity/trivy:0.74.0@sha256:62b1e65e8869bc4b4c6aa4fa2b21595256c7c2f6018a9d9ad61caf87187c1969' diff --git a/scripts/verify-haproxy-runtime b/scripts/verify-haproxy-runtime new file mode 100644 index 0000000..7696931 --- /dev/null +++ b/scripts/verify-haproxy-runtime @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +set -euo pipefail + +image=${1:?usage: verify-haproxy-runtime IMAGE} +version=$(docker image inspect -f '{{index .Config.Labels "org.pasturestack.haproxy.version"}}' "$image") +aws_lc=$(docker image inspect -f '{{index .Config.Labels "org.pasturestack.aws-lc.version"}}' "$image") +test -n "$version" && test -n "$aws_lc" +details=$(docker run --rm --entrypoint /usr/sbin/haproxy "$image" -vv) +printf '%s\n' "$details" +grep -Fq "HAProxy version $version" <<< "$details" +grep -Fq "AWS-LC $aws_lc" <<< "$details" +grep -Fq 'Lua 5.4' <<< "$details" +linkage=$(docker run --rm --entrypoint /bin/sh "$image" -c 'ldd /usr/sbin/haproxy') +if grep -Eq 'lib(crypto|ssl)\.so|not found' <<< "$linkage"; then + echo 'Unexpected dynamic TLS dependency' >&2 + exit 1 +fi + +fixture=$(mktemp -d) +container= +cleanup() { + if [[ -n "$container" ]]; then docker rm -f "$container" >/dev/null; fi + rm -rf "$fixture" +} +trap cleanup EXIT +openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -days 1 \ + -subj /CN=localhost -addext 'subjectAltName=DNS:localhost' \ + -keyout "$fixture/key.pem" -out "$fixture/cert.pem" +cat "$fixture/cert.pem" "$fixture/key.pem" > "$fixture/endpoint.pem" +chmod 0755 "$fixture" +chmod 0444 "$fixture/endpoint.pem" +printf "%s\n" "assert(_VERSION == 'Lua 5.4')" > "$fixture/check.lua" +cat > "$fixture/haproxy.cfg" <<'CONFIG' +global + tune.lua.bool-sample-conversion normal + lua-load /probe/check.lua +defaults + mode http + timeout connect 2s + timeout client 5s + timeout server 5s +frontend tls_probe + bind :8443 ssl crt /probe/endpoint.pem ssl-min-ver TLSv1.3 + http-request return status 200 content-type text/plain string pasturestack-lb-tls-ok +CONFIG +chmod 0444 "$fixture/haproxy.cfg" "$fixture/check.lua" +docker run --rm -v "$fixture:/probe:ro" --entrypoint /usr/sbin/haproxy "$image" \ + -c -f /probe/haproxy.cfg +container=$(docker run -d -p 127.0.0.1::8443 -v "$fixture:/probe:ro" \ + --entrypoint /usr/sbin/haproxy "$image" -db -f /probe/haproxy.cfg) +endpoint=$(docker port "$container" 8443/tcp) +port=${endpoint##*:} +if ! response=$(curl --fail --silent --show-error --max-time 5 \ + --retry 6 --retry-all-errors --retry-delay 1 --retry-max-time 20 \ + --noproxy '*' --resolve "localhost:$port:127.0.0.1" \ + --tlsv1.3 --tls-max 1.3 --cacert "$fixture/cert.pem" "https://localhost:$port/") || + [[ "$response" != pasturestack-lb-tls-ok ]]; then + docker logs "$container" >&2 + exit 1 +fi +printf '%s\n' 'HAPROXY_AWS_LC_LUA_AND_TLS_OK'