<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12
      Fork me on GitHub

      容器安全之 Dockerfile 安全掃描

      一、Dockerfile 掃描工具

      • checkov
      • hadolint(構(gòu)建最佳實(shí)踐Docker 鏡像。)
      • 也可以考慮 docker scan

      二、checkov

      Dockerfile Configuration Scaning-checkov

      checkov 不僅可以掃描dockfile, 也可以掃描 CloudformationAWS SAMKubernetesHelm chartsKustomize 、鏡像等。

      Checkov 支持對 Dockerfile 文件的策略進(jìn)行評估。 使用 checkov 掃描包含 Dockerfile 的目錄時(shí),它將驗(yàn)證該文件是否符合 Docker 最佳實(shí)踐,例如不使用 root 用戶、確保運(yùn)行狀況檢查存在以及不公開 SSH 端口。

      可以在此處找到 Dockerfile 策略檢查的完整列表。

      2.1、示例配置錯(cuò)誤的 Dockerfile

      FROM node:alpine
      WORKDIR /usr/src/app
      COPY package*.json ./
      RUN npm install
      COPY . .
      EXPOSE 3000 22
      HEALTHCHECK CMD curl --fail http://localhost:3000 || exit 1
      USER root
      CMD ["node","app.js"]
      

      2.2、安裝

      Requirements

      • Python >= 3.7 (Data classes are available for Python 3.7+)
      • Terraform >= 0.12
      pip3 install checkov   -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
      

      2.3、在 CLI 中運(yùn)行

      checkov -d . --framework dockerfile
      

      2.4、示例輸出

      # checkov -d . --framework dockerfile
      [ dockerfile framework ]: 100%|████████████████████|[1/1], Current File Scanned=..\..\..\..\Dockerfile
      
      
             _               _
         ___| |__   ___  ___| | _______   __
        / __| '_ \ / _ \/ __| |/ / _ \ \ / /
       | (__| | | |  __/ (__|   < (_) \ V /
        \___|_| |_|\___|\___|_|\_\___/ \_/
      
      By bridgecrew.io | version: 2.3.102
      Update available 2.3.102 -> 2.3.121
      Run pip3 install -U checkov to update
      
      
      dockerfile scan results:
      
      Passed checks: 21, Failed checks: 2, Skipped checks: 0
      
      Check: CKV_DOCKER_11: "Ensure From Alias are unique for multistage builds."
              PASSED for resource: /Dockerfile.
              File: /Dockerfile:1-9
              Guide: https://docs.bridgecrew.io/docs/ensure-docker-from-alias-is-unique-for-multistage-builds
      Check: CKV_DOCKER_7: "Ensure the base image uses a non latest version tag"
              PASSED for resource: /Dockerfile.
              File: /Dockerfile:1-9
              Guide: https://docs.bridgecrew.io/docs/ensure-the-base-image-uses-a-non-latest-version-tag
      Check: CKV_DOCKER_9: "Ensure that APT isn't used"
              PASSED for resource: /Dockerfile.
              File: /Dockerfile:1-9
              Guide: https://docs.bridgecrew.io/docs/ensure-docker-apt-is-not-used
      Check: CKV_DOCKER_5: "Ensure update instructions are not use alone in the Dockerfile"
              PASSED for resource: /Dockerfile.
              File: /Dockerfile:1-9
              Guide: https://docs.bridgecrew.io/docs/ensure-update-instructions-are-not-used-alone-in-the-dockerfile
      Check: CKV_DOCKER_10: "Ensure that WORKDIR values are absolute paths"
              PASSED for resource: /Dockerfile.
              File: /Dockerfile:1-9
              Guide: https://docs.bridgecrew.io/docs/ensure-docker-workdir-values-are-absolute-paths
      Check: CKV_DOCKER_2: "Ensure that HEALTHCHECK instructions have been added to container images"
              PASSED for resource: /Dockerfile.HEALTHCHECK
              File: /Dockerfile:7-7
              Guide: https://docs.bridgecrew.io/docs/ensure-that-healthcheck-instructions-have-been-added-to-container-images
      Check: CKV_DOCKER_3: "Ensure that a user for the container has been created"
              PASSED for resource: /Dockerfile.USER
              File: /Dockerfile:8-8
              Guide: https://docs.bridgecrew.io/docs/ensure-that-a-user-for-the-container-has-been-created
      Check: CKV2_DOCKER_14: "Ensure that certificate validation isn't disabled for git by setting the environment variable 'GIT_SSL_NO_VERIFY' to any value"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_6: "Ensure that certificate validation isn't disabled with the NODE_TLS_REJECT_UNAUTHORIZED environmnet variable"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_12: "Ensure that certificate validation isn't disabled for npm via the 'NPM_CONFIG_STRICT_SSL' environmnet variable"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_5: "Ensure that certificate validation isn't disabled with the PYTHONHTTPSVERIFY environmnet variable"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_7: "Ensure that packages with untrusted or missing signatures are not used by apk via the '--allow-untrusted' option"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_11: "Ensure that the '--force-yes' option is not used, as it disables signature validation and allows packages to be downgraded which can leave the system in a broken or inconsistent state"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_8: "Ensure that packages with untrusted or missing signatures are not used by apt-get via the '--allow-unauthenticated' option"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_13: "Ensure that certificate validation isn't disabled for npm or yarn by setting the option strict-ssl to false"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_4: "Ensure that certificate validation isn't disabled with the pip '--trusted-host' option"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_10: "Ensure that packages with untrusted or missing signatures are not used by rpm via the '--nodigest', '--nosignature', '--noverify', or '--nofiledigest' options"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_2: "Ensure that certificate validation isn't disabled with curl"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_3: "Ensure that certificate validation isn't disabled with wget"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_1: "Ensure that sudo isn't used"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV2_DOCKER_9: "Ensure that packages with untrusted or missing GPG signatures are not used by dnf, tdnf, or yum via the '--nogpgcheck' option"
              PASSED for resource: /Dockerfile.RUN
              File: /Dockerfile:4-4
      Check: CKV_DOCKER_1: "Ensure port 22 is not exposed"
              FAILED for resource: /Dockerfile.EXPOSE
              File: /Dockerfile:6-6
              Guide: https://docs.bridgecrew.io/docs/ensure-port-22-is-not-exposed
      
                      6 | EXPOSE 3000 22
      
      Check: CKV_DOCKER_8: "Ensure the last USER is not root"
              FAILED for resource: /Dockerfile.USER
              File: /Dockerfile:8-8
              Guide: https://docs.bridgecrew.io/docs/ensure-the-last-user-is-not-root
      
                      8 | USER root
      

      三、hadolint

      GitHub - hadolint/hadolint: Dockerfile linter, validate inline bash, 用 Haskell 編寫

      3.1、在線網(wǎng)站

      Dockerfile Linter (hadolint.github.io)

      3.2、DockerFile

      FROM node:alpine
      WORKDIR /usr/src/app
      COPY package*.json ./
      RUN npm install
      COPY . .
      EXPOSE 3000 22
      HEALTHCHECK CMD curl --fail http://localhost:3000 || exit 1
      USER root
      CMD ["node","app.js"]
      

      3.3、基于容器運(yùn)行

      docker run --rm -i hadolint/hadolint < Dockerfile
      # OR
      docker run --rm -i ghcr.io/hadolint/hadolint < Dockerfile
      

      3.4、Centos 安裝運(yùn)行

      [root@ops-pinpoint-123 tmp]# wget https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
      [root@ops-pinpoint-123 tmp]# chmod +x hadolint-Linux-x86_64
      [root@ops-pinpoint-123 tmp]# hadolint-Linux-x86_64 ./Dockerfile
      [root@ops-pinpoint-123 tmp]# ./hadolint-Linux-x86_64  /root/Dockerfile  
      /root/Dockerfile:8 DL3002 warning: Last USER should not be root
      

      我們可以發(fā)現(xiàn) hadolint 掃描出來的是基于他特定的規(guī)則和最佳實(shí)踐。

      四、兩者對比

      我們前面進(jìn)行檢查的 Dockerfile 是一樣的,我們發(fā)現(xiàn)兩者給出來的信息還是有些差異的。

      hadolint 檢測出來的 USERROOT 的問題。 checkov 不僅檢測出了 USERROOT 的問題, 還有一個(gè) 22 端口的問題。因?yàn)?22 端口一般都是我們 ssh 使用的端口,我們也不應(yīng)該暴露出來。

      posted @ 2023-03-29 09:38  自由早晚亂余生  閱讀(728)  評論(0)    收藏  舉報(bào)
      主站蜘蛛池模板: 亚洲综合一区二区三区不卡| 十八禁在线观看视频播放免费| 五月天丁香婷婷亚洲欧洲国产| 精品激情视频一区二区三区| 国产a在视频线精品视频下载| 亚洲中文字幕在线观看| 亚洲国产成人午夜在线一区| 免费人成在线观看网站| 免费人成视频网站在线观看18| 91老熟女老人国产老太| 欧美亚洲另类制服卡通动漫| 男女xx00xx的视频免费观看| 亚洲第三十四九中文字幕| 亚洲精品国产av成拍色拍个| 在线综合亚洲欧洲综合网站| 无码人妻丝袜在线视频| 农村欧美丰满熟妇xxxx| 少妇撒尿一区二区在线视频| 精品人妻日韩中文字幕| 阿合奇县| 国产永久免费高清在线观看| 欧美一级黄色影院| 高清中文字幕国产精品| 五月开心六月丁香综合色啪| 久久中文字幕无码一区二区| 粉嫩小泬无遮挡久久久久久| 成人伊人青草久久综合网| 免费黄色大全一区二区三区| 久久青青草原亚洲AV无码麻豆| 国产高在线精品亚洲三区| 特级aaaaaaaaa毛片免费视频| 蜜臀视频一区二区在线播放| 日本亚洲色大成网站www久久| 高清一区二区三区不卡视频| 美女胸18下看禁止免费视频| 青青草无码免费一二三区| 激情综合网五月激情五月| 一级做a爰片在线播放| 久久精品丝袜高跟鞋| 国产中文字幕精品喷潮| 汽车|