当前位置:网站首页>Kubernetes 1.24: preventing unauthorized volume mode switching
Kubernetes 1.24: preventing unauthorized volume mode switching
2022-06-10 15:04:00 【CNCF】
author : Raunak Pradip Shah (Mirantis)
Kubernetes v1.24 Introduced a new alpha Stage characteristics , It can prevent unauthorized users from modifying Kubernetes What's already in the cluster VolumeSnapshot[1] Created PersistentVolumeClaim[2] Volume mode for .
problem
Volume mode [3] Determines whether the volume is formatted as a file system or displayed as a raw block device .
Users can use self Kubernetes v1.20 Has been stable since VolumeSnapshot function , be based on Kubernetes Existing in the cluster VolumeSnapshot Create a PersistentVolumeClaim ( abbreviation PVC ).PVC The statute includes a dataSource Field , It can point to an existing VolumeSnapshot example . Look up Create a snapshot based on the volume PVC[4] Get more details .
When using the above functions , There is no logic to verify that the mode of the original volume where the snapshot is located matches the mode of the newly created volume .
This raises a security vulnerability , Allow malicious users to potentially exploit unknown vulnerabilities in the host operating system .
In order to improve efficiency , Many popular storage backup vendors switch volume mode during backup operations , This makes Kubernetes The operation cannot be completely blocked , And brings challenges in distinguishing trusted users from malicious users .
Prevent unauthorized users from switching volume mode
under these circumstances , An authorized user is one who has the right to VolumeSnapshotContents( Cluster-level resources ) perform Update or Patch Users of the operation . Cluster administrators can only send messages to trusted users or applications ( Such as backup supplier ) Provide these permissions .
If in snapshot-controller、snapshot-validation-webhook and external-provisioner in Enable [5] With this alpha characteristic , Based on VolumeSnapshot establish PVC when , Unauthorized users will not be allowed to modify their volume mode .
To switch volume mode , Authorized users must do the following :
Are you sure you want to use as a newly created in the given namespace PVC Of the data source VolumeSnapshot.
Be sure to bind to the above VolumeSnapshot Of VolumeSnapshotContent.
kubectl get volumesnapshot -n <namespace>
- to
VolumeSnapshotContentadd to snapshot.storage.kubernetes.io/allowVolumeModeChange[6] annotation .
This annotation can be added by software or manually by authorized users .VolumeSnapshotContent The annotation must be similar to the following listing fragment :
kind: VolumeSnapshotContent
metadata:
annotations:
- snapshot.storage.kubernetes.io/allowVolumeModeChange: "true"
...
Be careful : For pre prepared VolumeSnapshotContents, You have to take extra steps to set up spec.sourceVolumeMode Field is Filesystem or Block, This depends on the mode of the volume where the snapshot is located .
Here is an example :
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
For all systems that need to switch volume mode during a backup or restore operation VolumeSnapshotContents, Repeat step 1 To 3.
If VolumeSnapshotContent The above steps exist on the object 4 Comments shown in ,Kubernetes Conversion to volume mode will not be prevented . The user is trying to add annotations to any VolumeSnapshotContent Before , This should be kept in mind .
Next
Enable this feature [7] And let us know what you think !
We hope that this feature will not interrupt the existing workflow , At the same time, prevent malicious users from exploiting security vulnerabilities in the cluster .
If there are any questions , Please be there. #sig-storage slack Create a session in the channel , Or in the CSI External snapshot storage Warehouse [8] Report one in issue.
Reference material
[1]
VolumeSnapshot: /zh/docs/concepts/storage/volume-snapshots/
[2]
PersistentVolumeClaim: /zh/docs/concepts/storage/persistent-volumes/
[3]
Volume mode : /zh/docs/concepts/storage/persistent-volumes/#volume-mode
[4]
Create a snapshot based on the volume PVC: /zh/docs/concepts/storage/persistent-volumes/#create-persistent-volume-claim-from-volume-snapshot
[5]
Enable : https://kubernetes-csi.github.io/docs/
[6]
snapshot.storage.kubernetes.io/allowVolumeModeChange: /zh/docs/reference/labels-annotations-taints/#snapshot-storage-kubernetes-io-allowvolumemodechange
[7]
Enable this feature : https://kubernetes-csi.github.io/docs/
[8]
Warehouse : https://github.com/kubernetes-csi/external-snapshotter
CNCF (Cloud Native Computing Foundation) Founded on 2015 year 12 month , Affiliated to the Linux Foundation, It's a non-profit organization .
CNCF( Cloud native Computing Foundation ) Committed to fostering and maintaining a vendor neutral open source ecosystem , To promote cloud native technology . By democratizing the most cutting-edge model , Let these innovations be used by the public .
边栏推荐
猜你喜欢

Create a space of local value together. In 2022, China successfully held the "one hundred cities tour · Ningbo Station" for commercial distribution

How to solve the problem that SVN cannot open the URL address

How the autorunner automated test tool creates a project -alltesting | Zezhong cloud test

作为程序员,对于底层原理真的有那么重要吗?

How can JMeter parameterization be implemented?

小程序网络请求Promise化

Problems with database creation triggers

【报名】解决科技创业者核心关切,「星云计划公开课」线上招生开启

几种方式可以实现 JMeter 参数化?

Remote monitoring and data acquisition solution
随机推荐
小程序实现全局数据共享
RSA a little bit of thought
Golang uses reflection to directly copy data from one structure to another (through the same fields)
如何構建以客戶為中心的產品藍圖:來自首席技術官的建議
How the WordPress administrator user name was leaked
2022 Nanjing International Smart site equipment exhibition
We media video Hot Ideas sharing
WordPress的管理员用户名是如何泄露的
自媒体视频热门思路分享
详解OpenCV的函数filter2D(),并提醒大家它做的运算并不是卷积运算而是相关运算
Interview question details
微信小程序 返回上一页并传参
数据库创建触发器的问题
QT interface nested movement based on qscrollarea
欧几里得算法求最大公因数 Go语言实现
MITM(中间人攻击)
洞見科技入選「愛分析· 隱私計算廠商全景報告」,獲評金融解决方案代錶廠商
cmake实战记录(一)
几种方式可以实现 JMeter 参数化?
【报名】解决科技创业者核心关切,「星云计划公开课」线上招生开启