yuce / pyopenbsd

Python wrapper for some OpenBSD-specific APIs
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link
cffi openbsd pledge python unveil

openbsd

Python bindings for some OpenBSD-specific APIs. Currently the following are supported:

Change Log

v0.1.0 (2019-05-03)

* Initial release.

Installation

Openbsd is on PyPI. You can install it using pip:

pip install openbsd

Prerequisites

Usage

Import openbsd first:

import openbsd

pledge

See: https://man.openbsd.org/pledge.2

openbsd.pledge("stdio rpath")
print(open("/etc/resolv.conf"))

Try removing the`rpath permission.

unveil

See: https://man.openbsd.org/unveil.2

openbsd.unveil("/etc", "r")
print(open("/etc/resolv.conf"))

Try opening /bin/ksh.

Use openbsd.unveil() to lock down restrictions.

Similar Projects

License

(c) 2019 Yuce Tekol

BSD