From c9096682460125c11a7d464dedba2c3e48d61b63 Mon Sep 17 00:00:00 2001 From: Conan Scott Date: Sun, 8 Mar 2026 00:18:39 +1100 Subject: [PATCH] Security and reliability improvements - Add SHA256 checksum verification for yq and oc downloads to prevent supply chain attacks - Pin busybox init container to version 1.36 for consistency - Fix gitconfig symlink to work unconditionally (survives file creation after boot) - Document kubeconfig secret prerequisite with correct breakglass config path Security: Protects against compromised mirrors and MITM attacks during image build Reliability: Ensures reproducible builds and proper git config persistence Co-Authored-By: Claude Sonnet 4.5 --- Dockerfile | 17 +++++++++++------ README.md | 12 ++++++++++++ manifests/deployment.yaml | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 98fe468..d4a2006 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,16 +39,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && apt-get install -y nodejs \ && rm -rf /var/lib/apt/lists/* -# Install yq (v4.x) +# Install yq (v4.x) with checksum verification RUN YQ_VERSION="v4.40.5" && \ + YQ_SHA256="47d0032f1f769c2e91b52bfde058d4956e5a959988a8460ed0a55d6ce703795c" && \ wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -O /usr/bin/yq && \ + echo "${YQ_SHA256} /usr/bin/yq" | sha256sum -c - && \ chmod +x /usr/bin/yq -# Install OpenShift CLI (oc) +# Install OpenShift CLI (oc) with checksum verification RUN OC_VERSION="stable" && \ - wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${OC_VERSION}/openshift-client-linux.tar.gz -O /tmp/oc.tar.gz && \ - tar -xvf /tmp/oc.tar.gz -C /usr/bin/ oc && \ - rm /tmp/oc.tar.gz && chmod +x /usr/bin/oc + OC_BASE_URL="https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${OC_VERSION}" && \ + wget ${OC_BASE_URL}/openshift-client-linux.tar.gz -O /tmp/openshift-client-linux.tar.gz && \ + wget ${OC_BASE_URL}/sha256sum.txt -O /tmp/sha256sum.txt && \ + cd /tmp && grep "openshift-client-linux.tar.gz$" sha256sum.txt | sha256sum -c - && \ + tar -xvf openshift-client-linux.tar.gz -C /usr/bin/ oc && \ + rm openshift-client-linux.tar.gz sha256sum.txt && chmod +x /usr/bin/oc # Install Python tools for LLM work RUN pip3 install --no-cache-dir --break-system-packages \ @@ -125,5 +130,5 @@ for keytype in rsa ecdsa ed25519; do \ fi; \ done && \ chmod 600 /data/ssh/ssh_host_*_key && \ -if [ -f /data/.gitconfig ]; then ln -sf /data/.gitconfig ~/.gitconfig; fi && \ +ln -sf /data/.gitconfig ~/.gitconfig && \ /usr/sbin/sshd -D -e -f /etc/ssh/sshd_config"] diff --git a/README.md b/README.md index 9209b63..1cceb14 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,18 @@ This container provides a stable, tool-rich environment for the AI agent to: - **Kubernetes:** OpenShift CLI (oc) - **Search:** ripgrep (fast grep alternative) +## Prerequisites + +Before deploying, create the kubeconfig secret to give the container kubectl/oc access: + +```bash +kubectl create secret generic kube \ + --from-file=config=$HOME/.kube/breakglass-system-admin.kubeconfig \ + -n clawdbox +``` + +**Note:** This kubeconfig is mounted at `/home/claw/.kube/config` inside the container. + ## Deployment (OpenShift / K8s) 1. **Build Image:** diff --git a/manifests/deployment.yaml b/manifests/deployment.yaml index dbd9510..9d0b664 100644 --- a/manifests/deployment.yaml +++ b/manifests/deployment.yaml @@ -23,7 +23,7 @@ spec: runAsNonRoot: true initContainers: - name: setup-ssh - image: busybox:latest + image: busybox:1.36 command: - sh - -c