[GUIDE] Running your own SteemDNS server

in #namecoin8 years ago

Running your own SteemDNS server

Check out the original post about SteemDNS here!

SteemDNS is an open standard created by myself. It works similarly to Namecoin. Using the json_metadata of a user, we can iterate through all users on Steemit and add them to a database. Once you're synchronized, you can then run the live websocket feed instead, which will update a user usually within 60 seconds of them changing their metadata.

It's entirely possible to do this with any DNS server, however I personally use PowerDNS as it can read from a database in real-time, allowing me to update the DNS configuration without having to generate ZONE files or building plugins.

If you need a server host, I strongly recommend DigitalOcean ($10 free credit for signing up), or if you desperately want to pay with Steem Dollars, VertVPS accepts Steem.

DISCLAIMER: This article is aimed at people who have at least a small amount of server experience.

It's not recommended to operate a server unless you know what you're doing, as you could be attacked by failing to secure it. If you're installing it for local usage, then this isn't as much of a problem.

Step 1 - Installing PowerDNS

I'm going to assume you're using Ubuntu 16.04 (Xenial). If you're using any other distribution, or you're using an older version of ubuntu, the instructions may differ.

Obtain PowerDNS 4.0.x from the repository site at https://repo.powerdns.com/

If you're using Ubuntu 16.04 the instructions are as follows:

sudo su
echo "deb http://repo.powerdns.com/ubuntu xenial-rec-40 main" > /etc/apt/preferences.d/pdns.list
echo -e "Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 600" > /etc/apt/preferences.d/pdns
curl https://repo.powerdns.com/FD380FBB-pub.asc | apt-key add -
apt update && apt install pdns-recursor pdns-backend-sqlite3 sqlite3

Edit /etc/powerdns/pdns.conf and add the following under where the existing launch= is (replace it).

launch=gsqlite3
gsqlite3-database=/var/spool/powerdns/steem.sqlite

You may want to add a recursive resolver (this allows you to resolve non-steem domains like google.com):

recursor=8.8.4.4

Other items in the configuration are completely optional, and have rather sensible defaults, so don't worry about those unless you intend for an advanced configuration.

Don't worry about restarting the PowerDNS server just yet, we have to set up the scanner first!

Step 2 - Installing SteemDNS loader script

The source code is in Python, and is available at Github

As a normal user (or as root if you don't care):

cd ~
git clone https://github.com/Someguy123/steemdns.git
cd steemdns

You'll need python3 installed, and python3-pip

sudo apt install python3 python3-pip

Run the following command to install dependencies:

pip3 install -r requirements.txt

Create a DB using

sudo touch /var/spool/powerdns/steem.sqlite
sudo sqlite3 /var/spool/powerdns/steem.sqlite < schema.sql
# to allow access by different users, i.e. the one running the watcher
sudo chmod 777 /var/spool/powerdns/steem.sqlite

You'll need to configure the nameserver domain (which is a domain you own that points at your server), and SOA in the python file:

NAMESERVERS = ['ns1.example.com']
SOA = 'ns1.example.com dns-admin.example.com 0'

If you're running this locally, and aren't going to be publishing your DNS, you can set all domains to localhost. Leave the '0' at the end of the SOA. That tells PowerDNS to automatically detect when a domain changes and adjust the value automatically.

Now re-scan all users (may take a long time!)

python3 cmd.py rescan_users

Once it's re-scanned, you can now run the watcher command. Run this in screen to prevent it from closing when you disconnect.

screen -S steemwatchchain python3 cmd.py watch_chain

Remember to restart PowerDNS now that we have the database working nicely:

sudo service pdns restart

You can inspect the sqlite database by running sqlite3 /var/spool/powerdns/steem.sqlite. To verify if your DNS is working, just run on the server:

dig a someguy123.steem @127.0.0.1

If this is public, remember to verify the outside can see it too!

At this point you should be good to go. Keep an eye on the steem watch script in-case it crashes (though it should be reliable), you may want to test it by publishing your own DNS records to your json_metadata.

Follow me to keep up to date on my development work for STEEM. If you like what I'm doing, vote for someguy123 to be a witness

Sort:  

Doing god's work my man! steemitqa.steem is coming soon ;)

Thank you, I will be trying this out once I have finished my web project, if ever.. You talked about security, perhaps you could do a post about it at some point as this would be my first public hosting.

Interesting
What is the incentive for running a Steem DNS server?

If SteemDNS became popular, I'm sure you could make money from just posting about it.

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 58116.56
ETH 2361.49
USDT 1.00
SBD 2.42