GithubHelp home page GithubHelp logo

instructure / straitjacket Goto Github PK

View Code? Open in Web Editor NEW
32.0 14.0 15.0 2.25 MB

a restricted code execution framework

License: GNU Affero General Public License v3.0

C 0.02% Java 0.02% Scala 0.02% Go 1.63% Shell 0.20% Makefile 0.02% C++ 0.01% Ruby 0.04% CoffeeScript 0.02% Perl 0.01% CSS 3.56% HTML 0.19% JavaScript 94.26%

straitjacket's Introduction

StraitJacket 2.0

This web application is a (hopefully) safe and secure remote execution environment framework. It builds on top of Docker and Linux' AppArmor system calls and as such won't be able to run on any other operating system.

The end goal is to be able to run someone else's source code in any (configured) language automatically and not worry about hax.

Design

StraitJacket comes with a number of predetermined AppArmor profiles, and docker containers built for each supported language. When StraitJacket gets an incoming request to run some code, it will launch that container with the AppArmor profile applied.

AppArmor really does all the heavy lifting. For more information please see AppArmor's wiki. A big thanks to Immunix and the subsequent AppArmor team!

API

The API has two calls:

GET /info
POST /execute

There is also a more advanced websocket API at GET /executews.

You can view the API documentation directly from github at http://petstore.swagger.io/?url=https://raw.githubusercontent.com/instructure/straitjacket/master/public/api/2015-07-14.yml though you'll need to spin up an instance of straitjacket to actually perform API calls from that page.

Installation

Development

There is a Vagrantfile provided for developing Straitjacket. Run vagrant up to build the image.

To run straitjacket locally for development, ssh into the VM with vagrant ssh and run:

cd straitjacket
sudo ./straitjacket-setup.sh
./run-dev.sh

This will listen on port 8081, which is forwarded to the host machine.

You'll need to re-run straitjacket-setup.sh any time you add/modify a language apparmor profile or docker image. New docker images need to be added there, as well.

To run the language tests (sanity checks) defined in the config .yml files, run:

./run-dev.sh --test

AMI

You can build an AWS AMI using Packer by calling the build_ami.sh build script. You'll need to modify packer.json for your VPC and subnet IDs.

A pre-built AMI may be made public later.

License

StraitJacket is released under the AGPLv3. Please see COPYRIGHT and LICENSE.

straitjacket's People

Contributors

codekitchen avatar dented42 avatar jtolio avatar ryanmt avatar seanhess 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

Watchers

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

straitjacket's Issues

Update Haskell Platform?

Hi there,

I'm hoping to use haskell for the competition next week, but your version is a few years old (ghc 7.6 is from 2013).

I would be happy to create a pull request to your dockerfile fixing this, but I want to make sure my time isn't wasted. Would you accept one? I can mimic the approach you are taking so far, but is there anything to keep in mind?

on timeout, docker can blast syslog with errors

This is the root cause of the filled-up root partitions during the 2015 competition:

When a container times out, we kill it forcefully. I've verified that this correctly kills the process running in the container, but docker's logging infrastructure seems to have an async queue that is causing us problems...

Once the container is removed, docker will continue to write out the queued log lines, and since the container's data directory is gone, it fails on each line. It ends up writing an error to syslog every time.

This straitjacket request wrote over 6 million errors to syslog in my testing, taking up 3gb of space in /var/log/syslog:

curl 'http://localhost:8081/execute' -F language=ruby -F source='i=0; loop { puts(i+=1) }' -F timelimit=5

I wonder where docker's logging queue is stored, as well.

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.