vSRX + K2 On-Premises
Instructions for deploying vSRX with K2 On-Premises Platform.
Goal
Prerequisites
Steps
Part 1: K2 OnPrem Portal
Parameters: KeyName: Description: Name of an existing EC2 KeyPair to enable SSH access to the instance Default: cftwest1 #Configurable Section1 Type: AWS::EC2::KeyPair::KeyName ConstraintDescription: must be the name of an existing EC2 KeyPair. AllowedAddress: Description: Source IP address (CIDR notation) from which any access to vSRXs is allowed Type: String Default: 0.0.0.0/0 InstanceType: Description: WebServer EC2 instance type Type: String Default: m5.2xlarge AllowedValues: [t2.nano, t2.micro, t2.small, t2.medium, t2.large, t2.xlarge, t2.2xlarge, t3.nano, t3.micro, t3.small, t3.medium, t3.large, t3.xlarge, t3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m5.large, m5.xlarge, m5.2xlarge, m5.4xlarge, c5.large, c5.xlarge, c5.2xlarge, c5.4xlarge, c5.9xlarge, g3.8xlarge, r5.large, r5.xlarge, r5.2xlarge, r5.4xlarge, i3.xlarge, i3.2xlarge, i3.4xlarge, i3.8xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge] ConstraintDescription: must be a valid EC2 instance type. SSHLocation: Description: The IP address range that can be used to SSH to the EC2 instances Type: String MinLength: 9 MaxLength: 18 Default: 0.0.0.0/0 AllowedPattern: (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2}) ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x. ############################ K2 Configuration #1 Ends Here ############################
Mappings: K2CloudAMIEC2: us-east-1: CentOS7: ami-0dd3922502962f0ae us-west-2: CentOS7: ami-b55a51cc us-west-1: CentOS7: ami-027956be094a99d30 eu-west-1: CentOS7: ami-f1978897 eu-central-1: CentOS7: ami-0e258161 ap-northeast-1: CentOS7: ami-5c9a933b ap-southeast-1: CentOS7: ami-cb981aa8 ap-southeast-2: CentOS7: ami-9a3322f9
Resources: S3Bucket: Type: 'AWS::S3::Bucket' Properties: BucketName: k2cloud-backup EC2InstanceProfile: Type: AWS::IAM::InstanceProfile Properties: Path: / Roles: [!Ref 'EC2Role'] # Role for the EC2 hosts. EC2Role: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Effect: Allow Principal: Service: [ec2.amazonaws.com] Action: ['sts:AssumeRole'] Path: / Policies: - PolicyName: k2cloud-policy PolicyDocument: Statement: - Effect: Allow Action: - 's3:AbortMultipartUpload' - 's3:GetBucketLocation' - 's3:GetObject' - 's3:ListBucket' - 's3:ListBucketMultipartUploads' - 's3:PutObject' Resource: - arn:aws:s3:::k2cloud-backup - arn:aws:s3:::k2cloud-backup/* EC2Instance: Type: AWS::EC2::Instance Properties: ImageId: !FindInMap - K2CloudAMIEC2 - !Ref 'AWS::Region' - CentOS7 InstanceType: !Ref 'InstanceType' SecurityGroupIds: [{ "Fn::GetAtt" : ["InstanceSecurityGroup", "GroupId"] }] KeyName: !Ref 'KeyName' IamInstanceProfile: !Ref 'EC2InstanceProfile' BlockDeviceMappings: - DeviceName: "/dev/sda1" Ebs: VolumeType: "gp2" DeleteOnTermination: true VolumeSize: 200 #SubnetId: !Ref PublicSubnet1 Tags: - Key: Name Value: Test InstanceSecurityGroup: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: Enable SSH access via port 22 SecurityGroupIngress: - IpProtocol: tcp FromPort: 22 ToPort: 22 CidrIp: !Ref 'SSHLocation' - IpProtocol: tcp FromPort: 80 ToPort: 80 CidrIp: !Ref AllowedAddress - IpProtocol: tcp FromPort: 8080 ToPort: 8080 CidrIp: !Ref AllowedAddress - IpProtocol: tcp FromPort: 443 ToPort: 443 CidrIp: !Ref AllowedAddress
aws cloudformation create-stack --region ${REGION_NAME} --stack-name ${PROVIDE_STACKNAME_HERE} --template-body file://${PROVIDE_TEMPLATE_NAME}aws cloudformation create-stack --region us-west-1 --stack-name ec2-k2 --template-body file
Part 2: vSRX installation (This is a sample and you should use your own vSRX installation CFT)
Part 3: Installation of K2 agents on EC2 instances
Part 4 : Configure vSRX policies using K2Manager
Step 1 : Open Firewall Integration

Step 2 : Add a new Firewall Configuration Rule
Add a new Firewall Configuration Rule

Step 3 : Add Blocking List Configurations

Step 4 : Add Allowed List Configurations

Complete Template Example
End to End Verification
Generate an attack from the Vulnerable Application.
Link: http://<REVENUE_ELASTIC_IP>:8080

K2 Vulnerable Applications UI

K2M Firewall Blocked List
On K2 UI: Settings → Firewall Integration → Blocked List
Link: https://www.k2io.net/centralmanager/#!/app/settings/firewall

The attacker IP is detected and added to the blocked list, which can be viewed on K2 UI.

Last updated
Was this helpful?
