seccomp

Linux Seccomp sandbox library

Readme

nim-seccomp

Nim adapter for the Seccomp sandbox facility

Features

  • Provides a high-level adaptor in seccomp.nim

  • Low-level wrapper in seccomp_lowlevel.nim

  • Tested on Linux

  • Basic tests

Installation

sudo apt-get install libseccomp2
nimble install seccomp

Usage

Refer to the generated documentation for the seccomp and seccomp_lowlevel modules

import seccomp

let ctx = seccomp_ctx()
ctx.add_rule(Allow, "write")
ctx.add_rule(Allow, "exit_group")
ctx.load()

echo """Seccomp is now enabled. Future attempts to change the Seccomp configuration
or to call forbidden system calls will cause the process to be terminated"""

# e.g. createDir("/tmp/foo")

tests/trigger_seccomp.nim contains running examples of syscalls that will be blocked

Contributing

Testing and PRs are welcome.

Running tests:

nimble test
nimble test_trigger_seccomp
Need help? Read Nimble
No tagged versions available
License: LGPLv2.1

Project website Hosted docs