Skip to content

Tighten Ec2SSMConnect security group configuration #206

Description

@droguljic

Currently Ec2SSMConnect uses one security group for the Ec2 instance and VPC endpoints with inbound/outbound config:

ingress: [
  {
    protocol: 'tcp',
    fromPort: 22,
    toPort: 22,
    cidrBlocks: [vpcOutput.vpc.cidrBlock],
  },
  {
    protocol: 'tcp',
    fromPort: 443,
    toPort: 443,
    cidrBlocks: [vpcOutput.vpc.cidrBlock],
  },
],
egress: [
  { protocol: '-1', fromPort: 0, toPort: 0, cidrBlocks: ['0.0.0.0/0'] },
],

This should be split into two security groups:

  1. Ec2 instance security group with inbound/outbound config:
ingress: [],
egress: [
  { protocol: 'tcp', fromPort: 443, toPort: 443, cidrBlocks: ['0.0.0.0/0'] },
]
  1. VPC endpoints security group with inbound/outbound config:
ingress: [
  {
    protocol: 'tcp',
    fromPort: 443,
    toPort: 443,
    cidrBlocks: [vpcOutput.vpc.cidrBlock],
  },
],
egress: [
  { protocol: '-1', fromPort: 0, toPort: 0, cidrBlocks: ['0.0.0.0/0'] },
]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions