A wrapper of /bin/sh that limits the available commands.
shell sh zig security
1

Configure Feed

Select the types of activity you want to include in your feed.

Zig 99.7%
Other 0.3%
12 1 0

Clone this repository

https://tangled.org/nouveauprintemps.org/limited-shell https://tangled.org/did:plc:zpmmsjfinextm33vhw7hxbt3
git@knot.git.nouveauprintemps.org:nouveauprintemps.org/limited-shell git@knot.git.nouveauprintemps.org:did:plc:zpmmsjfinextm33vhw7hxbt3

For self-hosted knots, clone URLs may differ based on your setup.



README.md

Limited Shell#

A wrapper of /bin/sh that limits the available commands. Useful if you want to harden your CD pipelines.

Usage#

  1. Change the default shell of the user to /usr/local/bin/limited-shell (or /usr/bin/limited-shell).
  2. Create the config directory /etc/limited-shell.
  3. Create the file /etc/limited-shell/user (replace user by its username).
  4. List allowed commands in this file. You can use * to allow every subcommands.

Now, the user can only use the listed commands.

Build#

This project uses Zig 0.16.

Build it with:

zig build

The binary is in ./zig-out/bin/limited-shell.

Then, you can install it with:

sudo install -m 755 -o root:root ./zig-out/bin/limited-shell /usr/local/bin/limited-shell

Doc#

The manpages are written with scdoc.

You can generate them with:

scdoc < docs/limited-shell.1.scd > docs/limited-shell.1
scdoc < docs/limited-shell.5.scd > docs/limited-shell.5

And you can install them with:

sudo install -m 755 ./docs/limited-shell.1 /usr/local/man/man1/
sudo install -m 755 ./docs/limited-shell.5 /usr/local/man/man5/