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

遵循CIS Docker Benchmarks規(guī)范的開源巡檢腳本

開源
CIS[1]即Center for Internet Security (CIS) 為安全基準計劃提供了定義明確、公正、基于一致性的行業(yè)最佳實踐來幫助組織評估和增強其安全性。

 [[421322]]

本文轉載自微信公眾號「云原生生態(tài)圈」,作者Marionxue。轉載本文請聯(lián)系云原生生態(tài)圈公眾號。

1CIS是什么?

CIS[1]即Center for Internet Security (CIS) 為安全基準計劃提供了定義明確、公正、基于一致性的行業(yè)最佳實踐來幫助組織評估和增強其安全性

2Docker Bench Security

Docker Bench for Security[2]是一個開源的腳本。它是基于CIS Docker Benchmark v1.3.1[3]規(guī)范的,用于自動化巡檢在生產環(huán)境中運行Docker容器的數(shù)十種常見的最佳實踐的腳本。

通過調用tests目錄的以下腳本進行巡檢, 具體的巡檢的內容可以參考的腳本的內容。

  1. 1_host_configuration.sh 
  2. 2_docker_daemon_configuration.sh 
  3. 3_docker_daemon_configuration_files.sh 
  4. 4_container_images.sh 
  5. 5_container_runtime.sh 
  6. 6_docker_security_operations.sh 
  7. 7_docker_swarm_configuration.sh 
  8. 8_docker_enterprise_configuration.sh 
  9. 99_community_checks.sh 

在docker-bench-security中可以通過修改functions中的腳本選擇檢查的項,也可以通過命令行選項排除不需要檢查的項,下面看下支持的命令行選項.

3命令選項

docker-bench-security

  1. -b       可選   Do not print colors 不打印顏色 
  2. -h     可選   Print this help message 打印幫助信息 
  3. -l FILE  可選   Log output in FILE, inside container if run using docker 日志輸出文件,如果使用docker運行,在容器內部 
  4. -u USERS 可選   Comma delimited list of trusted docker user(s) 以逗號分隔的受信任docker用戶列表 
  5. -c CHECK 可選   Comma delimited list of specific check(s) id 以逗號分隔的指定檢查id列表 
  6. -e CHECK 可選   Comma delimited list of specific check(s) id to exclude 要排除的以逗號分隔的檢查id列表 
  7. -i INCLUDE 可選 Comma delimited list of patterns within a container or image name to check 以逗號分隔的容器或圖像名稱中的模式列表 
  8. -x EXCLUDE 可選 Comma delimited list of patterns within a container or image name to exclude from check 容器或圖像名稱中要排除的以逗號分隔的模式列表 
  9. -n LIMIT   可選 In JSON outputwhen reporting lists of items (containers, images, etc.), limit the number of reported items to LIMIT. Default 0 (no limit). 
  10.  在JSON輸出中,當報告項目列表(容器,圖像等)時,限制報告項目的數(shù)量為LIMIT。默認0(無限制)。 
  11. -p PRINT   可選 Disable the printing of remediation measures. Default: print remediation measures. 禁用打印補救措施。默認值:打印補救措施。 

每個CIS巡檢項在腳本中是以check_<section>_<number>格式命名的. 如果要排除某項檢查可以使用

 

  1. sh docker-bench-security.sh -e check_2_2 # 表示檢查所有,除了check_2_2(2.2 Ensure the logging level is set to 'info'

也可以只檢查某項

  1. sh docker-bench-security.sh -c check_2_2 

使用很簡單。

在使用的時候可以通過--help查看支持的命令行選項,我在使用的時候發(fā)現(xiàn)docker鏡像中支持的與git倉庫中寫的不一致,當然你可以自己打一個鏡像。

構建鏡像

  1. git clone https://github.com/docker/docker-bench-security.git 
  2. cd docker-bench-security 
  3. docker build --no-cache -t docker-bench-security . 

下面是在Mac上執(zhí)行一次巡檢的Demo.

Docker Desktop for Mac

  1. docker run --rm --net host --pid host --userns host --cap-add audit_control \ 
  2.     -e DOCKER_CONTENT_TRUST=$DOCKER_CONTENT_TRUST \ 
  3.     -v /var/lib:/var/lib:ro \ 
  4.     -v /var/run/docker.sock:/var/run/docker.sock:ro \ 
  5.     -v `pwd`:/usr/local/bin/log/ \ 
  6.     --label docker_bench_security \ 
  7.     docker/docker-bench-security -t devops.v1 
  8. ------------------------------------------------------------------------------ 
  9. # Docker Bench for Security v1.3.4 
  10. # Docker, Inc. (c) 2015- 
  11. # Checks for dozens of common best-practices around deploying Docker containers in production. 
  12. # Inspired by the CIS Docker Community Edition Benchmark v1.1.0. 
  13. ------------------------------------------------------------------------------ 
  14.  
  15. Initializing Thu Sep  2 04:55:59 UTC 2021 
  16.  
  17. Looking for image devops.v1 
  18.  
  19. [INFO] 1 - Host Configuration 
  20. [WARN] 1.1  - Ensure a separate partition for containers has been created 
  21. [NOTE] 1.2  - Ensure the container host has been Hardened 
  22. ....[省略省略過多內容] 
  23. [PASS] 7.10  - Ensure management plane traffic has been separated from data plane traffic (Swarm mode not enabled) 
  24.  
  25. [INFO] Checks: 105 
  26. [INFO] Score: 7 

參考資料

[1]Center for Internet Security (CIS): https://www.cisecurity.org/

[2]Docker bench security: https://github.com/docker/docker-bench-security

[3]CIS Docker Benchmark: https://www.cisecurity.org/benchmark/docker/

 

 

責任編輯:武曉燕 來源: 云原生生態(tài)圈
相關推薦

2021-11-22 10:40:35

Linux腳本內存

2023-08-02 11:39:21

SSL證書過期

2025-04-02 09:10:00

LinuxShell腳本

2024-04-09 08:55:54

MySQL產品模型

2025-03-19 09:47:08

Shell服務器腳本

2021-11-16 07:26:05

開源項目規(guī)范

2019-08-12 08:47:14

腳本語言數(shù)據(jù)庫MySQL

2011-05-03 10:14:10

掃描儀CCD技術CIS技術

2023-03-20 07:23:45

Docker開源存儲庫

2025-02-14 10:36:37

2012-09-10 09:22:07

PHP項目開源

2019-07-31 08:03:45

Oracle數(shù)據(jù)庫巡檢腳本

2011-03-11 17:00:08

SQL

2011-08-04 08:45:40

FTTH分光器

2011-05-07 08:35:22

PHP

2019-12-16 15:16:29

工具代碼開發(fā)

2019-10-21 10:01:55

CIS關鍵安全控制清單網絡安全

2020-01-02 14:25:50

工具代碼開發(fā)

2019-04-22 08:31:00

Docker容器工具

2020-04-16 21:02:35

前端命名規(guī)范html規(guī)范
點贊
收藏

51CTO技術棧公眾號