-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tidy code up and make the project more user friendly overall
- Loading branch information
Showing
16 changed files
with
325 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,48 @@ | ||
# Simple DNS Server | ||
# 🌎 Simple DNS server | ||
A tiny DNS server that is capable of serving records configured in a MySQL table, or configured statically in a JSON file | ||
|
||
## Installation | ||
1. Create a file with the path `/etc/systemd/system/argondns.service` and with the following content: | ||
## 🧐 Configuration documentation | ||
|
||
- `mode`: Can be either `db` if your records are stored in a MySQL database, or `static_records` if your records are static and stored in the configuration JSON file. | ||
|
||
- `db`: The MySQL server & database credentials. This works only if `mode` is set to `db` | ||
|
||
- `listener`: The listening/bind settings for the DNS server (usually has to be kept binding on port 53 to be able to accept DNS requests). | ||
|
||
- `process_unstored_dns_queries`: Should the DNS server also accept queries of records that are not stored in your database table/static records configuration? Enable this if yes. | ||
|
||
- `static_records`: Configure your static records here, one per JSON array. This works only if `mode` is set to `static_records` | ||
|
||
## 🛠️ Installation as a service | ||
|
||
1. Store your configuration file at `/etc/simpledns/config.json` | ||
You can copy the example configuration file and change it to serve your needs. | ||
2. If running Simple DNS server in the `db` mode, use this database structure for your records table: https://github.com/oddmario/simple-dns-server/blob/main/db_structure.sql | ||
3. Place the binary file of Simple DNS server at `/usr/local/bin` (e.g. `/usr/local/bin/simpledns`) | ||
4. Make the binary file executable: `chmod u+x /usr/local/bin/simpledns` | ||
5. Create a systemd service for the application. This can be done by creating /etc/systemd/system/simpledns.service to have this content: | ||
``` | ||
[Unit] | ||
Description=ArgonDNS | ||
Description=SimpleDNSserver | ||
[Service] | ||
User=root | ||
WorkingDirectory=/root/argondns | ||
WorkingDirectory=/usr/local/bin | ||
LimitNOFILE=2097152 | ||
TasksMax=infinity | ||
ExecStart=/root/argondns/simpledns_linux_amd64 | ||
ExecStart=/usr/local/bin/simpledns /etc/simpledns/config.json | ||
Restart=on-failure | ||
StartLimitInterval=180 | ||
StartLimitBurst=30 | ||
RestartSec=5s | ||
[Install] | ||
WantedBy=multi-user.target | ||
``` | ||
|
||
2. Put the `simpledns_linux_amd64` executable file at a directory with path `/root/argondns/` - so the final path of the executable will be `/root/argondns/simpledns_linux_amd64` | ||
|
||
3. Run `chmod -R 777 /root/argondns/simpledns_linux_amd64` | ||
|
||
4. Place the `config.json` file found in this repository at `/root/argondns` along with the `simpledns_linux_amd64` executable file | ||
|
||
5. Run `systemctl enable argondns` | ||
``` | ||
6. Port 53 (the DNS server port) is usually in use by default. To solve this, follow https://unix.stackexchange.com/a/676977/405697 then run `systemctl restart systemd-resolved` | ||
|
||
7. Make sure that there are no other DNS servers (such as bind9) are running, then run `systemctl start argondns` to start our DNS server :) | ||
7. Make sure that there are no other DNS servers (such as bind9) are running | ||
8. Enable the Simple DNS server service on startup & start it now: | ||
``` | ||
systemctl enable --now simpledns.service | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package constants | ||
|
||
var ConfigFilePath string = "" | ||
var Version string = "v1.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.