-
Notifications
You must be signed in to change notification settings - Fork 207
/
Copy pathgateway.yaml
607 lines (606 loc) · 19.6 KB
/
gateway.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
AWSTemplateFormatVersion: 2010-09-09
Description: Deploys a Check Point Security Gateway into an existing VPC (20241027)
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: VPC Network Configuration
Parameters:
- VPC
- PublicSubnet
- PrivateSubnet
- InternalRouteTable
- Label:
default: EC2 Instance Configuration
Parameters:
- GatewayName
- GatewayInstanceType
- KeyName
- AllocatePublicAddress
- VolumeSize
- VolumeType
- VolumeEncryption
- EnableInstanceConnect
- TerminationProtection
- MetaDataToken
- Label:
default: Check Point Settings
Parameters:
- GatewayVersion
- Shell
- GatewaySICKey
- GatewayPasswordHash
- GatewayMaintenancePasswordHash
- Label:
default: Quick connect to Smart-1 Cloud (Recommended)
Parameters:
- GatewayToken
- Label:
default: Advanced Settings
Parameters:
- ResourcesTagName
- GatewayHostname
- AllowUploadDownload
- CloudWatch
- GatewayBootstrapScript
- NTPPrimary
- NTPSecondary
- Label:
default: Automatic Provisioning with Security Management Server Settings (optional)
Parameters:
- ControlGatewayOverPrivateOrPublicAddress
- ManagementServer
- ConfigurationTemplate
ParameterLabels:
VPC:
default: VPC
PublicSubnet:
default: Public subnet
PrivateSubnet:
default: Private subnet
InternalRouteTable:
default: Internal route table
GatewayName:
default: Gateway Name
GatewayInstanceType:
default: Gateway Instance type
KeyName:
default: Key name
AllocatePublicAddress:
default: Allocate an Elastic IP
VolumeSize:
default: Root volume size (GB)
VolumeType:
default: Volume Type
VolumeEncryption:
default: Volume encryption KMS key identifier
EnableInstanceConnect:
default: Enable AWS Instance Connect
TerminationProtection:
default: Termination Protection
MetaDataToken:
default: Metadata HTTP token
GatewayVersion:
default: Gateway Version & license
Shell:
default: Admin shell
GatewaySICKey:
default: Gateway SIC key
GatewayToken:
default: Smart-1 Cloud Token
GatewayPasswordHash:
default: Gateway Password hash
GatewayMaintenancePasswordHash:
default: Gateway Maintenance Password hash
ResourcesTagName:
default: Resources prefix tag
GatewayHostname:
default: Gateway Hostname
AllowUploadDownload:
default: Allow upload & download
CloudWatch:
default: CloudWatch metrics
GatewayBootstrapScript:
default: Bootstrap Script
NTPPrimary:
default: Primary NTP server
NTPSecondary:
default: Secondary NTP server
ControlGatewayOverPrivateOrPublicAddress:
default: Gateway address
ManagementServer:
default: Management Server
ConfigurationTemplate:
default: Configuration template
Parameters:
VPC:
Type: AWS::EC2::VPC::Id
MinLength: 1
PublicSubnet:
Description: The public subnet of the security gateway.
Type: AWS::EC2::Subnet::Id
MinLength: 1
PrivateSubnet:
Description: The private subnet of the security gateway.
Type: AWS::EC2::Subnet::Id
MinLength: 1
InternalRouteTable:
Description: The route table id in which to set 0.0.0.0/0 route to the Gateway instance (e.g. rtb-12a34567). Route table cannot have an existing 0.0.0.0/0 route. If empty - traffic will not be routed through the Security Gateway, this requires manual configuration in the route table. (optional)
Type: String
Default: ''
GatewayName:
Description: The name tag of the Security Gateway instances. (optional)
Type: String
Default: Check-Point-Gateway
GatewayInstanceType:
Description: The instance type of the Secutiry Gateway.
Type: String
Default: c6in.xlarge
AllowedValues:
- c4.large
- c4.xlarge
- c5.large
- c5.xlarge
- c5.2xlarge
- c5.4xlarge
- c5.9xlarge
- c5.12xlarge
- c5.18xlarge
- c5.24xlarge
- c5n.large
- c5n.xlarge
- c5n.2xlarge
- c5n.4xlarge
- c5n.9xlarge
- c5n.18xlarge
- c5d.large
- c5d.xlarge
- c5d.2xlarge
- c5d.4xlarge
- c5d.9xlarge
- c5d.12xlarge
- c5d.18xlarge
- c5d.24xlarge
- m5.large
- m5.xlarge
- m5.2xlarge
- m5.4xlarge
- m5.8xlarge
- m5.12xlarge
- m5.16xlarge
- m5.24xlarge
- m6i.large
- m6i.xlarge
- m6i.2xlarge
- m6i.4xlarge
- m6i.8xlarge
- m6i.12xlarge
- m6i.16xlarge
- m6i.24xlarge
- m6i.32xlarge
- c6i.large
- c6i.xlarge
- c6i.2xlarge
- c6i.4xlarge
- c6i.8xlarge
- c6i.12xlarge
- c6i.16xlarge
- c6i.24xlarge
- c6i.32xlarge
- c6in.large
- c6in.xlarge
- c6in.2xlarge
- c6in.4xlarge
- c6in.8xlarge
- c6in.12xlarge
- c6in.16xlarge
- c6in.24xlarge
- c6in.32xlarge
- r5.large
- r5.xlarge
- r5.2xlarge
- r5.4xlarge
- r5.8xlarge
- r5.12xlarge
- r5.16xlarge
- r5.24xlarge
- r5a.large
- r5a.xlarge
- r5a.2xlarge
- r5a.4xlarge
- r5a.8xlarge
- r5a.12xlarge
- r5a.16xlarge
- r5a.24xlarge
- r5b.large
- r5b.xlarge
- r5b.2xlarge
- r5b.4xlarge
- r5b.8xlarge
- r5b.12xlarge
- r5b.16xlarge
- r5b.24xlarge
- r5n.large
- r5n.xlarge
- r5n.2xlarge
- r5n.4xlarge
- r5n.8xlarge
- r5n.12xlarge
- r5n.16xlarge
- r5n.24xlarge
- r6i.large
- r6i.xlarge
- r6i.2xlarge
- r6i.4xlarge
- r6i.8xlarge
- r6i.12xlarge
- r6i.16xlarge
- r6i.24xlarge
- r6i.32xlarge
- m6a.large
- m6a.xlarge
- m6a.2xlarge
- m6a.4xlarge
- m6a.8xlarge
- m6a.12xlarge
- m6a.16xlarge
- m6a.24xlarge
- m6a.32xlarge
- m6a.48xlarge
ConstraintDescription: Must be a valid EC2 instance type
KeyName:
Description: The EC2 Key Pair to allow SSH access to the instance.
Type: AWS::EC2::KeyPair::KeyName
MinLength: 1
ConstraintDescription: must be the name of an existing EC2 KeyPair.
AllocatePublicAddress:
Type: String
Default: true
AllowedValues:
- true
- false
VolumeSize:
Type: Number
Default: 100
MinValue: 100
VolumeType:
Description: General Purpose SSD Volume Type
Type: String
Default: gp3
AllowedValues:
- gp3
- gp2
VolumeEncryption:
Description: KMS or CMK key Identifier - Use key ID, alias or ARN. Key alias should be prefixed with 'alias/' (e.g. for KMS default alias 'aws/ebs' - insert 'alias/aws/ebs').
Type: String
Default: alias/aws/ebs
EnableInstanceConnect:
Description: Ec2 Instance Connect is not supported with versions prior to R80.40.
Type: String
Default: false
AllowedValues:
- true
- false
TerminationProtection:
Description: Prevents an instance from accidental termination.
Type: String
Default: false
AllowedValues:
- true
- false
MetaDataToken:
Description: Set true to deploy the instance with metadata v2 token required.
Type: String
Default: true
AllowedValues:
- true
- false
GatewayVersion:
Type: String
Default: R81.20-BYOL
AllowedValues:
- R81.10-BYOL
- R81.10-PAYG-NGTP
- R81.10-PAYG-NGTX
- R81.20-BYOL
- R81.20-PAYG-NGTP
- R81.20-PAYG-NGTX
- R82-BYOL
- R82-PAYG-NGTP
- R82-PAYG-NGTX
Shell:
Description: Change the admin shell to enable advanced command line configuration.
Type: String
Default: /etc/cli.sh
AllowedValues:
- /etc/cli.sh
- /bin/bash
- /bin/csh
- /bin/tcsh
GatewaySICKey:
Description: The Secure Internal Communication key creates trusted connections
between Check Point components. Choose a random string consisting of at least
8 alphanumeric characters.
Type: String
AllowedPattern: '[a-zA-Z0-9]{8,}'
NoEcho: true
GatewayToken:
Description: Follow the instructions in SK180501 to quickly connect this Gateway to Smart-1 Cloud. Paste here the token copied from the Connect Gateway screen in Smart-1 Cloud portal.
Type: String
AllowedPattern: '(^aHR0cHM6Ly9(.+)|(.*)\s[aHR0cHM6Ly9](.+)|^$)'
NoEcho: true
GatewayPasswordHash:
Description: Admin user's password hash (use command "openssl passwd -6 PASSWORD"
to get the PASSWORD's hash). (optional)
Type: String
Default: ''
AllowedPattern: '[\$\./a-zA-Z0-9]*'
NoEcho: true
GatewayMaintenancePasswordHash:
Description: Check Point recommends setting Admin user's password and maintenance-mode password for recovery purposes. For R81.10 and below the Admin user's password is used also as maintenance-mode password. (To generate a password hash use the command "grub2-mkpasswd-pbkdf2" on Linux and paste it here). (optional)
Type: String
Default: ''
AllowedPattern: '[\$\./a-zA-Z0-9]*'
NoEcho: true
ResourcesTagName:
Description: The name tag of the resources. (optional)
Type: String
Default: ''
GatewayHostname:
Description: The name must not contain reserved words. For details, refer to sk40179 (optional).
Type: String
Default: ''
AllowedPattern: '^([A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?|)$'
ConstraintDescription: A valid hostname label or an empty string.
AllowUploadDownload:
Description: Automatically download updates and share statistical data for product improvement purpose.
Type: String
Default: true
AllowedValues:
- true
- false
CloudWatch:
Description: Report Check Point specific CloudWatch metrics.
Type: String
Default: false
AllowedValues:
- true
- false
GatewayBootstrapScript:
Description: An optional script with semicolon (;) separated commands to run on the initial boot. (optional)
Type: String
Default: ''
NoEcho: true
NTPPrimary:
Description: (optional)
Type: String
Default: 169.254.169.123
AllowedPattern: '^[\.a-zA-Z0-9\-]*$'
NTPSecondary:
Description: (optional)
Type: String
Default: 0.pool.ntp.org
AllowedPattern: '^[\.a-zA-Z0-9\-]*$'
ControlGatewayOverPrivateOrPublicAddress:
Description: Determines if the Security Gateway is provisioned using its private
or public address.
Type: String
Default: private
AllowedValues:
- private
- public
ManagementServer:
Description: The name that represents the Security Management Server in the automatic
provisioning configuration.
Type: String
ConfigurationTemplate:
Description: A name of a Security Gateway configuration template in the automatic
provisioning configuration.
Type: String
MaxLength: 30
Conditions:
ProvidedRouteTable: !Not [!Equals [!Ref InternalRouteTable, '']]
AllocateAddress: !Equals [!Ref AllocatePublicAddress, true]
EncryptedVolume: !Not [!Equals [!Ref VolumeEncryption, '']]
ProvidedResourcesTag: !Not [!Equals [!Ref ResourcesTagName, '']]
ProvidedManagementParameters: !And [!Not [!Equals [!Ref ManagementServer, '']], !Not [!Equals [!Ref ConfigurationTemplate, '']]]
EnableCloudWatch: !Equals [!Ref CloudWatch, true]
EnableMetaDataToken: !Equals [!Ref MetaDataToken, true]
Resources:
ReadyHandle:
Type: AWS::CloudFormation::WaitConditionHandle
Condition: AllocateAddress
Properties: {}
ReadyCondition:
Type: AWS::CloudFormation::WaitCondition
Condition: AllocateAddress
DependsOn: GatewayInstance
Properties:
Handle: !Ref ReadyHandle
Timeout: 1800
GatewayIAMRole:
Condition: EnableCloudWatch
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service: [ ec2.amazonaws.com ]
Action: sts:AssumeRole
Path: /
GatewayInstanceProfile:
Condition: EnableCloudWatch
Type: AWS::IAM::InstanceProfile
Properties:
Path: /
Roles: [!Ref GatewayIAMRole]
CloudwatchPolicy:
Condition: EnableCloudWatch
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://cgi-cfts.s3.amazonaws.com/iam/cloudwatch-policy.yaml
Parameters:
PolicyName: !If [ ProvidedResourcesTag, !Ref ResourcesTagName, !Ref 'AWS::StackName' ]
PolicyRole: !Ref GatewayIAMRole
AMI:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://cgi-cfts.s3.amazonaws.com/utils/amis.yaml
Parameters:
Version: !Join ['-', [!Ref GatewayVersion,GW]]
ExternalNetworkInterface:
Type: AWS::EC2::NetworkInterface
Properties:
Tags:
- Key: Name
Value:
!Join
- _
- - !If [ProvidedResourcesTag, !Ref ResourcesTagName, !Ref 'AWS::StackName']
- ExternalNetworkInterface
Description: eth0
SourceDestCheck: false
GroupSet:
- !Ref PermissiveSecurityGroup
SubnetId: !Ref PublicSubnet
InternalNetworkInterface:
Type: AWS::EC2::NetworkInterface
Properties:
Tags:
- Key: Name
Value:
!Join
- _
- - !If [ProvidedResourcesTag, !Ref ResourcesTagName, !Ref 'AWS::StackName']
- InternalNetworkInterface
Description: eth1
SourceDestCheck: false
GroupSet:
- !Ref PermissiveSecurityGroup
SubnetId: !Ref PrivateSubnet
PermissiveSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
Tags:
- Key: Name
Value:
!Join
- _
- - !If [ProvidedResourcesTag, !Ref ResourcesTagName, !Ref 'AWS::StackName']
- PermissiveSecurityGroup
GroupDescription: Permissive security group.
VpcId: !Ref VPC
SecurityGroupIngress:
- IpProtocol: -1
CidrIp: 0.0.0.0/0
InternalDefaultRoute:
Type: AWS::EC2::Route
Condition: ProvidedRouteTable
Properties:
DestinationCidrBlock: 0.0.0.0/0
NetworkInterfaceId: !Ref InternalNetworkInterface
RouteTableId: !Ref InternalRouteTable
GatewayInstance:
Type: AWS::EC2::Instance
DependsOn: GatewayLaunchTemplate
Properties:
LaunchTemplate:
LaunchTemplateId: !Ref GatewayLaunchTemplate
Version: !GetAtt GatewayLaunchTemplate.LatestVersionNumber
DisableApiTermination: !Ref TerminationProtection
Tags:
- Key: Name
Value: !Ref GatewayName
- !If
- ProvidedManagementParameters
- Key: x-chkp-tags
Value:
!Join
- ':'
- - !Join ['=', [management, !Ref ManagementServer]]
- !Join ['=', [template,!Ref ConfigurationTemplate]]
- !Join ['=',[ip-address, !Ref ControlGatewayOverPrivateOrPublicAddress]]
- !Ref 'AWS::NoValue'
GatewayLaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateData:
NetworkInterfaces:
- DeviceIndex: 0
NetworkInterfaceId: !Ref ExternalNetworkInterface
- DeviceIndex: 1
NetworkInterfaceId: !Ref InternalNetworkInterface
KeyName: !Ref KeyName
ImageId: !GetAtt AMI.Outputs.ImageId
InstanceType: !Ref GatewayInstanceType
MetadataOptions:
HttpTokens: !If [EnableMetaDataToken, required, optional]
BlockDeviceMappings:
- DeviceName: '/dev/xvda'
Ebs:
Encrypted: !If [ EncryptedVolume, true, false ]
KmsKeyId: !If [ EncryptedVolume, !Ref VolumeEncryption, !Ref 'AWS::NoValue' ]
VolumeType: !Ref VolumeType
VolumeSize: !Ref VolumeSize
IamInstanceProfile:
Name: !If [EnableCloudWatch, !Ref GatewayInstanceProfile, !Ref 'AWS::NoValue']
UserData:
'Fn::Base64':
!Join
- |+
- - '#cloud-config'
- 'runcmd:'
- ' - |'
- ' set -e'
- !Sub ' admin_shell=${Shell} ; hostname=${GatewayHostname} ; allow_info=${AllowUploadDownload} ; cw=${CloudWatch} ; ntp1=${NTPPrimary} ; ntp2=${NTPSecondary} ; eic=${EnableInstanceConnect} ; eip=${AllocatePublicAddress} ; token=''${GatewayToken}'''
- !If [AllocateAddress, !Sub ' wait_handle=''${ReadyHandle}''',!Ref 'AWS::NoValue']
- !Join ['', [' sic="$(echo ', 'Fn::Base64': !Ref GatewaySICKey, ')"']]
- !Join ['', [' pwd_hash="$(echo ', 'Fn::Base64': !Ref GatewayPasswordHash, ')"']]
- !Join ['', [' maintenance_pwd_hash="$(echo ', 'Fn::Base64': !Ref GatewayMaintenancePasswordHash, ')"']]
- !Join ['', [' bootstrap="$(echo ', 'Fn::Base64': !Ref GatewayBootstrapScript, ')"']]
- !Sub [' version=${Version}', {Version: !Select [0, !Split ['-', !Ref GatewayVersion]]}]
- ' python3 /etc/cloud_config.py enableCloudWatch=\"${cw}\" waitHandle=\"${wait_handle}\" sicKey=\"${sic}\" "smart1CloudToken=\"${token}\"" installationType=\"gateway\" osVersion=\"${version}\" allowUploadDownload=\"${allow_info}\" templateVersion=\"20240204\" templateName=\"gateway\" shell=\"${admin_shell}\" enableInstanceConnect=\"${eic}\" hostName=\"${hostname}\" ntpPrimary=\"${ntp1}\" ntpSecondary=\"${ntp2}\" passwordHash=\"${pwd_hash}\" MaintenanceModePassword=\"${maintenance_pwd_hash}\" allocatePublicAddress=\"${eip}\" bootstrapScript64=\"${bootstrap}\"'
VersionDescription: Initial template version
PublicAddress:
Type: AWS::EC2::EIP
Condition: AllocateAddress
Properties:
Domain: vpc
AddressAssoc:
Type: AWS::EC2::EIPAssociation
Condition: AllocateAddress
DependsOn: GatewayInstance
Properties:
NetworkInterfaceId: !Ref ExternalNetworkInterface
AllocationId: !GetAtt PublicAddress.AllocationId
PrivateIpAddress: !GetAtt ExternalNetworkInterface.PrimaryPrivateIpAddress
Outputs:
PublicAddress:
Description: The public address of the Check Point instance.
Value: !Ref PublicAddress
Condition: AllocateAddress
PrivateExternalAddress:
Description: The private external address of the Check Point instance.
Value: !GetAtt ExternalNetworkInterface.PrimaryPrivateIpAddress
PrivateInternalAddress:
Description: The private internal address of the Check Point instance.
Value: !GetAtt InternalNetworkInterface.PrimaryPrivateIpAddress
SSH:
Description: SSH command to the Check Point instance.
Value: !Join ['', ['ssh -i ', !Ref KeyName, ' admin@', !Ref PublicAddress]]
Condition: AllocateAddress
URL:
Description: URL to the portal.
Value: !Join ['', ['https://', !Ref PublicAddress]]
Condition: AllocateAddress
ManagementName:
Description: The name that represents the Security Management Server.
Value: !Ref ManagementServer
ConfigurationTemplateName:
Description: The name that represents the configuration template. Configurations
required to automatically provision the Gateways in the Auto Scaling Group,
such as what Security Policy to install and which Blades to enable, will be
placed under this template name.
Value: !Ref ConfigurationTemplate