-
Notifications
You must be signed in to change notification settings - Fork 23
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
Refine CVE check in scs-0210-v2 test script. #526
Comments
Note to myself: while working on #476 I noticed that the
It doesn't cover the case that all versions prior |
And a general note: I would actually like to replace our custom CVE retrieval and parsing with an existing library, if possible. An obvious candidate I want to evaluate in this regard is cvelib. |
@martinmo Yes, very well. Also (as stated in the description of this issue) we might require the use of some external CVE check tool, if you can find something appropriate. |
Oh, and one other note: maybe in the course of this issue, you can also try to make the check work for any given date, instead of just the current, so that unit tests can work without monkeypatching. |
I did some research on the CVE/vulnerability scanning part of this issue. An additional candidate for a Python CVE query library is nvdlib, which uses the "National Vulnerability Database". But there is a big caveat and the database is not reliable at the moment (see https://heise.de/-9656574, for example). However, before digging deeper into the Python libraries, I decided to look for vulnerability scanning solutions in the K8s ecosystem:
The proper way to address point 2 would be to create an inventory and check it, for example with the cluster-inventory plugin for sonobuoy or the KBOM ("Kubernetes Bill of Materials"). A promising solution to tackle points 2 and 1 seems to be trivy, which conveniently is Apache-2.0 licensed. For example, the experimental trivy k8s --report=summary --scanners=vuln cluster
trivy k8s --format=json --scanners=vuln --namespace=kube-system all
trivy k8s --scanners=vuln --namespace=kube-system --format=json -o result.json nodes,pods JSON output is supported, which means we can further process the information. Trivy can also be run in a k8s native fashion as an operator (trivy-operator). However I think this doesn't make sense if we only test short lived clusters which only exist during the conformance tests. |
Today I brought the question about which scanning tools could be used into the Team Container call. However, because of holidays/vacation, we were only two people and this couldn't be discussed with a broader audience (I'll try again in the next week if necessary). In the meantime, I picked up another tool that I will evaluate: |
I performend some evaluation on more CVE scanner tools for K8s. Unfortunately, most of them are not suited for our purpose – they either do not scan cluster components (e.g., the
So all in all, Furthermore, yesterday I prototyped with the Python libraries
For example, knowing that our cluster runs v1.27.2, with import nvdlib
results = nvdlib.searchCVE(
cpeName='cpe:2.3:a:kubernetes:kubernetes:1.27.2',
isVulnerable=True,
cvssV3Severity="HIGH",
limit=10
) we can get the CVEs this version is affected by. The library also wraps the CVE records data in a nice data structure. According to my research, it should be sufficient to search only for
The |
In today's Team Container call I brought the issue up again. Sven confirmed that FTR, we also had a short discussion whether the standard is feasible for CSPs, i.e., whether the timeframes that are set out are too short. It was concluded that it is feasible and that in reality a CSP needs to react quickly anyway. Also, in practice, critical K8s vulnerabilities do not appear often. (Nevertheless, this issue here can be tackled independently as it just deals with the implementation of the check.) |
For the prototype using trivy k8s --scanners=vuln --components=infra --report=summary \
--severity=HIGH --exit-code=1 --format=json -o trivy-cluster-infra-scan.yml cluster The "narrowing" happens with Now I have two problems:
|
FTR, the EOL check failed for the first time in the Zuul E2E tests for cluster-stacks because I did not update the |
During my research about the task I have tried to dive into all of the mentioned technologies. Started with setting up the k8s cluster with yaook, unfortunately without any success, so moved to kind approach, on which I have installed openstack and on that openstack I was able to use capi. EDIT: after attempt to create Kubernetes cluster on top of the OpenStack using yaook there was an error found also by @michal-gubricky:
from the logs of that service renew-ssh-certificates.service at the gateway instance visible was error:
|
What I have done right now is restore the original standard text and drop the changes based on the review comment. According to the code, there were several changes made:
I have found some problems with SSL certificates as well on my side, for MacOS users there is a simple solution with
What stopped me mostly was an error that told me: EDIT: I haven't met the problems with request quantity but I was able to check that it is:
|
codes are waiting for review |
The test script currently does not really check whether any patch-level update that targets any critical CVEs is deployed in time.
Furthermore, the standard is a bit vague about whether this part is actually required or recommended.
Thirdly, could you make some kind of suggestion of how to best integrate with CVE check tools? For instance, the test script could accept a log file by one of these tools and just verify that the tool ran fine. You could then add this to the standard as a recommendation; I think we might get this in even with the now stable standard because it wouldn't turn any compliant clouds non-compliant.
The text was updated successfully, but these errors were encountered: