Go to file
2015-05-15 16:02:15 +02:00
seccomp Indentation + add missing macros to the seccomp helper 2015-05-15 02:05:36 +02:00
cmdline.c Initial import 2015-05-14 23:44:48 +02:00
cmdline.h Initial import 2015-05-14 23:44:48 +02:00
common.h Initial import 2015-05-14 23:44:48 +02:00
contain.c Logs from the child process (namespaced) are proxied to the parent 2015-05-15 16:02:15 +02:00
contain.h Logs from the child process (namespaced) are proxied to the parent 2015-05-15 16:02:15 +02:00
CONTRIBUTING Initial import 2015-05-14 23:44:48 +02:00
LICENSE Initial import 2015-05-14 23:44:48 +02:00
log.c Logs from the child process (namespaced) are proxied to the parent 2015-05-15 16:02:15 +02:00
log.h Logs from the child process (namespaced) are proxied to the parent 2015-05-15 16:02:15 +02:00
Makefile Indentation + add missing macros to the seccomp helper 2015-05-15 02:05:36 +02:00
net.c Initial import 2015-05-14 23:44:48 +02:00
net.h Initial import 2015-05-14 23:44:48 +02:00
nsjail.c Initial import 2015-05-14 23:44:48 +02:00
nsjail.h Initial import 2015-05-14 23:44:48 +02:00
README.md Formatting #4 2015-05-15 02:30:53 +02:00
sandbox.c Indentation + add missing macros to the seccomp helper 2015-05-15 02:05:36 +02:00
sandbox.h Initial import 2015-05-14 23:44:48 +02:00
subproc.c Logs from the child process (namespaced) are proxied to the parent 2015-05-15 16:02:15 +02:00
subproc.h Initial import 2015-05-14 23:44:48 +02:00

WHAT IS IT?

NsJail is a Linux process isolation tool making use of the namespacing features, and seccomp-bpf filters of the Linux kernel

This is NOT an official Google product.

WHAT KIND OF ISOLATION DOES IT PROVIDE?

  1. Linux namespaces: UTS, MOUNT, PID, IPC, NET, USER (optional)
  2. FS chroot-ing: chroot(), pivot_root()
  3. Resource limits (CPU time, etc.)
  4. Seccomp-bpf syscall filters

WHAT USE-CASES DOES IT COVER?

Isolating networking daemons (inetd-style)

  • Server:
 $ ./nsjail -Ml --port 9000 --chroot /chroot/ --user 99999 --group 99999 -- /bin/sh -i
  • Client:
  $ nc 127.0.0.1 9000
  / $ ifconfig
  / $ ifconfig -a
  lo    Link encap:Local Loopback
        LOOPBACK  MTU:65536  Metric:1
	    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
	    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0
	    RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Isolating local processes (run it once, and exit)

 $ ./nsjail -Mo --chroot /chroot/ --user 99999 --group 99999 -- /bin/sh -i
  / $ ifconfig -a
  lo    Link encap:Local Loopback
        LOOPBACK  MTU:65536  Metric:1
	    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
	    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0
	    RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 / $ id
 uid=99999 gid=99999
 / $exit
 $

Isolating local processes (and re-running them)

 $ ./nsjail -Mr --chroot /chroot/ --user 99999 --group 99999 -- /bin/sh -i
 BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) built-in shell (ash)
 Enter 'help' for a list of built-in commands.
 / $ exit
 BusyBox v1.21.1 (Ubuntu 1:1.21.0-1ubuntu1) built-in shell (ash)
 Enter 'help' for a list of built-in commands.
 / $

MORE INFO?

Type:

./nsjail --help'

the commandline options are reasonably well-documented