Crates.io | pftables-rs |
lib.rs | pftables-rs |
version | 0.1.1 |
source | src |
created_at | 2021-03-05 21:24:08.776659 |
updated_at | 2021-03-06 22:27:35.462917 |
description | Small library for managing tables in OpenBSD pf (packet filter) |
homepage | |
repository | https://github.com/d3npa/pftables-rs |
max_upload_size | |
id | 364551 |
size | 19,888 |
A small Rust library for managing pf tables on OpenBSD.
Note: I haven't tested it but it may work on other BSDs and macOS as well.
This was primarily a learning exercise for me. I wanted to manage my pf tables from a rocket.rs application, and didn't want to just proxy to pfctl
. Instead this library talks directly to /dev/pf
, the kernel device that controls pf (see man 4 pf
for more info).
I'm not currently planning on supporting operations on rules or anchors. I wrote all of the code by hand and it's incredibly time consuming to create working wrappers for all the structures the kernel is expecting.
Currently, this library supports the following operations:
See examples/my_table
for some sample high-level usage. src/lib.rs
contains a high-level interface called PfTable
for interacting with tables. The source of PfTable
may be a useful reference if you want to do more than what is provided. src/bridge/mod.rs
contains the majority of the ffi code.