MyNixOS website logo
Description

Running worker processes under system resource restrictions.

This library provides an abstract interface for running various kinds of workers under resource restrictions. It was originally developed as part of the interactive-diagrams (http://github.com/co-dan/interactive-diagrams) project. To read more about the idia behind the library check out my GSoC report: http://parenz.wordpress.com/2013/07/15/interactive-diagrams-gsoc-progress-report/.

The library provides a convenient way of running worker processes, saving data obtained by the workers at start-up, a simple pool abstraction and a configurable security and resource limitations. Please consult https://github.com/co-dan/interactive-diagrams/tree/master/restricted-workers/README.md and https://github.com/co-dan/interactive-diagrams/wiki/Restricted-Workers for more details.

Warning: this library requires SELinux to function

Restricted Workers Library

This library provides an abstract interface for running various kinds of workers under resource restrictions. It was originally developed as part of the interactive-diagrams (project. You can read more about security restrictions in the wiki: <https://github.com/co-dan/interactive-diagrams/wiki/Restricted-Workers

The library provides a convenient way of running worker processes, saving data obtained by the workers at start-up, a simple pool abstraction and a configurable security and resource limitations.

Right now there are several kinds of security restrictions that could be applied to the worker process:

  • RLimits
  • chroot jail
  • custom process euid
  • cgroups
  • process niceness
  • SELinux security context

Documentation

The easiest way to get a grip of the restricted-workers library is to look at the examples below showing off the basic concepts of the library. Another good idea would be to read haddock documentations which feature comments for each exported function and type in the library. Do not hesitate to bug me if you think that the documentation in some places can be improved.

Examples

The following examples will walk you through creating basic kinds of workers (IOWorker), handling a pool of workers, communicating with workers using 'System.Restricted.Workers.Protocol' and creating your own types of workers.

Wiki page

https://github.com/co-dan/interactive-diagrams/wiki/Restricted-Workers

External configurations

Some restrictions require external configuration, below we provide some example files for them that we use in interactive-diagrams:

  • SELinux configuration: https://github.com/co-dan/interactive-diagrams/tree/master/selinux

    Run build.sh to build the policy module, then load.sh to load it. Read the blog post which explains the policy.

  • CGroups: https://github.com/co-dan/interactive-diagrams/blob/master/cgconfig.conf

    CGroups configuration is pretty straightforward. You can load the configuration with

    cgconfigparser -l cgconfig.conf
    
Metadata

Version

0.1.1

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows