Skip to content

Commit

Permalink
chore: add resolver to Cargo.toml and update README.md and justfile
Browse files Browse the repository at this point in the history
  • Loading branch information
wqld committed Apr 28, 2024
1 parent 89818cf commit e15fae1
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[workspace]
members = ["xtask", "app", "common"]
resolver = "2"
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,56 @@
# dnstop
An efficient DNS monitoring tool based on eBPF

## Introduction

`dnstop` is attached to a specific network interface and simply outputs the results of DNS queries and responses that are forwarded to it in the form shown below.

```sh
REQ: ID=40797 SRC=192.168.64.6:54110 DST=192.168.64.1:53 DNS_NAME=www.google.com DNS_TYPE=A DNS_CLASS=IN
REQ: ID=39114 SRC=192.168.64.6:40193 DST=192.168.64.1:53 DNS_NAME=www.google.com DNS_TYPE=AAAA DNS_CLASS=IN
OK: ID=40797 DNS_NAME=www.google.com DNS_TYPE=A DNS_CLASS=IN
OK: ID=39114 DNS_NAME=www.google.com DNS_TYPE=AAAA DNS_CLASS=IN
REQ: ID=25132 SRC=192.168.64.6:44543 DST=192.168.64.1:53 DNS_NAME=www.woogole.com DNS_TYPE=A DNS_CLASS=IN
REQ: ID=55755 SRC=192.168.64.6:39533 DST=192.168.64.1:53 DNS_NAME=www.woogole.com DNS_TYPE=AAAA DNS_CLASS=IN
NXDOMAIN: ID=25132 DNS_NAME=www.woogole.com DNS_TYPE=A DNS_CLASS=IN
NXDOMAIN: ID=55755 DNS_NAME=www.woogole.com DNS_TYPE=AAAA DNS_CLASS=IN
REQ: ID=42662 SRC=192.168.64.6:34430 DST=192.168.64.1:53 DNS_NAME=www.woogole.com DNS_TYPE=A DNS_CLASS=IN
REQ: ID=42543 SRC=192.168.64.6:48084 DST=192.168.64.1:53 DNS_NAME=www.woogole.com DNS_TYPE=AAAA DNS_CLASS=IN
NXDOMAIN: ID=42662 DNS_NAME=www.woogole.com DNS_TYPE=A DNS_CLASS=IN
NXDOMAIN: ID=42543 DNS_NAME=www.woogole.com DNS_TYPE=AAAA DNS_CLASS=IN
```

## Prerequisites

- Rust
- Docker
- Justfile

## How to use

### 1. clone the repository

```bash
git clone https://github.com/wqld/dnstop.git
```

### 2. build the project

```bash
just build-image
```

You can specify the target architecture as follows. (The default is aarch64).

```bash
just build-image --arch x86_64
```

### 3. run the container

It requires privileged privileges because it needs to run the eBPF program.
Specify the network interface to watch for DNS packets with the `--iface` option.

```bash
docker run --privileged --rm --network host dnstop:manually --iface enp0s1
```
6 changes: 4 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
arch := "aarch64"

build-image:
cargo xtask build-ebpf
cargo build --target aarch64-unknown-linux-musl
docker build --build-arg ARCH=aarch64 -t dnstop:test .
cargo build --target {{ arch }}-unknown-linux-musl
docker build --build-arg ARCH={{ arch }} -t dnstop:manually .

0 comments on commit e15fae1

Please sign in to comment.