SlideShare a Scribd company logo
codetainer
building  a  browser  
  code  `sandbox`
Jen  Andre  
E4E  Conference,  Sep  2015
about me
@fun_cuddles  /  jenpire.com  /  
organizer  @BostonGoLang  
EIR  Accomplice  VC  
co-­‐founder  @threatstack,    
formerly  researcher  
@Mandiant,  @Symantec    
what is a ‘codetainer’?
“try ‘X’ in your browser”
… for all X?
inspiration
use cases
tutorials  for  APIs  
learn  programming  language  X  
training  on  UNIX  tools,  debugging,  etc  
remote  management  for  containers
requirements
flexible  &  powerful  enough  to  support  mulXple  use-­‐
cases  (programmable,  API  driven)  
self-­‐hosted  (open  source!)  
reasonably  secure-­‐able  :)
containers to the rescue!
“Docker  allows  you  to  package  an  applicaXon  with  all  
of  its  dependencies  into  a  standardized  unit  for  
so`ware  development.”
host linux system
container process
process
virtual file system
system namespaces
docker daemon/API tools
container process
process
virtual file system
system namespaces
…
process  virtualiza/on
not your parent’s virtualization
• it’s  lightweight!    
• process  containers  measured  in  terms  of  kilobytes  or  megabytes  
instead  of  GB  
• startup  measured  in  seconds,  not  minutes  
• images  are  layered  and  reusable  
• (see  DockerHub)  
• there’s  powerful  introspecXon  /  management  APIs  
• Management  is  programmable
introspection
peer  “inside”  of  containers  and  perform  acXons
codetainer architecture
codetainer
API server
loaded via
iframe
docker
API
“codetainer”
process
“codetainer”
process
“codetainer”
process
http /
websockets
sqlite
/api/v1/codetainer/{id}/attach
/api/v1/codetainer/{id}/create
/api/v1/codetainer/{id}/stop
…
components
•   “codetainer”  
•   this  is  just  a  Docker  container    
• “codetainer  image”    
•   this  is  a  Docker  image  registered  for  codetainer  use  
• “codetainer  profile”    
•   this  is  a  profile  associated  with  a  codetainer  that  
defines  its  runXme  characterisXcs  (e.g.  security)
other tools
• Go  
• Docker  APIs  wrifen  in  this  
• It’s  just  a  nice,  clean  language  you  can  be  producXve  in  quickly  
• xterm.js  
• for  rendering  terminals  in  the  browser  
• sqlite  
• for  storing  metdata  about  ‘codetainers’  
using codetainer!
starting the server
$	
  ./bin/codetainer	
  server	
  
Codetainer	
  10:34:16	
  [~INFO]	
  Initializing	
  Codetainer	
  
(0.1.0)	
  
Codetainer	
  10:34:16	
  [~INFO]	
  URL:	
  http://127.0.0.1:3000	
  
$	
  ./bin/codetainer	
  —help	
  
usage:	
  Codetainer	
  [<flags>]	
  <command>	
  [<args>	
  ...]	
  
Flags:	
  
	
  	
  -­‐-­‐help	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  Show	
  help	
  (also	
  see	
  -­‐-­‐help-­‐long	
  
and	
  -­‐-­‐help-­‐man).	
  
	
  	
  -­‐v,	
  -­‐-­‐debug	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  Enable	
  debug	
  logging.	
  
	
  	
  -­‐-­‐dev	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  Enable	
  dev	
  mode.	
  
	
  	
  -­‐q,	
  -­‐-­‐quiet	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  Remove	
  all	
  output	
  logging.	
  
step 1: create an image
• Create  your  Docker  image    
• Register  a  Docker  image  for  use  in  a  codetainer  
• POST	
  /api/v1/image
$	
  curl	
  -­‐XPOST	
  http://127.0.0.1:3000/api/v1/image	
  -­‐-­‐data	
  "id=tcpdump-­‐
demo:latest&description=hi"	
  2>	
  /dev/null	
  |	
  jq	
  .	
  
{	
  
	
  	
  "image":	
  {	
  
	
  	
  	
  	
  "id":	
  
"e5d42500e0419df4a29d1ed443de2da5c2c8d2e683cb045883b79b2e826910b0",	
  
	
  	
  	
  	
  "command":	
  "",	
  
	
  	
  	
  	
  "description":	
  "hi",	
  
	
  	
  	
  	
  "Tags":	
  [	
  
	
  	
  	
  	
  	
  	
  "tcpdump-­‐demo:latest"	
  
	
  	
  	
  	
  ],	
  
	
  	
  	
  	
  "CreatedAt":	
  "0001-­‐01-­‐01T00:00:00Z",	
  
	
  	
  	
  	
  "UpdatedAt":	
  "0001-­‐01-­‐01T00:00:00Z",	
  
	
  	
  	
  	
  "Enabled":	
  true	
  
	
  	
  }	
  
step 2: launch a codetainer
• POST	
  /api/v1/codetainer
$	
  curl	
  -­‐XPOST	
  http://127.0.0.1:3000/api/v1/codetainer/	
  -­‐-­‐data	
  
"name=tcpdump&image-­‐id=tcpdump-­‐demo:latest"	
  2>	
  /dev/null	
  |	
  jq	
  .	
  
{	
  
	
  	
  "codetainer":	
  {	
  
	
  	
  	
  	
  "id":	
  
"07fd1305dc22714ff5c005f8edb5db8bb462ff931bb94c51feab879a10cbcaa6",	
  
	
  	
  	
  	
  "name":	
  "tcpdump",	
  
	
  	
  	
  	
  "image-­‐id":	
  
"e5d42500e0419df4a29d1ed443de2da5c2c8d2e683cb045883b79b2e826910b0",	
  
	
  	
  	
  	
  "Defunct":	
  false,	
  
	
  	
  	
  	
  "Running":	
  false,	
  
	
  	
  	
  	
  "Profile":	
  "",	
  
	
  	
  	
  	
  "CreatedAt":	
  "0001-­‐01-­‐01T00:00:00Z",	
  
	
  	
  	
  	
  "UpdatedAt":	
  "0001-­‐01-­‐01T00:00:00Z"	
  
	
  	
  }	
  
step 3: interact with it!
• /api/v1/codetainer/{id}/attach	
  (attach	
  via	
  websockets)	
  
• /api/v1/codetainer/{id}/view	
  (render	
  terminal	
  view)	
  
• /api/v1/codetainer/{id}/send	
  (send	
  keystrokes)
more!
• List/Upload/Download  files  in  a  codetainer  
• GET	
  /api/v1/codetainer/{id}/files	
  
• GET	
  /api/v1/codetainer/{id}/files/
download	
  
• PUT	
  /api/v1/codetainer/{id}/files/upload
command-line too
$	
  ./bin/codetainer	
  list	
  
Found	
  2	
  codetainers.	
  
-­‐-­‐	
  [4505c3c844a46f4966280cd6762d3512ba8c04ebd5cb550ba90732c11a5514ee]	
  
lRf9QWOrhAYbNf4_PUdZ58DtKpfmTihu	
  (Running)	
  
-­‐-­‐	
  [c2fce38a8ba86caf0e3f1462177809f14d905c26e3cd04ac907d7d18ad9a63f0]	
  
R0bZK2O-­‐1SWsoTp7a2gas1-­‐cHjnFIlf_	
  (Running)	
  
$	
  ./bin/codetainer	
  image	
  register	
  ubuntu:14.04	
  
Codetainer	
  08:01:31	
  [~INFO]	
  Registering	
  New	
  Image:	
  
&{91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e	
  
	
  267c	
  	
  	
  [ubuntu:14.04]	
  0001-­‐01-­‐01	
  00:00:00	
  +0000	
  UTC	
  0001-­‐01-­‐01	
  
00:00:00	
  +0000	
  UTC	
  true}	
  
odetainer	
  08:01:31	
  [~INFO]	
  Registration	
  succeeded.
challenges
Dealing  with  missing  introspecXon  APIs  (e.g.  file  lisXng)  
minimize  risk  of  abuse  by  ‘sandboxing’  what  a  
container  can  do
Docker Security Knobs
{	
  
	
  	
  "Config":	
  {	
  
	
  	
  	
  	
  "NetworkDisabled":	
  true	
  
	
  	
  },	
  
	
  	
  "HostConfig":	
  {	
  
	
  	
  	
  	
  "Privileged":	
  false,	
  
	
  	
  	
  	
  "ReadonlyRootfs":	
  true,	
  
	
  	
  	
  	
  "Memory":	
  1000000000,	
  
	
  	
  	
  	
  "Ulimits":	
  [{	
  "Name":	
  "nofile",	
  "Soft":	
  
1024,	
  "Hard":	
  2048	
  }]	
  
	
  	
  }	
  
limiting a codetainer’s permissions using
profiles
$	
  ./bin/codetainer	
  profile	
  register	
  ./
secure.json	
  secure	
  
2015/09/18	
  10:52:54	
  Created	
  profile	
  with	
  
id=767653c7-­‐8fb6-­‐4f78-­‐bfcf-­‐3853bbe6df64:	
  
2015/09/18	
  10:52:54	
  -­‐-­‐	
  
2015/09/18	
  10:52:54	
  {	
  
	
  	
  "Config":	
  {	
  
	
  	
  	
  "NetworkDisabled":	
  true	
  
	
  	
  },	
  
	
  	
  "HostConfig":	
  {	
  
• pass	
  codetainer-­‐profile-­‐id	
  to	
  POST	
  /api/v1/
codetainer	
  when	
  creating	
  a	
  codetainer
secure.json
Missing APIs
• Docker  has  an  API  to  ‘exec’  processes  in  the  context  
of  a  container.  
• SoluXon:  mount  all  codetainers  with  a  shared  “/
codetainer/uXls”  volume  with  custom  tools.  
• Example:  /api/v1/codetainer/{id}/files    
• Executes  /codetainer/uXls/files    —path  <path>    
• returns  JSON  path  lisXng
Codetainer: a Docker-based browser code 'sandbox'
demo time!
• creaXng  a  codetainer  
• lsof  tutorial
status
• “Alpha”  -­‐  works  but  needs  a  lifle  more  ‘umph’  to  
make  it  producXon  ready    
• Auth  for  API  
• DocumentaXon,  documentaXon,  documentaiton  
• TesXng
contribute!
github.com/codetainerapp/codetainer
jandre@gmail.com  or  @fun_cuddles  on  twifer
or just say hi…

More Related Content

What's hot (14)

DOCX
EXPLOIT POST EXPLOITATION
BGA Cyber Security
 
PDF
MITRE ATT&CK Framework
n|u - The Open Security Community
 
PDF
VMware vSphere Networking deep dive
Sanjeev Kumar
 
PDF
Açık kaynak kodlu uygulamalar ile adli bilişim labaratuarı kurma son
BGA Cyber Security
 
PDF
Deep Learning Introduction Lecture
shivam chaurasia
 
PPT
Honeypots
Jayant Gandhi
 
PDF
“Person Re-Identification and Tracking at the Edge: Challenges and Techniques...
Edge AI and Vision Alliance
 
PPTX
Multimedia Steganography
Kaushik Chakraborty
 
PDF
Deep learning for person re-identification
哲东 郑
 
PPTX
VMware vSphere Vcenter Vsan presentation
khalifahezzaldeen502
 
PDF
DDoS Saldırıları ve Korunma Yolları
BGA Cyber Security
 
PDF
Crowd Counting from UAVs (ECCV2020)
Gennaro Vessio
 
PPTX
unified threat management by Nisha Menon K
Nisha Menon K
 
EXPLOIT POST EXPLOITATION
BGA Cyber Security
 
MITRE ATT&CK Framework
n|u - The Open Security Community
 
VMware vSphere Networking deep dive
Sanjeev Kumar
 
Açık kaynak kodlu uygulamalar ile adli bilişim labaratuarı kurma son
BGA Cyber Security
 
Deep Learning Introduction Lecture
shivam chaurasia
 
Honeypots
Jayant Gandhi
 
“Person Re-Identification and Tracking at the Edge: Challenges and Techniques...
Edge AI and Vision Alliance
 
Multimedia Steganography
Kaushik Chakraborty
 
Deep learning for person re-identification
哲东 郑
 
VMware vSphere Vcenter Vsan presentation
khalifahezzaldeen502
 
DDoS Saldırıları ve Korunma Yolları
BGA Cyber Security
 
Crowd Counting from UAVs (ECCV2020)
Gennaro Vessio
 
unified threat management by Nisha Menon K
Nisha Menon K
 

Similar to Codetainer: a Docker-based browser code 'sandbox' (20)

PDF
How abusing the Docker API led to remote code execution same origin bypass an...
Aqua Security
 
PPTX
Introduction to containers
Nitish Jadia
 
PPTX
Docker Starter Pack
Saeed Hajizade
 
PDF
Evolution of containers to kubernetes
Krishna-Kumar
 
PDF
Docker Online Meetup #3: Docker in Production
Docker, Inc.
 
PDF
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Erica Windisch
 
PDF
Docker Intro
Ruben Taelman
 
PDF
Online Meetup: Why should container system / platform builders care about con...
Docker, Inc.
 
PDF
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
Yandex
 
PDF
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Jérôme Petazzoni
 
PDF
Docker Architecture (v1.3)
rajdeep
 
PDF
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
dotCloud
 
PDF
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Docker, Inc.
 
PDF
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
Erica Windisch
 
PDF
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Partner S.A.
 
PDF
The State of containerd
Moby Project
 
PPTX
What is Docker?
Shubhrank Rastogi
 
PDF
Accelerate your software development with Docker
Andrey Hristov
 
PPTX
Accelerate your development with Docker
Andrey Hristov
 
PDF
Docker 0.11 at MaxCDN meetup in Los Angeles
Jérôme Petazzoni
 
How abusing the Docker API led to remote code execution same origin bypass an...
Aqua Security
 
Introduction to containers
Nitish Jadia
 
Docker Starter Pack
Saeed Hajizade
 
Evolution of containers to kubernetes
Krishna-Kumar
 
Docker Online Meetup #3: Docker in Production
Docker, Inc.
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Erica Windisch
 
Docker Intro
Ruben Taelman
 
Online Meetup: Why should container system / platform builders care about con...
Docker, Inc.
 
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
Yandex
 
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Jérôme Petazzoni
 
Docker Architecture (v1.3)
rajdeep
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
dotCloud
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Docker, Inc.
 
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
Erica Windisch
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Partner S.A.
 
The State of containerd
Moby Project
 
What is Docker?
Shubhrank Rastogi
 
Accelerate your software development with Docker
Andrey Hristov
 
Accelerate your development with Docker
Andrey Hristov
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Jérôme Petazzoni
 
Ad

Recently uploaded (20)

PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Ad

Codetainer: a Docker-based browser code 'sandbox'

  • 1. codetainer building  a  browser    code  `sandbox` Jen  Andre   E4E  Conference,  Sep  2015
  • 2. about me @fun_cuddles  /  jenpire.com  /   organizer  @BostonGoLang   EIR  Accomplice  VC   co-­‐founder  @threatstack,     formerly  researcher   @Mandiant,  @Symantec    
  • 3. what is a ‘codetainer’?
  • 4. “try ‘X’ in your browser”
  • 7. use cases tutorials  for  APIs   learn  programming  language  X   training  on  UNIX  tools,  debugging,  etc   remote  management  for  containers
  • 8. requirements flexible  &  powerful  enough  to  support  mulXple  use-­‐ cases  (programmable,  API  driven)   self-­‐hosted  (open  source!)   reasonably  secure-­‐able  :)
  • 10. “Docker  allows  you  to  package  an  applicaXon  with  all   of  its  dependencies  into  a  standardized  unit  for   so`ware  development.” host linux system container process process virtual file system system namespaces docker daemon/API tools container process process virtual file system system namespaces … process  virtualiza/on
  • 11. not your parent’s virtualization • it’s  lightweight!     • process  containers  measured  in  terms  of  kilobytes  or  megabytes   instead  of  GB   • startup  measured  in  seconds,  not  minutes   • images  are  layered  and  reusable   • (see  DockerHub)   • there’s  powerful  introspecXon  /  management  APIs   • Management  is  programmable
  • 12. introspection peer  “inside”  of  containers  and  perform  acXons
  • 13. codetainer architecture codetainer API server loaded via iframe docker API “codetainer” process “codetainer” process “codetainer” process http / websockets sqlite /api/v1/codetainer/{id}/attach /api/v1/codetainer/{id}/create /api/v1/codetainer/{id}/stop …
  • 14. components •  “codetainer”   •  this  is  just  a  Docker  container     • “codetainer  image”     •  this  is  a  Docker  image  registered  for  codetainer  use   • “codetainer  profile”     •  this  is  a  profile  associated  with  a  codetainer  that   defines  its  runXme  characterisXcs  (e.g.  security)
  • 15. other tools • Go   • Docker  APIs  wrifen  in  this   • It’s  just  a  nice,  clean  language  you  can  be  producXve  in  quickly   • xterm.js   • for  rendering  terminals  in  the  browser   • sqlite   • for  storing  metdata  about  ‘codetainers’  
  • 17. starting the server $  ./bin/codetainer  server   Codetainer  10:34:16  [~INFO]  Initializing  Codetainer   (0.1.0)   Codetainer  10:34:16  [~INFO]  URL:  http://127.0.0.1:3000   $  ./bin/codetainer  —help   usage:  Codetainer  [<flags>]  <command>  [<args>  ...]   Flags:      -­‐-­‐help                              Show  help  (also  see  -­‐-­‐help-­‐long   and  -­‐-­‐help-­‐man).      -­‐v,  -­‐-­‐debug                    Enable  debug  logging.      -­‐-­‐dev                                Enable  dev  mode.      -­‐q,  -­‐-­‐quiet                    Remove  all  output  logging.  
  • 18. step 1: create an image • Create  your  Docker  image     • Register  a  Docker  image  for  use  in  a  codetainer   • POST  /api/v1/image $  curl  -­‐XPOST  http://127.0.0.1:3000/api/v1/image  -­‐-­‐data  "id=tcpdump-­‐ demo:latest&description=hi"  2>  /dev/null  |  jq  .   {      "image":  {          "id":   "e5d42500e0419df4a29d1ed443de2da5c2c8d2e683cb045883b79b2e826910b0",          "command":  "",          "description":  "hi",          "Tags":  [              "tcpdump-­‐demo:latest"          ],          "CreatedAt":  "0001-­‐01-­‐01T00:00:00Z",          "UpdatedAt":  "0001-­‐01-­‐01T00:00:00Z",          "Enabled":  true      }  
  • 19. step 2: launch a codetainer • POST  /api/v1/codetainer $  curl  -­‐XPOST  http://127.0.0.1:3000/api/v1/codetainer/  -­‐-­‐data   "name=tcpdump&image-­‐id=tcpdump-­‐demo:latest"  2>  /dev/null  |  jq  .   {      "codetainer":  {          "id":   "07fd1305dc22714ff5c005f8edb5db8bb462ff931bb94c51feab879a10cbcaa6",          "name":  "tcpdump",          "image-­‐id":   "e5d42500e0419df4a29d1ed443de2da5c2c8d2e683cb045883b79b2e826910b0",          "Defunct":  false,          "Running":  false,          "Profile":  "",          "CreatedAt":  "0001-­‐01-­‐01T00:00:00Z",          "UpdatedAt":  "0001-­‐01-­‐01T00:00:00Z"      }  
  • 20. step 3: interact with it! • /api/v1/codetainer/{id}/attach  (attach  via  websockets)   • /api/v1/codetainer/{id}/view  (render  terminal  view)   • /api/v1/codetainer/{id}/send  (send  keystrokes)
  • 21. more! • List/Upload/Download  files  in  a  codetainer   • GET  /api/v1/codetainer/{id}/files   • GET  /api/v1/codetainer/{id}/files/ download   • PUT  /api/v1/codetainer/{id}/files/upload
  • 22. command-line too $  ./bin/codetainer  list   Found  2  codetainers.   -­‐-­‐  [4505c3c844a46f4966280cd6762d3512ba8c04ebd5cb550ba90732c11a5514ee]   lRf9QWOrhAYbNf4_PUdZ58DtKpfmTihu  (Running)   -­‐-­‐  [c2fce38a8ba86caf0e3f1462177809f14d905c26e3cd04ac907d7d18ad9a63f0]   R0bZK2O-­‐1SWsoTp7a2gas1-­‐cHjnFIlf_  (Running)   $  ./bin/codetainer  image  register  ubuntu:14.04   Codetainer  08:01:31  [~INFO]  Registering  New  Image:   &{91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e    267c      [ubuntu:14.04]  0001-­‐01-­‐01  00:00:00  +0000  UTC  0001-­‐01-­‐01   00:00:00  +0000  UTC  true}   odetainer  08:01:31  [~INFO]  Registration  succeeded.
  • 23. challenges Dealing  with  missing  introspecXon  APIs  (e.g.  file  lisXng)   minimize  risk  of  abuse  by  ‘sandboxing’  what  a   container  can  do
  • 25. {      "Config":  {          "NetworkDisabled":  true      },      "HostConfig":  {          "Privileged":  false,          "ReadonlyRootfs":  true,          "Memory":  1000000000,          "Ulimits":  [{  "Name":  "nofile",  "Soft":   1024,  "Hard":  2048  }]      }   limiting a codetainer’s permissions using profiles $  ./bin/codetainer  profile  register  ./ secure.json  secure   2015/09/18  10:52:54  Created  profile  with   id=767653c7-­‐8fb6-­‐4f78-­‐bfcf-­‐3853bbe6df64:   2015/09/18  10:52:54  -­‐-­‐   2015/09/18  10:52:54  {      "Config":  {        "NetworkDisabled":  true      },      "HostConfig":  {   • pass  codetainer-­‐profile-­‐id  to  POST  /api/v1/ codetainer  when  creating  a  codetainer secure.json
  • 26. Missing APIs • Docker  has  an  API  to  ‘exec’  processes  in  the  context   of  a  container.   • SoluXon:  mount  all  codetainers  with  a  shared  “/ codetainer/uXls”  volume  with  custom  tools.   • Example:  /api/v1/codetainer/{id}/files     • Executes  /codetainer/uXls/files    —path  <path>     • returns  JSON  path  lisXng
  • 28. demo time! • creaXng  a  codetainer   • lsof  tutorial
  • 29. status • “Alpha”  -­‐  works  but  needs  a  lifle  more  ‘umph’  to   make  it  producXon  ready     • Auth  for  API   • DocumentaXon,  documentaXon,  documentaiton   • TesXng