Code Monkey home page Code Monkey logo

wyrd's Introduction

Wyrd (deprecated)

Automatic, NodeInfo based DNS implementation for Yggdrasil

This project is deprecated in favor of blockchain based DNS - ALFIS, the crawler is stopped forever (no more new domains).

Now working servers are here:

Server IP Location
301:2522::53 Praha, Czechia
301:2923::53 Bratislava, Slovakia
300:4523::53 Duesseldorf, Germany
303:8b1a::53 Saint Petersburg, Russia

They will be migrated to ALFIS DNS soon.

Introduction

If you use Yggdrasil network, then you've thought about new DNS. Not only to convert names to IPs, but use some additional records, that you can't add to hosts file, like CNAME, MX or TXT. And the system should be reliable, if someone got one domain, it must maintain it's owner, and not give it to some second guy. There are some "crypto-dns" systems, like EmerDNS and alike, but they need you to have some gigabytes of HDD-space to store that blockchain. We cannot afford this in mobile phones and tablets. Then, we need to use some ordinary caching server to provide those DNS-records, to set them in mobile and use like ordinary DNS.

What is Wyrd?

Wyrd is a crawler script for BIND DNS-server, to collect and validate DNS-records from NodeInfo data from all nodes. It gets data - domains, DNS-records, checks for "owner", and stores them in MySQL database (one simple table), then gets all records from that table and feeds it to BIND server.

How it works?

  1. Checks all nodes (like in map.ygg crawler) for DNS info.
  2. Iterates over domains found, and checks their validity, zone and ownership. If the domain is new, it is added, if the owner (IPv6 of the node) is the same, it updates DNS-records, if IPv6 != owner, it just ignores the domain.
  3. When the domain is added, the node (represented by IPv6) is saved as an owner, and datetime (seen_first) is saved along it.
  4. If you need to change the owner to some other node, you set owner property to the new IPv6, and it will be changed in DB.
  5. If you want to use some other node as a "backup owner" in case first node dies, you can set fallback property, and that second node will become a new owner when the first will be gone for some time (not yet implemented).
  6. In future version every domain will need to be "bought" by PoW. Simple mining of nonce, that will eliminate squatting, or make it hard enough.

How to add your domain to those servers? Easy! Just add needed DNS-records to your zoneinfo like this:

One domain

Althought it has a lot of different brackets, but it is simple

NodeInfo: {
  dns: {
    domains: [
      {
        domain: example.ygg
        ip: 200:1111:2222:3333:4444:5555:6666:7777
      }
    ]
  }
}

One domain with subdomains

If you use the records array with type and/or ttl, then you need to change ip to data, because there may be some CNAME also, not only IP.

NodeInfo: {
  dns: {
    domains: [
      {
        domain: example.ygg
        records: [
            {
                data: 200:1111:2222:3333:4444:5555:6666:7777
                name: @
                ttl: 300
                type: AAAA
            }
            {
                data: 200:1111:2222:3333:4444:5555:6666:7778
                name: ftp
                ttl: 600
                type: AAAA
            }
        ]
      }
    ]
  }
}

All other variants with explanation

"nodeinfo": {
    "dns": {
      // You may add some contact, just how WHOIS does
      "contact": [email protected]
      "domains": [
        {
          "domain": "test.ygg", // Your desired domain
          "records": [
            {
              // The IP address to resolve to, it may be different from your node's address
              "data": "200:149b::b722:fe09:d31:84a4",
              "name": "*", // You can omit it, default "@" will be used
              "ttl": 300, // You can omit it too, default 3600 (one hour) will be used
              "type": "AAAA" // And this one can be omited, AAAA will be used as default
            }
          ],
          // Tags will be used for ranking and searching in the future, stay tuned ;)
          "tags": [
            "test",
            "dns",
            "experiment"
          ]
        },
        {
          // You can try some real domains, but they will be ignored :)
          "domain": "google.com",
          // Instead of "records" array you can just enter an IP address,
          // type and TTL will be default - AAAA & 3600
          "ip": "200:149b::b722:fe09:d31:84a4"
        }
      ]
    },
    "location": "Somewhere on Earth", // The common fields
    "name": "My meganode!",
  }

Currently only this TLD is supported: .ygg. If the community will need some more, we can add some.

Installation (if you want to run your instance)

  1. You need to have installed bind9, python3 and python3-mysqldb. For example: apt-get install bind9 python3 python3-mysqldb
  2. Clone this repository
  3. Create a database wyrd, user wyrd and give this user all privileges for this DB
  4. Import DB dump from ./db
  5. Copy all contains in bind directory to /etc/bind/
  6. Change a password in ./src/config.py
  7. Check your yggdrasil adminlisten block. It should be tcp://localhost:9001
  8. Run it by python3 ./src/crawler.py or ./run.sh & / disown %1
  9. It would be great to add it to the cron, like for every 15 minutes

Synchronization

You can ask - what if I run it on my server, and get some domain from already ignored squatter, not from legitimate owner? Okay, for that I have a solution, but not implemented yet. As I have a first Wyrd server, I will push DB states after every modification to this repository, and anyone who is starting his server would not start from a scratch. His server would be populated with all current records in a glance. And, what is more important - all the changes in domains and records could be monitored easily.

wyrd's People

Contributors

nikatik avatar revertron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

wyrd's Issues

Chrome не резолвит домены

Добрый день, хром не резолвит домены, хотя остальные браузеры это делают замечательно. Secure DNS выключен.

Windows 7 SP1 x64 / Chrome 89.0.4389.82 x64

image

Сломалась зона

В файле зоны:

@ // You can omit it, default "@" will be used.giantrocks       300     IN      AAAA    200:ae7b:e9dc:e737:e340:4e3:e983:4e24
time.giantrocks 300     IN      AAAA    200:ae7b:e9dc:e737:e340:4e3:e983:4e24

В логах dns:

Mar 18 16:08:50 resolver named[82]: db.ygg.records:50: unknown RR type '//'
Mar 18 16:08:50 resolver named[82]: zone ygg/IN/yggdrasil: loading from master file db.ygg failed: unknown class/type
Mar 18 16:08:50 resolver named[82]: zone ygg/IN/yggdrasil: not loaded due to errors.
Mar 18 16:08:50 resolver named[82]: managed-keys-zone/yggdrasil: Unable to fetch DNSKEY set '.': ncache nxrrset
Mar 18 16:08:51 resolver named[82]: zone 255.in-addr.arpa/IN/local: loading from master file empty.zone failed: file not found
Mar 18 16:08:51 resolver named[82]: zone 255.in-addr.arpa/IN/local: not loaded due to errors.

Исправьте похалуйста

crawler.py not working

You say:

Run:
python3 src/crawler.py

However MySQLdb is not compatible with Python 3.

So you get the error:

python3 src/crawler.py
Traceback (most recent call last):
  File "src/crawler.py", line 8, in <module>
    import MySQLdb
ImportError: No module named 'MySQLdb'

I changed mysqldb to "mysqlclient", etc, and still doesn't work.

Then went back to the original script and tried:

python2 src/crawler.py

Used python2 instead of 3 to see if it'd work with mysqldb, and that fails too:

python2 src/crawler.py
Traceback (most recent call last):
  File "src/crawler.py", line 19, in <module>
    from queue import Queue
ImportError: No module named queue

Though that time it made it further in the script before giving errors.

I'll try again on a different machine later but I have all required dependencies and installed many more in an effort to solve this myself.

Couple errors when running.

Hello, when running the script via 'python3 src/crawler.py' I encounter the error(s) below. I believe I have met all dependency requirements. I can confirm that the database and user has been made with the proper permissions and that the contents of /wyrd/bind has been moved to /etc/bind/ as per instructions.

    Traceback (most recent call last):
      File "src/crawler.py", line 92, in doRequest
        ygg.connect(host_port)
    ConnectionRefusedError: [Errno 111] Connection refused
    selfInfo: None 
     
    Traceback (most recent call last):
      File "src/crawler.py", line 451, in <module>
        crawl()
      File "src/crawler.py", line 395, in crawl
        for k,v in selfInfo['response']['self'].items():
    TypeError: 'NoneType' object is not subscriptable

Сломался DNS

Короче, вот:

Jul 07 03:03:29 resolver named[78]: reloading zones succeeded
Jul 07 03:03:29 resolver named[78]: dns_rdata_fromtext: db.ygg.records:46: near 'mx.mail': bad IPv6 address
Jul 07 03:03:29 resolver named[78]: zone ygg/IN/yggdrasil: loading from master file db.ygg failed: bad IPv6 address
Jul 07 03:03:29 resolver named[78]: zone ygg/IN/yggdrasil: not loaded due to errors.
Jul 07 03:03:29 resolver named[78]: zone 255.in-addr.arpa/IN/local: loading from master file empty.zone failed: file not found
Jul 07 03:03:29 resolver named[78]: zone 255.in-addr.arpa/IN/local: not loaded due to errors.
Jul 07 03:03:29 resolver named[78]: zone 0.in-addr.arpa/IN/local: loading from master file empty.zone failed: file not found
Jul 07 03:03:29 resolver named[78]: zone 0.in-addr.arpa/IN/local: not loaded due to errors.
Jul 07 03:03:29 resolver named[78]: all zones loaded
Jul 07 03:03:29 resolver named[78]: running

В файле зоны:

46 mail 600     IN      AAAA    mx.mail

Как могла попасть неправельная запись?

Автоматическая поддержка домена .ygg в Линуксе

Можно ли указать в NetworkManager предоставляемые вами IP-адреса рабочих серверов так, чтобы операционная система стала автоматически преобразовывать домен .ygg? Подключение к Интернету производится через IPv4.

Альтернативные варианты БД (SQLite)

Было бы неплохо, если бы была возможность использовать альтернативные MySQL/MariaDB базы данных, в частности SQLite, поскольку тот не требует отдельного запущенного жирного демона, что может быть проблематично на роутере или одноплатнике.

Вопрос

Предположим, что есть домен pupok.ygg, который желают иметь Вася и Петя. Оба в приблизительно одно время (допустим, с разницей в 2 минуты) прописывают себе в конфиг данный адрес.

Исходя из предположения о том, что crawler'ы индексируют сеть в случайном порядке (поправьте, если не прав), информация в сети о владельце доменаразделится на два лагеря.

Как предполагается бороться с данной проблемой?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.