# DNS filesystem



I've reworked my older 
[DNS filesystem](/2007/december/22/a_dns_filesystem/index.html)
Perl script to make something nicer. It's still not perfect, but works
much better. 

You can now `cat` files for instance. The filesizes *are* something that 
should also be fixed, if set them to 512 bytes.

From a DNS standpoint some other things can be improved. Right now everything
is shown from a zone (everything that can be discovered that is), however this
also includes glue...

To get this running you'll need FUSE (should be installed if you run
Linux) and Perl with the Perl Fuse module installed. I'm running Ubuntu
Gutsy and everything could be installed very easily.

Furthermore you'll need two files, a
[Fdns.pm](/downloads/Fdns.pm) module and a
[fdns.pl](/downloads/fdns.pl) Perl script. Place both in a directory
and type:

    mkdir theworld
    ./fdns theworld

Now the world of DNS is mounted on `theworld`. Now you can do the
following:

    $ cd theworld
    $ ls
    # this might take a WHILE!!!!
    ...
    eu/                  ns2.undp.org             utama.bolnet.bo
    eur1.nipr.mil        ns2.univie.ac.at         uucp-gw-1.pa.dec.com
    eur2.nipr.mil        ns2.uz                   uucp-gw-2.pa.dec.com
    euro-ns1.cw.net      ns2.yemen.net.ye         uy/
    euro-ns2.cw.net      ns2.zamnet.zm            uz/
    euro-ns3.cw.net      ns3.aalnet.net           va/
    euterpe.william.org  ns3.arnes.eu             vc/
    f5.nstld.com         ns3-auth.sprintlink.net  ve/
    ...

This is part of the root zone, you see the `eu` delegation, so that is a
directory. There is also a `nl` directory in there. Let go there:

    $ cd nl
    $ ls
    @

So `nl` doesn't do `axfr` and all that could be discovered is contained
in the file `@`. Lets check that one out:
    
    $ cat @
    nl.  5988  IN SOA ns.domain-registry.nl. postmaster.domain-registry.nl. (
                      2008030205      ; Serial
                      7200    ; Refresh
                      900     ; Retry
                      2419200 ; Expire
                      900 )   ; Minimum TTL
    nl.     85188   IN      NS      ns3.nic.nl.
    nl.     85188   IN      NS      ns4.nic.nl.
    nl.     85188   IN      NS      ns-ext.isc.org.
    nl.     85188   IN      NS      ns-nl.nic.fr.
    nl.     85188   IN      NS      ns.domain-registry.nl.
    nl.     85188   IN      NS      ns2.nic.nl.
    nl.     85188   IN      NS      nl1.dnsnode.net.

This is the SOA record for `nl`. Lets see if there any funny
delegations:

    $ cd fghjfhfjdhdj
    cd: no such file or directory: fghjfhfjdhdj

Nope, that one does not exists, maybe there are funny names?

    $ cat fjhfdjfd  
    cat: fjhfdjfd: No such file or directory

Nope. Okay, why not descend into some directory I *know* should be there.

    $ cd miek
    $ ls
    @  a  localhost  www
    $ cat a
    a.miek.nl.      3600    IN      A       192.168.1.2
    $ cat www
    www.miek.nl.    3600    IN      CNAME   a.miek.nl.

So every file has the name of a label, and the contents are RRs who have
that label. Esp. funny are zones with wildcards `*`, as you can `cat`
any name you wish.

# color output of `ls`
It's wise to disable that when you are roaming around in this
filesystem. As every discovered name is `statted`, which means
another DNS lookup.

# Feedback

Comments and patches are welcome.

