about summary refs log tree commit diff stats
path: root/README.md
blob: b8b12a26b613c0caec7de552313bfe9dbfdaa996 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# openbsd

Python bindings for some OpenBSD-specific APIs. Currently the following are supported:
* `pledge`
* `unveil`

## 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

* OpenBSD 6.4 or better
* Python 3.6 or better OR Python 2.7

## Usage

Import `openbsd` first:
```python
import openbsd
```

### pledge

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

Try removing `rpath` permission.

### unveil

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

Try opening `/bin/ksh`.

Use `openbsd.unveil()` to lock down restrictions.

## License

(c) 2019 Yuce Tekol

[BSD](LICENSE)