شعار Container Hardening

Container Hardening

مؤسسة
RedHatProductSecurity
container-hardening

Harden container images and runtime configuration. Use when building, reviewing, or auditing Containerfiles, Dockerfiles, container compose files, or Kubernetes pod security settings.

نظرة عامة

الناشرRedHatProductSecurity
المستودعprodsec-skills
اسم المهارةcontainer-hardening
النجوم
56
التفريعات
9
الملفات المرفقة
تعليمات فقط
الترخيصApache-2.0
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • مكتفية بذاتها

    كل ما يحتاجه النموذج موجود في التعليمات — لا ملفات إضافية لمزامنتها.

  • مفتوحة المصدر

    نشرها RedHatProductSecurity على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Container Hardening في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/container-hardening
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RedHatProductSecurity/prodsec-skills.git /tmp/prodsec-skills
mkdir -p .claude/skills
cp -r /tmp/prodsec-skills/ge-core/container-hardening .claude/skills/container-hardening
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Container Hardening في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Container Hardening تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Container Hardening بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Container Hardening

Secure container images and runtime configuration to reduce attack surface, prevent privilege escalation, and ensure compliance with Kubernetes security best practices.

Base Image Selection

  • Use a Universal Base Image (UBI) from the official Red Hat Container Registry
  • Prefer ubi-minimal (ubi8/ubi-minimal or ubi9/ubi-minimal) to reduce attack surface
  • Use the most up-to-date image available

Required for: all profiles (mandatory)

Image Tagging Strategy

SourceStrategy
Red Hat CatalogOmit floating tags to get the latest image; exception: Konflux project uses digest-based pinning with automated updates
Non-Red Hat registriesPin the version or digest to ensure you use the intended image and not a tampered one

Minimize Installed Software

Remove non-essential packages and clean up package manager caches:

dockerfile
RUN microdnf upgrade -y && \
    microdnf install -y <required-packages> && \
    microdnf remove -y <unnecessary-packages> && \
    microdnf clean all

Use microdnf on ubi-minimal images; dnf on full UBI images.

Runtime Security

Non-Root Execution

Containers must not run as root. Set runAsNonRoot: true and provide a numeric non-root USER in the Containerfile.

Required for: all profiles (mandatory)

dockerfile
USER 1000
yaml
securityContext:
  runAsNonRoot: true
  runAsUser: 1000

Either the pod-level or container-level securityContext can set these fields. Do not use UID 0 (root) or UID 1337 (reserved for Istio sidecar proxies).

Required for: Extended (mandatory), all others (optional) — UID 1337 restriction

Privilege Restrictions

Set allowPrivilegeEscalation: false to prevent privilege escalation during container execution:

Required for: all profiles (mandatory)

yaml
securityContext:
  allowPrivilegeEscalation: false

Or in a compose file:

yaml
security_opt:
  - no-new-privileges: true

Read-Only Filesystem

Use read-only root filesystems wherever possible:

Required for: all profiles (optional, recommended best practice)

yaml
securityContext:
  readOnlyRootFilesystem: true

Mount writable tmpfs volumes only where the application requires write access (e.g., /tmp, /var/run).

Read-Only Volumes

Mount volumes as read-only unless the container must write to them:

yaml
volumeMounts:
  - name: config
    mountPath: /etc/app
    readOnly: true

Service Account Token

Disable automatic mounting of the Kubernetes API service account token unless the pod needs API access:

Required for: Telco (mandatory), Far-Edge (mandatory), Extended (mandatory), Non-Telco (optional)

yaml
spec:
  automountServiceAccountToken: false

Pods that require API access (e.g., operators, controllers) should use a dedicated service account with minimal RBAC permissions and explicitly set automountServiceAccountToken: true.

One Process Per Container

Each container should run a single process. This simplifies monitoring, log collection, debugging, and security assessment. Use sidecar containers for auxiliary tasks (log shipping, proxy, etc.) rather than running multiple daemons in one container.

Required for: all profiles (optional, recommended best practice)

No SSH Daemons

Containers must not run SSH daemons. SSH in containers creates additional attack surfaces and violates immutable infrastructure principles. Use kubectl exec or oc debug for troubleshooting instead.

Required for: Telco (mandatory), Far-Edge (mandatory), Extended (mandatory), Non-Telco (optional)

Security Context Categories

The certsuite defines 4 approved security context categories based on required Linux capabilities. Target Category 1 (most restrictive) unless the workload requires advanced networking or DPDK.

Required for: Extended (mandatory), all others (optional)

CategoryDescriptionAdded Capabilities
Category 1Limited access (default)None
Category 1 (no UID 0)Basic rights with mesh networksNone (runAsNonRoot: true)
Category 2Advanced networking (VLAN tag, DSCP, priority)NET_ADMIN, NET_RAW
Category 3SR-IOV and DPDKNET_ADMIN, NET_RAW, IPC_LOCK

All categories require:

  • Drop capabilities: ALL (or at minimum MKNOD, SETUID, SETGID, KILL)
  • No host access: hostIPC: false, hostNetwork: false, hostPID: false, no hostPort
  • No privileged containers: privileged: false
  • User identity: runAsUser and fsGroup set, SELinux context present
  • Allowed volume types only: ConfigMap, DownwardAPI, EmptyDir, PersistentVolumeClaim, Projected, Secret

Example: Category 1 Security Context (Preferred)

yaml
spec:
  securityContext:
    runAsNonRoot: true
    runAsUser: 1000
    fsGroup: 1000
    seLinuxOptions:
      type: container_t
  containers:
    - name: app
      image: registry.example.com/app:v1.2.3
      securityContext:
        allowPrivilegeEscalation: false
        readOnlyRootFilesystem: true
        capabilities:
          drop: ["ALL"]

Base Image Integrity

Container base images must not be modified after startup. All required binaries and dependencies must be built into the image at build time.

Required for: all profiles (mandatory)

Protected directories that must remain unchanged at runtime: /bin, /sbin, /lib, /lib64, /usr/bin, /usr/sbin, /usr/lib, /usr/lib64, /var/lib/rpm, /var/lib/dpkg

OpenShift Note: SELinux must be in Enforcing mode on all cluster nodes (mandatory across all profiles). Base images must be Red Hat UBI (mandatory across all profiles).

Containerfile Linting

Use Hadolint to lint Containerfiles for best-practice violations and inline bash issues:

bash
hadolint Containerfile

Hadolint catches common issues (running as root, missing version pins, unnecessary sudo) but should not be trusted without additional verification.

Implementation Checklist

  • Base image is a Red Hat UBI from the official catalog
  • ubi-minimal is used unless a full UBI is justified
  • Non-Red Hat base images are pinned by version or digest
  • Non-essential packages are removed and caches cleaned
  • runAsNonRoot: true is set at pod or container level
  • A numeric non-root USER is set in the Containerfile
  • Container UID is not 0 or 1337
  • allowPrivilegeEscalation: false is set
  • readOnlyRootFilesystem: true is set
  • Volumes are mounted read-only unless writes are required
  • automountServiceAccountToken: false unless API access is required
  • Each container runs a single process
  • No SSH daemons are running in containers
  • Security context matches an approved category (Category 1-3)
  • Required capabilities are dropped (ALL, or at minimum MKNOD, SETUID, SETGID, KILL)
  • Container base image is not modified post-startup
  • SELinux is in Enforcing mode on all cluster nodes
  • Hadolint runs in CI on all Containerfiles
  • Container images are rebuilt regularly to pick up base image updates

Certsuite Test Mapping

GuidanceCertsuite Test IDProfiles
Privilege escalation disabledaccess-control-security-context-privilege-escalationAll profiles: mandatory
Run as non-rootaccess-control-security-context-non-root-user-id-checkAll profiles: mandatory
Read-only root filesystemaccess-control-security-context-read-only-file-systemAll profiles: optional
Security context categoryaccess-control-security-contextExtended: mandatory, all others: optional
UID not 1337access-control-no-1337-uidExtended: mandatory, all others: optional
One process per containeraccess-control-one-process-per-containerAll profiles: optional
Service account tokenaccess-control-pod-automount-service-account-tokenTelco/Far-Edge/Extended: mandatory, Non-Telco: optional
No SSH daemonsaccess-control-ssh-daemonsTelco/Far-Edge/Extended: mandatory, Non-Telco: optional
Base image not modifiedplatform-alteration-base-imageAll profiles: mandatory
SELinux enforcingplatform-alteration-is-selinux-enforcingAll profiles: mandatory
Red Hat base imageplatform-alteration-isredhat-releaseAll profiles: mandatory

References

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Container Hardening؟

Harden container images and runtime configuration. Use when building, reviewing, or auditing Containerfiles, Dockerfiles, container compose files, or Kubernetes pod security settings.

لماذا تستخدم Container Hardening على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Container Hardening عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Container Hardening في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/RedHatProductSecurity/prodsec-skills/tree/main/ge-core/container-hardening. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Container Hardening؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Container Hardening؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Container Hardening معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Container Hardening مجانية؟

نعم. نشرها RedHatProductSecurity على GitHub بموجب ترخيص Apache-2.0. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل
شعار mattpocock

Wizard

mattpocock
المجتمعشائع

أنشئ معالجًا تفاعليًا في bash يرشد المستخدم خلال الخطوات التي لا يستطيع تنفيذها سوى شخص. استخدمه عند تجهيز البنية التحتية، أو إعداد بيانات الاعتماد أو أسرار CI، أو التنقل في لوحة تحكم خارجية غير مألوفة…

22.3K
264.4K
الملفات: 2
عرض
شعار affaan-m

Deployment Patterns

affaan-m
المجتمعشائع

سير عمل النشر، وأنماط مسارات CI/CD، واستخدام Docker في الحاويات، وفحوصات الصحة، واستراتيجيات التراجع، وقوائم التحقق من الجاهزية للإنتاج لتطبيقات الويب…

39.1K
261.1K
التعليمات
عرض
شعار affaan-m

Docker Patterns

affaan-m
المجتمعشائع

أنماط Docker وDocker Compose للتطوير المحلي، وأمان الحاويات، والشبكات، واستراتيجيات وحدات التخزين، وتنسيق الخدمات المتعددة.

39.1K
261.1K
التعليمات
عرض
شعار affaan-m

Architecture Decision Records

affaan-m
المجتمعشائع

سجّل قرارات البنية المعمارية أثناء جلسات البرمجة في سجلات ADR منظمة، مع اكتشاف لحظات اتخاذ القرار تلقائيًا وتوثيق السياق والبدائل التي جرى النظر فيها والمبررات. حافظ على سجل ADR يساعد المطورين مستقبلًا على فهم أسباب تشكيل قاعدة الشيفرة على نحوها الحالي.

39.1K
261.1K
التعليمات
عرض

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇