-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(etcd): add checks for Kubernetes etcd #3294
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 Reviewed with comments about some broken links in the metadata files and the way to check the commands within the pod's containers.
"ResourceType": "EtcdService", | ||
"Description": "This check ensures that client authentication is enabled for the etcd service, which is a key-value store used by Kubernetes for persistent storage of all REST API objects. Enabling client authentication helps in securing access to etcd.", | ||
"Risk": "If --client-cert-auth is not set to true, etcd service may be accessible by unauthenticated clients, posing a significant security risk.", | ||
"RelatedUrl": "https://coreos.com/etcd/docs/latest/op-guide/security.html", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken link.
}, | ||
"Recommendation": { | ||
"Text": "Enable client certificate authentication for the etcd service for improved security.", | ||
"Url": "https://coreos.com/etcd/docs/latest/op-guide/security.html" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken link.
prowler/providers/kubernetes/services/etcd/etcd_client_cert_auth/etcd_client_cert_auth.py
Show resolved
Hide resolved
"ResourceType": "EtcdService", | ||
"Description": "This check ensures that etcd does not use self-signed certificates for TLS, which are less secure than certificates from a trusted authority. Avoiding self-signed certificates enhances the security of etcd.", | ||
"Risk": "Using --auto-tls=true may result in the use of self-signed certificates, reducing the overall security of the etcd service.", | ||
"RelatedUrl": "https://coreos.com/etcd/docs/latest/op-guide/security.html", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken link.
}, | ||
"Recommendation": { | ||
"Text": "Ensure etcd is not using self-signed certificates for TLS.", | ||
"Url": "https://coreos.com/etcd/docs/latest/op-guide/security.html" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken link.
for container in pod.containers.values(): | ||
for command in container.command: | ||
if command.startswith("--trusted-ca-file"): | ||
etcd_ca_file = command.split("=")[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here you should get all the CA files configured in each container, not just one because they can be different.
prowler/providers/kubernetes/services/etcd/etcd_peer_tls_config/etcd_peer_tls_config.py
Show resolved
Hide resolved
.../providers/kubernetes/services/etcd/etcd_peer_client_cert_auth/etcd_peer_client_cert_auth.py
Show resolved
Hide resolved
prowler/providers/kubernetes/services/etcd/etcd_no_peer_auto_tls/etcd_no_peer_auto_tls.py
Show resolved
Hide resolved
prowler/providers/kubernetes/services/etcd/etcd_no_auto_tls/etcd_no_auto_tls.py
Show resolved
Hide resolved
The controller manager check included in this PR is expected right? If so, add it to the PR body. |
if "--auto-tls=" in str(container.command) and "--auto-tls=true" in str( | ||
container.command | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if "--auto-tls=" in str(container.command) and "--auto-tls=true" in str( | |
container.command | |
): | |
if "--auto-tls=true" in str(container.command): |
for container in pod.containers.values(): | ||
if "--peer-cert-file" not in str( | ||
container.command | ||
) or "--peer-key-file" not in str(container.command): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OR or AND?
f"Etcd has client certificate authentication enabled in pod {pod.name}." | ||
) | ||
for container in pod.containers.values(): | ||
if "--client-cert-auth=true" not in str(container.command): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include --client-cert-auth
report.status = "PASS" | ||
report.status_extended = f"Etcd is configured for peer client certificate authentication in pod {pod.name}." | ||
for container in pod.containers.values(): | ||
if "--peer-client-cert-auth=true" not in str(container.command): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include --peer-client-cert-auth
Description
Add all checks for Kubernetes etcd and one left for scheduler:
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.