Skip to content

Commit eb560ca

Browse files
committed
chore(ec2): add ESP and AH IPsec protocol
1 parent ed94c5e commit eb560ca

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

packages/@aws-cdk/aws-ec2/lib/port.ts

+26
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export enum Protocol {
99
UDP = 'udp',
1010
ICMP = 'icmp',
1111
ICMPV6 = '58',
12+
ESP = 'esp',
13+
AH = 'ah',
1214
}
1315

1416
/**
@@ -171,6 +173,30 @@ export class Port {
171173
});
172174
}
173175

176+
/**
177+
* A single ESP port
178+
*/
179+
public static esp(): Port {
180+
return new Port({
181+
protocol: Protocol.ESP,
182+
fromPort: 50,
183+
toPort: 50,
184+
stringRepresentation: 'ESP 50',
185+
});
186+
}
187+
188+
/**
189+
* A single AH port
190+
*/
191+
public static ah(): Port {
192+
return new Port({
193+
protocol: Protocol.AH,
194+
fromPort: 51,
195+
toPort: 51,
196+
stringRepresentation: 'AH 51',
197+
});
198+
}
199+
174200
/**
175201
* Whether the rule containing this port range can be inlined into a securitygroup or not.
176202
*/

packages/@aws-cdk/aws-ec2/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@
315315
"docs-public-apis:@aws-cdk/aws-ec2.Protocol.UDP",
316316
"docs-public-apis:@aws-cdk/aws-ec2.Protocol.ICMP",
317317
"docs-public-apis:@aws-cdk/aws-ec2.Protocol.ICMPV6",
318+
"docs-public-apis:@aws-cdk/aws-ec2.Protocol.ESP",
319+
"docs-public-apis:@aws-cdk/aws-ec2.Protocol.AH",
318320
"docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_SQL_2008_SP4_EXPRESS",
319321
"docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_CHINESE_SIMPLIFIED_64BIT_BASE",
320322
"docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_CHINESE_TRADITIONAL_64BIT_BASE",

packages/@aws-cdk/aws-ec2/test/integ.vpc.expected.json

+15-1
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,20 @@
567567
"FromPort": 800,
568568
"IpProtocol": "udp",
569569
"ToPort": 801
570+
},
571+
{
572+
"CidrIp": "0.0.0.0/0",
573+
"Description": "from 0.0.0.0/0:ESP 50",
574+
"FromPort": 50,
575+
"IpProtocol": "esp",
576+
"ToPort": 50
577+
},
578+
{
579+
"CidrIp": "0.0.0.0/0",
580+
"Description": "from 0.0.0.0/0:AH 51",
581+
"FromPort": 51,
582+
"IpProtocol": "ah",
583+
"ToPort": 51
570584
}
571585
],
572586
"VpcId": {
@@ -575,4 +589,4 @@
575589
}
576590
}
577591
}
578-
}
592+
}

packages/@aws-cdk/aws-ec2/test/integ.vpc.ts

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const rules = [
1616
ec2.Port.allUdp(),
1717
ec2.Port.udp(123),
1818
ec2.Port.udpRange(800, 801),
19+
ec2.Port.esp(),
20+
ec2.Port.ah(),
1921
];
2022

2123
for (const rule of rules) {

0 commit comments

Comments
 (0)