国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具

這篇具有很好參考價(jià)值的文章主要介紹了kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

開(kāi)頭語(yǔ)

寫在前面:如有問(wèn)題,以你為準(zhǔn),

目前24年應(yīng)屆生,各位大佬輕噴,部分資料與圖片來(lái)自網(wǎng)絡(luò)

內(nèi)容較長(zhǎng),頁(yè)面右上角目錄方便跳轉(zhuǎn)

CIS 介紹

問(wèn)題:下載pdf后,根據(jù)里面的基準(zhǔn)來(lái)檢查K8s集群配置,但內(nèi)容量太大,一般會(huì)采用相關(guān)工具來(lái)完成這項(xiàng)工作。

Kube-bench是容器安全廠商Aquq推出的工具,以CISK8s基準(zhǔn)作為基礎(chǔ),來(lái)檢查K8s是否安全部署。

主要查找不安全的配置參數(shù)、敏感的文件權(quán)限、不安全的帳戶或公開(kāi)端口等等。

kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具,kubernetes,kubernetes,安全,容器,云原生,運(yùn)維

可以獲得各種操作系統(tǒng)的安全最佳實(shí)踐基準(zhǔn)

kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具,kubernetes,kubernetes,安全,容器,云原生,運(yùn)維

kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具,kubernetes,kubernetes,安全,容器,云原生,運(yùn)維

Kube-bench

GitHub - aquasecurity/kube-bench: Checks whether Kubernetes is deployed according to security best practices as defined in the CIS Kubernetes Benchmark

[root@master kube-bench]# ls

kube-bench_0.6.12_linux_amd64.tar.gz

[root@master kube-bench]# tar -xvf kube-bench_0.6.12_linux_amd64.tar.gz

cfg/ack-1.0/config.yaml

cfg/ack-1.0/controlplane.yaml

cfg/ack-1.0/etcd.yaml

...

[root@master kube-bench]# ls

cfg? kube-bench? kube-bench_0.6.12_linux_amd64.tar.gz

[root@master kube-bench]# cd cfg/

[root@master cfg]# ls

ack-1.0? cis-1.20? cis-1.24? cis-1.6????? config.yaml? eks-1.1.0???????????????? gke-1.0??? rh-0.7

aks-1.0? cis-1.23? cis-1.5?? cis-1.6-k3s? eks-1.0.1??? eks-stig-kubernetes-v1r6? gke-1.2.0? rh-1.0

另創(chuàng)目錄

mkdir /etc/kube-bench

mv cfg? kube-bench? /etc/kube-bench/

[root@master kube-bench]# cd /etc/kube-bench/

[root@master kube-bench]# cp kube-bench /bin

命令介紹

kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具,kubernetes,kubernetes,安全,容器,云原生,運(yùn)維

https://github.com/aquasecurity/kube-bench/blob/main/docs/platforms.md

[root@master cfg]# kube-bench help

This tool runs the CIS Kubernetes Benchmark (https://www.cisecurity.org/benchmark/kubernetes/)



Usage:

? kube-bench [flags]

? kube-bench [command]



Available Commands:

? completion? Generate the autocompletion script for the specified shell

? help??????? Help about any command

? run???????? Run tests

? version???? Shows the version of kube-bench.



Flags:

????? --alsologtostderr????????????????? log to standard error as well as files

...

kube-bench run 常用參數(shù):

-s,--targets 指定要基礎(chǔ)測(cè)試的目標(biāo),這個(gè)目標(biāo)需要匹配cfg/<version>中的

文件名稱,已有目標(biāo):master,controlplane,node,etcd,policies

--version: 指定k8s版本,如果未指定會(huì)自動(dòng)檢測(cè)

--benchmark:手動(dòng)指定CIS基準(zhǔn)版本,不能與--version一起使用

檢查源代碼

kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具,kubernetes,kubernetes,安全,容器,云原生,運(yùn)維

kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具,kubernetes,kubernetes,安全,容器,云原生,運(yùn)維

type 可以手動(dòng)設(shè)置來(lái)讓其跳過(guò)某一項(xiàng)檢測(cè)

手動(dòng)跳過(guò)某項(xiàng)檢測(cè)

--profiling 最新版本被棄用了kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具,kubernetes,kubernetes,安全,容器,云原生,運(yùn)維

kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具,kubernetes,kubernetes,安全,容器,云原生,運(yùn)維重新執(zhí)行檢測(cè)

kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具,kubernetes,kubernetes,安全,容器,云原生,運(yùn)維

匯總信息輸出

kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具,kubernetes,kubernetes,安全,容器,云原生,運(yùn)維

運(yùn)行原理

通過(guò) cfg 文件下的 cis-1.24 目錄中的yaml 進(jìn)行檢測(cè)(簡(jiǎn)單的配置比對(duì))

cis-1.24是根據(jù)cis安全基準(zhǔn)來(lái)的

修復(fù)

檢測(cè) master
[root@master cfg]# ls

ack-1.0? cis-1.20? cis-1.24? cis-1.6????? config.yaml? eks-1.1.0???????????????? gke-1.0??? rh-0.7

aks-1.0? cis-1.23? cis-1.5?? cis-1.6-k3s? eks-1.0.1??? eks-stig-kubernetes-v1r6? gke-1.2.0? rh-1.0

[root@master cis-1.24]# ls

config.yaml? controlplane.yaml? etcd.yaml? master.yaml? node.yaml? policies.yaml

這些就是cis的手冊(cè)安全配置,通過(guò)這些配置進(jìn)行檢測(cè)集群
[root@master cfg]# kube-bench run --targets=master

[INFO] 1 Control Plane Security Configuration



[INFO] 1.1 Control Plane Node Configuration Files

[PASS] 1.1.1 Ensure that the API server pod specification file permissions are set to 644 or more restrictive (Automated)

[PASS] 1.1.2 Ensure that the API server pod specification file ownership is set to root:root (Automated)

[PASS] 1.1.3 Ensure that the controller manager pod specification file permissions are set to 600 or more restrictive (Automated)

[PASS] 1.1.4 Ensure that the controller manager pod specification file ownership is set to root:root (Automated)

[PASS] 1.1.5 Ensure that the scheduler pod specification file permissions are set to 600 or more restrictive (Automated)

[PASS] 1.1.6 Ensure that the scheduler pod specification file ownership is set to root:root (Automated)

[PASS] 1.1.7 Ensure that the etcd pod specification file permissions are set to 600 or more restrictive (Automated)

[PASS] 1.1.8 Ensure that the etcd pod specification file ownership is set to root:root (Automated)

[WARN] 1.1.9 Ensure that the Container Network Interface file permissions are set to 600 or more restrictive (Manual)

[WARN] 1.1.10 Ensure that the Container Network Interface file ownership is set to root:root (Manual)

[PASS] 1.1.11 Ensure that the etcd data directory permissions are set to 700 or more restrictive (Automated)

[FAIL] 1.1.12 Ensure that the etcd data directory ownership is set to etcd:etcd (Automated)

[PASS] 1.1.13 Ensure that the admin.conf file permissions are set to 600 or more restrictive (Automated)

....

== Remediations master ==

.....



== Summary master ==

40 checks PASS

9 checks FAIL

12 checks WARN

0 checks INFO



== Summary total ==

40 checks PASS

9 checks FAIL

12 checks WARN

0 checks INFO

[PASS]: 測(cè)試通過(guò)

[FAIL]: 測(cè)試未通過(guò),重點(diǎn)關(guān)注,在測(cè)試結(jié)果會(huì)給出修復(fù)建議

[WARN]: 警告,可做了解

[INFO]: 信息
決安全問(wèn)題

將沒(méi)有通過(guò)篩選出來(lái)

[FAIL] 1.1.12 Ensure that the etcd data directory ownership is set to etcd:etcd (Automated)

[FAIL] 1.2.5 Ensure that the --kubelet-certificate-authority argument is set as appropriate (Automated)

[FAIL] 1.2.17 Ensure that the --profiling argument is set to false (Automated)

[FAIL] 1.2.18 Ensure that the --audit-log-path argument is set (Automated)

[FAIL] 1.2.19 Ensure that the --audit-log-maxage argument is set to 30 or as appropriate (Automated)

[FAIL] 1.2.20 Ensure that the --audit-log-maxbackup argument is set to 10 or as appropriate (Automated)

[FAIL] 1.2.21 Ensure that the --audit-log-maxsize argument is set to 100 or as appropriate (Automated)
== Remediations master == # 下面就會(huì)有解決方法

1.1.12 On the etcd server node, get the etcd data directory, passed as an argument --data-dir,

from the command 'ps -ef | grep etcd'.

Run the below command (based on the etcd data directory found above).

For example, chown etcd:etcd /var/lib/etcd

[root@master cis-1.24]# ps -ef | grep etcd | grep data-dir

root??????? 3466??? 3420? 1 Feb23 ???????? 08:48:04 etcd --advertise-client-urls=https://192.168.100.53:2379 --cert-file=/etc/kubernetes/pki/etcd/server.crt --client-cert-auth=true --data-dir=/var/lib/etcd

[root@master cis-1.24]# ll /var/lib/etcd

total 0

drwx------. 4 root root 29 Feb? 2 07:11 member

# 注意etcd現(xiàn)在是pod部署,所有這個(gè)項(xiàng)安全不需要改

[FAIL] 1.2.17 Ensure that the --profiling argument is set to false (Automated)

1.2.17 Edit the API server pod specification file /etc/kubernetes/manifests/kube-apiserver.yaml

on the control plane node and set the below parameter.

--profiling=false
# 配置文件進(jìn)行備份

[root@master manifests]# cp kube-apiserver.yaml kube-apiserver.yaml.bak

# 進(jìn)行修改添加字段

[root@master manifests]# vim kube-apiserver.yaml

spec:

? containers:

? - command:

??? - --tls-cert-file=/etc/kubernetes/pki/apiserver.crt

??? - --tls-private-key-file=/etc/kubernetes/pki/apiserver.key

??? - --enable-aggregator-routing=true

??? - --profiling=false #在最下添加這個(gè)字段

[root@master manifests]# systemctl restart kubelet

[root@master manifests]# kubectl get node

NAME???? STATUS?? ROLES?????????? AGE?? VERSION

master?? Ready??? control-plane?? 42d?? v1.26.1

node1??? Ready??? <none>????????? 42d?? v1.26.1

node2??? Ready??? <none>????????? 42d?? v1.26.1

# 再使用 kube-bench 進(jìn)行檢測(cè),注意需要第一次可能還不通過(guò),多執(zhí)行幾次

[root@master cfg]# kube-bench run --targets=master

[PASS] 1.2.17 Ensure that the admission control plugin NodeRestriction is set (Automated)

# 如果沒(méi)成功是因?yàn)?bak文件在這個(gè)目錄下,不知道為什么kuberneter會(huì)識(shí)別bak結(jié)尾的文件

# 創(chuàng)建一個(gè)backup目錄,然后將備份的yaml移動(dòng)進(jìn)去,就解決了

# 原因:是不是全文件名匹配(強(qiáng)匹配),可能是kube-apiserver*這種,所以會(huì)導(dǎo)致在后面加.bak依舊被識(shí)別
檢測(cè) node

需要將kube-bench也在node上使用,并將命令改為(node上執(zhí)行)

./kube-bench run --targets node --benchmark cis-1.24文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-787611.html

到了這里,關(guān)于kubernetes CIS 安全基準(zhǔn) Kube-bench 安全工具的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 【云原生】容器編排工具Kubernetes

    【云原生】容器編排工具Kubernetes

    目錄 一、 K8S介紹 官網(wǎng)地址: 1.1docker編排與k8s編排相比 1.2特性 1.3功能 二、K8S重要組件 2.1核心組件 (1)Kube-apiserver (2)Kube-controller-manager (3)Kube-scheduler (4)Node ①kubelet ②kube-proxy ③docker (5)etcd 2.2Kubernetes工作原理 三、Pod 3.1 Pod控制器 (1)Deployment (2)ReplicaSet (3)

    2024年02月09日
    瀏覽(32)
  • 【云原生】Kubernetes容器編排工具

    【云原生】Kubernetes容器編排工具

    目錄 1. K8S介紹 1.1 k8s的由來(lái) 下載地址 1.2 docker編排與k8s編排相比 1.3 傳統(tǒng)后端部署與k8s 的對(duì)比 傳統(tǒng)部署 k8s部署? ?2. k8s的集群架構(gòu)與組件 (1) Kube-apiserver (2)Kube-controller-manager? (3)Kube-scheduler?? 2.2?k8s的配置存儲(chǔ)中心 2.3? k8s的Node 組件? ?(1)Kubelet? ?(2)Kube-Proxy?

    2024年02月10日
    瀏覽(23)
  • kubernetes--安全沙箱運(yùn)行容器gVisor

    kubernetes--安全沙箱運(yùn)行容器gVisor

    ? ?????? 所知,容器的應(yīng)用程序可以直接訪問(wèn)Linux內(nèi)核的系統(tǒng)調(diào)用,容器在安全隔離上還是比較弱,雖然內(nèi)核在不斷的增強(qiáng)自身的安全特性,但由于內(nèi)核自身代碼極端復(fù)雜,CVE漏洞層出不窮。 ?????? 所以要想減少這方面安全風(fēng)險(xiǎn),就是做好安全隔離,阻斷容器內(nèi)程序?qū)?/p>

    2024年02月16日
    瀏覽(20)
  • kubernetes gVisor 安全沙箱運(yùn)行容器(RuntimeClass)

    kubernetes gVisor 安全沙箱運(yùn)行容器(RuntimeClass)

    開(kāi)頭語(yǔ) 寫在前面:如有問(wèn)題,以你為準(zhǔn), 目前24年應(yīng)屆生,各位大佬輕噴,部分資料與圖片來(lái)自網(wǎng)絡(luò) 內(nèi)容較長(zhǎng),頁(yè)面右上角目錄方便跳轉(zhuǎn) 容器的應(yīng)用程序可以直接訪問(wèn)Liux內(nèi)核的系統(tǒng)調(diào)用,容器在安全隔離上還是比較弱,雖然 內(nèi)核在不斷地增強(qiáng)自身的安全特性,但由于內(nèi)核

    2024年01月18日
    瀏覽(49)
  • kubernetes和容器安全的7個(gè)關(guān)鍵特性

    Uptycs結(jié)合了針對(duì)Kubernetes和容器運(yùn)行時(shí)的威脅檢測(cè),自動(dòng)注冊(cè)表掃描和Kubernetes硬化檢查。 許多組織正在開(kāi)始他們的Kubernetes和容器之旅,而其他組織在擴(kuò)展部署規(guī)模時(shí)遇到了復(fù)雜性問(wèn)題。容器化應(yīng)用程序帶來(lái)了許多好處,但也引入了新類型的安全挑戰(zhàn)。 Uptycs通過(guò)將威脅、漏洞

    2024年02月09日
    瀏覽(17)
  • 測(cè)試工具ab(apache bench)

    測(cè)試工具ab(apache bench)

    在使用ab壓力測(cè)試工具之前,首先我們要了解幾個(gè)關(guān)于壓力測(cè)試的概念 吞吐率 概念:服務(wù)器并發(fā)處理能力的量化描述,單位是reqs/s,指的是某個(gè)并發(fā)用戶數(shù)下單位時(shí)間內(nèi)處理的請(qǐng)求數(shù)。某個(gè)并發(fā)用戶數(shù)下單位時(shí)間內(nèi)能處理的最大請(qǐng)求數(shù),稱之為最大吞吐率。 計(jì)算公式:總請(qǐng)

    2024年01月16日
    瀏覽(17)
  • 容器編排工具的比較:Kubernetes、Docker Swarm、Nomad

    容器編排工具的比較:Kubernetes、Docker Swarm、Nomad

    隨著容器化技術(shù)的普及,容器編排工具成為了現(xiàn)代應(yīng)用部署和管理的重要組成部分。容器編排工具能夠自動(dòng)化容器的部署、擴(kuò)展和管理,從而提高應(yīng)用的可靠性和可伸縮性。在眾多的容器編排工具中,Kubernetes、Docker Swarm和Nomad是三個(gè)備受關(guān)注的主要候選。本文將對(duì)這三個(gè)工具

    2024年02月09日
    瀏覽(31)
  • Kubernetes 漫游:kube-scheduler

    什么是 kube-scheduler ? Kubernetes 集群的核心組件之一,它負(fù)責(zé)為新創(chuàng)建的 Pods 分配節(jié)點(diǎn)。它根據(jù)多種因素進(jìn)行決策,包括: 資源需求和限制 :考慮每個(gè) Pod 請(qǐng)求的資源量(如 CPU 和內(nèi)存)以及節(jié)點(diǎn)上可用的資源。 親和性和反親和性規(guī)則 :根據(jù) Pod 的親和性設(shè)置選擇最適合的節(jié)點(diǎn)

    2024年02月05日
    瀏覽(22)
  • Kubernetes VS Docker Swarm:選擇適合自己的容器編排工具

    容器編排工具是一種自動(dòng)化部署和管理容器的工具。 利用容器編排工具可以方便地解決容器化應(yīng)用程序的部署、擴(kuò)展和高可用性等問(wèn)題。 Kubernetes 和 Docker Swarm 是目前最流行的兩個(gè)容器編排工具,因此選用它們來(lái)進(jìn)行比較。 1.1 Kubernetes 的來(lái)源和發(fā)展背景 Kubernetes 源于 Google 的

    2024年02月06日
    瀏覽(16)
  • 容器安全 - 利用容器的特權(quán)配置實(shí)現(xiàn)對(duì)Kubernetes攻擊,以及如何使用 PSA 防范風(fēng)險(xiǎn)(視頻)

    《OpenShift / RHEL / DevSecOps 匯總目錄》 通過(guò)將運(yùn)行 Pod 的 privileged 設(shè)為 true,容器就以特權(quán)模式運(yùn)行在宿主機(jī)上。和普通容器相比,特權(quán)容器具有非常大的權(quán)限和能力。 容器被賦予所有能力 不屏蔽敏感路徑,例如 sysfs 中的 kernel 模塊 within Any sysfs and procfs mounts are mounted RW AppArm

    2024年02月04日
    瀏覽(15)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包