Git Product home page Git Product logo

cdk-aspects-library-security-group's Introduction

cdk-aspects-library-security-group

build

A CDK library containing EC2 security group related CDK Aspects and the ability to define custom aspects.

Features

  • Utilize built in aspects for common cases:
    • Disallow public access to any port
    • Disallow public access to AWS Restricted Common ports (per the AWS Config rule)
    • Disallow public access to SSH or RDP per CIS Benchmark guidelines and general good practice
    • Disallow public or ALL access to common management ports like SSH, RDP, WinRM, WinRM over HTTPS
    • Disallow public or ALL access common relational DB ports like MSSQL, MySQL, PostgreSQL, and Oracle
    • Disallow public or ALL common web ports like HTTP (80, 8080) and HTTPS (443, 8443)
  • Create any other aspect using the base security group aspect class.
  • By default aspects generate errors in the CDK metadata which the deployment or synth process will find, but this can be changed with the annotationType property
  • All default provided aspects restrict based on the public access CIDRs (0.0.0.0/0 and ::/0) but you can also defined aspects with any set of restricted CIDRs or security group IDs you like

API Doc

See API

Examples

Typescript

// Add an existing aspect to your stack
Aspects.of(stack).add(new NoPublicIngressAspect());

// Add a custom aspect to your stack
Aspects.of(stack).add(new SecurityGroupAspectBase({
  annotationText: 'This is a custom message warning you how you should not do what you are doing.',
  annotationType: AnnotationType.WARNING,
  ports: [5985],
  restrictedCidrs: ['10.1.0.0/16'],
}));

// Change an existing aspects message and type
Aspects.of(stack).add(new NoPublicIngressAspect(
  annotationText: 'This is custom text.',
  annotationType: AnnotationType.WARNING
));

cdk-aspects-library-security-group's People

Contributors

ataraxia937 avatar bmiller08 avatar dependabot[bot] avatar github-actions[bot] avatar sfaragenis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cdk-aspects-library-security-group's Issues

Need the ability to test aspects in other libraries or stacks

Is your feature request related to a problem? Please describe.
The aspect classes work in testing within the library and seem to work in practice, but the aspects then become a testing hole everywhere the library is utilized. It would helped prevent breaking changes from propagating to projects that rely on these aspects if the testing code for the aspects was also available within the library since examining the stack manifest isn't super simple.

Describe the solution you'd like
Rework the getMetadataAnnotations function to take return annotations for any resource path. Create a better function to get the node id for the resource being tested.

Describe alternatives you've considered
Collecting all annotations, but then you'd have to parse the results for the resource path you want anyway.

Proposed implementation

function getMetadataAnnotations(app:cdk.App, id:string) {
  // look for the key associated with the id of the resource in the manifest data
  // for each item under that key look for the type aws::cdk::<error type>
  // add to returned array of annotations
}

Any downsides to this approach
Still complex, but currently dont see easier ways to collect this data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.