Skip to content

Commit f1dcebb

Browse files
committed
adjust ip whitelisting
1 parent 7cf236c commit f1dcebb

8 files changed

+33
-17
lines changed

.circleci/config.yml

Whitespace-only changes.

cloudformation/60_databases.yml.j2

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ Resources:
88
GroupDescription: Security group for Postgres Metadata DB. Public access
99
GroupName: "{{ serviceName }}-{{ ENVIRONMENT }}-metadata-db-public-security-group"
1010
SecurityGroupEgress:
11-
- CidrIp: 0.0.0.0/0
11+
{% for ip in whitelistedIPs %}
12+
- CidrIp: "{{ ip }}"
1213
FromPort: "{{ metadataDb.port }}"
13-
IpProtocol: -1
14+
IpProtocol: tcp
1415
ToPort: "{{ metadataDb.port }}"
16+
{% endfor %}
1517
SecurityGroupIngress:
1618
- CidrIp: 0.0.0.0/0
1719
FromPort: "{{ metadataDb.port }}"

cloudformation/70_redis.yml.j2

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ Resources:
1717
GroupDescription: Security group for Redis
1818
GroupName: "{{ serviceName }}-{{ ENVIRONMENT }}-redis-security-group"
1919
SecurityGroupEgress:
20-
- CidrIp: 0.0.0.0/0
21-
FromPort: 0
22-
IpProtocol: -1
23-
ToPort: 0
20+
{% for ip in whitelistedIPs %}
21+
- CidrIp: "{{ ip }}"
22+
FromPort: "{{ celeryBackend.port }}"
23+
IpProtocol: tcp
24+
ToPort: "{{ celeryBackend.port }}"
25+
{% endfor %}
2426
SecurityGroupIngress:
2527
- CidrIp: "{{ service.cidrBlock }}/16"
2628
FromPort: "{{ celeryBackend.port }}"

cloudformation/83_airflow-flower.yml.j2

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ Resources:
77
GroupDescription: Security group for Airflow Flower. Allow all inbound traffic.
88
GroupName: "{{ serviceName }}-{{ ENVIRONMENT }}-flower-external-security-group"
99
SecurityGroupEgress:
10-
{{ securityGroupEgressRules }}
10+
{% for ip in whitelistedIPs %}
11+
- CidrIp: "{{ ip }}"
12+
FromPort: 80
13+
IpProtocol: tcp
14+
ToPort: 80
15+
- CidrIp: "{{ ip }}"
16+
FromPort: 443
17+
IpProtocol: tcp
18+
ToPort: 443
19+
{% endfor %}
1120
SecurityGroupIngress:
1221
- CidrIp: 0.0.0.0/0
1322
FromPort: "{{ service.port }}"

cloudformation/84_airflow-scheduler.yml.j2

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Resources:
66
Properties:
77
GroupDescription: Security group for Airflow Scheduler
88
GroupName: "{{ serviceName }}-{{ ENVIRONMENT }}-scheduler-security-group"
9-
SecurityGroupEgress:
10-
{{ securityGroupEgressRules }}
119
VpcId: !ImportValue network-VpcId
1210
Tags:
1311
- Key: Name

cloudformation/85_airflow-webserver.yml.j2

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@ Resources:
77
GroupDescription: Security group for Airflow webserver. Allow all inbound traffic.
88
GroupName: "{{ serviceName }}-{{ ENVIRONMENT }}-webserver-security-group"
99
SecurityGroupEgress:
10-
{{ securityGroupEgressRules }}
10+
{% for ip in whitelistedIPs %}
11+
- CidrIp: "{{ ip }}"
12+
FromPort: 80
13+
IpProtocol: tcp
14+
ToPort: 80
15+
- CidrIp: "{{ ip }}"
16+
FromPort: 443
17+
IpProtocol: tcp
18+
ToPort: 443
19+
{% endfor %}
1120
SecurityGroupIngress:
1221
- CidrIp: 0.0.0.0/0
1322
FromPort: "{{ service.port }}"

cloudformation/86_airflow-workers.yml.j2

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Resources:
66
Properties:
77
GroupDescription: Security group for Airflow workers
88
GroupName: "{{ serviceName }}-{{ ENVIRONMENT }}-workers-security-group"
9-
SecurityGroupEgress:
10-
{{ securityGroupEgressRules }}
119
SecurityGroupIngress:
1210
- CidrIp: "{{ service.cidrBlock }}/16"
1311
FromPort: "{{ service.workers.port }}"

service.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,8 @@ publicSubnet:
8383

8484
# List of SecurityGroupEgress.
8585
# Will be used to whitelist IPs for webserver, flower, workers and scheduler
86-
securityGroupEgressRules:
87-
- CidrIp: 0.0.0.0/0
88-
FromPort: 0
89-
IpProtocol: -1
90-
ToPort: 0
86+
whitelistedIPs:
87+
- 0.0.0.0/0
9188

9289
metadataDb:
9390
instanceType: db.t3.micro
@@ -103,6 +100,7 @@ metadataDb:
103100
maxConnections: 100
104101

105102

103+
106104
celeryBackend:
107105
port: 6379
108106
azMode: single-az

0 commit comments

Comments
 (0)