Hello,
I was thinking about the security implications a DNS server brings to the Nu infrastructure.
My thought process resulted in me pushing a PHP script called “cf-php” to the https://github.com/bananenwilly/nubits-seeder master branch.
This tutorial is also available on https://docs.nubits.com/create-nu-dns-seed/
What does cf-php do?
It reads a file called dnsseed.dump in the nubits-seeder root directory, which is continuously created when nubits-seeder is crawling for nodes. It will generate a IP-table from the dnseed.dump file and pushes this table to a Cloudflare (CF) enabled domain of your choice over the Cloudflare API.
It will generate a DNS zone file like this
;; ANSWER SECTION:
nuseed.coinerella.com. 299 IN A 212.129.19.120
nuseed.coinerella.com. 299 IN A 217.23.13.138
nuseed.coinerella.com. 299 IN A 162.243.108.181
nuseed.coinerella.com. 299 IN A 188.226.223.94
nuseed.coinerella.com. 299 IN A 85.214.145.24
nuseed.coinerella.com. 299 IN A 104.131.41.17
nuseed.coinerella.com. 299 IN A 176.9.65.41
nuseed.coinerella.com. 299 IN A 176.9.113.75
nuseed.coinerella.com. 299 IN A 73.7.110.25
nuseed.coinerella.com. 299 IN A 212.114.48.31
without the need to run your own DNS server!
Requirements
- CloudFlare.com account
- Domain (e. g. praisejordanleeourlordandsaviour.com) configured to use CF’s DNS servers
- small server (RPi could easily handle this)
- php5-cli, php5-curl, nubits-seeder repo
Let’s get started
-
Get your CF API Key (My Settings -> Account -> API Key -> View API Key)
-
Download and start nubits-seeder
git clone https://github.com/bananenwilly/nubits-seeder
cd nubits-seeder
make
chmod +x dnsseed
./dnsseed
or
screen -dmS nuseed sh -c "./dnsseed"
to have a screen session, detach the screen session with CTRL+A+D -
Edit cf-php/cf.php file
open cf.php in an editor of your choice
and fill in$domain =“domain.com”;
$name = “nuseed”; //subdomain e.g. name.domain.com
$number_of_records = 10; //maximum n A records with $name…
$user = “emailofcloudflareaccount”; //user name
$key = “yourapikey”; //key for cloudflare api found in account settings
$seed_dump = “/path/to/dnsseed.dump”; //absolute path to dnsseed.dump in the nubits-seeder root directory
accordingly. (The number_of_records in the table displayed above is “10” and I think that’s a good number.)
4. Have a cronjob run cf-php regularly
crontab -e
* * * * * php ~/nubits-seeder/cf-php/cf.php
That should be it. You now have your own Nu DNS seed.
Thanks to @MatthewLM and vexxhost