All Projects → ets → aws-lambda-firewall

ets / aws-lambda-firewall

Licence: other
Securely and conveniently support IP address whitelists for your publicly routable services.

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to aws-lambda-firewall

Alagarr
🦍 Alagarr is a request-response helper library that removes the boilerplate from your Node.js (AWS Lambda) serverless functions and helps make your code portable.
Stars: ✭ 58 (+262.5%)
Mutual labels:  aws-lambda, aws-apigateway
Awsmobile Cli
CLI experience for Frontend developers in the JavaScript ecosystem.
Stars: ✭ 147 (+818.75%)
Mutual labels:  aws-lambda, aws-apigateway
Aws Sam Golang Example
An example API and Worker written in Golang using the Amazon Serverless Application Model (AWS SAM)
Stars: ✭ 73 (+356.25%)
Mutual labels:  aws-lambda, aws-apigateway
Cloudmagick
CloudMagick is a serverless application which provides a dynamic image transformation like the small light module of apache2
Stars: ✭ 11 (-31.25%)
Mutual labels:  aws-lambda, aws-apigateway
Aws Lambda Typescript
This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.
Stars: ✭ 228 (+1325%)
Mutual labels:  aws-lambda, aws-apigateway
Aws Lambda Dotnet
Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
Stars: ✭ 945 (+5806.25%)
Mutual labels:  aws-lambda, aws-apigateway
Serverless Sam
Serverless framework plugin to export AWS SAM templates for a service
Stars: ✭ 143 (+793.75%)
Mutual labels:  aws-lambda, aws-apigateway
Aws Lambda Graphql
Use AWS Lambda + AWS API Gateway v2 for GraphQL subscriptions over WebSocket and AWS API Gateway v1 for HTTP
Stars: ✭ 313 (+1856.25%)
Mutual labels:  aws-lambda, aws-apigateway
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (+1250%)
Mutual labels:  aws-lambda, aws-apigateway
Aws Csa Notes 2018
My AWS Certified Solutions Architect Associate Study Notes!
Stars: ✭ 167 (+943.75%)
Mutual labels:  aws-lambda, aws-apigateway
Aws Serverless Auth Reference App
Serverless reference app and backend API, showcasing authentication and authorization patterns using Amazon Cognito, Amazon API Gateway, AWS Lambda, and AWS IAM.
Stars: ✭ 724 (+4425%)
Mutual labels:  aws-lambda, aws-apigateway
hyper-kube-config
H Y P E R K U B E - A Serverless API and kubectl plugin providing a storage and retrieval Kubernetes cluster credentials. Hyperkube leverages AWS Secrets Manager for storing credential information.
Stars: ✭ 27 (+68.75%)
Mutual labels:  aws-lambda, aws-apigateway
Serverless Offline
Emulate AWS λ and API Gateway locally when developing your Serverless project
Stars: ✭ 4,330 (+26962.5%)
Mutual labels:  aws-lambda, aws-apigateway
Chalice
Python Serverless Microframework for AWS
Stars: ✭ 8,513 (+53106.25%)
Mutual labels:  aws-lambda, aws-apigateway
Serverless Photo Recognition
A collection of 3 lambda functions that are invoked by Amazon S3 or Amazon API Gateway to analyze uploaded images with Amazon Rekognition and save picture labels to ElasticSearch (written in Kotlin)
Stars: ✭ 345 (+2056.25%)
Mutual labels:  aws-lambda, aws-apigateway
Architect
The simplest, most powerful way to build serverless applications
Stars: ✭ 1,925 (+11931.25%)
Mutual labels:  aws-lambda, aws-apigateway
terraform-lambda-example
Hello World example of AWS Lambda
Stars: ✭ 35 (+118.75%)
Mutual labels:  aws-lambda, aws-apigateway
Archive aws Lambda Go Net
Network I/O interface for AWS Lambda Go runtime.
Stars: ✭ 151 (+843.75%)
Mutual labels:  aws-lambda, aws-apigateway
aws-sync-routes
Synchronizes the specified route from the main/default route table to all custom route tables in the VPC.
Stars: ✭ 16 (+0%)
Mutual labels:  aws-lambda, aws-apigateway
lambda-facebook-oauth
An AWS Lambda function to facilitate Oauth2 social login with Facebook
Stars: ✭ 16 (+0%)
Mutual labels:  aws-lambda, aws-apigateway

aws-lambda-firewall

Use a secure & convenient "knock for access" protocol for creating/expiring AWS Security Group ingress rules.

Current usecase scenarios are:

  • Allow authorized users to add their current IP address to multiple security groups thereby granting access to ports 22,80,443 on specific EC2 instances and/or ELBs
  • Conveniently support access for users behind dynamic IP addresses without opening up sensitive ports to the public internet

End users "knock for access" using a valid API Gateway token. By making a valid call to this AWS Lambda function behind an AWS API Gateway, the end user's IP is added (for 24 hours) to security groups that permit access to other resources.

This allows us to restrict access to ports (e.g. SSH port on our Bastion host or 443 on the ELB that fronts our development & test servers) but allow access to authorized users without the need to establish a VPN or otherwise modify routing across the Internet.

IAM policies required by the role assigned to the lambda

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "securityGroupManipulationPermissions",
      "Effect": "Allow",
      "Action": [
        "ec2:AuthorizeSecurityGroupEgress",
        "ec2:AuthorizeSecurityGroupIngress",
        "ec2:CreateSecurityGroup",
        "ec2:DeleteSecurityGroup",
        "ec2:DescribeInstanceAttribute",
        "ec2:DescribeInstanceStatus",
        "ec2:DescribeInstances",
        "ec2:DescribeNetworkAcls",
        "ec2:DescribeSecurityGroups",
        "ec2:ModifyInstanceAttribute",
        "ec2:RevokeSecurityGroupEgress",
        "ec2:RevokeSecurityGroupIngress",
        "elasticloadbalancing:DescribeLoadBalancerAttributes",
        "elasticloadbalancing:DescribeLoadBalancers",
        "elasticloadbalancing:ModifyLoadBalancerAttributes",
        "elasticloadbalancing:SetSecurityGroups"
      ],
      "Resource": [
        "*"
      ]
    },
    {
        "Sid": "cloudwatchloggingforwhitelister",
        "Effect": "Allow",
        "Action": [
            "logs:*"
        ],
        "Resource": [
            "arn:aws:logs:*:*:*"
        ]
    },
    {
          "Sid": "simpleDBdatastorageforwhitelister",
          "Effect": "Allow",
          "Action": [
              "sdb:*"
          ],
          "Resource": [
              "arn:aws:sdb:us-east-1:903373720037:domain/SIMPLEDB_DOMAIN_NAME_DECLARED_IN_LAMBDA_SCRIPT"
          ]
      }    
  ]
}

Description

The Lambda firewall can be used in sensitive environments where you want to keep strict control over security groups. Users with a valid API gateway key can make a request to temporarily whitelist their IP address for a specific duration without the need for access to the console or IAM permissions to alter Security Groups. After the whitelist entry expires, it is automatically removed. You no longer need to add or remove ingress rules or security groups manually, which is especially useful for users with many different source/origin IP addresses.

Installation

  1. Add the Lambda function (lambda_function.py) to your account with a Python 2.x handler "lambda_function.lambda_handler"
  2. Use the API Gateway trigger and for Security use "Open with Access Key"
  3. Configure the Lambda with the IAM Role defined using the rules in the section above
  4. Next, create a second trigger for your Lambda using CloudWatch and set it to call the lambda periodically to delete expired groups
  5. Under API Gateway, create a Usage Plan with a set of API Keys
  6. Add a valid API key and the correct Lambda URL in the "firewall_client" scripts and distribute it to your users.

Usage

  • To whitelist your IP, call the firewall_client (python and CURL examples included) manually

History

Contact

For any questions or fixes, please reach out via github!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].