当前位置:网站首页>Kubernetes 1.24: 防止未经授权的卷模式转换
Kubernetes 1.24: 防止未经授权的卷模式转换
2022-06-10 14:45:00 【CNCF】
作者: Raunak Pradip Shah (Mirantis)
Kubernetes v1.24 引入了一个新的 alpha 级特性,可以防止未经授权的用户修改基于 Kubernetes 集群中已有的 VolumeSnapshot[1]创建的 PersistentVolumeClaim[2] 的卷模式。
问题
卷模式[3]确定卷是格式化为文件系统还是显示为原始块设备。
用户可以使用自 Kubernetes v1.20 以来就稳定的 VolumeSnapshot 功能, 基于 Kubernetes 集群中的已有的 VolumeSnapshot 创建一个 PersistentVolumeClaim (简称 PVC )。PVC 规约包括一个 dataSource 字段,它可以指向一个已有的 VolumeSnapshot 实例。查阅基于卷快照创建 PVC[4]获取更多详细信息。
当使用上述功能时,没有逻辑来验证快照所在的原始卷的模式是否与新创建的卷的模式匹配。
这引起了一个安全漏洞,允许恶意用户潜在地利用主机操作系统中的未知漏洞。
为了提高效率,许多流行的存储备份供应商在备份操作过程中转换卷模式, 这使得 Kubernetes 无法完全阻止该操作,并在区分受信任用户和恶意用户方面带来挑战。
防止未经授权的用户转换卷模式
在这种情况下,授权用户是指有权对 VolumeSnapshotContents(集群级资源)执行 Update或 Patch 操作的用户。集群管理员只能向受信任的用户或应用程序(如备份供应商)提供这些权限。
如果在 snapshot-controller、snapshot-validation-webhook 和external-provisioner 中启用[5]了这个 alpha 特性,则基于 VolumeSnapshot 创建 PVC 时,将不允许未经授权的用户修改其卷模式。
如要转换卷模式,授权用户必须执行以下操作:
确定要用作给定命名空间中新创建 PVC 的数据源的 VolumeSnapshot。
确定绑定到上面 VolumeSnapshot 的 VolumeSnapshotContent。
kubectl get volumesnapshot -n <namespace>
- 给
VolumeSnapshotContent添加snapshot.storage.kubernetes.io/allowVolumeModeChange[6]注解。
此注解可通过软件添加或由授权用户手动添加。VolumeSnapshotContent 注解必须类似于以下清单片段:
kind: VolumeSnapshotContent
metadata:
annotations:
- snapshot.storage.kubernetes.io/allowVolumeModeChange: "true"
...
注意:对于预先制备的 VolumeSnapshotContents,你必须采取额外的步骤设置 spec.sourceVolumeMode字段为 Filesystem 或 Block,这取决于快照所在卷的模式。
如下为一个示例:
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotContent
metadata:
annotations:
- snapshot.storage.kubernetes.io/allowVolumeModeChange: "true"
name: new-snapshot-content-test
spec:
deletionPolicy: Delete
driver: hostpath.csi.k8s.io
source:
snapshotHandle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002
sourceVolumeMode: Filesystem
volumeSnapshotRef:
name: new-snapshot-test
namespace: default
对于在备份或恢复操作期间需要转换卷模式的所有 VolumeSnapshotContents,重复步骤 1 到 3。
如果 VolumeSnapshotContent 对象上存在上面步骤 4 中显示的注解,Kubernetes 将不会阻止转换卷模式。用户在尝试将注解添加到任何 VolumeSnapshotContent 之前,应该记住这一点。
接下来
启用此特性[7]并让我们知道你的想法!
我们希望此功能不会中断现有工作流程,同时防止恶意用户利用集群中的安全漏洞。
若有任何问题,请在 #sig-storage slack 频道中创建一个会话, 或在 CSI 外部快照存储仓库[8]中报告一个 issue。
参考资料
[1]
VolumeSnapshot: /zh/docs/concepts/storage/volume-snapshots/
[2]
PersistentVolumeClaim: /zh/docs/concepts/storage/persistent-volumes/
[3]
卷模式: /zh/docs/concepts/storage/persistent-volumes/#volume-mode
[4]
基于卷快照创建 PVC: /zh/docs/concepts/storage/persistent-volumes/#create-persistent-volume-claim-from-volume-snapshot
[5]
启用: https://kubernetes-csi.github.io/docs/
[6]
snapshot.storage.kubernetes.io/allowVolumeModeChange: /zh/docs/reference/labels-annotations-taints/#snapshot-storage-kubernetes-io-allowvolumemodechange
[7]
启用此特性: https://kubernetes-csi.github.io/docs/
[8]
仓库: https://github.com/kubernetes-csi/external-snapshotter
CNCF (Cloud Native Computing Foundation)成立于2015年12月,隶属于Linux Foundation,是非营利性组织。
CNCF(云原生计算基金会)致力于培育和维护一个厂商中立的开源生态系统,来推广云原生技术。我们通过将最前沿的模式民主化,让这些创新为大众所用。
边栏推荐
- Notes on the second test of C language
- 2022 the 15th Nanjing International Industrial Automation Exhibition
- Microsoft Word tutorial, how to change margins and create a newsletter column in word?
- . Net C Foundation (7): interface - how people interact with cats
- [Chongqing University] information sharing of preliminary and second examinations (with postgraduate entrance examination group)
- 微信小程序 返回上一页并传参
- 利用 GDB 快速阅读 postgresql 的内核代码
- [registration] to solve the core concerns of technology entrepreneurs, the online enrollment of "nebula plan open class" was opened
- AUTOCAD——设置文字间距与行距
- Do you understand all these difficult memory problems?
猜你喜欢
![[Chongqing University] information sharing of preliminary and second examinations (with postgraduate entrance examination group)](/img/1d/550a991385b842a21e2b301725407e.png)
[Chongqing University] information sharing of preliminary and second examinations (with postgraduate entrance examination group)

Operation of simulated examination platform for theoretical question bank of refrigeration and air conditioning equipment operation in 2022

Anaconda installs opencv (CV2) and uses it in the jupyter notebook

Singleton pattern and special class design

Binary tree and Figure 2

Do you understand all these difficult memory problems?
![[logodetection data set processing] (1) divide the data set into training set and verification set](/img/f9/422cd4b710cd57f0ebb3abd7e01c29.png)
[logodetection data set processing] (1) divide the data set into training set and verification set

How to implement the association between interfaces in JMeter?
![[logodetection data set processing] (3) divide the training set into multiple folders by category](/img/eb/49c65f9af4c899b8cffaeec630be79.png)
[logodetection data set processing] (3) divide the training set into multiple folders by category

Main features of IIC bus / communication process / read / write process
随机推荐
CVPR 2022 | 基于序列对比学习的长视频逐帧动作表示
22.6.7 successfully use doc2vec model to generate embedded vectors
svn外网打不开url地址怎么解决
2022南京国际智慧工地装备展览会
[discrete mathematics review series] IV. figure
Does Fortran have a standard library
消息中间件的消费模式
Beijing / Shanghai internal promotion | recruitment of full-time interns in the system and network group of Microsoft Research Asia
微信小程序 滑动到顶部
How to write a global notice component?
Primary master-slave table integration process development process
ScrollView 初始化的时候不在最顶部?
Shutter wrap button bottomnavigationbar learning summary 4
Mutual transformation among lists, arrays and tensors
超强实操!手把手教学Kinect深度图与RGB摄像头的标定与配准
Do you understand all these difficult memory problems?
How can JMeter parameterization be implemented?
C # list of shallow copy and deep copy customized classes <>
[discrete mathematics review series] III. concept and operation of sets
SIGIR 2022 | HKU and Wuhan University put forward kgcl: a recommendation system based on knowledge map comparative learning