Skip to content

Commit f736d81

Browse files
authored
Add policy pack - Redshift Cluster Public Access Check. Closes #859 (#860)
1 parent 97d69c9 commit f736d81

File tree

4 files changed

+126
-0
lines changed

4 files changed

+126
-0
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
categories: ["compute", "networking", "security"]
3+
primary_category: "security"
4+
---
5+
6+
# Enforce AWS Redshift Clusters Are Not Publicly Accessible
7+
8+
Enforcing that AWS Redshift Clusters are not publicly accessible is crucial for protecting sensitive data and ensuring database security. This measure prevents unauthorized internet access to your Redshift clusters, reducing the risk of data breaches and enhancing compliance with security best practices and regulatory requirements.
9+
10+
This [policy pack](https://turbot.com/guardrails/docs/concepts/policy-packs) can help you configure the following settings for Redshift clusters:
11+
12+
- Enforce Redshift clusters to not be publicly accessible
13+
14+
## Documentation
15+
16+
- **[Review policy settings →](https://hub.guardrails.turbot.com/policy-packs/aws_redshift_enforce_clusters_are_not_publicly_accessible/settings)**
17+
18+
## Getting Started
19+
20+
### Requirements
21+
22+
- [Terraform](https://developer.hashicorp.com/terraform/install)
23+
- Guardrails mods:
24+
- [@turbot/aws-redshift](https://hub.guardrails.turbot.com/mods/aws/mods/aws-redshift)
25+
26+
### Credentials
27+
28+
To create a policy pack through Terraform:
29+
30+
- Ensure you have `Turbot/Admin` permissions (or higher) in Guardrails
31+
- [Create access keys](https://turbot.com/guardrails/docs/guides/iam/access-keys#generate-a-new-guardrails-api-access-key) in Guardrails
32+
33+
And then set your credentials:
34+
35+
```sh
36+
export TURBOT_WORKSPACE=myworkspace.acme.com
37+
export TURBOT_ACCESS_KEY=acce6ac5-access-key-here
38+
export TURBOT_SECRET_KEY=a8af61ec-secret-key-here
39+
```
40+
41+
Please see [Turbot Guardrails Provider authentication](https://registry.terraform.io/providers/turbot/turbot/latest/docs#authentication) for additional authentication methods.
42+
43+
## Usage
44+
45+
### Install Policy Pack
46+
47+
> [!NOTE]
48+
> By default, installed policy packs are not attached to any resources.
49+
>
50+
> Policy packs must be attached to resources in order for their policy settings to take effect.
51+
52+
Clone:
53+
54+
```sh
55+
git clone https://github.com/turbot/guardrails-samples.git
56+
cd guardrails-samples/policy_packs/aws/redshift/enforce_clusters_are_not_publicly_accessible
57+
```
58+
59+
Run the Terraform to create the policy pack in your workspace:
60+
61+
```sh
62+
terraform init
63+
terraform plan
64+
```
65+
66+
Then apply the changes:
67+
68+
```sh
69+
terraform apply
70+
```
71+
72+
### Apply Policy Pack
73+
74+
Log into your Guardrails workspace and [attach the policy pack to a resource](https://turbot.com/guardrails/docs/guides/policy-packs#attach-a-policy-pack-to-a-resource).
75+
76+
If this policy pack is attached to a Guardrails folder, its policies will be applied to all accounts and resources in that folder. The policy pack can also be attached to multiple resources.
77+
78+
For more information, please see [Policy Packs](https://turbot.com/guardrails/docs/concepts/policy-packs).
79+
80+
### Enable Enforcement
81+
82+
> [!TIP]
83+
> You can also update the policy settings in this policy pack directly in the Guardrails console.
84+
>
85+
> Please note your Terraform state file will then become out of sync and the policy settings should then only be managed in the console.
86+
87+
By default, the policies are set to `Check` in the pack's policy settings. To enable automated enforcements, you can switch these policies settings by adding a comment to the `Check` setting and removing the comment from one of the listed enforcement options:
88+
89+
```hcl
90+
resource "turbot_policy_setting" "aws_redshift_cluster_publicly_accessible" {
91+
resource = turbot_policy_pack.main.id
92+
type = "tmod:@turbot/aws-redshift#/policy/types/clusterPubliclyAccessible"
93+
# value = "Check: Cluster is not publicly accessible"
94+
value = "Enforce: Cluster is not publicly accessible"
95+
}
96+
```
97+
98+
Then re-apply the changes:
99+
100+
```sh
101+
terraform plan
102+
terraform apply
103+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "turbot_policy_pack" "main" {
2+
title = "Enforce AWS Redshift Clusters Are Not Publicly Accessible"
3+
description = "This measure prevents unauthorized internet access to your Redshift clusters, reducing the risk of data breaches and enhancing compliance with security best practices and regulatory requirements."
4+
akas = ["aws_redshift_enforce_clusters_are_not_publicly_accessible"]
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# AWS > Redshift > Cluster > Publicly Accessible
2+
resource "turbot_policy_setting" "aws_redshift_cluster_publicly_accessible" {
3+
resource = turbot_policy_pack.main.id
4+
type = "tmod:@turbot/aws-redshift#/policy/types/clusterPubliclyAccessible"
5+
value = "Check: Cluster is not publicly accessible"
6+
# value = "Enforce: Cluster is not publicly accessible"
7+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
terraform {
2+
required_providers {
3+
turbot = {
4+
source = "turbot/turbot"
5+
version = ">= 1.11.0"
6+
}
7+
}
8+
}
9+
10+
provider "turbot" {
11+
}

0 commit comments

Comments
 (0)