forked from Azure/azure-policy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Built-in Policy Release da9c6b7a (Azure#1238)
Co-authored-by: Azure Policy Bot <[email protected]>
- Loading branch information
Showing
19 changed files
with
963 additions
and
29 deletions.
There are no files selected for viewing
135 changes: 135 additions & 0 deletions
135
built-in-policies/policyDefinitions/Azure Government/Kubernetes/BlockAdminRolebindings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{ | ||
"properties": { | ||
"displayName": "Kubernetes clusters should ensure that the cluster-admin role is only used where required", | ||
"policyType": "BuiltIn", | ||
"mode": "Microsoft.Kubernetes.Data", | ||
"description": "The role 'cluster-admin' provides wide-ranging powers over the environment and should be used only where and when needed.", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "Kubernetes" | ||
}, | ||
"version": "1.0.0", | ||
"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. 'Disabled' turns off the policy.", | ||
"portalReview": true | ||
}, | ||
"allowedValues": [ | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
}, | ||
"excludedNamespaces": { | ||
"type": "Array", | ||
"metadata": { | ||
"displayName": "Namespace exclusions", | ||
"description": "List of Kubernetes namespaces to exclude from policy evaluation. System namespaces \"kube-system\", \"gatekeeper-system\" and \"azure-arc\" are always excluded by design. \"azure-extensions-usage-system\" is optional to remove." | ||
}, | ||
"defaultValue": [ | ||
"kube-system", | ||
"gatekeeper-system", | ||
"azure-arc", | ||
"azure-extensions-usage-system" | ||
] | ||
}, | ||
"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": {}, | ||
"schema": { | ||
"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.", | ||
"type": "object", | ||
"properties": { | ||
"matchLabels": { | ||
"description": "matchLabels is a map of {key,value} pairs.", | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
}, | ||
"minProperties": 1 | ||
}, | ||
"matchExpressions": { | ||
"description": "matchExpressions is a list of values, a key, and an operator.", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"key": { | ||
"description": "key is the label key that the selector applies to.", | ||
"type": "string" | ||
}, | ||
"operator": { | ||
"description": "operator represents a key's relationship to a set of values.", | ||
"type": "string", | ||
"enum": [ | ||
"In", | ||
"NotIn", | ||
"Exists", | ||
"DoesNotExist" | ||
] | ||
}, | ||
"values": { | ||
"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.", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"key", | ||
"operator" | ||
], | ||
"additionalProperties": false | ||
}, | ||
"minItems": 1 | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"field": "type", | ||
"equals": "Microsoft.ContainerService/managedClusters" | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]", | ||
"details": { | ||
"templateInfo": { | ||
"sourceType": "PublicURL", | ||
"url": "https://store.policy.azure.us/kubernetes/block-admin-rolebindings/v1/template.yaml" | ||
}, | ||
"apiGroups": [ | ||
"rbac.authorization.k8s.io" | ||
], | ||
"kinds": [ | ||
"ClusterRoleBinding", | ||
"RoleBinding" | ||
], | ||
"excludedNamespaces": "[parameters('excludedNamespaces')]", | ||
"namespaces": "[parameters('namespaces')]", | ||
"labelSelector": "[parameters('labelSelector')]" | ||
} | ||
} | ||
} | ||
}, | ||
"id": "/providers/Microsoft.Authorization/policyDefinitions/a3dc4946-dba6-43e6-950d-f96532848c9f", | ||
"name": "a3dc4946-dba6-43e6-950d-f96532848c9f" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
built-in-policies/policyDefinitions/Kubernetes/AKS_Autoupgrade_Cluster_Audit.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"properties": { | ||
"policyType": "BuiltIn", | ||
"displayName": "Azure Kubernetes Service Clusters should enable cluster auto-upgrade", | ||
"description": "AKS cluster auto-upgrade can ensure your clusters are up to date and don't miss the latest features or patches from AKS and upstream Kubernetes. Learn more at: https://learn.microsoft.com/en-us/azure/aks/auto-upgrade-cluster.", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "Kubernetes" | ||
}, | ||
"version": "1.0.0", | ||
"mode": "Indexed", | ||
"parameters": { | ||
"effect": { | ||
"type": "String", | ||
"defaultValue": "Audit", | ||
"allowedValues": [ | ||
"Audit", | ||
"Disabled" | ||
], | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Enable or disable the execution of the policy." | ||
} | ||
}, | ||
"allowedClusterAutoUpgradeChannels": { | ||
"type": "Array", | ||
"metadata": { | ||
"displayName": "Allowed Cluster Auto-upgrade Channels", | ||
"description": "Cluster auto-upgrade channels viewed as complaint. Lean more at https://learn.microsoft.com/en-us/azure/aks/auto-upgrade-cluster#use-cluster-auto-upgrade", | ||
"portalReview": true | ||
}, | ||
"allowedValues": [ | ||
"rapid", | ||
"stable", | ||
"patch", | ||
"node-image", | ||
"none" | ||
], | ||
"defaultValue": [ | ||
"rapid", | ||
"stable", | ||
"patch" | ||
] | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.ContainerService/managedClusters" | ||
}, | ||
{ | ||
"anyOf": [ | ||
{ | ||
"field": "Microsoft.ContainerService/managedClusters/autoUpgradeProfile.upgradeChannel", | ||
"exists": false | ||
}, | ||
{ | ||
"field": "Microsoft.ContainerService/managedClusters/autoUpgradeProfile.upgradeChannel", | ||
"notin": "[parameters('allowedClusterAutoUpgradeChannels')]" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} | ||
}, | ||
"id": "/providers/Microsoft.Authorization/policyDefinitions/5c345cdf-2049-47e0-b8fe-b0e96bc2df35", | ||
"name": "5c345cdf-2049-47e0-b8fe-b0e96bc2df35" | ||
} |
135 changes: 135 additions & 0 deletions
135
built-in-policies/policyDefinitions/Kubernetes/BlockAdminRolebindings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{ | ||
"properties": { | ||
"displayName": "Kubernetes clusters should ensure that the cluster-admin role is only used where required", | ||
"policyType": "BuiltIn", | ||
"mode": "Microsoft.Kubernetes.Data", | ||
"description": "The role 'cluster-admin' provides wide-ranging powers over the environment and should be used only where and when needed.", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "Kubernetes" | ||
}, | ||
"version": "1.0.0", | ||
"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. 'Disabled' turns off the policy.", | ||
"portalReview": true | ||
}, | ||
"allowedValues": [ | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
}, | ||
"excludedNamespaces": { | ||
"type": "Array", | ||
"metadata": { | ||
"displayName": "Namespace exclusions", | ||
"description": "List of Kubernetes namespaces to exclude from policy evaluation. System namespaces \"kube-system\", \"gatekeeper-system\" and \"azure-arc\" are always excluded by design. \"azure-extensions-usage-system\" is optional to remove." | ||
}, | ||
"defaultValue": [ | ||
"kube-system", | ||
"gatekeeper-system", | ||
"azure-arc", | ||
"azure-extensions-usage-system" | ||
] | ||
}, | ||
"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": {}, | ||
"schema": { | ||
"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.", | ||
"type": "object", | ||
"properties": { | ||
"matchLabels": { | ||
"description": "matchLabels is a map of {key,value} pairs.", | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
}, | ||
"minProperties": 1 | ||
}, | ||
"matchExpressions": { | ||
"description": "matchExpressions is a list of values, a key, and an operator.", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"key": { | ||
"description": "key is the label key that the selector applies to.", | ||
"type": "string" | ||
}, | ||
"operator": { | ||
"description": "operator represents a key's relationship to a set of values.", | ||
"type": "string", | ||
"enum": [ | ||
"In", | ||
"NotIn", | ||
"Exists", | ||
"DoesNotExist" | ||
] | ||
}, | ||
"values": { | ||
"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.", | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"key", | ||
"operator" | ||
], | ||
"additionalProperties": false | ||
}, | ||
"minItems": 1 | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"field": "type", | ||
"equals": "Microsoft.ContainerService/managedClusters" | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]", | ||
"details": { | ||
"templateInfo": { | ||
"sourceType": "PublicURL", | ||
"url": "https://store.policy.core.windows.net/kubernetes/block-admin-rolebindings/v1/template.yaml" | ||
}, | ||
"apiGroups": [ | ||
"rbac.authorization.k8s.io" | ||
], | ||
"kinds": [ | ||
"ClusterRoleBinding", | ||
"RoleBinding" | ||
], | ||
"excludedNamespaces": "[parameters('excludedNamespaces')]", | ||
"namespaces": "[parameters('namespaces')]", | ||
"labelSelector": "[parameters('labelSelector')]" | ||
} | ||
} | ||
} | ||
}, | ||
"id": "/providers/Microsoft.Authorization/policyDefinitions/a3dc4946-dba6-43e6-950d-f96532848c9f", | ||
"name": "a3dc4946-dba6-43e6-950d-f96532848c9f" | ||
} |
Oops, something went wrong.