自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Kubernetes 資源清單靜態(tài)分析工具 - KubeLinter

開源
KubeLinter 是一種開源靜態(tài)分析工具,用于識別 Kubernetes 對象中的錯誤配置。KubeLinter 提供了對 Kubernetes YAML 文件和 Helm Chart 的安全檢查的能力,驗證集群配置是否遵循最佳安全實踐。

KubeLinter 是一種開源靜態(tài)分析工具,用于識別 Kubernetes 對象中的錯誤配置。KubeLinter 提供了對 Kubernetes YAML 文件和 Helm Chart 的安全檢查的能力,驗證集群配置是否遵循最佳安全實踐。通過內(nèi)置檢查,可以獲得有關(guān)錯誤配置和違反 Kubernetes 策略的反饋。這提高了開發(fā)人員的工作效率,將安全即代碼與 DevOps 和 DevSecOps 流程集成,同時確保為 Kubernetes 應(yīng)用程序自動實施強化的安全策略。

KubeLinter 分析 YAML 文件和 Helm Chart 并運行 Kubernetes 原生安全檢查,以識別提升的訪問權(quán)限、錯誤配置和一般的最佳實踐違規(guī)行為。KubeLinter 是一個基于 Go 的二進制文件,用于命令行或 CI 管道的一部分,并在允許任何 Kubernetes 配置更改之前為開發(fā)人員提供必要的安全檢查。目前,CLI 中內(nèi)置了 19 項安全檢查,包括:

  • 使用默認ServiceAccount
  • 不匹配的選擇器
  • 以 root 身份運行容器
  • 設(shè)置可寫的 host 主機掛載

安裝 KubeLinter

使用 Go 安裝

  1. GO111MODULE=on go get golang.stackrox.io/kube-linter/cmd/kube-linter 

或者直接從 Release 頁面(https://github.com/stackrox/kube-linter/releases/tag/0.2.2)下載最新的二進制文件添加到 PATH 路徑下即可。

使用 brew 安裝

在 macOS 下使用 Homebrew 或者在 Linux 下使用 LinuxBrew 安裝:

  1. brew install kube-linter 

使用 KubeLinter

運行 KubeLinter 對 YAML 文件進行 Lint 只需要最基本的兩個步驟即可:

1. 找到您要測試安全性和生產(chǎn)就緒最佳實踐的 YAML 文件

2. 執(zhí)行命令 kube-linter lint /path/to/your/yaml.yaml

例如下面的的 pod.yaml 資源文件,該文件存在幾個問題:

安全問題

1. 這個 pod 中的容器不是作為只讀文件系統(tǒng)運行的,這可能允許它寫入 root 文件系統(tǒng)。

生產(chǎn)就緒

1. 容器的 CPU 限制未設(shè)置,這可能會使其消耗過多的 CPU2. 未設(shè)置容器的內(nèi)存限制,這可能會使其消耗過多內(nèi)存

  1. apiVersion: v1 
  2. kind: Pod 
  3. metadata: 
  4. name: security-context-demo 
  5. spec: 
  6. securityContext: 
  7.     runAsUser: 1000 
  8.     runAsGroup: 3000 
  9.     fsGroup: 2000 
  10. volumes: 
  11. name: sec-ctx-vol 
  12.     emptyDir: {} 
  13. containers: 
  14. name: sec-ctx-demo 
  15.     image: busybox 
  16.     resources: 
  17.     requests: 
  18.         memory: "64Mi" 
  19.         cpu: "250m" 
  20.     command: [ "sh""-c""sleep 1h" ] 
  21.     volumeMounts: 
  22.     - name: sec-ctx-vol 
  23.     mountPath: /data/demo 
  24.     securityContext: 
  25.     allowPrivilegeEscalation: false 

3. 拷貝上面的 pod.yaml 文件執(zhí)行下面的命令進行 lint

  1. kube-linter lint pod.yaml 

4. KubeLinter 運行默認檢查,會輸出如下所示的結(jié)果

  1. pod.yaml: (object: <no namespace>/security-context-demo /v1, Kind=Pod) container "sec-ctx-demo" does not have a read-only root file system (checkno-read-only-root-fs, remediation: Set readOnlyRootFilesystem to true in your container's securityContext.) 
  2.  
  3. pod.yaml: (object: <no namespace>/security-context-demo /v1, Kind=Pod) container "sec-ctx-demo" has cpu limit 0 (check: unset-cpu-requirements, remediation: Set    your container's CPU requests and limits depending on its requirements. See    https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/   #requests-and-limits for more details.) 
  4.  
  5. pod.yaml: (object: <no namespace>/security-context-demo /v1, Kind=Pod) container "sec-ctx-demo" has memory limit 0 (check: unset-memory-requirements, remediation:    Set your container's memory requests and limits depending on its requirements.    See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/   #requests-and-limits for more details.) 
  6.  
  7. Error: found 3 lint errors 

 

責(zé)任編輯:姜華 來源: Github愛好者
相關(guān)推薦

2020-11-17 09:27:26

KubernetesYAMLKubeLinter

2021-06-08 13:56:34

工具靜態(tài)代碼

2020-11-23 08:48:00

Kubernetes容器開發(fā)

2016-05-17 13:54:05

2022-12-13 15:42:56

Clang-Tidy靜態(tài)分析工具

2022-12-09 15:38:54

Cppcheck靜態(tài)分析工具

2024-11-15 08:30:23

2023-05-31 08:12:26

Kubernete資源分配工具

2016-03-29 14:54:36

2017-05-10 14:27:29

靜態(tài)代碼漏洞安全

2012-05-22 00:28:21

JavaJava開源開源工具

2023-10-04 18:24:54

wpf動態(tài)資源

2021-02-22 08:29:03

KubernetesKubectl Fla應(yīng)用

2015-11-16 15:37:13

編排工具集群管理對比

2013-10-31 11:08:15

2020-07-31 07:00:00

Kubernetes容器Linux

2022-03-24 08:04:50

Kubernetes資源限制

2020-12-22 08:00:00

開發(fā)分析工具

2021-01-05 09:25:27

DockerSemgrep代碼靜態(tài)分析工具

2024-01-08 13:47:00

代碼分析工具
點贊
收藏

51CTO技術(shù)棧公眾號