summaryrefslogtreecommitdiff
path: root/readme.md
blob: 2c9b3b04ec6a646cfe4a22fed919bc52ae9c859f (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Wrapper

A simple and lightweight dns server written in C

## How to

Wrapper by default runs on port 53 udp and tcp, which is the default port for DNS. If you wish to change this variable, set the `PORT` environment variable is set to a different port number.

To set custom records, wrapper reads confguration from `/etc/wrapper.conf`, and if that doesnt exist, `./config`.

The config file format is a question on its own line, then followed by records on their own line. To seperate questions/records from eachother, place a extra empty new line between them. For example...

```
IN A google.com
IN A 300 12.34.56.78 

IN TXT joe
IN TXT 60 biden
``` 

### Question

Now to break this down piece by piece, the question is made up of a class, record type, and domain. Domain is self explanitory, but for the other two:

#### Class

The valid classes are `IN` (Internet), `CH` (Chaosnet), and `HS` (Hesiod). For most purposes your going to be using IN.

#### Record type

The current supported record types are `A`, `NS`, `CNAME`, `SOA`, `PTR`, `MX`, `TXT`, `AAAA`, `SRV`, and `CAA`. 

### Answer

Answers are very similar to questions, they have a class, record type, but also have a Time to Live (TTL), and its record data. TTL is just the amount of seconds other DNS servers should cache the value, but for record data, it's formatted as such:

#### Record Data

- `A` ipv4 (0.0.0.0)
- `NS`, `CNAME`, `PTR` domain (google.com)
- `SOA` mname, nname serial refresh retry expire minimum (ns1.google.com. dns-admin.google.com. 523655285 900 900 1800 60)
- `MX`: priority domain (10 smtp.google.com)
- `TXT`: text (Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua)
- `AAAA` ipv6 (2607:f8b0:4006:080c:0000:0000:0000:200e::)
- `SRV` priority weight port domain (10 10 10 example.com)
- `CAA` flags tag value (0 issue "pki.goog")

Wrapper also has a few joke/meme records for fun. Note these should never acutaly be used for general use, but they are funny.

- `AR`, `AAAAR`
- `CMD` command (neofetch)

`AR` and `AAAAR` have no record data since they generate ipv4's and ipv6's respectively, and turn into `A` and `AAAA` upon response to sender

`CMD` runs the command supplied on the host system and returns the std output as a `TXT` record

## License

This project is Licensed under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html)

## Compilation

Wrapper only runs on Linux systems that are Posix 2008 compliant

Make sure to have `gcc` and `make` installed, and then run

```shell
$ make # compiles the program
$ sudo make install # installs the binary
```

If you are running openrc, there is a premade service file so you can run

```shell
$ sudo make install-openrc # installs the binary and service file 
```

If you wish to remove the program, you can run

```shell
$ sudo make uninstall # removes the binary
```

Or again if your running openrc

```shell
$ sudo make uninstall-openrc # removes the binary and service file
```