90 lines
2.9 KiB
Markdown
90 lines
2.9 KiB
Markdown
|
|
||
|
# 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
|
||
|
```
|