Exercise: find the tampered binary
Host: controlplane · Time: 5 min · Domain: Cluster Setup
Task
- Verify
/usr/local/bin/kubectl,/usr/local/bin/kubeletand/usr/local/bin/kubeadmagainst the official v1.35.0 checksums. - Write the names of the failing binaries, one per line, to
/root/tampered.txt. Writenoneif all pass.
Acceptance criteria
- The file exists and names exactly the bad binary (or
none). - You used a checksum comparison, not a size or date comparison.
Solution
cd /tmp && : > /root/tampered.txt
for f in kubectl kubelet kubeadm; do
curl -sLO https://dl.k8s.io/v1.35.0/bin/linux/amd64/$f.sha256
if echo "$(cat $f.sha256) /usr/local/bin/$f" | sha256sum --check >/dev/null 2>&1; then
echo "$f OK"
else
echo "$f FAILED" && echo "$f" >> /root/tampered.txt
fi
done
[ -s /root/tampered.txt ] || echo none > /root/tampered.txt
cat /root/tampered.txt