Skip to content
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

feat(kubernetes): add etcd, controllermanager and rbac services #3261

Merged
merged 9 commits into from Feb 19, 2024

Conversation

sergargar
Copy link
Member

Description

Add etcd, ControllerManager and RBAC services for Kubernetes.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sergargar sergargar requested a review from a team as a code owner January 11, 2024 09:36
@jfagoagas jfagoagas added prowler-4.0 provider/kubernetes Issues/PRs related with the Kubernetes provider labels Jan 11, 2024
Copy link
Member

@jfagoagas jfagoagas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @sergargar, please review my comments 👏

from prowler.providers.common.common import global_provider
from prowler.providers.kubernetes.services.rbac.rbac_service import Rbac

rbac_client = Rbac(global_provider)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rbac_client = Rbac(global_provider)
rbac_client = RBAC(global_provider)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from prowler.providers.common.common import global_provider
from prowler.providers.kubernetes.services.etcd.etcd_service import Etcd

etcd_client = Etcd(global_provider)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
etcd_client = Etcd(global_provider)
etcd_client = ETCD(global_provider)

"ResourceType": "ClusterRoleBinding",
"Description": "This check ensures that the 'cluster-admin' role, which provides wide-ranging powers, is used only where necessary. The 'cluster-admin' role grants super-user access to perform any action on any resource, including all namespaces. It should be applied cautiously to avoid excessive privileges.",
"Risk": "Inappropriate use of the 'cluster-admin' role can lead to excessive privileges, increasing the risk of malicious actions and potentially impacting the cluster's security posture.",
"RelatedUrl": "https://kubernetes.io/docs/admin/authorization/rbac/#user-facing-roles",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review this link please.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

},
"Recommendation": {
"Text": "Audit and assess the use of 'cluster-admin' role in all ClusterRoleBindings. Ensure it is assigned only to subjects that require such extensive privileges. Consider using more restrictive roles wherever possible.",
"Url": "https://kubernetes.io/docs/admin/authorization/rbac/#clusterrolebinding-example"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review this link please.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

sergargar and others added 2 commits February 16, 2024 10:32
Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
},
"Recommendation": {
"Text": "Review and adjust the --terminated-pod-gc-threshold argument in the kube-controller-manager to ensure efficient garbage collection and optimal resource utilization.",
"Url": "https://kubernetes.io/docs/admin/kube-controller-manager/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check this link too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"ResourceType": "Etcd",
"Description": "This check verifies that the etcd service in a Kubernetes cluster is configured with appropriate TLS encryption settings. etcd, being a key value store for all Kubernetes REST API objects, should have its communication encrypted to protect these sensitive objects in transit.",
"Risk": "Without proper TLS configuration, data stored in etcd can be susceptible to interception and unauthorized access, posing a significant security risk to the entire Kubernetes cluster.",
"RelatedUrl": "https://coreos.com/etcd/docs/latest/op-guide/security.html",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include a specific link instead of a generic one about etcd security.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

},
"Recommendation": {
"Text": "Ensure that the etcd service is configured with TLS encryption for secure communication. The --cert-file and --key-file arguments should point to a valid TLS certificate and key.",
"Url": "https://kubernetes.io/docs/admin/etcd/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review this link too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@jfagoagas jfagoagas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jfagoagas jfagoagas merged commit 3cc367e into prowler-4.0-dev Feb 19, 2024
3 of 6 checks passed
@jfagoagas jfagoagas deleted the k8s-services-1 branch February 19, 2024 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider/kubernetes Issues/PRs related with the Kubernetes provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants