Skip to content

Commit dd418d1

Browse files
committed
docs: Document the data persistence and data import features
1 parent b1138ca commit dd418d1

File tree

12 files changed

+206
-45
lines changed

12 files changed

+206
-45
lines changed

docs/getting_started/interface_specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ English | [简体中文](interface_specification.zh_CN.md)
165165

166166
| Field | Description |
167167
|-------|-------------|
168-
|duration<br />*int*| Duration is the duration in minutes to modeling. |
168+
|duration<br />*int*| Duration is the duration in minutes for modeling. The modeling duration starts from the moment the policy is created and is only valid if the current time is earlier than the expected modeling completion time. This field supports dynamic adjustment, which can be used to end modeling early, extend the modeling duration, or restart modeling, and its value cannot be zero. |
169169

170170
## DefenseInDepth
171171

docs/getting_started/interface_specification.zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165

166166
| 字段 | 描述 |
167167
|-----|------|
168-
|duration<br />*int*| Duration 是行为建模所需的分钟数|
168+
|duration<br />*int*| Duration 是建模的时长(以分钟为单位)。建模时长从策略创建时刻开始计算,仅当当前时间早于预期建模完成时间时有效。该字段支持动态调整,可用于尽早结束建模、延长建模时间或重新启动建模,且取值不能为零|
169169

170170
## DefenseInDepth
171171

docs/guides/policies_and_rules/policy_modes/behavior_modeling.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The requirements for the BehaviorModeling mode are as follows.
3232

3333
* *The **varmor-agent** requires additional resources as shown below when the BehaviorModeling feature is enabled. Another component, the **varmor-classifier**, which is used to identify random patterns in the path, will also be deployed.*
3434

35-
```
35+
```yaml
3636
resources:
3737
limits:
3838
cpu: 2
@@ -157,11 +157,19 @@ demo varmor-cluster-demo-demo-4 CRDInternal 2 2 tr
157157
* The **BehaviorModeling** mode can only be switched to other modes after the modeling is completed.
158158
* When switching to **BehaviorModeling** mode from other modes or when the modeling has already been completed, you need to update the modeling duration and restart the target workload to restart the modeling process.
159159

160-
### Data Export
160+
### Data Persistence
161+
162+
The modeling results will be saved by the manager into the ArmorProfileModel object.
163+
164+
When the behavior data is too large, the manager will persist it to the local disk and set the `storageType` field to `LocalDisk`. By default, the manager uses an `emptyDir` volume with a storage space of **500Mi** to persist the modeling results.
161165

162-
You can export the behavior data and profiles of the target workloads for other purposes. For example, use [Policy Advisor](../../policy_advisor.md) to analyze which built-in rules can be used to enforce the target workloads, guide users to minimize permissions for the security context of the workload based on the behavior data, etc.
166+
You can enable the use of a persistent volume to store the modeling results by using the `--set manager.behaviorModeling.usePersistentVolume=true` option. Before enabling the persistent volume, please make sure that a PVC named **varmor-manager-apmdata-pvc** has been created in the namespace where the manager is located.
163167

164-
Different storage types have different methods for exporting ArmorProfileModel objects:
168+
### Data Export and Import
169+
170+
You can export the behavior data and profiles of the target workload for other purposes. For example, use [Policy Advisor](../../policy_advisor.md) to analyze which built-in rules can be used to harden the target application, and guide users to minimize the permissions of the security context of the workload based on the behavior data. You can also import the exported data into other clusters for exported data into other clusters for use.
171+
172+
The methods for exporting and importing ArmorProfileModel objects of different storage types are different:
165173

166174
* **CRDInternal**
167175

@@ -170,16 +178,22 @@ Different storage types have different methods for exporting ArmorProfileModel o
170178
```bash
171179
kubectl get ArmorProfileModel -n demo varmor-demo-demo-4 -o json > varmor-demo-demo-4.json
172180
```
181+
182+
- Import directly using kubectl
183+
184+
```bash
185+
kubectl apply -f varmor-demo-demo-4.json
186+
```
173187

174188
* **LocalDisk**
175189

176-
- Forward local port 8080 to port 8080 of the cluster varmor-state-svc Service
190+
- Forward local port 8080 to port 8080 of the cluster `varmor-state-svc` Service
177191

178192
```bash
179193
kubectl port-forward -n varmor service/varmor-status-svc 8080:8080
180194
```
181195

182-
- Request a ServiceAccount token of varmor-manager
196+
- Obtain the ServiceAccount token with read and write permissions for the armorprofilemodels resource. Here, use the ServiceAccount token of varmor-manager.
183197

184198
```bash
185199
token=$(kubectl create token varmor-manager -n varmor)
@@ -189,9 +203,22 @@ Different storage types have different methods for exporting ArmorProfileModel o
189203

190204
```bash
191205
curl -k -X GET \
192-
-H 'Authorization: Bearer $token' \
206+
-H "Authorization: Bearer $token" \
193207
https://localhost:8080/apis/crd.varmor.org/v1beta1/namespaces/demo/armorprofilemodels/varmor-demo-demo-4 > varmor-demo-demo-4.json
194208
```
209+
210+
- Access the `/apis/crd.varmor.org/v1beta1/namespaces/{namespace}/armorprofilemodels/{name}` interface to import data
211+
212+
If there is already an ArmorProfileModel object with the same name in the namespace of the cluster, the behavior data will be merged and the profiles will be overwritten.
213+
214+
```bash
215+
curl -k \
216+
-X POST https://localhost:8080/apis/crd.varmor.org/v1beta1/namespaces/demo/armorprofilemodels/varmor-demo-demo-4 \
217+
-H "Authorization: Bearer $token" \
218+
-H "Accept: application/json" \
219+
-H "Content-Type: application/json" \
220+
-d @varmor-demo-demo-4.json
221+
```
195222

196223
## Use Case
197224

docs/guides/policies_and_rules/policy_modes/behavior_modeling.zh_CN.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ BehaviorModeling 模式的前置条件如下所示:
3232

3333
* *启用 BehaviorModeling 特性时,**varmor-agent** 需要如下所示的追加资源。另外,**varmor-classifier** 组件也会被部署,用于识别路径中的随机字符串。*
3434

35-
```
35+
```yaml
3636
resources:
3737
limits:
3838
cpu: 2
@@ -156,11 +156,19 @@ demo varmor-cluster-demo-demo-4 CRDInternal 2 2 tr
156156
* 不支持将 BehaviorModeling 模式的策略切换为其他模式,反之亦然。您需要删除策略后重新创建策略才可切换。
157157
* 建模完成后,不支持修改策略的建模时长。您需要删除策略后重新创建策略才可以重新开始建模,但已有的行为数据会被保留。
158158

159-
### 数据导出
159+
### 数据持久化
160+
161+
建模结果会被 manager 保存到 ArmorProfileModel 对象中。
162+
163+
当行为数据过大时,manager 会将其持久化到本次磁盘,并将 `storageType` 字段设置为 `LocalDisk`。
164+
165+
默认情况下,manager 使用存储空间为 **500Mi** 的 `emptyDir` 卷来存储建模结果。您可以通过 `--set manager.behaviorModeling.usePersistentVolume=true` 选项启用使用持久化卷存储建模结果。启用持久卷前,请确保 manager 所在命名空间中已创建了名为 varmor-manager-apmdata-pvc 的 PVC。
160166

161-
您可以将目标负载的行为数据和 Profiles 导出用于其他目的。例如:使用 [策略顾问](../../policy_advisor.zh_CN.md) 分析哪些内置规则能够被用于加固目标应用,基于行为数据指导用户对工作负载的安全上下文进行权限最小化等。
167+
### 数据导出与导入
162168

163-
不同存储类型的 ArmorProfileModel 对象导出方法不同:
169+
您可以将目标负载的行为数据和 Profiles 导出用于其他目的。例如:使用[策略顾问](../../policy_advisor.md)分析哪些内置规则能够被用于加固目标应用,基于行为数据指导用户对工作负载的安全上下文进行权限最小化等。您还可以将导出的数据导入到其他集群中进行使用。
170+
171+
不同存储类型的 ArmorProfileModel 对象导出与导入方法不同:
164172

165173
* **CRDInternal**
166174

@@ -169,16 +177,22 @@ demo varmor-cluster-demo-demo-4 CRDInternal 2 2 tr
169177
```bash
170178
kubectl get ArmorProfileModel -n demo varmor-demo-demo-4 -o json > varmor-demo-demo-4.json
171179
```
180+
181+
- 直接使用 kubectl 导入
182+
183+
```bash
184+
kubectl apply -f varmor-demo-demo-4.json
185+
```
172186

173187
* **LocalDisk**
174188

175-
- 将本地端口 8080 转发到集群 varmor-status-svc Service 的 8080 端口
189+
- 将本地端口 8080 转发到集群 `varmor-status-svc` Service 的 8080 端口
176190

177191
```bash
178192
kubectl port-forward -n varmor service/varmor-status-svc 8080:8080
179193
```
180194

181-
- 获取 varmor-manager 的 ServiceAccount token
195+
- 获取具有 armorprofilemodels 资源读写权限的 ServiceAccount token。这里使用 varmor-manager 的 ServiceAccount token
182196

183197
```bash
184198
token=$(kubectl create token varmor-manager -n varmor)
@@ -188,9 +202,22 @@ demo varmor-cluster-demo-demo-4 CRDInternal 2 2 tr
188202

189203
```bash
190204
curl -k -X GET \
191-
-H 'Authorization: Bearer $token' \
205+
-H "Authorization: Bearer $token" \
192206
https://localhost:8080/apis/crd.varmor.org/v1beta1/namespaces/demo/armorprofilemodels/varmor-demo-demo-4 > varmor-demo-demo-4.json
193207
```
208+
209+
- 访问 `/apis/crd.varmor.org/v1beta1/namespaces/{namespace}/armorprofilemodels/{name}` 接口导入数据
210+
211+
如果集群的命名空间中已经有同名的 ArmorProfileModel 对象,那么行为数据会被合并,Profiles 会被覆盖。
212+
213+
```bash
214+
curl -k \
215+
-X POST https://localhost:8080/apis/crd.varmor.org/v1beta1/namespaces/demo/armorprofilemodels/varmor-demo-demo-4 \
216+
-H "Authorization: Bearer $token" \
217+
-H "Accept: application/json" \
218+
-H "Content-Type: application/json" \
219+
-d @varmor-demo-demo-4.json
220+
```
194221

195222
## 示例
196223

website/docs/getting_started/interface_specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ description: The interface specification of vArmor.
168168

169169
| Field | Description |
170170
|-------|-------------|
171-
|duration<br />*int*| Duration is the duration in minutes to modeling. |
171+
|duration<br />*int*| Duration is the duration in minutes for modeling. The modeling duration starts from the moment the policy is created and is only valid if the current time is earlier than the expected modeling completion time. This field supports dynamic adjustment, which can be used to end modeling early, extend the modeling duration, or restart modeling, and its value cannot be zero. |
172172

173173
## DefenseInDepth
174174

website/docs/guides/policies_and_rules/policy_modes/behavior_modeling.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,19 @@ demo varmor-cluster-demo-demo-4 CRDInternal 2 2 tr
169169
* The **BehaviorModeling** mode can only be switched to other modes after the modeling is completed.
170170
* When switching to **BehaviorModeling** mode from other modes or when the modeling has already been completed, you need to update the modeling duration and restart the target workload to restart the modeling process.
171171

172-
### Data Export
172+
### Data Persistence
173173

174-
You can export the behavior data and profiles of the target workloads for other purposes. For example, use [Policy Advisor](../../policy_advisor.md) to analyze which built-in rules can be used to enforce the target workloads, guide users to minimize permissions for the security context of the workload based on the behavior data, etc.
174+
The modeling results will be saved by the manager into the ArmorProfileModel object.
175175

176-
Different storage types have different methods for exporting ArmorProfileModel objects:
176+
When the behavior data is too large, the manager will persist it to the local disk and set the `storageType` field to `LocalDisk`.
177+
178+
By default, the manager uses an `emptyDir` volume with a storage space of **500Mi** to persist the modeling results. You can enable the use of a persistent volume to store the modeling results by using the `--set manager.behaviorModeling.usePersistentVolume=true` option. Before enabling the persistent volume, please make sure that a PVC named **varmor-manager-apmdata-pvc** has been created in the namespace where the manager is located.
179+
180+
### Data Export and Import
181+
182+
You can export the behavior data and profiles of the target workload for other purposes. For example, use [Policy Advisor](../../policy_advisor.md) to analyze which built-in rules can be used to harden the target application, and guide users to minimize the permissions of the security context of the workload based on the behavior data. You can also import the exported data into other clusters for exported data into other clusters for use.
183+
184+
The methods for exporting and importing ArmorProfileModel objects of different storage types are different:
177185

178186
* **CRDInternal**
179187

@@ -182,16 +190,22 @@ Different storage types have different methods for exporting ArmorProfileModel o
182190
```bash
183191
kubectl get ArmorProfileModel -n demo varmor-demo-demo-4 -o json > varmor-demo-demo-4.json
184192
```
193+
194+
- Import directly using kubectl
195+
196+
```bash
197+
kubectl apply -f varmor-demo-demo-4.json
198+
```
185199

186200
* **LocalDisk**
187201

188-
- Forward local port 8080 to port 8080 of the cluster varmor-state-svc Service
202+
- Forward local port 8080 to port 8080 of the cluster `varmor-state-svc` Service
189203

190204
```bash
191205
kubectl port-forward -n varmor service/varmor-status-svc 8080:8080
192206
```
193207

194-
- Request a ServiceAccount token of varmor-manager
208+
- Obtain the ServiceAccount token with read and write permissions for the armorprofilemodels resource. Here, use the ServiceAccount token of varmor-manager.
195209

196210
```bash
197211
token=$(kubectl create token varmor-manager -n varmor)
@@ -201,9 +215,22 @@ Different storage types have different methods for exporting ArmorProfileModel o
201215

202216
```bash
203217
curl -k -X GET \
204-
-H 'Authorization: Bearer $token' \
218+
-H "Authorization: Bearer $token" \
205219
https://localhost:8080/apis/crd.varmor.org/v1beta1/namespaces/demo/armorprofilemodels/varmor-demo-demo-4 > varmor-demo-demo-4.json
206220
```
221+
222+
- Access the `/apis/crd.varmor.org/v1beta1/namespaces/{namespace}/armorprofilemodels/{name}` interface to import data
223+
224+
If there is already an ArmorProfileModel object with the same name in the namespace of the cluster, the behavior data will be merged and the profiles will be overwritten.
225+
226+
```bash
227+
curl -k \
228+
-X POST https://localhost:8080/apis/crd.varmor.org/v1beta1/namespaces/demo/armorprofilemodels/varmor-demo-demo-4 \
229+
-H "Authorization: Bearer $token" \
230+
-H "Accept: application/json" \
231+
-H "Content-Type: application/json" \
232+
-d @varmor-demo-demo-4.json
233+
```
207234

208235
## Use Case
209236

website/i18n/zh-cn/docusaurus-plugin-content-docs/current/getting_started/interface_specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ description: vArmor 的接口规范。
168168

169169
| 字段 | 描述 |
170170
|-----|------|
171-
|duration<br />*int*| Duration 是行为建模所需的分钟数|
171+
|duration<br />*int*| Duration 是建模的时长(以分钟为单位)。建模时长从策略创建时刻开始计算,仅当当前时间早于预期建模完成时间时有效。该字段支持动态调整,可用于尽早结束建模、延长建模时间或重新启动建模,且取值不能为零|
172172

173173
## DefenseInDepth
174174

website/i18n/zh-cn/docusaurus-plugin-content-docs/current/guides/policies_and_rules/policy_modes/behavior_modeling.md

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ BehaviorModeling 模式的前置条件如下所示:
4646
```
4747
:::
4848
49-
5049
## 使用说明
5150
5251
### 基本用法
@@ -169,11 +168,19 @@ demo varmor-cluster-demo-demo-4 CRDInternal 2 2 tr
169168
* 建模完成后,方可将 **BehaviorModeling** 切换为其他模式。
170169
* 从其他模式切换到 **BehaviorModeling** 或建模已经完成时,您需要更新建模时长并重启目标工作负载,以重新启动行为建模过程。
171170

172-
### 数据导出
171+
### 数据持久化
172+
173+
建模结果会被 manager 保存到 ArmorProfileModel 对象中。
174+
175+
当行为数据过大时,manager 会将其持久化到本次磁盘,并将 `storageType` 字段设置为 `LocalDisk`。
176+
177+
默认情况下,manager 使用存储空间为 **500Mi** 的 `emptyDir` 卷来存储建模结果。您可以通过 `--set manager.behaviorModeling.usePersistentVolume=true` 选项启用使用持久化卷存储建模结果。启用持久卷前,请确保 manager 所在命名空间中已创建了名为 varmor-manager-apmdata-pvc 的 PVC。
173178

174-
您可以将目标负载的行为数据和 Profiles 导出用于其他目的。例如:使用 [策略顾问](../../policy_advisor.md) 分析哪些内置规则能够被用于加固目标应用,基于行为数据指导用户对工作负载的安全上下文进行权限最小化等。
179+
### 数据导出与导入
175180

176-
不同存储类型的 ArmorProfileModel 对象导出方法不同:
181+
您可以将目标负载的行为数据和 Profiles 导出用于其他目的。例如:使用[策略顾问](../../policy_advisor.md)分析哪些内置规则能够被用于加固目标应用,基于行为数据指导用户对工作负载的安全上下文进行权限最小化等。您还可以将导出的数据导入到其他集群中进行使用。
182+
183+
不同存储类型的 ArmorProfileModel 对象导出与导入方法不同:
177184

178185
* **CRDInternal**
179186

@@ -182,16 +189,22 @@ demo varmor-cluster-demo-demo-4 CRDInternal 2 2 tr
182189
```bash
183190
kubectl get ArmorProfileModel -n demo varmor-demo-demo-4 -o json > varmor-demo-demo-4.json
184191
```
192+
193+
- 直接使用 kubectl 导入
194+
195+
```bash
196+
kubectl apply -f varmor-demo-demo-4.json
197+
```
185198

186199
* **LocalDisk**
187200

188-
- 将本地端口 8080 转发到集群 varmor-status-svc Service 的 8080 端口
201+
- 将本地端口 8080 转发到集群 `varmor-status-svc` Service 的 8080 端口
189202

190203
```bash
191204
kubectl port-forward -n varmor service/varmor-status-svc 8080:8080
192205
```
193206

194-
- 获取 varmor-manager 的 ServiceAccount token
207+
- 获取具有 armorprofilemodels 资源读写权限的 ServiceAccount token。这里使用 varmor-manager 的 ServiceAccount token
195208

196209
```bash
197210
token=$(kubectl create token varmor-manager -n varmor)
@@ -201,9 +214,22 @@ demo varmor-cluster-demo-demo-4 CRDInternal 2 2 tr
201214

202215
```bash
203216
curl -k -X GET \
204-
-H 'Authorization: Bearer $token' \
217+
-H "Authorization: Bearer $token" \
205218
https://localhost:8080/apis/crd.varmor.org/v1beta1/namespaces/demo/armorprofilemodels/varmor-demo-demo-4 > varmor-demo-demo-4.json
206219
```
220+
221+
- 访问 `/apis/crd.varmor.org/v1beta1/namespaces/{namespace}/armorprofilemodels/{name}` 接口导入数据
222+
223+
如果集群的命名空间中已经有同名的 ArmorProfileModel 对象,那么行为数据会被合并,Profiles 会被覆盖。
224+
225+
```bash
226+
curl -k \
227+
-X POST https://localhost:8080/apis/crd.varmor.org/v1beta1/namespaces/demo/armorprofilemodels/varmor-demo-demo-4 \
228+
-H "Authorization: Bearer $token" \
229+
-H "Accept: application/json" \
230+
-H "Content-Type: application/json" \
231+
-d @varmor-demo-demo-4.json
232+
```
207233

208234
## 示例
209235

website/i18n/zh-cn/docusaurus-plugin-content-docs/version-v0.8/getting_started/interface_specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ description: vArmor 的接口规范。
168168

169169
| 字段 | 描述 |
170170
|-----|------|
171-
|duration<br />*int*| Duration 是行为建模所需的分钟数|
171+
|duration<br />*int*| Duration 是建模的时长(以分钟为单位)。建模时长从策略创建时刻开始计算,仅当当前时间早于预期建模完成时间时有效。该字段支持动态调整,可用于尽早结束建模、延长建模时间或重新启动建模,且取值不能为零|
172172

173173
## DefenseInDepth
174174

0 commit comments

Comments
 (0)