在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):nccgroup/kube-auto-analyzer开源软件地址(OpenSource Url):https://github.com/nccgroup/kube-auto-analyzer开源编程语言(OpenSource Language):HTML 68.0%开源软件介绍(OpenSource Introduction):ArchivedThis project is not under active development at the moment and hasn't been updated in some time, so has been archived. Consider using Aqua's Kube-Bench and/or kube-hunter to achieve similar goals. Kubernetes Auto AnalyzerThis is a Kubernetes Security configuration review tool it's designed to automate the process of checking specific items on cluster security. It also has some ability to audit against the CIS Kubernetes benchmark, however this isn't really mantained at the moment, so if this is a feature you need, consider checking out Aqua's Kube-Bench Getting StartedThere's two ways to run the analyzer either as a ruby gem or using docker. DockerUnsurprisingly there's an image on Docker hub. To run you'll need to put the config file (if you're using one) in a directory that can be accessed by the docker container and then mount it as a volume to /data in the container e.g.
Ruby GemPre-requisitesFor the gem install you'll need some development libs to get it working. In general a ruby version of 2.1+ and the ruby-dev and build-essential packages should work on debian based distributions. For Amazon Linux this set of commands should work
Gem InstallTo install the ruby gem , just do OperationBy default the analyzer will check enabled authentication and authorization mechanisms, check a couple of common vulnerabilities and then create an HTML report. There are other options to make things more useful, which are detailed below. The best way to use the tool is to provide it a KUBECONFIG file to identify and authenticate the session. in that event you can run it with
If there are multiple contexts in your Kubeconfig file and you don't want to use the one specified as "current-context" then you can specify one on the commmand line with
If you've got an authorisation token for the system (e.g. with many Kubernetes 1.5 or earlier installs) you can run with
If you've got access to the insecure API port and would like to run against that, you can run with
Running Additional OptionsFor the API server based checking there are a couple of additional options which can be supplied to extract additional information from the cluster.
CIS AuditIf you want to do some CIS audit checks against the server (carried out at the Kubernetes 1.8 version of the standard), add Agent ChecksWarning: Experimental The This will also slow things down a bit (depending on your network/cluster speed) ReportingThere are two reporting modes available, JSON and HTML. The HTML is intended for humans to read and the JSON for input to other tools. The HTML report should looks something like this. Technical Background - ApproachThere's two parts currently implemented by this tool, both wrapped in a ruby gem. The first element takes the approach of extracting the command lines used to start the relevant containers (e.g. API Server, Scheduler etc) from the API and check them against the relevant sections of the standard. This is possible via the API server as the spec. of each container contains the command line executed. At the moment Kubernetes doesn't have any form of API to query it's launch parameters, so this seems like the best approach. This approach has some limitations but has the advantage of working from anywhere that has access to the API server (so doesn't need deployment on the actual nodes themselves). In addition to that we've got an agent based approach for checks on the nodes, like file permission and kubelet checks. The agent can get deployed via the Kubernetes API and then complete it's checks and place the results in the pod log which can then be read in by the script and parsed. This is a bit on the hacky side but avoids the necessity for any form of network communications from the agent to the running script, which could well be complex. One of the challenges with scripting these checks is that there are many different Kubernetes distributions, and each one does things differently, so implementing a generic script that covers them all would be tricky. We're working off kubeadm as a base, but ideally we'll get it working with as many distributions as possible. Additional Vulnerability ChecksWe're starting to implement checks for common Kubernetes vulnerabilities. Some of these can be derived from the CIS compliance checks, but in order to get more of a chance of picking them up, we're implementing direct checks as well.
Tested With
The switch for adding agent based checking is TODO
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论