GithubHelp home page GithubHelp logo

sathishkumarmca / bastion-security Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kirasystems/bastion-security

0.0 1.0 0.0 10 KB

AWS template files for better bastion security

Go 92.03% Makefile 7.97%

bastion-security's Introduction

Simple Bastion Security

The files in this repository demonstrate a relatively lightweight method to improve the security of your bastion host(s) by removing the need to allow connections from the entire public internet (0.0.0.0/0). The key to this is the use of a security group that, in its "base" state, disallows connections entirely. When a user wishes to connect, they run a small utility to insert a rule into the security group that allows connection only from the public IP address that they're actually on. To make sure that the security group doesn't end up littered with many obsolete rules, a Lambda function runs periodically that removes "expired" rules.

User Roles in AWS

Users of the bastion-util must have a role attached with at least the permissions in the below policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "ec2:DescribeSecurityGroups",
                "ec2:AuthorizeSecurityGroupIngress",
                "ec2:RevokeSecurityGroupIngress"
            ],
            "Resource": "<dynamic security group arn>",
            "Effect": "Allow"
        }
    ]
}

Where <dynamic security group arn> is replaced with the full ARN of the security group to be managed (e.g. arn:aws:ec2:ca-central-1:123456789012:security-group/sg-00112233445566778). The ARN may be obtained from the sgDynamicBastion output of the CloudFormation template.

Using the files herein

Clean up everything local with make distclean or make clean, depending on how picky you are.

A "normal" build process would go along the lines of

# edit demo-bastion-security.yaml and change parameter values as necessary
make create-stack
make
# wait for the stack to complete creation; check the AWS console
make deploy
# note the filename of the LambdaHandler zipfile;
# edit demo-bastion-security.yaml to replace that parameter
# edit demo-bastion-security.yaml to uncomment the bottom half
make update-stack
# edit your SSH configuration file to include (corrected) contents of the ssh-config file here
# ssh to your bastion

bastion-security's People

Contributors

joey-coleman avatar

Watchers

James Cloos avatar

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.