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 <noreply@anthropic.com>
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -39,16 +39,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
&& apt-get install -y nodejs \
|
&& apt-get install -y nodejs \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install yq (v4.x)
|
# Install yq (v4.x) with checksum verification
|
||||||
RUN YQ_VERSION="v4.40.5" && \
|
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 && \
|
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
|
chmod +x /usr/bin/yq
|
||||||
|
|
||||||
# Install OpenShift CLI (oc)
|
# Install OpenShift CLI (oc) with checksum verification
|
||||||
RUN OC_VERSION="stable" && \
|
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 && \
|
OC_BASE_URL="https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${OC_VERSION}" && \
|
||||||
tar -xvf /tmp/oc.tar.gz -C /usr/bin/ oc && \
|
wget ${OC_BASE_URL}/openshift-client-linux.tar.gz -O /tmp/openshift-client-linux.tar.gz && \
|
||||||
rm /tmp/oc.tar.gz && chmod +x /usr/bin/oc
|
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
|
# Install Python tools for LLM work
|
||||||
RUN pip3 install --no-cache-dir --break-system-packages \
|
RUN pip3 install --no-cache-dir --break-system-packages \
|
||||||
@@ -125,5 +130,5 @@ for keytype in rsa ecdsa ed25519; do \
|
|||||||
fi; \
|
fi; \
|
||||||
done && \
|
done && \
|
||||||
chmod 600 /data/ssh/ssh_host_*_key && \
|
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"]
|
/usr/sbin/sshd -D -e -f /etc/ssh/sshd_config"]
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -19,6 +19,18 @@ This container provides a stable, tool-rich environment for the AI agent to:
|
|||||||
- **Kubernetes:** OpenShift CLI (oc)
|
- **Kubernetes:** OpenShift CLI (oc)
|
||||||
- **Search:** ripgrep (fast grep alternative)
|
- **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)
|
## Deployment (OpenShift / K8s)
|
||||||
|
|
||||||
1. **Build Image:**
|
1. **Build Image:**
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ spec:
|
|||||||
runAsNonRoot: true
|
runAsNonRoot: true
|
||||||
initContainers:
|
initContainers:
|
||||||
- name: setup-ssh
|
- name: setup-ssh
|
||||||
image: busybox:latest
|
image: busybox:1.36
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
|
|||||||
Reference in New Issue
Block a user