Skip to main content

Cerber

https://travis-ci.org/gr0und-s3ct0r/cerber.svg?branch=devel https://badge.fury.io/py/cerber.svg

A straightforward command line tool for generate seccomp json profile

Overview

Seccomp (short for secure computing mode) is a computer security facility in the Linux kernel. Seccomp allows a process to make a one-way transition into a “secure” state where it cannot make any system calls except exit(), sigreturn(), read() and write() to already-open file descriptors. Should it attempt any other system calls, the kernel will terminate the process with SIGKILL or SIGSYS. In this sense, it does not virtualize the system’s resources but isolates the process from them entirely.

Seccomp profile is used with by a lot of applications like:

  • docker

  • firefox

  • systemd

  • openssh

  • chrome

  • and more…

Cerber help you to generate seccomp profile that you can use with docker per example.

Prerequisites

  • Linux

  • Python3.5+

  • Strace

Install

$ pip install cerber

Usage

Generate a seccomp_profile.json in your current directory:

$ cerber docker run hello-world
$ ls
seccomp_profile.json
$ cat seccomp_profile.json
{
    "defaultAction": "SCMP_ACT_ERRNO",
    "architecture": [
        "SCMP_ARCH_X86_64",
        "SCMP_ARCH_X86",
        "SCMP_ARCH_X32"
    ],
    "syscalls": [
        {
            "action": "SCMP_ACT_ALLOW",
            "args": [],
            "name": "read"
        },
        ...
        {
            "action": "SCMP_ACT_ALLOW",
            "args": [],
            "name": "execve"
        },
        {
            "action": "SCMP_ACT_ALLOW",
            "args": [],
            "name": "arch_prctl"
        }
    ]
}

Now you can assign this seccomp profile to your container at run:

$ docker run \
--rm \
--security-opt="no-new-privileges" \
--security-opt seccomp=seccomp_profile.json \
hello-world # you can get the following output for docker hello world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
...
For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

Becareful to generate seccomp profile with cerber on the same cpu architecture that your production environment (where you want run your container).

Features

  • detect syscalls

  • generate seccomp profile from detected syscalls

Contribute

$ git clone https://github.com/gr0und-s3ct0r/cerber
$ cd cerber
$ pipenv install pbr
$ pipenv shell # generate a virtual environment
$ python setup.py develop # install cerber in development mode
$ pip install -e .[test] # install testing dependencies
$ # make your changes
$ tox

Further readings

Original Authors

CHANGES

0.2.0

  • install from pypi

  • fix license classifier

  • update changelog

0.1.0

  • adding build badge

  • fix pep8 errors

  • ignore pyc

  • fix pep8 errors

  • adding overview about seccomp

  • adding further readings

  • example on how to use security profil

  • fix filename output on documentation

  • fix install

  • fix contribute guide

  • update usage with seccomp.json file generated

  • use restructuredText for readme instead of markdown

  • packaging + TU + CI

  • introduce CI

  • keep strace statistics

  • add gitignore

  • rename tmpfile and create seccomp profile in a file

  • do not touch stdout and stderr to be transparent on execution

  • further reading and contributors

  • update doc with command

  • pass command to execute to bouncer

  • improve usage

  • rename tool

  • initialize repository

Hervé Beraud <herveberaud.pro@gmail.com> Sebastien Boyron <sebastien@boyron.eu>

Metadata

Release files for cerber 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cerber 0.3.0
File Size Uploaded
cerber-0.3.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cerber 0.3.0
File Interpreter ABI Platform
cerber-0.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 14.8 kB

Release files / cerber-0.3.0.tar.gz

Download URL cerber-0.3.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0fb764047dc72f6a5a7d5ab1d6b1b01e9ba6719bdd9c0b084183ebf7f5709754
BLAKE2b-256 checksum
How to use checksums
c4ff70c14d92ae8652bff21a238fb7079f98b7fb698abdda91d698c646cb21b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cerber-0.3.0-py2.py3-none-any.whl

Download URL cerber-0.3.0-py2.py3-none-any.whl
Size 8.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
33e8648fd82254b98a01ac3fe47894318d078cee4a7d7dd2c164e9c4ec4ac9a9
BLAKE2b-256 checksum
How to use checksums
a59739225ba8bee90b190e4ba92bf8a5fada7d7e87c986466a4cd9e28a1a79e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page