Skip to content
Skillv1.0.0

cis-k8s-v1110-5.2.5

Minimize the admission of containers wishing to share the host network namespace (Manual)

by CyberStrikeus(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from CyberStrikeus/CyberStrike (.cyberstrike/skill/CIS_benchmarks/Server_Software/Kubernetes/CIS_Kubernetes_Benchmark_v1.11.0/cis-k8s-v1110-5.2.5/SKILL.md). Install upstream with npx skills add CyberStrikeus/CyberStrike --skill cis-k8s-v1110-5.2.5. Copyright stays with the author.

5.2.5 Minimize the admission of containers wishing to share the host network namespace (Manual)

Profile Applicability

  • Level 1 - Master Node

Description

Do not generally permit containers to be run with the hostNetwork flag set to true.

Rationale

A container running in the host's network namespace could access the local loopback device, and could access network traffic to and from other pods.

There should be at least one admission control policy defined which does not permit containers to share the host network namespace.

If you need to run containers which require access to the host's network namespaces, this should be defined in a separate policy and you should carefully check to ensure that only limited service accounts and users are given permission to use that policy.

Impact

Pods defined with spec.hostNetwork: true will not be permitted unless they are run under a specific policy.

Audit

To fetch hostNetwork from each pod.

kubectl get pods -A -o=jsonpath=$'{range .items[*]}{@.metadata.name}: {@.spec.hostNetwork}\n{end}'

Remediation

Add policies to each namespace in the cluster which has user workloads to restrict the admission of hostNetwork containers.

Default Value

By default, there are no restrictions on the creation of hostNetwork containers.

References

  1. https://kubernetes.io/docs/concepts/security/pod-security-standards/

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/cyberstrikeus-cyberstrike-cis-k8s-v1110-5-2-5/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

cyberstrikeus-cyberstrike-cis-k8s-v1110-5-2-5.ocm.jsonjson
{
  "ocm": "1",
  "id": "cyberstrikeus-cyberstrike-cis-k8s-v1110-5-2-5",
  "kind": "skill",
  "name": "cis-k8s-v1110-5.2.5",
  "description": "Minimize the admission of containers wishing to share the host network namespace (Manual)",
  "publisher": "CyberStrikeus",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "cis",
      "kubernetes",
      "policies",
      "pod-security",
      "host-network",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Minimize the admission of containers wishing to share the host network namespace (Manual)"
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/CyberStrikeus/CyberStrike",
      "path": ".cyberstrike/skill/CIS_benchmarks/Server_Software/Kubernetes/CIS_Kubernetes_Benchmark_v1.11.0/cis-k8s-v1110-5.2.5/SKILL.md",
      "ref": "df28ccd3dc6d6c02391169121ee2dcdf4a6a132b",
      "url": "https://github.com/CyberStrikeus/CyberStrike/blob/df28ccd3dc6d6c02391169121ee2dcdf4a6a132b/.cyberstrike/skill/CIS_benchmarks/Server_Software/Kubernetes/CIS_Kubernetes_Benchmark_v1.11.0/cis-k8s-v1110-5.2.5/SKILL.md",
      "key": "CyberStrikeus/CyberStrike/.cyberstrike/skill/CIS_benchmarks/Server_Software/Kubernetes/CIS_Kubernetes_Benchmark_v1.11.0/cis-k8s-v1110-5.2.5/SKILL.md"
    }
  },
  "instructions": "# 5.2.5 Minimize the admission of containers wishing to share the host network namespace (Manual)\n\n## Profile Applicability\n\n- Level 1 - Master Node\n\n## Description\n\nDo not generally permit containers to be run with the `hostNetwork` flag set to true.\n\n## Rationale\n\nA container running in the host's network namespace could access the local loopback device, and could access network traffic to and from other pods.\n\nThere should be at least one admission control policy defined which does not permit containers to share the host network namespace.\n\nIf you need to run containers which require access",
  "cost": {
    "context_tokens": 354
  }
}

Fetch it by URL: GET /api/v1/registry/cyberstrikeus-cyberstrike-cis-k8s-v1110-5-2-5/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.