Coder Social home page Coder Social logo

akihirosuda / subuidless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rootless-containers/subuidless

0.0 2.0 0.0 25 KB

Rootless Containers without `/etc/subuid` and `/etc/subgid`

License: GNU Lesser General Public License v2.1

C 97.74% Shell 2.26%

subuidless's Introduction

OCI Seccomp Receiver for running Rootless Containers without /etc/subuid and /etc/subgid

subuidless is an implementaion of OCI Seccomp Receiver for running Rootless Containers without /etc/subuid and /etc/subgid.

subuidlesss emulates ID-related system calls using Seccomp User Notification and XAttrs. Unlike ptrace implementatins of similar projects such as runROOTLESS (PRoot) and remainroot, subuidless can minimize the overhead of system call hooking.

Status

Early POC. Do not use.

Why do we need subuidless?

  • It is hard to configure /etc/subuid and /etc/subgid in LDAP environments
  • Some container images may require strange UIDs/GIDs that are out of the typical /etc/subuid and /etc/subgid configuration. The typical configuration only allows 65,536 IDs to be available in the container.

Goals and non-goals

Goals:

  • Simplicity
  • Minimal overhead

Non-goals:

  • Provide security boundry across emulated IDs

Requirements

Note: libseccomp >= v2.5.0 is not available as a dpkg/rpm package in most distros as of July 2020.

To install libseccomp from the source onto a custom prefix (/opt/libseccomp):

$ git clone https://github.com/seccomp/libseccomp.git
$ cd libseccomp
$ git checkout v2.5.0
$ ./autogen.sh
$ ./configure --prefix=/opt/seccomp && make && sudo make install

To install crun:

$ git clone https://github.com/containers/crun.git
$ cd crun
$ hub checkout https://github.com/containers/crun/pull/438
$ ./autogen.sh
$ CFLAGS="-I/opt/libseccomp/include/" LDFLAGS="-L/opt/libseccomp/lib" ./configure && make && sudo make install

Usage

Terminal 1:

$ LIBSECCOMP_PREFIX=/opt/libseccomp ./make.sh
$ mkdir -p ./test/rootfs && docker create --name foo alpine && docker export foo | tar Cx ./test/rootfs && docker rm -f foo
$ ./subuidless ~/.subuidless.sock
Listening on /home/user/.subuidless.sock
...

Terminal 2:

$ RUN_OCI_SECCOMP_RECEIVER=~/.subuidless.sock unshare -r crun run -b ./test foo
/ # cat /proc/self/uid_map
         0       1001          1
/ # touch foo
/ # chown 42:42 foo

Make sure that the chown command succeeds without Invalid argument error, even though no subuid is configured in the uid_map file. The UID ang GID are recorded to the user.rootlesscontainers xattr of the target file.

FIXME: The chowned value are not shown in ls -l currently. Will be shown after the implementaion of stat syscalls. Use getfattr -d -e hex -m user.rootlesscontainers to inspect the xattr value.

Hooked system calls

To be documented, see SCMP_ACT_NOTIFY entries in ./test/config.json.

subuidless's People

Contributors

akihirosuda avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.