Provide a way to modify the Audit Policy used by the kube-apiserver in AKS
What happened: I would like to know if there is a way (and if not, can we add a feature request) to make the Kubernetes audit policy used by managed AKS configurable.
Right now, I don't see any way to configure this. I found Issue #1873, where user @miwithro noted the following:
Hello, There is already an audit policy applied to the AKS clusters. There is no need to add one. You simply just need to query the logs.
https://docs.microsoft.com/en-us/azure/aks/view-master-logs
Here is the applied audit policy: https://github.com/Azure/aks-engine/blob/24244adcd09afcf452c2e16317999046a240e992/parts/k8s/addons/audit-policy.yaml
Based on that policy, it looks like it would use "Request" as the policy for secrets. Which according to the docs it would:
"Request - log event metadata and request body but not response body. This does not apply for non-resource requests."
However, I setup audit log streaming, made a secret, and viewed the log...I did NOT see the request body which would contain my base64 encoded string of the secret, which leads me to believe maybe AKS has updated it's default audit policy?
What you expected to happen:
I really just want to see what the full k8s Audit Policy that AKS is using looks like, so I can ensure that Secret objects are NOT being audited with a Request or RequestResponse policy. Being able to provide my own audit policy at AKS creation time would also be great, but that's definitely secondary to ensure that the secret data is not being stored in audits.
How to reproduce it (as minimally and precisely as possible): N/A
Anything else we need to know?: Kubernetes version - 1.19.7
Hi carlsoncoder, AKS bot here :wave: Thank you for posting on the AKS Repo, I'll do my best to get a kind human from the AKS team to assist you.
I might be just a bot, but I'm told my suggestions are normally quite good, as such:
- If this case is urgent, please open a Support Request so that our 24/7 support team may help you faster.
- Please abide by the AKS repo Guidelines and Code of Conduct.
- If you're having an issue, could it be described on the AKS Troubleshooting guides or AKS Diagnostics?
- Make sure your subscribed to the AKS Release Notes to keep up to date with all that's new on AKS.
- Make sure there isn't a duplicate of this issue already reported. If there is, feel free to close this one and '+1' the existing issue.
- If you have a question, do take a look at our AKS FAQ. We place the most common ones there!
Triage required from @Azure/aks-pm
Action required from @Azure/aks-pm
Issue needing attention of @Azure/aks-leads
It would also be great if we can provide an optional filter that allows to not receive all audit events which are generated by default system service accounts. Most of the time customers are only interested in activities from custom service accounts or actual users (authenticated by aad).
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
Issue needing attention of @Azure/aks-leads
You are correct the audit-policy has been updated. Specific to secrets here is what is configured.
Secrets, ConfigMaps, ServiceAccounts and TokenReviews can contain sensitive & binary data, # so only log at the Metadata level. - level: Metadata resources: - group: "" resources: ["secrets", "configmaps", "serviceaccounts"] - group: authentication.k8s.io resources: ["tokenreviews"] omitStages: - "RequestReceived"
Thanks for reaching out. I'm closing this issue as it was marked with "Answer Provided" and it hasn't had activity for 2 days.