last sync: 2021-Jul-23 16:37:57 UTC

Azure Policy definition

Kubernetes cluster services should only use allowed external IPs

Name Kubernetes cluster services should only use allowed external IPs
Azure Portal
Id d46c275d-1680-448d-b2ec-e495a3b6cc89
Version 3.0.0
details on versioning
Category Kubernetes
Microsoft docs
Description Use allowed external IPs to avoid the potential attack (CVE-2020-8554) in a Kubernetes cluster. For more information, see https://aka.ms/kubepolicydoc.
Mode Microsoft.Kubernetes.Data
Type BuiltIn
Preview FALSE
Deprecated FALSE
Effect Default: audit
Allowed: (audit, deny, disabled)
Used RBAC Role none
History
Date/Time (UTC ymd) (i) Change type Change detail
2021-03-16 16:49:20 change Major, old suffix: preview (2.0.0-preview > 3.0.0)
2021-03-02 15:11:40 change Major, suffix remains equal (1.0.0-preview > 2.0.0-preview)
2021-01-13 16:08:35 add d46c275d-1680-448d-b2ec-e495a3b6cc89
Used in Initiatives none
JSON Changes

JSON
{
  "properties": {
    "displayName": "Kubernetes cluster services should only use allowed external IPs",
    "policyType": "BuiltIn",
    "mode": "Microsoft.Kubernetes.Data",
    "description": "Use allowed external IPs to avoid the potential attack (CVE-2020-8554) in a Kubernetes cluster. For more information, see https://aka.ms/kubepolicydoc.",
    "metadata": {
      "version": "3.0.0",
      "category": "Kubernetes"
    },
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "'Audit' allows a non-compliant resource to be created or updated, but flags it as non-compliant. 'Deny' blocks the non-compliant resource creation or update. 'Disabled' turns off the policy."
        },
        "allowedValues": [
          "audit",
          "deny",
          "disabled"
        ],
        "defaultValue": "audit"
      },
      "excludedNamespaces": {
        "type": "Array",
        "metadata": {
          "displayName": "Namespace exclusions",
          "description": "List of Kubernetes namespaces to exclude from policy evaluation. Providing a value for this parameter is optional."
        },
        "defaultValue": [
          "kube-system",
          "gatekeeper-system",
          "azure-arc"
        ]
      },
      "namespaces": {
        "type": "Array",
        "metadata": {
          "displayName": "Namespace inclusions",
          "description": "List of Kubernetes namespaces to only include in policy evaluation. An empty list means the policy is applied to all resources in all namespaces."
        },
        "defaultValue": [
          
        ]
      },
      "labelSelector": {
        "type": "Object",
        "metadata": {
          "displayName": "Kubernetes label selector",
          "description": "Label query to select Kubernetes resources for policy evaluation. An empty label selector matches all Kubernetes resources."
        },
        "defaultValue": {
          
        }
      },
      "allowedExternalIPs": {
        "type": "Array",
        "metadata": {
          "displayName": "Allowed External IPs",
          "description": "List of External IPs that services are allowed to use. Empty array means all external IPs are disallowed."
        },
        "defaultValue": [
          
        ]
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "in": [
          "AKS Engine",
          "Microsoft.Kubernetes/connectedClusters",
          "Microsoft.ContainerService/managedClusters"
        ]
      },
      "then": {
      "effect": "[parameters('effect')]",
        "details": {
          "constraintTemplate": "https://store.policy.core.windows.net/kubernetes/allowed-external-ips/v1/template.yaml",
          "constraint": "https://store.policy.core.windows.net/kubernetes/allowed-external-ips/v1/constraint.yaml",
        "excludedNamespaces": "[parameters('excludedNamespaces')]",
        "namespaces": "[parameters('namespaces')]",
        "labelSelector": "[parameters('labelSelector')]",
          "values": {
          "allowedExternalIPs": "[parameters('allowedExternalIPs')]"
          }
        }
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/d46c275d-1680-448d-b2ec-e495a3b6cc89",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "d46c275d-1680-448d-b2ec-e495a3b6cc89"
}