File tree Expand file tree Collapse file tree 9 files changed +294
-114
lines changed
tencentcloud/cvm/cvm_virtual_machine_disks_are_unencrypted Expand file tree Collapse file tree 9 files changed +294
-114
lines changed Load Diff Large diffs are not rendered by default.
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 1+ # Tencent Cloud CVM Virtual Machine's disk are unencrypted
2+
3+ English | [ 中文] ( ./README_CN.md )
4+
5+ ## Description
6+
7+ This is a scenario used to build the Tencent Cloud CVM Virtual Machine's disk are unencrypted.
8+
9+ ## Deployment Environment
10+
11+ Execute the following command in the container
12+
13+ ``` shell
14+ cd /TerraformGoat/tencentcloud/cvm/cvm_virtual_machine_disks_are_unencrypted
15+ ```
16+
17+ Edit the ` terraform.tfvars ` file and write your ` tencentcloud_secret_id ` and ` tencentcloud_secret_key ` in the file
18+
19+ ``` shell
20+ vim terraform.tfvars
21+ ```
22+
23+ > You can create and view your SecretKey on the [ API Key Management] ( https://console.cloud.tencent.com/cam/capi ) of the Tencent Cloud console
24+
25+ Deploy Vulnerable Environment
26+
27+ ``` shell
28+ terraform init
29+ terraform apply
30+ ```
31+
32+ > When the terminal prompts ` Enter a value: ` , enter ` yes `
33+
34+ After the environment is set up, you can see the ID of the instance in Outputs.
35+
36+ ## Steps
37+
38+ Use Tencent Cloud command line tool to view the encryption of the instance mounted disk.
39+
40+ ``` bash
41+ > tccli configure
42+ > apt-get install jq -y
43+ > tccli cvm DescribeInstances | jq ' .InstanceSet[].DataDisks'
44+
45+ [
46+ {
47+ " DiskSize" : 50,
48+ " DiskType" : " CLOUD_PREMIUM" ,
49+ " DiskId" : " disk-11lafkjo" ,
50+ " DeleteWithInstance" : true,
51+ " SnapshotId" : null,
52+ " Encrypt" : false,
53+ " KmsKeyId" : null,
54+ " ThroughputPerformance" : 0,
55+ " CdcId" : null
56+ }
57+ ]
58+ ```
59+
60+ ## Destroy the environment
61+
62+ ``` shell
63+ terraform destroy
64+ ```
Original file line number Diff line number Diff line change 1+ # 腾讯云 CVM 磁盘未加密场景
2+
3+ [ English] ( ./README.md ) | 中文
4+
5+ ## 描述信息
6+
7+ 这是一个用于构建腾讯云 CVM 磁盘未加密的场景。
8+
9+ ## 环境搭建
10+
11+ 在容器中执行以下命令
12+
13+ ``` shell
14+ cd /TerraformGoat/tencentcloud/cvm/cvm_virtual_machine_disks_are_unencrypted
15+ ```
16+
17+ 编辑 ` terraform.tfvars ` 文件,在文件中填入你的 ` tencentcloud_secret_id ` 和 ` tencentcloud_secret_key `
18+
19+ ``` shell
20+ vim terraform.tfvars
21+ ```
22+
23+ > 在腾讯云控制台的 [ API 密钥管理] ( https://console.cloud.tencent.com/cam/capi ) 可以创建和查看您的 SecretKey
24+
25+ 部署靶场
26+
27+ ``` shell
28+ terraform init
29+ terraform apply
30+ ```
31+
32+ > 在终端提示 ` Enter a value: ` 时,输入 ` yes ` 即可
33+
34+ 环境搭建完后,在 Outputs 处可以看到实例的 ID
35+
36+ ## 步骤
37+
38+ 使用腾讯云命令行工具查看实例挂载磁盘的加密情况。
39+
40+ ``` bash
41+ > tccli configure
42+ > apt-get install jq -y
43+ > tccli cvm DescribeInstances | jq ' .InstanceSet[].DataDisks'
44+
45+ [
46+ {
47+ " DiskSize" : 50,
48+ " DiskType" : " CLOUD_PREMIUM" ,
49+ " DiskId" : " disk-11lafkjo" ,
50+ " DeleteWithInstance" : true,
51+ " SnapshotId" : null,
52+ " Encrypt" : false,
53+ " KmsKeyId" : null,
54+ " ThroughputPerformance" : 0,
55+ " CdcId" : null
56+ }
57+ ]
58+ ```
59+
60+ 通过返回的内容可以看到 Encrypt 为 false,即未加密。
61+
62+ ## 销毁环境
63+
64+ ``` shell
65+ terraform destroy
66+ ```
Original file line number Diff line number Diff line change 1+ resource "tencentcloud_instance" "instance" {
2+ instance_name = " huocorp_terraform_goat_instance"
3+ availability_zone = " ap-guangzhou-7"
4+ image_id = " img-pi0ii46r"
5+ instance_type = data. tencentcloud_instance_types . instance_types . instance_types . 0 . instance_type
6+ data_disks {
7+ data_disk_type = " CLOUD_PREMIUM"
8+ data_disk_size = 50
9+ encrypt = false
10+ }
11+ }
12+
13+ data "tencentcloud_instance_types" "instance_types" {
14+ cpu_core_count = 1
15+ memory_size = 1
16+ }
Original file line number Diff line number Diff line change 1+ output "tencentcloud_instance_id" {
2+ value = tencentcloud_instance. instance . id
3+ }
Original file line number Diff line number Diff line change 1+ tencentcloud_secret_id = " xxx"
2+ tencentcloud_secret_key = " xxx"
Original file line number Diff line number Diff line change 1+ variable "tencentcloud_secret_id" {
2+ type = string
3+ description = " Set TencentCloud secret id."
4+ sensitive = true
5+ nullable = false
6+ }
7+
8+ variable "tencentcloud_secret_key" {
9+ type = string
10+ description = " Set TencentCloud secret key."
11+ sensitive = true
12+ nullable = false
13+ }
Original file line number Diff line number Diff line change 1+ terraform {
2+ required_providers {
3+ tencentcloud = {
4+ source = " tencentcloudstack/tencentcloud"
5+ version = " 1.70.2"
6+ }
7+ }
8+ }
9+
10+ provider "tencentcloud" {
11+ secret_id = var. tencentcloud_secret_id
12+ secret_key = var. tencentcloud_secret_key
13+ region = " ap-guangzhou"
14+ }
You can’t perform that action at this time.
0 commit comments