bpyfilter
Crazy idea... write firewalls in Python (technically, write bpfilter programs in Python, but bpfotato, bpftata).
bpyfilter is a binding for libbpfilter: you write packet filtering rules in Python, and bpfilter turns them into BPF programs and attaches them to the kernel.
In software development, as in screenwriting, it's better to show, not tell... so here is how it works: nobody can ping this machine.
from bpyfilter import ACCEPT, DROP, NF_LOCAL_IN, Chain, icmp, ip4
chain = Chain("no_ping", NF_LOCAL_IN(priorities=(101, 102)), policy=ACCEPT) # netfilter: the whole system
chain.rule(ip4.proto == "icmp", icmp.type == "echo-request", verdict=DROP)
chain.install() # into the kernel: nobody can ping us now
chain.counters()
# ChainCounters(hook='BF_HOOK_NF_LOCAL_IN', policy_verdict='ACCEPT', attached=True,
# rules=[Counter(packets=2, bytes=196)],
# policy=Counter(packets=0, bytes=0), error=Counter(packets=0, bytes=0))
chain.flush() # and we're pingable again
A chain, in bpfilter's terms, is a group of rules that decide the fate of a packet. The Python syntax looks very similar to bpfilter's own language; if you don't believe me, turn a chain into a string:
print(str(chain))
chain no_ping BF_HOOK_NF_LOCAL_IN{priorities=101-102} ACCEPT
rule
ip4.proto eq icmp
icmp.type eq echo-request
counter
DROP
Installing
pip install bpyfilter
The wheels (Linux, x86_64 and aarch64, CPython 3.11+) bundle their own
libbpfilter: you don't need bpfilter installed. They're built from
bpfilter v0.8.0 and
libbpf v1.8.0, by
ci/build-bpfilter.sh, and also bundle libelf and libzstd, from the AlmaLinux 9
packages of the build image (manylinux_2_34; the versions are in the bundled files'
names, under bpyfilter.libs/). Loading BPF programs still needs root (or the
right capabilities) and a recent kernel.
Installing from source (the sdist, or this repository) builds against the libbpfilter installed on the system, which must be bpfilter 0.8.
bpyfilter's version is the bundled bpfilter's version plus a revision of its own:
0.8.0.1 is the first release built on bpfilter 0.8.0, 0.8.0.2 the next one, and
0.8.1.1 would be the first on bpfilter 0.8.1. To stay on one bpfilter line, pin
the first numbers: bpyfilter==0.8.* gets every release built on bpfilter 0.8
(0.8.0.1, 0.8.1.1...), and bpyfilter==0.8.0.* only those on bpfilter 0.8.0.
Careful with ~=, which counts the parts you give it: ~=0.8.0 is
==0.8.*, but ~=0.8.0.1 is ==0.8.0.*.
Hooks
Chains have hooks: a hook is where a chain is attached, and it decides what the chain sees. A hook is called with the options
that say where to attach (XDP(ifindex="eth0")), like bfcli's BF_HOOK_XDP{ifindex=2}.
For example, two other ways we could have written the no_ping chain would be to attach it to the proper interface, or to a group of processes:
# only on eth0, at the driver, before the kernel does anything else with the packet
chain = Chain("no_ping", XDP(ifindex="eth0"), policy=ACCEPT)
chain.rule(ip4.proto == "icmp", icmp.type == "echo-request", verdict=DROP)
# only for the processes in one cgroup: they can't ping anyone
chain = Chain("no_ping", CGROUP_SKB_EGRESS(cgpath="/sys/fs/cgroup/myapp"), policy=ACCEPT)
chain.rule(ip4.proto == "icmp", icmp.type == "echo-request", verdict=DROP)
You don't need to pass the hook's options when you create the chain: you can pass them (or override them) at install time, for instance:
chain = Chain("no_ping", XDP, policy=ACCEPT)
chain.rule(ip4.proto == "icmp", icmp.type == "echo-request", verdict=DROP)
chain.install(ifindex="eth0")
The full list of hooks, and the options each one takes, is in Current hooks.
Matchers
When writing rules, you can do it three ways... the following are all the same:
from bpyfilter import Matcher, Op
from bpyfilter.match import ip4
chain.rule(ip4.daddr == "1.1.1.1", verdict=DROP) # Python expressions
chain.rule("ip4.daddr eq 1.1.1.1", verdict=DROP) # bfcli's text
chain.rule((Matcher.IP4_DADDR, Op.EQ, "1.1.1.1"), verdict=DROP) # enums, for generated rules
| expression | bfcli |
|---|---|
ip4.daddr == ip_address("1.1.1.1") |
ip4.daddr eq 1.1.1.1 |
ip4.dnet == ip_network("10.0.0.0/8") |
ip4.dnet eq 10.0.0.0/8 |
tcp.dport != 22, or ~(tcp.dport == 22) |
tcp.dport not eq 22 |
tcp.dport.range(1024, 65535) |
tcp.dport range 1024-65535 |
~tcp.dport.range(1, 1023) |
tcp.dport not range 1-1023 |
tcp.flags.any("syn", "ack") / .all(...) |
tcp.flags any syn,ack |
icmp.type == "echo-request" |
icmp.type eq echo-request |
ip4.proto == socket.IPPROTO_ICMP |
ip4.proto eq 1 (= icmp) |
Several matchers in one rule must all match: chain.rule(ip4.proto == "icmp", ip4.daddr == "8.8.8.8", verdict=...). Every field libbpfilter knows is
available as family.name (meta.l4_proto, ip6.saddr, icmp.type...);
payloads go through str() and are parsed by libbpfilter, so strings, numbers
and ipaddress objects all work.
A matcher is a rule's condition, not a truth value: Python turns not, and,
or and if into plain bools, so they can't build rules, and using one
raises TypeError (instead of silently meaning True). Negate with ~.
meta.pid == 1234 matches a process (its PID in the initial PID namespace),
only on the CGROUP_SOCK_ADDR_* hooks: they run in the process calling
connect() or sendmsg(), while the packet hooks only see packets. A PID only
names a process until it exits, then the kernel can give it to an unrelated
process, which the rule would match: keep such rules short-lived, remove the
PID when the process exits, or use a cgroup per process (cgroup IDs aren't
reused). Your own children are safe until you wait() for them: a zombie
keeps its PID.
Sets
We have extensive support for sets, too much support really. A set matches a packet against many values at once (a hash map, or a longest-prefix-match trie for networks), instead of one rule per value, and you can change it while the chain runs:
chain = Chain("blocklist", NF_LOCAL_OUT(priorities=(101, 102)), policy=ACCEPT)
blocked = chain.add_set("blocked", ip4.daddr, ["8.8.4.4"], auto_update=True)
chain.rule(blocked, ip4.proto == "icmp", verdict=DROP) # icmp, to anything in blocked
chain.install()
# can't ping 8.8.4.4, but can ping 8.8.8.8
blocked.add("8.8.8.8") # auto_update=True pushes it right away (without it: blocked.update_chain())
# now we can't ping 8.8.8.8 either
There are two types of sets: one defined inline in a rule (they don't have names), and one defined on the chain, which can be referenced by name in multiple rules... we support both. Examples:
from ipaddress import ip_address, ip_network
from bpyfilter import SetRef
from bpyfilter.match import ip4, key, tcp, udp
blocked = chain.add_set("blocked", ip4.daddr, [ip_address("1.1.1.1"), "8.8.8.8"])
svc = chain.add_set("svc", (ip4.daddr, tcp.dport), [("10.0.0.1", 443), ("10.0.0.2", 22)])
lan = chain.add_set("lan", ip4.dnet, [ip_network("10.0.0.0/8"), ip_network("192.168.0.0/16")])
chain.rule(blocked, verdict=DROP) # shortcut for: ip4.daddr in the blocked set
chain.rule(ip4.daddr.isin(blocked), verdict=DROP) # the same as before
chain.rule(~blocked, verdict=DROP) # ip4.daddr *not* in the blocked set
chain.rule(svc, verdict=DROP) # block the pair ip4.daddr/tcp.dport
chain.rule(SetRef("svc"), verdict=DROP) # the same as the one before, by name instead of by object
chain.rule(lan, udp.dport == 53, verdict=ACCEPT) # accept DNS to the local networks (a trie)
chain.rule(ip4.saddr.isin(["10.0.0.1", "10.0.0.2"]), verdict=DROP) # inline set, made on the fly
chain.rule(key(ip4.daddr, tcp.dport).isin([("1.1.1.1", 443)]), verdict=DROP) # inline, composite
chain.rule("(ip4.daddr) in blocked", verdict=DROP) # bfcli's text
Updating a set
A bpyfilter Set also acts as a Python set. You can mutate it, then update_chain() pushes just the
changes to the chain in bpfilter, without replacing the chain (bfcli's chain update-set, libbpfilter's bf_chain_update_set):
blocked = chain.add_set("blocked", ip4.daddr, ["8.8.8.8"])
live = chain.add_set("live", ip4.daddr, [], auto_update=True)
chain.rule(blocked, verdict=DROP).rule(live, verdict=DROP).install()
blocked.add("1.2.3.4")
blocked.discard(ip_address("8.8.8.8"))
blocked |= {"9.9.9.9", "10.0.0.1"}
blocked.update_chain() # one push, for all of the above
live.add("1.2.3.4") # auto_update: pushed right away
A set added to a chain that's already installed isn't in bpfilter yet: its
changes stay local (pushing them raises, saying so) until chain.update()
sends it.
A set keyed on one port field takes ranges, Set(tcp.dport, [22, "8000-8080", range(9000, 9010)]): libbpfilter stores every port, and so does the Python
set, so 8042 in s and s.discard(8042) work.
in, len(), iteration, add, discard, remove, update,
difference_update, clear, |= and -= all work; elements compare as the
text libbpfilter gets, so "8.8.8.8" and ip_address("8.8.8.8") are the same.
update_chain() pushes to the set's chain; on a set that belongs to no chain it
raises, and before the chain is installed changes are only local (install()
sends everything). A set is not a truth value: use len(s).
Mutating a chain
| what changes | attachment | counters | |
|---|---|---|---|
chain.install() |
everything: creates the chain (replace=True to replace one of that name) |
attaches it with the hook's options, or install(**hookopts) (none: loaded only) |
restart |
chain.update() |
its rules and sets, in place | kept, whatever it is | restart |
s.update_chain(), chain.update_set(...) |
one set's elements, in place | kept | kept |
Rules are immutable (Rule is a frozen dataclass): to change them, replace
them in chain.rules and update() the chain:
chain.rules[0] = Rule([ip4.daddr == "1.1.1.2"], verdict=DROP) # or chain.rules.clear(); chain.rule(...)
chain.update()
Chain lifecycle (starting and stopping a chain)
You can enable and disable (install and flush) a chain in multiple ways. The first is to explicitly call install() and flush():
chain = (Chain("no_ping", NF_LOCAL_IN(priorities=(101, 102)), policy=ACCEPT)
.rule(ip4.proto == "icmp", icmp.type == "echo-request", verdict=DROP)
.install()) # into the kernel: nobody can ping us now
chain.flush() # and we're pingable again
With install() your chain becomes active, and with flush() the chain disappears... in true Python fashion, you can also use a context manager: entering the block installs the chain, and leaving it removes it:
with (Chain("no_ping", NF_LOCAL_IN(priorities=(101, 102)), policy=ACCEPT)
.rule(ip4.proto == "icmp", icmp.type == "echo-request", verdict=DROP)) as chain:
... # things happen: nobody can ping us
# the chain is gone from the kernel, even if the block raised
Rules added inside the block are local until chain.update() sends them.
In particular, the chain constructor is very useful: you can create sets and rules at once.
fw = Chain(
"fw",
CGROUP_SKB_EGRESS(cgpath="/sys/fs/cgroup/myapp"),
policy=ACCEPT,
sets={"foo": Set(ip4.daddr, ["1.1.1.1"])},
rules=[
Rule([SetRef("foo")], verdict=DROP),
Rule([~SetRef("foo"), tcp.dport == 22], verdict=DROP),
],
)
Loading a chain
You can also use bpyfilter to debug existing chains (or modify them): Chain.load(name) reads a chain back from bpfilter, whoever made it (bpyfilter,
bfcli, another program), as an installed Chain: its sets, rules, policy and,
if it's attached, its hook options.
fw = Chain.load("no_ping")
print(fw) # the chain, as bfcli's text
fw.sets["blocked"].add("9.9.9.9")
print(fw.diff()) # how it differs from the chain bpfilter has
fw.sets["blocked"].update_chain() # change a set in place
fw.rules.append(Rule([tcp.dport == 23], verdict=DROP))
print(fw.diff()) # how it differs from the chain bpfilter has
fw.update() # or its rules
Payloads and set elements come back the way libbpfilter prints them ("443",
"10.0.0.0/8", "icmp"), and comparing works as usual (443 in s). Rules with
a mark or a log rate limit (log every 1s) raise ValueError: bpyfilter can't
express those yet.
Starting libbpfilter: setup()
bpfilter has no daemon: libbpfilter runs inside your process, and starts on the first chain operation. To start it with options, or for one block only:
with bpyfilter.setup(bpffs_path="/sys/fs/bpf"): # libbpfilter for the block
with Chain("fw", CGROUP_SKB_EGRESS(cgpath=cg), sets={"blocked": Set(ip4.daddr, ["1.1.1.1"])},
rules=[Rule([SetRef("blocked")], verdict=DROP)]) as fw:
fw.sets["blocked"].add("8.8.8.8"); fw.sets["blocked"].update_chain()
# here the chain is gone from bpfilter, even if the block raised
setup() returns a context manager that tears libbpfilter down at the end of
the block (chains installed outside a with Chain stay attached). As in
"Chain lifecycle", with chain: installs the chain and removes it when the
block ends; a chain that's already installed stays as it is, so
with chain.install(ifindex=2): works too, for options given to install().
Examples
There are plenty of examples in this repo... this is mostly a teaching tool, and the best way to learn is with examples.
They're organized in one folder per hook. All need root, and run offline: they use loopback
addresses, a scratch cgroup, or a throwaway network namespace (bpyf-lab,
a veth cable to this host's bpyf0), and remove what they create.
examples/xdp/ |
|
drop_ping.py |
drop pings at the driver of one interface, TCP still gets through |
blocklist.py |
a set of banned source addresses, grown in place while attached |
examples/tc/ |
|
ingress_ports.py |
close TCP ports on an interface, with an inline set of ports |
egress_ping.py |
one-way ping: drop outgoing echo requests, not the replies |
examples/netfilter/ |
|
no_ping.py |
nobody pings this machine (NF_LOCAL_IN, priorities=) |
local_out.py [addr ...] |
a blocklist for every process on the machine (NF_LOCAL_OUT) |
examples/cgroup_skb/ |
|
per_cgroup_firewall.py [cmd] |
no ping, no DNS, for one command |
blocklist.py [addr ...] |
a named set of destinations a command can't reach |
allowlist.py |
policy DROP, plus a trie of networks it may reach |
not_in_set.py |
"anything except the set", with ~blocked |
traffic_meter.py [cmd] |
CONTINUE rules as counters: a command's packets per protocol |
declarative.py |
a whole chain in one expression: sets=, rules=, SetRef, with blocks |
update_set.py |
change a running blocklist: set methods, update_chain(), auto_update |
tcp_ports.py |
a port range and an (address, port) set, against local listeners |
examples/cgroup_sock_addr/ |
|
connect4.py |
the same rule on CGROUP_SKB_EGRESS (connect times out) and CONNECT4 (fails at once with EPERM) |
sendmsg4.py |
refuse UDP sendto() to some ports |
per_pid.py |
two processes in one cgroup, only one can connect: meta.pid |
examples/_lab.py has the helpers they share. To run them (in the dev VM, or as root on a
machine with bpfilter 0.8), see dev/README.md.
Installing and using it
bpyfilter needs bpfilter 0.8, which has no daemon: libbpfilter generates and loads the BPF programs itself, from your process. Distributions still ship 0.6 (Fedora 44 and 45, as of November 2026), so build it from source:
sudo dnf install clang cmake gcc libbpf-devel bison flex sed xxd git
git clone --branch v0.8.0 https://github.com/meta/bpfilter.git && cd bpfilter
cmake -S . -B build -DWITH_DOCS=OFF -DWITH_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr
cmake --build build -j && sudo cmake --install build
pip install . # in bpyfilter: builds the Cython extension
API
Hook, Verdict, Matcher, Op |
StrEnums read from the installed libbpfilter (Hook.CGROUP_SKB_EGRESS, Verdict.DROP, Matcher.IP4_DADDR, Op.RANGE...). Plain strings ("BF_HOOK_XDP" or "XDP") work too |
ACCEPT, DROP, CONTINUE, XDP, CGROUP_SKB_EGRESS, ... |
every verdict and hook, also importable on its own: from bpyfilter import CGROUP_SKB_EGRESS, DROP |
ip4, ip6, tcp, udp, icmp, icmpv6, meta, ... |
every match family libbpfilter has, from bpyfilter.match or the top level: from bpyfilter import ip4, tcp |
NF_LOCAL_IN(priorities=(101, 102)), XDP(ifindex="eth0"), ... |
a hook called with its options: a HookSpec, which Chain takes in place of the hook; checked by libbpfilter right away; str() is bfcli's BF_HOOK_NF_LOCAL_IN{priorities=101-102} |
bpyfilter.match |
one namespace per field family (ip4.daddr...), and key(*fields) for composite inline sets |
bpyfilter.setup(bpffs_path="/sys/fs/bpf", with_bpf_token=False, verbose=0) |
start libbpfilter in this process, with options; also a context manager (with bpyfilter.setup():). Optional: the first chain operation starts it with the defaults; importing never does |
bpyfilter.teardown(), bpyfilter.is_setup() |
stop it (also runs at exit; chains stay attached), and ask |
Chain(name, hook, policy=ACCEPT, sets=None, rules=None) |
a chain for one hook, bare (NF_LOCAL_IN) or with its options (NF_LOCAL_IN(priorities=(101, 102))); sets={name: Set} declares sets, rules=[Rule, ...] starts its rules; with chain: installs it for the block and removes it at the end |
chain.rule(*matchers, verdict=..., counters=True, log=False, redirect=None) |
append a rule; verdict is required; log=True logs everything the hook can (bfcli chain logs), or some layers: "link", "internet", "transport" (a tuple for several), "5-tuple"; redirect=(interface, "in" or "out") with REDIRECT (returns the chain) |
Set(key, elements=(), name=None, auto_update=False, min_size=0) |
a set: a matcher for rules, and a Python set; owned by at most one chain (s.chain), and needs a name (letters, digits, _, -) to join one; min_size reserves room for elements added later; s.bind(chain, name=None) / s.unbind() |
SetRef(name) |
a reference to a set the chain declares, resolved at install()/update(); ~SetRef(name) negates it |
chain.sets |
the chain's sets: [name] / [index], [name] = Set, del [name], in, len, iteration, .names() |
chain.add_set(name, key, elements=(), auto_update=False, min_size=0) |
declare a named set on the chain; returns the Set (same as chain.sets[name] = Set(key, elements)) |
chain.install(replace=False, **hookopts) |
create it in bpfilter and attach; if bpfilter already has a chain of that name, BpfilterError (EEXIST), unless replace=True or it's this chain (installed or loaded by this object). Attaches with the hook's options, or with hookopts (ifindex= for XDP/TC, priorities=(a, b) for netfilter, cgpath= for cgroups), which win; no options anywhere = load only (see Current hooks) |
chain.rules |
the chain's rules: a list of frozen Rule(matchers, verdict, ...); replace items, then update() |
s.update_chain() |
push the set's changes since the last push to its chain, in place; auto_update=True does it on every mutation |
chain.update() |
replace the rules and sets of an existing chain, keeping whatever it's attached to (bfcli's chain update); counters restart from zero |
chain.update_set(set, add=[...], remove=[...]) |
add/remove elements of a named set in place: libbpfilter regenerates the program, no install() needed |
Chain.load(name) |
a chain bpfilter has, whoever made it, back as an installed Chain |
bpyfilter.chains() |
the names of every chain bpfilter has, whoever made them, sorted (bfcli's ruleset get, names only) |
chain.copy(name=None, hook=None, policy=None, sets=None, rules=None) |
a new chain with its own rules and sets, not installed; each argument given replaces that part (fw.copy(name="fw_connect", hook=CGROUP_SOCK_ADDR_CONNECT4)). A bare hook keeps the hook options when it takes them (cgpath= between cgroup hooks); with sets=, the rules point at the new sets of the same names |
copy.copy(chain), copy.copy(s) |
a chain: same as chain.copy() (install(replace=True) replaces the chain of that name); a set: unowned, same name and elements |
chain.clean(rules=True, sets=True) |
remove the chain's rules, its sets, or both, here only (update() sends it); a set a remaining rule uses can't go (ValueError) |
str(chain), chain.to_bfcli(**hookopts) |
the chain as bfcli's text (with the last install()'s hook options, or these) |
chain2.diff(chain1, context=3), chain.diff(), chain.diff(name) |
how chain2 differs from chain1, as a unified diff of their bfcli text (set elements one per line, sorted); no argument: against bpfilter's chain of the same name, so what update() would change; a name: against that chain in bpfilter. context= is the unchanged lines shown around each change (3, as git diff; 0 for only the changes, math.inf for the whole chain). Empty (falsy) if they're the same |
chain.counters() / bpyfilter.get(name) |
a Counter(packets, bytes) per rule, plus policy and error counters; after - before is the difference |
chain.flush() / bpyfilter.flush(name) / bpyfilter.flush_all() |
detach and delete (not "empty the rules": the chain is gone); chain.flush() returns the chain |
Errors from libbpfilter raise BpfilterError (an OSError); invalid hooks,
verdicts, matchers, payloads or set references raise ValueError before
anything reaches libbpfilter.
How it works
| module | |
|---|---|
bpyfilter.chain |
Chain, Rule, ChainCounters, chains / get / flush / flush_all |
bpyfilter.match |
the fields (ip4.daddr...), Match, and parse() for the three spellings |
bpyfilter.sets |
Set, SetRef, ChainSets (chain.sets), Key / key(), SetMatch |
bpyfilter.enums |
Hook, Verdict, Matcher, Op, read from libbpfilter; HookSpec |
bpyfilter._core |
the Cython layer: libbpfilter objects, memory, and calls |
Everything public is re-exported from bpyfilter.
bpyfilter/_libbpfilter.pxd declares the subset of libbpfilter's public API we
use, compiled against bpfilter-devel's headers; _core.pyx owns all the C
memory (bf_chain_add_set and bf_chain_add_rule take what they're given,
bf_chain_get returns objects the caller frees). libbpfilter's process-wide
context (bf_ctx_setup) is set up on first use and torn down at exit, so
importing bpyfilter needs no privileges. Matchers and sets are built from text
with bf_matcher_new_from_raw() and bf_set_new_from_raw(), so payloads are
parsed by libbpfilter itself. The chain owns its named sets, and a rule's
matcher points at one (bf_matcher_new_for_named_set); an inline set belongs
to its matcher (bf_matcher_new_for_anon_set_from_raw).
The enums are filled at import time from libbpfilter's *_to_str() functions.
Development
See dev/README.md: a throwaway Lima VM with bpfilter built from source, to develop and run the tests in.
Compatibility
bpyfilter supports bpfilter 0.8 only.
Current hooks
Here is the list of current hooks, and the options each one takes:
| hook | sees | options |
|---|---|---|
XDP |
packets arriving on one interface, at the driver, before the kernel spends anything on them | XDP(ifindex=...) |
TC_INGRESS, TC_EGRESS |
packets in or out of one interface | TC_INGRESS(ifindex=...) |
NF_PRE_ROUTING, NF_LOCAL_IN, NF_FORWARD, NF_LOCAL_OUT, NF_POST_ROUTING |
every packet the kernel routes, IPv4 and IPv6, on every interface | NF_LOCAL_IN(priorities=(a, b)) |
CGROUP_SKB_INGRESS, CGROUP_SKB_EGRESS |
packets of one cgroup's sockets | CGROUP_SKB_EGRESS(cgpath=...) |
CGROUP_SOCK_ADDR_CONNECT4 / 6, CGROUP_SOCK_ADDR_SENDMSG4 / 6 |
connect() and UDP sendmsg() calls of one cgroup, before any packet exists: DROP fails the call with EPERM |
CGROUP_SOCK_ADDR_CONNECT4(cgpath=...) |
ifindex=takes an index or an interface name: bpyfilter looks names up (libbpfilter only reads numbers, and would read"eth0"as 0).priorities=is two different, non-zero priorities among the other netfilter users (nftables, iptables); bpfilter needs two to replace the chain atomically.(101, 102)or bfcli's"101-102". Each update attaches the new program at the unused priority, so two netfilter chains on the same hook need different priorities, or their updates fail withEBUSY.cgpath=is a cgroup v2 directory, a string or aPath.- The options are checked where you write them (an option the hook doesn't
take, a bad value), by libbpfilter itself; interface names are looked up at
install(), so the interface can come later. - Nothing reaches the kernel until
install(). With no options anywhere,install()loads the chain without attaching it.
A cgroup hook filters the packets that cgroup's processes send. If a
program asks another service to do the work, that service's packets are not
in the cgroup: with systemd-resolved, getent hosts example.com inside the
cgroup still resolves (resolved, in its own cgroup, sends the UDP 53 query),
while a direct query to 1.1.1.1:53 from inside is dropped. And a socket keeps
the cgroup it was created in: move a process into the cgroup before it opens
its sockets (or start it there, as the examples do).
License
GPL-2.0-only, like libbpfilter, which bpyfilter links against. See LICENSE.
Metadata
Release files for bpyfilter 0.8.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bpyfilter-0.8.0.2.tar.gz | 64.2 kB | Without provenance | Details for bpyfilter-0.8.0.2.tar.gz |
Built distributions (wheels)
Total release size: 19.5 MB
Release files / bpyfilter-0.8.0.2.tar.gz
| Download URL | bpyfilter-0.8.0.2.tar.gz |
|---|---|
| Size | 64.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0851fa1624ebfef7f191ddd8ce763a291e8b07a1fd59c0ec83166fb3bab1d548
|
|
BLAKE2b-256 checksum How to use checksums |
5f3a709cb8bb447698cdf7a4c05e7792af05bd0ef7148c22544bc83776898e39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bpyfilter-0.8.0.2-cp315-cp315-manylinux_2_34_x86_64.whl
| Download URL | bpyfilter-0.8.0.2-cp315-cp315-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.15 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
65b6476d169d47bfe2813db329ce0421c1cbe89d2920daba7344509e74498e9d
|
|
BLAKE2b-256 checksum How to use checksums |
0a22a2edda6078beb02c71e1ae4d50350d9bd252f11a86a04f544edf83943705
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bpyfilter-0.8.0.2-cp315-cp315-manylinux_2_34_aarch64.whl
| Download URL | bpyfilter-0.8.0.2-cp315-cp315-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.15 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
1d85425f6de165c6a3725faec4d324b50097150b9efb95b183c321cb15c78d79
|
|
BLAKE2b-256 checksum How to use checksums |
1c26db98f337c0c2304b2ad8189d3ef740bb64a7105814ad8d7583f830508f60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bpyfilter-0.8.0.2-cp314-cp314-manylinux_2_34_x86_64.whl
| Download URL | bpyfilter-0.8.0.2-cp314-cp314-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.14 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
ad34c94dc18141e97cc69dcc56496b24f07249396dd5c9a978bca7d495a11af6
|
|
BLAKE2b-256 checksum How to use checksums |
aadb79f146b03b98b708d997dde275c5cceba10ae192caf7e9b6e09d269e3342
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bpyfilter-0.8.0.2-cp314-cp314-manylinux_2_34_aarch64.whl
| Download URL | bpyfilter-0.8.0.2-cp314-cp314-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.14 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
b60340ba62fcb86ae76ba59e8475639d8266bacda5c5674d6b305cdabeda9422
|
|
BLAKE2b-256 checksum How to use checksums |
5d257c5918e6a80bd274a1fc6a2e3df7607d9c943d2ba22d17533b14831e74fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bpyfilter-0.8.0.2-cp313-cp313-manylinux_2_34_x86_64.whl
| Download URL | bpyfilter-0.8.0.2-cp313-cp313-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.13 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
23dbf8e2a83ef2af95b81be09b95100a8a2aceeee302fd1aa7ad9ce900a84391
|
|
BLAKE2b-256 checksum How to use checksums |
2e449e23b84c4b486c312402681dfc071fd342f9e1b3d255ffe167eda64dd90d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bpyfilter-0.8.0.2-cp313-cp313-manylinux_2_34_aarch64.whl
| Download URL | bpyfilter-0.8.0.2-cp313-cp313-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.13 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
d9c1dcbac6c8faf1bec27fdf51a456fc7f5bf6a9dc25cf7c0dc3c2bb19e1299d
|
|
BLAKE2b-256 checksum How to use checksums |
2230a5fcb7e712db8b3155a11e77e4d46cdc8708b3e863c2a3d10e48ea6f1235
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bpyfilter-0.8.0.2-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | bpyfilter-0.8.0.2-cp312-cp312-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
4b27d219aa356c8b67e22498b6933732000b4c09e1794839285c827ade0efdb7
|
|
BLAKE2b-256 checksum How to use checksums |
8ccc661ca5fc99054b8454fd370ca0f41117079f0f6c6d34795535ff9ca87930
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bpyfilter-0.8.0.2-cp312-cp312-manylinux_2_34_aarch64.whl
| Download URL | bpyfilter-0.8.0.2-cp312-cp312-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.12 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
b15a4b579aac68f14c67db498fddf8606edef80792e94689fee7b5b710471cf4
|
|
BLAKE2b-256 checksum How to use checksums |
d6344bc211084392cc1328421b541e0367040a1a62b4d71a4b319898102dce33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bpyfilter-0.8.0.2-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | bpyfilter-0.8.0.2-cp311-cp311-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
71b058889f64c38884557ea044d998655219baf89cb7272c8dce0f56cfec1589
|
|
BLAKE2b-256 checksum How to use checksums |
58b2ce9ec9a144ee17e60f62bd78166b07a10d9d3a0bf44e6ca03054b319fbe2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bpyfilter-0.8.0.2-cp311-cp311-manylinux_2_34_aarch64.whl
| Download URL | bpyfilter-0.8.0.2-cp311-cp311-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.11 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
41822521df5dc48c5cb3c061e0a7ecc34e73aa85afcf69bf0639cc6bcf601fc4
|
|
BLAKE2b-256 checksum How to use checksums |
f3f244a3dab49e44fe0d4811217e9ae98c687f6a6d541ff4f059c7621e688771
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for bpyfilter 0.8.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.