Total Pageviews

Sunday, 14 July 2019

dnssb


It's fairly easy to serve dns from a nodejs process.
scuttlebot makes it easy to work with a peer-to-peer log store.
So let's mash them together.
What could go wrong?

Installation

Via npm:
npm i -g ssb-dns;
Or via git:
git clone https://github.com/ansuz/dnssb;
cd dnssb;
npm i -g;

Usage

dnssb assumes that you have a scuttlebot instance running. You can find out more about scuttlebot here.
Alternatively, you can run dnssb server as a scuttlebot plugin:
cd dnssb
mkdir -p ~/.ssb/node_modules
ln -rs . ~/.ssb/node_modules/dns
sbot plugins.enable dns
# restart sbot

Publish a record

NOTE:So far the publishing script is hardcoded to reject records which don't end in .ssb.
This was cSmith's idea.
In the future this might be genralized to squat even more TLDs, or to simply be unopinionated about them.
dnssb publish [{prev record key}...] {domain name} [{ttl}] [{dns class}] {record type} {value}
For example:
# publish an ipv4 record for localhost.ssb
dnssb publish localhost.ssb 3600 IN A 127.0.0.1

# publish an ipv6 record for localhost.ssb
dnssb publish localhost.ssb 3600 IN AAAA ::1
To replace some existing dnssb records, pass their ssb message id(s) as the first arguments to the publish command. To append a record to the set of existing records, omit the message ids.
To replace all existing records for a name+type+class, use update:
dnssb update {domain name} [{ttl}] [{dns class}] {record type} {value}

Display all records

I want to use this
You'll only be able to resolve records that your node knows about.
You can print a list of valid records with:
dnssb dump

Fetch a record

First launch the server in one terminal:
dnssb server {port: 53053} {host: 127.0.0.1}
Then query it for a record:
dig @localhost -p 53053 {name} {type}
The records which are available to you are determined by your peering, but assuming you have tried the localhost.ssbexample commands listed above, you should be able to run the following:
# query for ipv4 localhost.ssb
dig @localhost -p 53053 localhost.ssb A

# query for ipv6 localhost.ssb
dig @localhost -p 53053 localhost.ssb AAAA

Questions

See the FAQ

No comments:

Post a Comment