container-security-hardening – skill Bảo mật cho agent AI
Tăng cường bảo mật cho image Docker/container và các triển khai runtime với base image an toàn, người dùng non-root, quét CVE, SBOM/ký số, seccomp/AppArmor và kiểm soát bảo mật pod Kubernetes. Dùng cho rà soát bảo mật Dockerfile, CVE container, quét image, image distroless hoặc tăng cường bảo mật môi trường production.
Cài skill container-security-hardening bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/container-security-hardening-009ae.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /container-security-hardening – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/container-security-hardening-009ae.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $container-security-hardening – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/container-security-hardening-009ae.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /container-security-hardening – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/container-security-hardening-009ae.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /container-security-hardening – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Container Security Hardening Skill
A production-focused guide for building, scanning, and running containers securely — from Dockerfile authoring through runtime enforcement and supply chain integrity.
---
Detailed Guide
Read [the detailed guide](references/detailed-guide.md) before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.
When to Use This Skill
- User mentions Docker security, container hardening, or Dockerfile security review
- User asks about distroless images, non-root containers, or read-only filesystems
- User wants to scan images for CVEs with Trivy, Grype, or Snyk
- User mentions seccomp, AppArmor, Linux capabilities, or runtime security
- User asks "is my Dockerfile secure?" or "how do I reduce my image attack surface?"
- User wants to sign/verify images with Cosign or generate SBOMs
- User asks about Kubernetes pod security, NetworkPolicy, or RBAC hardening
- User says "fix container CVEs" or "harden my container for production"
When NOT to Use This Skill
- The user is primarily asking about GitHub Actions CI/CD → recommend
github-actions-advanced - The user needs general Docker usage help (not security) → recommend
docker-expert - The user is working with Kubernetes orchestration beyond security → recommend
kubernetes-architect - The user needs application-level security (SQL injection, XSS) → recommend
api-security-best-practices
---
Security Checklist
Dockerfile
- [ ] Supported minimal base image compatible with the application
- [ ] Multi-stage build — no build tools, devDependencies, or compilers in runtime image
- [ ] Non-root
USERdeclared beforeCMD/ENTRYPOINT - [ ] Base image pinned to
@sha256:...digest (not just tag) - [ ] No secrets in
ENV,ARG, orRUNcommands - [ ]
HEALTHCHECKdefined - [ ] OCI labels present (
org.opencontainers.image.*) - [ ]
.dockerignoreexcludes.git,.env, secrets, tests - [ ]
ENTRYPOINTuses exec form, not shell form
Image Scanning
- [ ] Trivy or Grype scan in CI (fails on HIGH/CRITICAL)
- [ ] Hadolint passes with no warnings
- [ ] Secret scan run on image (
trivy --scanners secret) - [ ] SBOM generated and stored
- [ ]
.trivyignorehas justified entries for accepted CVEs
Runtime
- [ ]
--read-onlyfilesystem - [ ]
--cap-drop ALL(add back only what's documented as required) - [ ]
--security-opt no-new-privileges:true - [ ] Runtime default seccomp applied; custom profile only after isolated validation
- [ ] Resource limits set (
--memory,--cpus,--pids-limit) - [ ] Image signed with Cosign; verified before deploy
Kubernetes
- [ ]
readOnlyRootFilesystem: true - [ ]
allowPrivilegeEscalation: false - [ ]
runAsNonRoot: truewith explicit UID - [ ]
capabilities.drop: ["ALL"] - [ ] Resource
requestsandlimitsdefined - [ ]
automountServiceAccountToken: false - [ ] Namespace PSA enforced at
restrictedlevel - [ ]
NetworkPolicydefault-deny applied - [ ] RBAC uses specific resource names and minimal verbs
---
Limitations
- Cluster-wide admission policies, registry settings and runtime restrictions can disrupt workloads. Review the intended scope, test in staging and provide rollback before applying. Bundled profiles and manifests are examples, not a security certification.
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific penetration testing or a formal security audit.
- Seccomp and AppArmor act on the Linux host/kernel; Docker Desktop may apply them inside its Linux VM depending on runtime support.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Skill liên quan
- s3-minio-content-type-xss – Khai thác việc ghi đè Content-Type của bucket công khai để thực hiện stored XSS trên…
- qutip – Mô phỏng và kiểm định các mô hình hệ lượng tử đóng và mở với QuTiP 5, gồm các quy trình…
- sast-configuration – Cấu hình công cụ SAST (Static Application Security Testing) để phát hiện lỗ hổng bảo mật…
- scada-hikvision-isapi – Liệt kê các endpoint ISAPI của Hikvision trên giao diện web SCADA và IoT.
- sector-recon-methodology – Chọn ngành, tổng hợp mục tiêu, recon hàng loạt cho chiến dịch.
- security-arsenal – Payload bảo mật, bảng bypass, wordlist, tên pattern gf, danh sách bug luôn bị từ chối và…
- source-leak-hunt – Quét hàng loạt để tìm file env, bản sao lưu và cấu hình git bị lộ.
- cross-chain-relayer-audit – Sổ kiểm toán relayer cầu nối đa chuỗi: xác minh hash thông điệp, nonce chống replay…