-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transparent Proxy CNI Plug-in: escalated privileges required on Consul containers #635
Comments
Hi! Is it possible to customize the policies? Our containers require certain permissions. |
Could you please help which kubernetes policies need to customize or can you list consul requirement of container permission to run on azure policy we tried to modify on following policies but not able to deploy consul policies
|
* Add support for L7 intentions
That does not seem like a secure approach. It is common to disallow assuming capabilities and running privileged for containers, and you should not depend on it being available in all namespaces that wish to run transparent proxy. |
As azure policy uses OPA Gatekeeper as engine I believe it would be quite tricky to allow only consul connect inject init container |
That would only work if there's no way for others to modify the command line arguments |
Yep, it is so. It also posible to filter out by service account which sends request to the api servers. In case if consul is the last sa which sends request to the api after injection then it possible to write a policy with condition like if request comes from consul service account which is sits in consul namespace then initcontainer with privileges is allowed. Let's say I'm creating a deployment with enabled consul who will be the final api requester me or consul service account which injects the init containers and envoy side car? For me it's clear that my initial request will be first sent to consul mutating webhook, altered and sent back to the k8s api but under which account this altered request will come to the api i'm not sure logically this should be a consul 'consul-connect-injector-webhook-svc-account'. Maybe somebody from consul-k8s can comment on this more. |
I would say that this is a more general issue than AKS with Policy enabled. It is not possible to run transparent proxy without allowing Privileged containers in general for that namespace, which is a big no-no in my book. This is a deal breaker. Quoting from the Kubernetes docs, https://kubernetes.io/docs/concepts/security/pod-security-standards/#privileged
Istio seems to solve this by providing a chained CNI: https://istio.io/latest/docs/setup/additional-setup/cni/ |
I agree with you it should be changed on consul-k8s side to do not require the high privileged containers, keeping in mind that this container will present in all meshed aps. IMO it would acceptable to have such privileged container in consul system ns itself as then access to it might easily restricted with RBAC and limited to admins only. |
Hi @scoof and @andriktr we are aware that those containers require escalated privileges due to our transparent proxy implementation to apply traffic redirection rules. We acknowledge that for security conscious users that may pose a problem. On the roadmap we currently have CNI Plugin for Transparent Proxy slotted to address these concerns but will be not be delivered until next year. I've updated the title and description to reflect the ask. Please upvote so we can gather feedback on how to prioritize this feature. |
Thanks for your patience, we're excited to see this feature released next week with #1456 now merged. |
Community Note
The current implementation of Transparent Proxy on Consul K8s requires the init-container we run before Envoy and application containers start to have CAP_NET_ADMIN privileges. This may not be acceptable for more security-conscious customers.
Writing our own CNI plugin for applying traffic redirection rules via iptables would enable us to delegate the actual running of the commands to kubelet instead of executing them in the init container.
Helm chart failed to install on aks, if azure-policy is enabled
Steps to reproduce
Consul config.yaml
Error Log
is there option to deploy consul with azure-policy enable in aks
The text was updated successfully, but these errors were encountered: