Bylaw

Gallery › Kubernetes › Azure Community Policy

Ensure Pods use only allowed Seccomp Profiles in a Kubernetes Cluster

Doesn't convert yet Policy Audit Deny Disabled Mode Microsoft.Kubernetes.Data Version 1.0.0 Preview

This policy ensures Pods in a Kubernetes cluster only use allowed Seccomp Profiles. For instructions on using this policy, please visit https://aka.ms/kubepolicydoc

ConvertTo-Bylaw can't convert this policy yet:

Azure Policy JSONazurepolicy.json · 71 lines
{
  "properties": {
    "displayName": "Ensure Pods use only allowed Seccomp Profiles in a Kubernetes Cluster",
    "policyType": "Custom",
    "mode": "Microsoft.Kubernetes.Data",
    "description": "This policy ensures Pods in a Kubernetes cluster only use allowed Seccomp Profiles. For instructions on using this policy, please visit https://aka.ms/kubepolicydoc",
    "metadata": {
      "version": "1.0.0",
      "category": "Kubernetes",
      "preview": true
    },
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of 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"
        ]
      },
      "allowedProfiles": {
        "type": "Array",
        "metadata": {
          "displayName": "Allowed Seccomp Profiles",
          "description": "List of Seccomp Profiles that pods are allowed to use. Use * to allow all profiles, an empty list will block everything."
        },
        "defaultValue": []
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "in": [
          "AKS Engine",
          "Microsoft.Kubernetes/connectedClusters",
          "Microsoft.ContainerService/managedClusters"
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "constraintTemplate": "https://raw.githubusercontent.com/Azure/Community-Policy/master/policyDefinitions/Kubernetes/allowed-seccomp-profiles/template.yaml",
          "constraint": "https://raw.githubusercontent.com/Azure/Community-Policy/master/policyDefinitions/Kubernetes/allowed-seccomp-profiles/constraint.yaml",
          "values": {
            "excludedNamespaces": "[parameters('excludedNamespaces')]",
            "allowedProfiles": "[parameters('allowedProfiles')]"
          }
        }
      }
    }
  },
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "24462566-db44-4475-bc57-43e1b74fa141"
}

Source: policyDefinitions/Kubernetes/allowed-seccomp-profiles/azurepolicy.json in Azure/Community-Policy, under the MIT licence.