Json |
{
"properties": {
"displayName": "[Preview]: 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": "1.0.0-preview",
"category": "Kubernetes",
"preview": true
},
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "[Preview]: 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": "[Preview]: 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": "[Preview]: 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": [
]
},
"allowedExternalIPs": {
"type": "Array",
"metadata": {
"displayName": "[Preview]: 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://raw.githubusercontent.com/Azure/azure-policy/master/built-in-references/Kubernetes/allowed-external-ips/template.yaml",
"constraint": "https://raw.githubusercontent.com/Azure/azure-policy/master/built-in-references/Kubernetes/allowed-external-ips/constraint.yaml",
"excludedNamespaces": "[parameters('excludedNamespaces')]",
"namespaces": "[parameters('namespaces')]",
"values": {
"excludedNamespaces": "[parameters('excludedNamespaces')]",
"allowedExternalIPs": "[parameters('allowedExternalIPs')]"
}
}
}
}
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/d46c275d-1680-448d-b2ec-e495a3b6cc89",
"type": "Microsoft.Authorization/policyDefinitions",
"name": "d46c275d-1680-448d-b2ec-e495a3b6cc89"
}
|