当前位置:网站首页>OpenShift 4 - 定制 RHACS 安全策略,阻断生产集群使用高风险 Registry
OpenShift 4 - 定制 RHACS 安全策略,阻断生产集群使用高风险 Registry
2022-07-31 14:13:00 【dawnsky.liu】
《OpenShift 4.x HOL教程汇总》
说明:本文已经在OpenShift 4.10 / RHACS 3.71环境中验证
ACS 安全策略场景
在 RHACS 中自带丰富的安全策略,可以帮助用户实现从镜像到容器、从网络到宿主机操作系统等各方面的安全检查。用户也可以定制个性化的策略来实现特性安全检查需求。
本示例将创建一个定制安全策略,该策略只针对 “生产集群” ,它不允许在生产环境中部署来自安全高风险的 docker.io 的容器镜像。
创建 ACS 安全策略
- 进入 RHACS 的 Platform Configuration -> Policy Management 菜单,然后点击 Create Policy 按钮。
- 在 Create policy 页面中的 Policy details 步骤中提供以下配置,然后点击 Next。
Name:Image Policy - Production
Severity:Medium
Categories:Production
Description:在生产环境中使用了来自 docker.io 的镜像
Rationale:在生产环境中使用来自 docker.io 的镜像安全风险较高
Guidance:不能在生产环境中使用来自 docker.io 的镜像 - 在 Create policy 页面中的 Policy behavior 步骤中提供以下配置,然后点击 Next。
Lifecycle stages:Deploy
Response method:Inform and enforce
Deploy:Enforce on Deploy
- 在 Create policy 页面中的 Policy criteria 步骤中将右侧的 Image registry 拖拽到 Drop a policy field inside,然后在下方填入 docker.io。进行点击 Next。

- 在 Create policy 页面中的 Policy scope 步骤中打开 Add inclusion scope,在 Cluster 中选择需要保护的 OpenShift 集群。然后点击 Next。

- 在最后一步中 Save 即可。
部署测试镜像
- 在 OpenShift 控制台中使用 “导入 YAML” 功能创建以下 Deployment,其中使用了 docker.io/openshift/hello-openshift 镜像。
kind: Deployment
apiVersion: apps/v1
metadata:
name: hello-openshift
labels:
app: hello-openshift
app.kubernetes.io/name: hello-openshift
app.kubernetes.io/part-of: hello-openshift-app
spec:
replicas: 1
selector:
matchLabels:
app: hello-openshift
template:
metadata:
labels:
app: hello-openshift
spec:
containers:
- name: hello-openshift
image: docker.io/openshift/hello-openshift
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 8888
protocol: TCP
- 确认出现以下错误提示。

- 将镜像换成 quay.io/dawnskyliu/hello-openshift 后重新创建 Deployment,确认可以成功创建。
kind: Deployment
apiVersion: apps/v1
metadata:
name: hello-openshift
labels:
app: hello-openshift
app.kubernetes.io/name: hello-openshift
app.kubernetes.io/part-of: hello-openshift-app
spec:
replicas: 1
selector:
matchLabels:
app: hello-openshift
template:
metadata:
labels:
app: hello-openshift
spec:
containers:
- name: hello-openshift
image: quay.io/dawnskyliu/hello-openshift
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 8888
protocol: TCP
参考
https://docs.openshift.com/acs/3.71/operating/manage-security-policies.html
边栏推荐
- 什么是消息队列呢?
- C#高级--委托
- All-round visual monitoring of the Istio microservice governance grid (microservice architecture display, resource monitoring, traffic monitoring, link monitoring)
- 技能大赛训练题:交换机虚拟化练习
- Uniapp WeChat small application reference standard components
- Open Inventor 10.12 重大改进--和谐版
- How to grab configuration information for DELL SC compellent storage system
- OAuth2:四种授权方式
- [QNX Hypervisor 2.2用户手册]9.13 rom
- Shell script classic case: detecting whether a batch of hosts is alive
猜你喜欢

The pre-sale of the new Hyundai Paristi is open, and safety and comfort are not lost

SetoolKit使用指南

Why do we need to sub-library and sub-table?

技能大赛训练题:ftp 服务攻防与加固

Resnet&API

IDEA连接MySQL数据库并使用数据

使用CompletableFuture进行异步处理业务

MySQL has played to such a degree, no wonder the big manufacturers are rushing to ask for it!

Shang Silicon Valley-JVM-Memory and Garbage Collection (P1~P203)

LeetCode·每日一题·1161.最大层内元素和·层次遍历
随机推荐
以后面试官问你 为啥不建议使用Select *,请你大声回答他!
The pre-sale of the new Hyundai Paristi is open, and safety and comfort are not lost
Sentinel限流和异常处理
C#高级--委托
Selenium自动化测试之Selenium IDE
最近很火的国产接口神器Apipost体验
Nuget package and upload tutorial
AI cocoa AI frontier introduction (7.31)
对数字化时代的企业来说,数据治理难做,但应该去做
Why do we need to sub-library and sub-table?
[Blue Bridge Cup Trial Question 46] Scratch Magnet Game Children's Programming Scratch Blue Bridge Cup Trial Question Explanation
STM32的CAN过滤器
Shell项目实战1.系统性能分析
技能大赛训练题:MS15_034漏洞验证与安全加固
Redis与分布式:主从复制
How to grab configuration information for DELL SC compellent storage system
海康摄像机取流RTSP地址规则说明
[QNX Hypervisor 2.2用户手册]9.13 rom
AWS实现定时任务-Lambda+EventBridge
The batch size does not have to be a power of 2!The latest conclusions of senior ML scholars