-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from teamssix/main
feat: add aliyun oss bucket logging disable scenario
- Loading branch information
Showing
7 changed files
with
219 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Alibaba Cloud OSS Bucket Logging Disable Scenario | ||
|
||
English | [中文](./README_CN.md) | ||
|
||
## Description | ||
|
||
This is a scenario for building an Alibaba Cloud OSS Bucket logging disable. | ||
|
||
## Deployment Environment | ||
|
||
Execute the following command in the container | ||
|
||
```shell | ||
cd /TerraformGoat/aliyun/oss/bucket_logging_disable | ||
``` | ||
|
||
Configure Alibaba Cloud Access Credentials | ||
|
||
```shell | ||
aliyun configure | ||
``` | ||
|
||
> You can create and view your AccessKey on the [AccessKey page](https://ram.console.aliyun.com/manage/ak) of the Alibaba Cloud console | ||
Deploy Vulnerable Environment | ||
|
||
```shell | ||
terraform init | ||
terraform apply | ||
``` | ||
|
||
> When the terminal prompts `Enter a value:`, enter `yes` | ||
After the scenario is built, you can see the URL of the Bucket in the Outputs. | ||
|
||
## Solution | ||
|
||
Use aliyun cli to see the current configuration of logging | ||
|
||
```shell | ||
aliyun oss logging --method get oss://huoxian-terraformgoat-bucket-xxxxx | ||
``` | ||
|
||
logging disable | ||
|
||
```xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<BucketLoggingStatus> | ||
<LoggingEnabled> | ||
<TargetBucket></TargetBucket> | ||
<TargetPrefix></TargetPrefix> | ||
</LoggingEnabled> | ||
</BucketLoggingStatus> | ||
``` | ||
|
||
logging enable | ||
|
||
```xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<BucketLoggingStatus> | ||
<LoggingEnabled> | ||
<TargetBucket>huoxian-terraformgoat-bucket-xxxxx</TargetBucket> | ||
<TargetPrefix>log/</TargetPrefix> | ||
</LoggingEnabled> | ||
</BucketLoggingStatus> | ||
``` | ||
|
||
## Destroy the environment | ||
|
||
```shell | ||
terraform destroy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# 阿里云 OSS Bucket 日志转存未开启场景 | ||
|
||
[English](./README.md) | 中文 | ||
|
||
## 描述信息 | ||
|
||
这是一个用于构建阿里云 OSS Bucket 日志转存未开启的场景。 | ||
|
||
## 环境搭建 | ||
|
||
在容器中执行以下命令 | ||
|
||
```shell | ||
cd /TerraformGoat/aliyun/oss/bucket_logging_disable | ||
``` | ||
|
||
配置阿里云访问凭证 | ||
|
||
```shell | ||
aliyun configure | ||
``` | ||
|
||
> 在阿里云控制台的 [AccessKey 页面](https://ram.console.aliyun.com/manage/ak) 可以创建和查看您的 AccessKey | ||
部署靶场 | ||
|
||
```shell | ||
terraform init | ||
terraform apply | ||
``` | ||
|
||
> 在终端提示 `Enter a value:` 时,输入 `yes` 即可 | ||
场景搭建完后,在 Outputs 处可以看到 Bucket 的 URL | ||
|
||
## 操作 | ||
|
||
使用 aliyun cli 可以查看当前 logging 的配置情况 | ||
|
||
```shell | ||
aliyun oss logging --method get oss://huoxian-terraformgoat-bucket-xxxxx | ||
``` | ||
|
||
未配置日志转存的情况 | ||
|
||
```xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<BucketLoggingStatus> | ||
<LoggingEnabled> | ||
<TargetBucket></TargetBucket> | ||
<TargetPrefix></TargetPrefix> | ||
</LoggingEnabled> | ||
</BucketLoggingStatus> | ||
``` | ||
|
||
配置了日志转存的情况 | ||
|
||
```xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<BucketLoggingStatus> | ||
<LoggingEnabled> | ||
<TargetBucket>huoxian-terraformgoat-bucket-xxx</TargetBucket> | ||
<TargetPrefix>log/</TargetPrefix> | ||
</LoggingEnabled> | ||
</BucketLoggingStatus> | ||
``` | ||
|
||
## 销毁环境 | ||
|
||
```shell | ||
terraform destroy | ||
``` |
Oops, something went wrong.