Skip to content

Commit f2e9ab1

Browse files
committed
Locking down 2375, a second attempt
Signed-off-by: Ken Cochrane <[email protected]>
1 parent ffc7dc5 commit f2e9ab1

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

aws/cloudformation/docker_for_aws.json

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,13 @@
368368
},
369369

370370
"SwarmWideSG": {
371-
"DependsOn": "NodeVpcSG",
371+
"DependsOn": "Vpc",
372372
"Type": "AWS::EC2::SecurityGroup",
373373
"Properties": {
374374
"VpcId": {
375375
"Ref": "Vpc"
376376
},
377-
"GroupDescription": "Wide open",
377+
"GroupDescription": "Swarm wide access",
378378
"SecurityGroupIngress": [
379379
{
380380
"IpProtocol": "-1",
@@ -428,8 +428,7 @@
428428
},
429429
"GroupDescription": "Manager SecurityGroup",
430430
"SecurityGroupIngress": [
431-
{"IpProtocol": "tcp","FromPort": "22","ToPort": "22","CidrIp": "0.0.0.0/0"},
432-
{"IpProtocol": "tcp","FromPort": "2375","ToPort": "2375", "SourceSecurityGroupId" : { "Fn::GetAtt" : [ "NodeVpcSG", "GroupId" ] } },
431+
{"IpProtocol": "tcp", "FromPort": "22","ToPort": "22","CidrIp": "0.0.0.0/0"},
433432
{"IpProtocol" : "tcp", "FromPort" : "2377", "ToPort" : "2377", "SourceSecurityGroupId" : { "Fn::GetAtt" : [ "NodeVpcSG", "GroupId" ] } },
434433
{"IpProtocol" : "udp", "FromPort" : "4789", "ToPort" : "4789", "SourceSecurityGroupId" : { "Fn::GetAtt" : [ "NodeVpcSG", "GroupId" ] } },
435434
{"IpProtocol" : "tcp", "FromPort" : "7946", "ToPort" : "7946", "SourceSecurityGroupId" : { "Fn::GetAtt" : [ "NodeVpcSG", "GroupId" ] } },
@@ -444,7 +443,21 @@
444443
"VpcId": {
445444
"Ref": "Vpc"
446445
},
447-
"GroupDescription": "Node SecurityGroup"
446+
"GroupDescription": "Node SecurityGroup",
447+
"SecurityGroupIngress": [
448+
{
449+
"IpProtocol": "-1",
450+
"FromPort": "0",
451+
"ToPort": "65535",
452+
"CidrIp": { "Fn::FindInMap" : [ "VpcCidrs", "vpc", "cidr" ] }
453+
}
454+
],
455+
"SecurityGroupEgress": [
456+
{"IpProtocol" : "icmp", "FromPort" : "8", "ToPort" : "0", "CidrIp": "0.0.0.0/0" },
457+
{"IpProtocol" : "udp", "FromPort" : "0", "ToPort" : "65535", "CidrIp": "0.0.0.0/0" },
458+
{"IpProtocol" : "tcp", "FromPort" : "0", "ToPort" : "2374", "CidrIp": "0.0.0.0/0" },
459+
{"IpProtocol" : "tcp", "FromPort" : "2376", "ToPort" : "65535", "CidrIp": "0.0.0.0/0" }
460+
]
448461
}
449462
},
450463

@@ -686,7 +699,7 @@
686699
}]
687700
},
688701
"AssociatePublicIpAddress": "true",
689-
"SecurityGroups": [ { "Ref" : "NodeVpcSG"}, { "Ref" : "SwarmWideSG"} ],
702+
"SecurityGroups": [ { "Ref" : "NodeVpcSG"} ],
690703
"UserData": {
691704
"Fn::Base64": {
692705
"Fn::Join": [
@@ -771,7 +784,7 @@
771784
"HealthCheck" : {
772785
"HealthyThreshold" : "2",
773786
"Interval" : "10",
774-
"Target" : "TCP:2375",
787+
"Target" : "TCP:44554",
775788
"Timeout" : "2",
776789
"UnhealthyThreshold" : "4"
777790
},

0 commit comments

Comments
 (0)