The author of this project is not responsible for any damage or data loss incurred as a result of using this software.
Use this software at your own risk. While efforts have been made to ensure the accuracy and reliability of the software, it is provided “as is” without warranty of any kind.
By using this software, you agree to assume all risks associated with its use. Opinions are that of the author and not that of AWS. Review the AWS pentesting policy prior to executing any security tools on AWS Lambda.
Lemma
Lemma is a Python-based AWS Lambda package and client designed to execute packaged command-line tools in a scalable, remote environment on AWS Lambda.
Lemma takes advantage of the new Response Streaming feature on AWS Lambda to stream real-time stdout back to the user as the tool is running. The Lemma project comprises three main components:
- Lemma Lambda Function Package: This package bundles a collection of command-line Linux tools provided by the user, making them accessible via AWS Lambda. It allows users to execute these tools remotely and scale their executions across multiple lambda instances.
- Web-CLI: This component provides a web-based terminal interface built with xterm.js, AWS Lambda Web Adapter and FastAPI, accessible via the Lambda URL.
- This web UI allows users to execute their command-line tools packaged in the Lambda entirely within their web browser.
- Terminal-CLI: A python-based command-line interface tool in charge invoking the Lemma Lambda function.
- This tool facilitates the remote execution of the Lambda-hosted tools from a local environment.
- It pipes stdin and stdout between local and remote tools, providing the ability to execute and scale cli-based workflows onto lambda and back using pipes.
- This tool facilitates the remote execution of the Lambda-hosted tools from a local environment.
While the intented use case for Lemma is to run verbose security security tooling on AWS lambda, Lemma can be used for any type of command-line tool you wish to run remotely.
Features
- Supports both a Web-CLI and a Terminal-CLI
- Quick and easy build script
- Support for adding your own custom tools
- Support for x86_64 and ARM64 lambda types
- Support for choosing memory, region and timeout
- Flexible terminal piping support
Installation
Requirements For Lemma Lambda
- An AWS account
- AWS access credentials with permissions to execute cloudformation templates
- Docker, python3 with pip
Lambda Build And Deploy Steps
Steps to build and deploy on a fresh Ubuntu 22 instance
sudo apt update
sudo apt install docker.io python3 python3-pip
git clone https://github.com/defparam/lemma
cd lemma
export AWS_ACCESS_KEY_ID=<your access key id>
export AWS_SECRET_ACCESS_KEY=<your secret access key>
./build.sh
- Fill out all the questions
- Copy the lambda URL with the key
Web-CLI:
- Open chrome and simply browse to your lambda URL w/key
Terminal-CLI:
- While in the lemma directory:
pip3 install .
(The Terminal-CLI is also available on pypi:pip install lemmacli
) - Invoke:
lemma
- When asked about the lambda URL, paste it into the prompt. This URL will be saved at
~/.lemma/lemma.ini