[ANN] Openbsd 1.0

I would like to announce a new (somehow niche) package Openbsd, which provides bindings for some specifics OpenBSD syscalls pledge(2) and unveil(2).

These syscalls lets the kernel OS to know what the running processus is expected to do, and so it is possible to restrict a processus to do only filesystem or only network or only pure computation…

The package is designed to be installable on any platform and provides simple method to check if Pledge or Unveil are supported. This way, it is possible to easily write portable code using the package, as it could be a turned on “no-operation” on Windows or Linux hosts (or provides alternative code path for sandboxing).



Examples

let open Openbsd in
if Pledge.supported then
  Pledge.promises "stdio rpath"
let open Openbsd in
if Unveil.supported then (
  Unveil.add "./lib" "r";
  Unveil.add "./logs" "rwc";
  Unveil.lock ())
7 Likes