ocaml lib to restrict system operations and filesystem view
https://removewingman.codeberg.page/restricted/
- OCaml 70.3%
- C 12.6%
- Shell 11%
- Makefile 4.6%
- Dune 1.5%
| .forgejo/workflows | Update .forgejo/workflows/publish-doc.yaml | |
| lib | change doc and clean up internal optional messy stuff | |
| test | change opam file | |
| .gitignore | change doc and clean up internal optional messy stuff | |
| .ocamlformat | description and impl changes linux landlock | |
| CHANGELOG.md | small changelog and publish stuff | |
| dune | fix project setup | |
| dune-project | change doc and clean up internal optional messy stuff | |
| LICENSE | init | |
| Makefile | small changelog and publish stuff | |
| notes.txt | change doc and clean up internal optional messy stuff | |
| README.md | run with exec promises | |
| restricted.opam | change opam file | |
restricted
This library lets you limit which system operations and which parts of the filesystem your program can access. Call it as early as possible in your program so that the rest of the code runs with reduced privileges. Currently, actual enforced restrictions are implemented for these operating systems:
- OpenBSD
- Linux (only filesystem view)
Even on other operating systems, you can still use restricted to document which privileges your program needs. Users can then test if your program respects these promises with tools such as pledge on Linux. Enjoy :)
Usage and Examples
opam install restricted
- basic functionality example
- file reading and writing example
- networking example
- calling other process
Contribute
Feel free to open issues and pull requests, especially tests are more than welcome.
Dependencies
- for build and installation: OCaml, Dune
- for development: OCaml, Dune, ppx_inline_test, ocamlformat, make, shellcheck, shfmt
inspired by
Thanks.
LICENSE
This work is licensed only under the GNU Affero General Public License version 3 (AGPLv3). See the LICENSE file for details.