OpenShift Security (11) - 用RHACS在DevOps的CICD中扫描部署中的安全风险
《OpenShift 4.x HOL教程汇总》
本文在 OpenShift4.9 + RHACS 环境中进行验证。
演示视频
说明,运行环境除了要安装RHACS外,还需要安装OpenShift Pipeline Operator。
- 执行命令,下载项目代码
$ git clone https://github.com/liuxiaoyu-git/acs-automation.git
- 执行命令,部署Pipeline资源
$ oc new-project rox-ctl-pipeline
$ cd acs-automation/ci/OpenShift-Pipelines
$ oc apply -f Tasks/
$ oc apply -f Pipeline/
- 在 RHACS 控制台中的 Integrations 中创建找到 “StackRox API Token” 进入。然后创建一个名为 “pipeline-token” 的 “Continuous Integration”。
- 创建完后显示下图,复制字符串。
- 执行命令,创建一个 secret。
$ oc create secret generic acs-secret -n rox-ctl-pipeline \--from-literal=acs_central_endpoint=$(oc get route central -n stackrox --template='{{ .spec.host }}'):443 \--from-literal=acs_api_token=<PIPELINE-TOKEN>
- 执行命令运行PipelineRun。
$ oc create -f PipelineRun/
- 然后在OpenShift控制台中查看 PipelineRun的运行情况,确认 PipelineRun可以全部执行。可以查看 “rox-deployment-check” 任务的执行日志,确认最后显示的是 “Setting overall result to pass”。
说明:缺省的 PipelineRun 只要 RHACS 检查 “ci/OpenShift-Pipelines/assets-for-validation/namespace.yaml”,所以可以通过安全检测。
Getting roxctl
Deployment check on file : /files/ci/Tekton/Scenario2/assets-for-validation/namespace.yaml
-- No errors found in this file --
Setting overall result to pass
- 修改本地的 “ci/OpenShift-Pipelines/PipelineRun/acs-pipelineRun.yaml” 文件,将以下 “fasle” 改为 “true”。
- name: recursive-searchvalue: "false
- 再次执行命令运行PipelineRun。
$ oc create -f PipelineRun/
- 然后在OpenShift控制台中查看 PipelineRun的运行情况,确认 PipelineRun 只执行完第二个任务。可以查看 “rox-deployment-check” 任务的执行日志,确认其中提示 “assets-for-validation/layer1/layer1-service.yaml”、“assets-for-validation/layer1/pod.yml”、“assets-for-validation/layer1/layer1.yaml” 都包含违规的问题,所以最后导致 “Setting overall result to fail”。
Getting roxctlDeployment check on file :/files/ci/Tekton/Scenario2/assets-for-validation/namespace.yaml-- No errors found in this file --Deployment check on file :
/files/ci/Tekton/Scenario2/assets-for-validation/layer1/layer1-service.yaml-- No errors found in this file --Deployment check on file :
/files/ci/Tekton/Scenario2/assets-for-validation/layer1/pod.yml2 alerts found ...Alert policy name : Fixable CVSS >= 7-- Build will be halted --- - - - - - - - - - - - - - - - - - - - - - - - - -2 violations found ...violation : -- Fixable CVE-2021-28831 (CVSS 7.5) found in component 'busybox' (version 1.32.1-r3) in container 'app-container', resolved by version 1.32.1-r4violation : -- Fixable CVE-2021-30139 (CVSS 7.5) found in component 'apk-tools' (version 2.12.1-r0) in container 'app-container', resolved by version 2.12.5-r0- - - - - - - - - - - - - - - - -Alert policy name : Docker CIS 4.1: Ensure That a User for the Container Has Been Created-- Policy violations will not stop the build process --- - - - - - - - - - - - - - - - - - - - - - - - - -1 violation found ...violation : -- Container 'app-container' has image with user 'root'- - - - - - - - - - - - - - - - ------------------------------------------------------Deployment check on file : /files/ci/Tekton/Scenario2/assets-for-validation/layer1/layer1.yaml3 alerts found ...Alert policy name : Latest tag-- Policy violations will not stop the build process --- - - - - - - - - - - - - - - - - - - - - - - - - -1 violation found ...violation : -- Container 'layer1' has image with tag 'latest'- - - - - - - - - - - - - - - - -Alert policy name : Fixable CVSS >= 7-- Build will be halted --- - - - - - - - - - - - - - - - - - - - - - - - - -11 violations found ...violation : -- Fixable CVE-2020-25648 (CVSS 7.5) found in component 'nss' ...violation : -- Fixable CVE-2020-25648 (CVSS 7.5) found in ...- - - - - - - - - - - - - - - - -Alert policy name : No resource requests or limits specified-- Policy violations will not stop the build process --- - - - - - - - - - - - - - - - - - - - - - - - - -4 violations found ...violation : -- CPU limit set to 0 cores for container 'layer1'violation : -- CPU request set to 0 cores for container 'layer1'violation : -- Memory limit set to 0 MB for container 'layer1'violation : -- Memory request set to 0 MB for container 'layer1'- - - - - - - - - - - - - - - - ------------------------------------------------------Setting overall result to fail
OpenShift Security (11) - 用RHACS在DevOps的CICD中扫描部署中的安全风险相关推荐
- OpenShift Security (9) - 用 RHACS 扫描 Log4j 安全漏洞,屏蔽不安全镜像部署
<OpenShift 4.x HOL教程汇总> 说明:本文已经在 OpenShift 4.9 + RHACS 环境中验证,需要先完成<OpenShift Security (2) - ...
- OpenShift Security 15 - 用 RHACS 的安全策略管理运行中的容器安全
<OpenShift 4.x HOL教程汇总> 本文在 OpenShift4.9 + RAHACS 环境中进行验证. 创建 RHACS 的 Policy 创建一个 Policy 的 JSO ...
- OpenShift Security 16 - 用 RHACS 为加固应用镜像安全提供线索
<OpenShift 4.x HOL教程汇总> 本文在 OpenShift 4.8 + RHACS 环境中进行验证. 演示视频 文章目录 部署测试应用 镜像漏洞分析 应用镜像安全加固 部署 ...
- OpenShift Security 14 - 使用 RHACS 中的进程基线功能找出在容器中运行的风险操作
<OpenShift 4.x HOL教程汇总> 本文在 OpenShift4.9 + RHACS 环境中进行验证. 演示视频 在 OpenShift 控制台中部署测试镜像 registry ...
- OpenShift Security (12) - 用 RHACS 管理容器之间的网络访问策略
<OpenShift 4.x HOL教程汇总> 本文在 OpenShift4.9 + RHACS 环境中进行验证. 演示视频 部署测试应用资源 oc new-project project ...
- OpenShift Security (10) - 用红帽高级集安全产品监控容器中运行的安全违规操作
<OpenShift 4.x HOL教程汇总> 本文已在 OpenShift 4.9 + RHACS 中测试验证. 演示视频 文章目录 场景说明 查看 Runtime 策略 部署测试应用 ...
- OpenShift Security (1) - 红帽多集群安全管理 RHACS 的主要功能和技术架构
<OpenShift 4.x HOL教程汇总> 本文在 OpenShift4.9 环境中进行验证. 主要功能 Red Hat Advanced Cluster Security for K ...
- OpenShift Security (2) - 安装 Red Hat Advanced Cluster Security(RHACS)
<OpenShift 4.x HOL教程汇总> 本文在 OpenShift4.9 环境中进行验证. 文章目录 环境要求 安装 RHACS Operator 创建 RHACS 环境 创建 C ...
- OpenShift Security (8) - 安装并运行 DevSecOps 应用
<OpenShift 4.x HOL教程汇总> 本文在 OpenShift 4.9 和 RHACS 3.67.1 环境中进行验证. 文章目录 安装 DevSecOps Pipeline 演 ...
最新文章
- 数据结构和算法:(3)3.2.1单链表的整表创建
- 主角用计算机控制身体,国漫段子手:绝技,用计算机控制挖掘机炒菜
- JSP笔记-JavaBean
- 深圳腾讯内部Jetpack宝典意外流出!极致经典,堪称Android架构组件的天花板
- Django:模型model和数据库mysql(一)
- 【工业控制】PolyWorks培训教程-设备转站
- Http请求中Content-Type讲解以及在Spring MVC注解中produce和consumes配置详解
- iptables实现NAT
- Android将ScrollView移动到最底部
- telnet不是内部命令
- MFC ------- AfxGetMainWnd( )
- 财务数字变革新契机丨RPA应用于财务领域的5大场景
- CoFlash 基本操作说明和Flash编程算法
- 大学生创新创业大赛案例_大学生创新创业典型案例4
- 读懂电影专业名词(转自CMCT-PT)
- 游戏逆向 修改植物大战僵尸阳光值
- RabbitMQ虚拟主机
- HTML5 小组 北京站 沙龙
- 拯救行动 OpenJ_Bailian - 4116
- LeetCode 2248、多个数组求交集
热门文章
- 高度固定 宽度裁剪_高领落肩连衣裙的制版裁剪教程才智服装
- 如何判断模糊图像_深圳企业宣传片拍摄制作教你如何使用手动聚焦
- android+php最佳实践视频,Android和PHP开发最佳实践 PDF 第2版
- python pandas写入_51-python3 pandas读写excel
- 春风app一直显示服务器内部错误,CHANGES.md
- 万能电商Banner素材模板,一切产品为王
- 电商促销页面需要的辅助图形给设计师准备好了,拿走!
- linux open dev/tty0 receive_buf,书写基于内核的linux键盘纪录器(p9-0e)(3)
- python所有变量更新_python更新全局变量
- excel匹配_Excel常用的关联匹配函数