Rust-Bee-NS intercepts a DNS request egressing from the L7 application and
replaces it with up to 4 duplicates sent to the specified uplink resolvers.
The first response to arrive (the 'winner') is passed to the requester and
the latecomers are dropped. The tool also maintains a primitive scoreboard.
This software was written as a 'pet project' by its author during vacation.
It relies exclusively on publicly available technologies and does not seek
any financial gain for the author and does not fulfil a commercial purpose.
It is provided 'as-is', without any express or implied warranty of fitness
for any particular purpose or operability in production-grade environments.
The tool comprises 2 kernel-space C BPF programs (the TC part to intercept
outbound DNS requests and the XDP part to intercept the responses) as well
as the user-space agent in Rust to load and configure the kernel component.
While the BPF programs aim at handling concurrency properly (to manage the
shared state of transactions), this implementation is wittingly unreliable.
The agent reads a configuration file in TOML format to acquire the list of
uplink resolvers as well as the (optional) 'virtual' resolver to which the
L7 application will send its requests to be matched and address-translated.
The remaining parameters are the network interface name and the timeout of
any given DNS transaction 'in flight' in milliseconds, defaulting to 10000.
The tool uses a shared map between the kernel- and user-space to configure
the BPF component and in order to display the current scoreboard on demand.
# (lightly tested on Debian 13.2.0 Xfce LIVE)
sudo apt update
sudo apt install --no-install-recommends --yes cargo clang libelf-dev pkg-config
git clone https://github.com/ivanmtech/rust-bee-ns
cd rust-bee-ns
cargo build
sudo ./target/debug/rust-bee-ns --agent
# (in another terminal window)
sudo apt install --no-install-recommends --yes dnsutils
./example--query.py
# (in yet another terminal window)
watch -n 1 "sudo ./target/debug/rust-bee-ns"
208.67.222.222 : 0
9.9.9.9 : 3
8.8.8.8 : 4
LinkedIn: https://am.linkedin.com/in/ivanmtech
Website: https://ivanmtech.com/
E-mail: ivanmtech@outlook.com