当前位置:网站首页>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
边栏推荐
- Linux bash: redis-server: 未找到命令
- The use of thread pool two
- The batch size does not have to be a power of 2!The latest conclusions of senior ML scholars
- ERROR: Failed building wheel for osgeo
- 技能大赛训练题:域用户和组织单元的创建
- 已解决(pymysqL连接数据库报错)pymysqL.err.ProgrammingError: (1146,“Table ‘test.students‘ doesn‘t exist“)
- 线程池的使用二
- Tortoise speed by "template"
- CodeIgniter 打开错误日志
- Shell项目实战1.系统性能分析
猜你喜欢

深度剖析 Apache EventMesh 云原生分布式事件驱动架构

Sentinel限流和异常处理

Linux bash: redis-server: command not found

DELL SC compellent 康贝存储系统怎么抓取配置信息

The 232-layer 3D flash memory chip is here: the single-chip capacity is 2TB, and the transmission speed is increased by 50%

Comparison of Optical Motion Capture and UWB Positioning Technology in Multi-agent Cooperative Control Research

使用NVM进行node版本切换管理

endnote引用

使用CompletableFuture进行异步处理业务
![[Blue Bridge Cup Trial Question 46] Scratch Magnet Game Children's Programming Scratch Blue Bridge Cup Trial Question Explanation](/img/57/f23c21c7ed4b9701a3f6119bfd8493.png)
[Blue Bridge Cup Trial Question 46] Scratch Magnet Game Children's Programming Scratch Blue Bridge Cup Trial Question Explanation
随机推荐
[Blue Bridge Cup Trial Question 46] Scratch Magnet Game Children's Programming Scratch Blue Bridge Cup Trial Question Explanation
Detailed guide to compare two tables using natural full join in SQL
Shang Silicon Valley-JVM-Memory and Garbage Collection (P1~P203)
C语言基础练(九九乘法表)与打印不同星号图案
How to grab configuration information for DELL SC compellent storage system
八大排序汇总及其稳定性
[Pytorch] F.softmax() method description
OAuth2:搭建授权服务器
OAuth2:微服务权限校验Session共享
Tortoise speed by "template"
In the future, the interviewer asks you why it is not recommended to use Select *, please answer him out loud!
redhat/openssl generates a self-signed ca certificate and uses it
[Pytorch] torch.argmax() usage
Combination series - there are combinations when there are arrangements
The batch size does not have to be a power of 2!The latest conclusions of senior ML scholars
纸质说明书秒变3D动画,斯坦福大学吴佳俊最新研究,入选ECCV 2022
【Pytorch】F.softmax()方法说明
MySQL 23道经典面试吊打面试官
机器学习模型验证:被低估的重要一环
CLion用于STM32开发