Code Monkey home page Code Monkey logo

nitrogen's Introduction

Nitrogen logo

Nitrogen CLI

Discord

Nitrogen is a tool for deploying web services to AWS Nitro Enclaves. Given a dockerfile and an ssh key, Nitrogen will spin up an EC2, configure the network, and build and deploy your web service. You get back a hostname that's ready to go. Nitrogen is fully open source and it comes with pre-built scripts for deploying popular services like Nginx, Redis, and MongoDB.

Install

Nitrogen can easily be installed with the following:

For Linux or Mac:

$ curl -fsSL https://raw.githubusercontent.com/capeprivacy/nitrogen/main/install.sh | sh

For Windows Powershell

$ iex (irm https://raw.githubusercontent.com/capeprivacy/nitrogen/main/install.ps1)

Note: An AWS account is required. If you have AWS cli configured you can retrieve your credentials with cat ~/.aws/credentials. See troubleshooting if your AWS account uses MFA

export AWS_ACCESS_KEY_ID=<YOUR ACCESS KEY>
export AWS_SECRET_ACCESS_KEY=<YOUR SECRET>

Commands

  • nitrogen setup <stack_name> <ssh_public_key>
  • nitrogen build <dockerfile_directory>
  • nitrogen deploy <stack_name> <ssh_private_key>
  • nitrogen logs <stack_name> <ssh_private_key>
  • nitrogen delete <stack_name>

Features

  • Spins up any enclave supported EC2 instance type (with Nitro Enclaves enabled)
  • Creates a security group for a specified port.
  • Sets up SSH.
  • Runs a socat proxy from public internet (TCP) into the nitro enclave (VSOCK).
  • Builds any Dockerfile into an Enclave Image File (EIF).
  • Deploys any EIF and launches a nitro enclave.

Examples

Nginx Example

$ nitrogen setup nitrogen-test ~/.ssh/id_rsa.pub --instance-type m5n.16xlarge
>  INFO nitrogen: Spinning up enclave instance 'nitrogen-test'.
>  INFO nitrogen::commands::setup: Successfully created enclave instance. stack_id="arn:aws:cloudformation:us-east-1:657861442343:stack/nitrogen-test/c93c7c80-5581-11ed-8a2b-0e2f3ffeccf1"
>  INFO nitrogen: User enclave information: name="nitrogen-test" instance_id="i-07daa284594ff02bc" public_ip="44.197.181.14" availability_zone="us-east-1b" public_dns="ec2-44-197-181-14.compute-1.amazonaws.com"
$ nitrogen build examples/nginx/
> Filename: nitrogen.eif
$ nitrogen deploy nitrogen-test ~/.ssh/id_rsa
> EIF is now running public_dns="ec2-1-234-56-789.compute-1.amazonaws.com:5000"
$ curl http://ec2-1-234-56-789.compute-1.amazonaws.com:5000/
> <!DOCTYPE html>
<html>
    <head>
        <title>Hello Nitrogen!</title>
    </head>
</html>

Nginx TLS Examples

See here.

Troubleshooting

If you have permissions issues and your aws account has MFA enabled then attempt to use a session token before running setup.

aws sts get-session-token --serial-number arn:aws:iam::<AWS ACCOUNT NUMBER>:mfa/<USER NAME> --token-code <CODE>

Export the values printed from the above command:

export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export AWS_SESSION_TOKEN=

You can also use a helper script in this library called sts.sh. Warning: this will unset any AWS environment variables related to auth that you have already set in your shell.

. sts.sh <ACCOUNT> <USER NAME> <CODE>

If you wish to deploy the enclave in debug mode, use the "--debug-mode" flag during deploy. You can then log into the instance and view the enclave console, or use the nitrogen logs command.

Contributors

Thank you to @kalebpace for contributing the name for the nitrogen crate.

nitrogen's People

Contributors

bendecoste avatar chrisfriesen avatar devinschulz avatar eric-capeprivacy avatar gavinuhma avatar jlapierre avatar justin1121 avatar jvmncs avatar rahul-ramesh avatar richardfan1126 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nitrogen's Issues

Add ability to turn on debug mode on the enclave

There's a flag in nitro-cli that enables the enclave to be debugged. We should add a flag to nitrogen to enable this. The flag is --debug-mode. Along with this we should consider adding tips on how to debug enclaves.

pull utility functions into a common module

we've started using the cloudformation helpers from setup in a few different places, and I could see this continuing in the future for other commands (e.g. w/ #26). it might be more maintainable to pull out cloudformation utilities (and maybe even the various ssh commands) into a shared module

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.