当前位置:网站首页>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
边栏推荐
- LeetCode旋转数组
- Selenium自动化测试之Selenium IDE
- 多智能体协同控制研究中光学动作捕捉与UWB定位技术比较
- Shell脚本经典案例:文件的备份
- An article makes it clear!What is the difference and connection between database and data warehouse?
- MySQL [subquery]
- 为什么要分库分表?
- redhat/openssl生成自签ca证书并使用
- Uniapp WeChat small application reference standard components
- [QNX Hypervisor 2.2 User Manual]9.14 safety
猜你喜欢
1小时直播招募令:行业大咖干货分享,企业报名开启丨量子位·视点
I summed up the bad MySQL interview questions
SetoolKit User Guide
DELL SC compellent 康贝存储系统怎么抓取配置信息
The Selenium IDE of the Selenium test automation
jvm 一之 类加载器
hyperf的启动源码分析(二)——请求如何到达控制器
最近很火的国产接口神器Apipost体验
Why do we need to sub-library and sub-table?
以后面试官问你 为啥不建议使用Select *,请你大声回答他!
随机推荐
什么是消息队列呢?
MySQL has played to such a degree, no wonder the big manufacturers are rushing to ask for it!
OAuth2:搭建授权服务器
STM32的CAN过滤器
搭建私有的的Nuget包服务器教程
机器学习模型验证:被低估的重要一环
[QNX Hypervisor 2.2 User Manual]9.14 safety
Selenium自动化测试之Selenium IDE
C# using ComboBox control
Spark Learning: Add Custom Optimization Rules for Spark Sql
20.nn.Module
Analysis of the startup source code of hyperf (2) - how the request reaches the controller
技能大赛dhcp服务训练题
[Blue Bridge Cup Trial Question 46] Scratch Magnet Game Children's Programming Scratch Blue Bridge Cup Trial Question Explanation
多智能体协同控制研究中光学动作捕捉与UWB定位技术比较
MySQL [aggregate function]
MySQL【聚合函数】
IDEA connects to MySQL database and uses data
redhat/openssl generates a self-signed ca certificate and uses it
推荐系统-召回阶段-2013:DSSM(双塔模型)【Embedding(语义向量)召回】【微软】