Skip to content

Commit 79ce811

Browse files
committed
Added S3 Policy Script
Added script to check S3 policy.
1 parent 617d1f6 commit 79ce811

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ You will need the [AWS-CLI](https://aws.amazon.com/cli/) installed and configure
2424

2525
**_GuardDuty/enale.sh_**: Enables GuardDuty in all available regions.
2626

27-
**_GuardDuty/findings.sh_**: Exports all GuardDuty findings to .json files.
27+
**_GuardDuty/findings.sh_**: Exports all GuardDuty findings to .json files.
28+
29+
**_S3/policies.sh_**: Lists all ACLs for S3 buckets in your account.
2830

2931
## Important Notice
3032
*I likely dont know what I am doing and this could be done faster, better and simpler some other way. These scripts could also break your cloud and make you cry.*

S3/policies.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
#Lists all ACLs for S3 buckets in your account.
3+
4+
#Remove Old Working Files.
5+
rm -rf buckets.txt
6+
rm -rf bucketpolicies.txt
7+
8+
#List All Buckets
9+
aws s3 ls | awk '{print $3}' > buckets.txt
10+
11+
#Find & Print ACLs for Buckets
12+
for i in $(cat buckets.txt)
13+
do
14+
printf "$i \n" >> bucketpolicies.txt
15+
aws s3api get-bucket-acl --bucket "$i" --output text >> bucketpolicies.txt
16+
printf "\n" >> bucketpolicies.txt
17+
done

0 commit comments

Comments
 (0)