|
| 1 | +{ |
| 2 | + "properties": { |
| 3 | + "displayName": "Kubernetes clusters should not allow endpoint edit permissions of ClusterRole/system:aggregate-to-edit", |
| 4 | + "policyType": "BuiltIn", |
| 5 | + "mode": "Microsoft.Kubernetes.Data", |
| 6 | + "description": "ClusterRole/system:aggregate-to-edit should not allow endpoint edit permissions due to CVE-2021-25740, Endpoint & EndpointSlice permissions allow cross-Namespace forwarding, https://github.com/kubernetes/kubernetes/issues/103675. This policy is generally available for Kubernetes Service (AKS), and preview for AKS Engine and Azure Arc enabled Kubernetes. For more information, see https://aka.ms/kubepolicydoc.", |
| 7 | + "metadata": { |
| 8 | + "version": "1.0.0", |
| 9 | + "category": "Kubernetes" |
| 10 | + }, |
| 11 | + "parameters": { |
| 12 | + "effect": { |
| 13 | + "type": "String", |
| 14 | + "metadata": { |
| 15 | + "displayName": "Effect", |
| 16 | + "description": "'Audit' allows a non-compliant resource to be created or updated, but flags it as non-compliant. 'Disabled' turns off the policy." |
| 17 | + }, |
| 18 | + "allowedValues": [ |
| 19 | + "Audit", |
| 20 | + "Disabled" |
| 21 | + ], |
| 22 | + "defaultValue": "Audit" |
| 23 | + }, |
| 24 | + "excludedNamespaces": { |
| 25 | + "type": "Array", |
| 26 | + "metadata": { |
| 27 | + "displayName": "Namespace exclusions", |
| 28 | + "description": "List of Kubernetes namespaces to exclude from policy evaluation." |
| 29 | + }, |
| 30 | + "defaultValue": [ |
| 31 | + "kube-system", |
| 32 | + "gatekeeper-system", |
| 33 | + "azure-arc" |
| 34 | + ] |
| 35 | + }, |
| 36 | + "namespaces": { |
| 37 | + "type": "Array", |
| 38 | + "metadata": { |
| 39 | + "displayName": "Namespace inclusions", |
| 40 | + "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." |
| 41 | + }, |
| 42 | + "defaultValue": [] |
| 43 | + }, |
| 44 | + "labelSelector": { |
| 45 | + "type": "object", |
| 46 | + "metadata": { |
| 47 | + "displayName": "Kubernetes label selector", |
| 48 | + "description": "Label query to select Kubernetes resources for policy evaluation. An empty label selector matches all Kubernetes resources." |
| 49 | + }, |
| 50 | + "defaultValue": {}, |
| 51 | + "schema": { |
| 52 | + "description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all resources.", |
| 53 | + "type": "object", |
| 54 | + "properties": { |
| 55 | + "matchLabels": { |
| 56 | + "description": "matchLabels is a map of {key,value} pairs.", |
| 57 | + "type": "object", |
| 58 | + "additionalProperties": { |
| 59 | + "type": "string" |
| 60 | + }, |
| 61 | + "minProperties": 1 |
| 62 | + }, |
| 63 | + "matchExpressions": { |
| 64 | + "description": "matchExpressions is a list of values, a key, and an operator.", |
| 65 | + "type": "array", |
| 66 | + "items": { |
| 67 | + "type": "object", |
| 68 | + "properties": { |
| 69 | + "key": { |
| 70 | + "description": "key is the label key that the selector applies to.", |
| 71 | + "type": "string" |
| 72 | + }, |
| 73 | + "operator": { |
| 74 | + "description": "operator represents a key's relationship to a set of values.", |
| 75 | + "type": "string", |
| 76 | + "enum": [ |
| 77 | + "In", |
| 78 | + "NotIn", |
| 79 | + "Exists", |
| 80 | + "DoesNotExist" |
| 81 | + ] |
| 82 | + }, |
| 83 | + "values": { |
| 84 | + "description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.", |
| 85 | + "type": "array", |
| 86 | + "items": { |
| 87 | + "type": "string" |
| 88 | + } |
| 89 | + } |
| 90 | + }, |
| 91 | + "required": [ |
| 92 | + "key", |
| 93 | + "operator" |
| 94 | + ], |
| 95 | + "additionalProperties": false |
| 96 | + }, |
| 97 | + "minItems": 1 |
| 98 | + } |
| 99 | + }, |
| 100 | + "additionalProperties": false |
| 101 | + } |
| 102 | + } |
| 103 | + }, |
| 104 | + "policyRule": { |
| 105 | + "if": { |
| 106 | + "field": "type", |
| 107 | + "in": [ |
| 108 | + "Microsoft.ContainerService/managedClusters" |
| 109 | + ] |
| 110 | + }, |
| 111 | + "then": { |
| 112 | + "effect": "[parameters('effect')]", |
| 113 | + "details": { |
| 114 | + "constraintTemplate": "https://store.policy.azure.us/kubernetes/block-endpoint-edit-default-role/v1/template.yaml", |
| 115 | + "constraint": "https://store.policy.azure.us/kubernetes/block-endpoint-edit-default-role/v1/constraint.yaml", |
| 116 | + "excludedNamespaces": "[parameters('excludedNamespaces')]", |
| 117 | + "namespaces": "[parameters('namespaces')]", |
| 118 | + "labelSelector": "[parameters('labelSelector')]" |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | + }, |
| 123 | + "id": "/providers/Microsoft.Authorization/policyDefinitions/1ddac26b-ed48-4c30-8cc5-3a68c79b8001", |
| 124 | + "name": "1ddac26b-ed48-4c30-8cc5-3a68c79b8001" |
| 125 | +} |
0 commit comments