Skip to content

Commit

Permalink
resolve code analysis feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
chkp-eddiek committed Sep 25, 2024
1 parent db9e8db commit 008dbe1
Show file tree
Hide file tree
Showing 217 changed files with 2,342 additions and 1,942 deletions.
30 changes: 19 additions & 11 deletions aws/templates/asg/autoscale.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AWSTemplateFormatVersion: 2010-09-09
Description: Create an Auto Scaling group of Check Point gateways (20240417)
Description: Create an Auto Scaling group of Check Point gateways (__VERSION__)
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
Expand All @@ -18,6 +18,7 @@ Metadata:
- VolumeType
- EnableVolumeEncryption
- EnableInstanceConnect
- MetaDataToken
- Label:
default: Auto Scaling Configuration
Parameters:
Expand Down Expand Up @@ -67,6 +68,8 @@ Metadata:
default: Enable volume encryption
EnableInstanceConnect:
default: Enable AWS Instance Connect
MetaDataToken:
default: Metadata HTTP token
GatewaysMinSize:
default: Minimum Gateway group size
GatewaysMaxSize:
Expand Down Expand Up @@ -119,7 +122,7 @@ Parameters:
GatewayInstanceType:
Description: The instance type of the Secutiry Gateways.
Type: String
Default: c5.xlarge
Default: c6in.xlarge
AllowedValues:
- c4.large
- c4.xlarge
Expand Down Expand Up @@ -262,6 +265,13 @@ Parameters:
AllowedValues:
- true
- false
MetaDataToken:
Description: Set true to deploy the instance with metadata v2 token required.
Type: String
Default: true
AllowedValues:
- true
- false
GatewaysMinSize:
Description: The minimal number of gateways in the Auto Scaling group.
Type: Number
Expand All @@ -287,12 +297,6 @@ Parameters:
Type: String
Default: R81.20-BYOL
AllowedValues:
- R80.40-BYOL
- R80.40-PAYG-NGTP
- R80.40-PAYG-NGTX
- R81-BYOL
- R81-PAYG-NGTP
- R81-PAYG-NGTX
- R81.10-BYOL
- R81.10-PAYG-NGTP
- R81.10-PAYG-NGTX
Expand Down Expand Up @@ -386,6 +390,7 @@ Conditions:
ProvidedTargetGroups: !Not [!Equals [!Ref GatewaysTargetGroups, '']]
EnableCloudWatch: !Equals [!Ref CloudWatch, true]
CreateELB: !Not [!Equals [!Ref ELBType, none]]
EnableMetaDataToken: !Equals [!Ref MetaDataToken, true]
Resources:
ChkpGatewayRole:
Type: AWS::IAM::Role
Expand All @@ -405,7 +410,7 @@ Resources:
Condition: EnableCloudWatch
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://cgi-cfts.s3.amazonaws.com/iam/cloudwatch-policy.yaml
TemplateURL: __URL__/iam/cloudwatch-policy.yaml
Parameters:
PolicyName: ChkpGatewayPolicy
PolicyRole: !Ref ChkpGatewayRole
Expand All @@ -419,7 +424,7 @@ Resources:
AMI:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://cgi-cfts.s3.amazonaws.com/utils/amis.yaml
TemplateURL: __URL__/utils/amis.yaml
Parameters:
Version: !Join ['-', [!Ref GatewayVersion, GW]]
NotificationTopic:
Expand Down Expand Up @@ -515,6 +520,8 @@ Resources:
KeyName: !Ref KeyName
ImageId: !GetAtt AMI.Outputs.ImageId
InstanceType: !Ref GatewayInstanceType
MetadataOptions:
HttpTokens: !If [EnableMetaDataToken, required, optional]
BlockDeviceMappings:
- DeviceName: '/dev/xvda'
Ebs:
Expand All @@ -538,7 +545,7 @@ Resources:
- !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}\" sicKey=\"${sic}\" installationType=\"autoscale\" osVersion=\"${version}\" allowUploadDownload=\"${allow_info}\" templateVersion=\"20240204\" templateName=\"autoscale\" shell=\"${admin_shell}\" enableInstanceConnect=\"${eic}\" passwordHash=\"${pwd_hash}\" MaintenanceModePassword=\"${maintenance_pwd_hash}\" bootstrapScript64=\"${bootstrap}\"'
- ' python3 /etc/cloud_config.py enableCloudWatch=\"${cw}\" sicKey=\"${sic}\" installationType=\"autoscale\" osVersion=\"${version}\" allowUploadDownload=\"${allow_info}\" templateVersion=\"__VERSION__\" templateName=\"autoscale\" shell=\"${admin_shell}\" enableInstanceConnect=\"${eic}\" passwordHash=\"${pwd_hash}\" MaintenanceModePassword=\"${maintenance_pwd_hash}\" bootstrapScript64=\"${bootstrap}\"'
VersionDescription: Initial template version
GatewayScaleUpPolicy:
Type: AWS::AutoScaling::ScalingPolicy
Expand Down Expand Up @@ -605,3 +612,4 @@ Outputs:
SecurityGroup:
Description: The Security Group of the Auto Scaling group.
Value: !GetAtt PermissiveSecurityGroup.GroupId

29 changes: 17 additions & 12 deletions aws/templates/cluster/cluster-master.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AWSTemplateFormatVersion: 2010-09-09
Description: Deploy a Check Point Cluster in a new VPC (20240204)
Description: Deploy a Check Point Cluster in a new VPC (__VERSION__)
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
Expand All @@ -23,6 +23,7 @@ Metadata:
- EnableInstanceConnect
- GatewayPredefinedRole
- TerminationProtection
- MetaDataToken
- Label:
default: Check Point Settings
Parameters:
Expand Down Expand Up @@ -75,6 +76,8 @@ Metadata:
default: Existing IAM role name
TerminationProtection:
default: Termination Protection
MetaDataToken:
default: Metadata HTTP token
GatewayVersion:
default: Version & license
Shell:
Expand Down Expand Up @@ -133,7 +136,7 @@ Parameters:
GatewayInstanceType:
Description: The instance type of the Secutiry Gateway.
Type: String
Default: c5.xlarge
Default: c6in.xlarge
AllowedValues:
- c4.large
- c4.xlarge
Expand Down Expand Up @@ -290,16 +293,17 @@ Parameters:
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:
- R80.40-BYOL
- R80.40-PAYG-NGTP
- R80.40-PAYG-NGTX
- R81-BYOL
- R81-PAYG-NGTP
- R81-PAYG-NGTX
- R81.10-BYOL
- R81.10-PAYG-NGTP
- R81.10-PAYG-NGTX
Expand Down Expand Up @@ -391,7 +395,7 @@ Resources:
VPCStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://cgi-cfts.s3.amazonaws.com/utils/vpc.yaml
TemplateURL: __URL__/utils/vpc.yaml
Parameters:
AvailabilityZones: !Ref AvailabilityZone
NumberOfAZs: 1
Expand All @@ -410,7 +414,7 @@ Resources:
Type: AWS::CloudFormation::Stack
DependsOn: VPCStack
Properties:
TemplateURL: https://cgi-cfts.s3.amazonaws.com/cluster/cluster.yaml
TemplateURL: __URL__/cluster/cluster.yaml
Parameters:
VPC: !GetAtt VPCStack.Outputs.VPCID
PublicSubnet: !GetAtt VPCStack.Outputs.PublicSubnet1ID
Expand All @@ -426,6 +430,7 @@ Resources:
EnableInstanceConnect: !Ref EnableInstanceConnect
GatewayPredefinedRole: !Ref GatewayPredefinedRole
TerminationProtection: !Ref TerminationProtection
MetaDataToken: !Ref MetaDataToken
GatewayVersion: !Ref GatewayVersion
Shell: !Ref Shell
GatewayPasswordHash: !Ref GatewayPasswordHash
Expand Down Expand Up @@ -494,12 +499,12 @@ Rules:
MemberATokenNotProvided:
RuleCondition: !Equals [!Ref MemberAToken, '']
Assertions:
- AssertDescription: "Smart-1 Cloud Token for member A can not be empty."
- AssertDescription: "Smart-1 Cloud Token for member A can not be empty"
Assert: !Equals [!Ref MemberBToken, '']
MemberBTokenNotProvided:
RuleCondition: !Equals [ !Ref MemberBToken, '' ]
Assertions:
- AssertDescription: "Smart-1 Cloud Token for member B can not be empty."
- AssertDescription: "Smart-1 Cloud Token for member B can not be empty"
Assert: !Equals [ !Ref MemberAToken, '' ]
MembersTokenValueEquals:
RuleCondition: !EachMemberEquals [ [ !Ref MemberBToken ], !Ref MemberAToken ]
Expand Down
Loading

0 comments on commit 008dbe1

Please sign in to comment.