A local namecoin proxy to implement most of the draft spec

Forum rules
Warning !
Avoid using binary softwares from untrusted users.
Prefer compiling it yourself and verify sources.
itsnotlupus
Posts: 12
Joined: Mon Jul 04, 2011 12:55 am

A local namecoin proxy to implement most of the draft spec

Post by itsnotlupus »

NmcSocks: A NameCoin socks proxy (and DNS server.)

NmcSocks is a SOCKS proxy that resolves Namecoin hostnames.

In addition, it can chain its connections into another SOCKS proxy, primarily to allow Tor/I2P interoperability.
It can also be used as a DNS server to resolve .bit domains specifically. See examples below.

It is designed to run side-by-side with namecoind, and its default settings will "just work" out of the box.
It also has a number of command line switches to fine tune its behavior.

get it

Binaries for linux32, osx32 and win32 are available at https://github.com/itsnotlupus/nmcsocks/downloads

The source is also accessible at https://github.com/itsnotlupus/nmcsocks

usage

Code: Select all

Start a NameCoin Socks 5 Proxy.
Usage: ./nmcsocks 

Options:
  --ip, -i       IP Address for the proxy to listen on                                                   [default: "127.0.0.1"]
  --port, -p     Port for the proxy to listen on                                                         [default: 9055]
  --chain, -c    Proxy chain policy (always|never|auto)                                                  [default: "auto"]
  --shost        Socks Proxy host to chain into                                                          [default: "127.0.0.1"]
  --sport        Socks Proxy port to chain into                                                          [default: 9050]
  --private      Refuse to resolve NameCoin domains that would cause a DNS leak. Implies --chain=always
  --tor          Resolve Tor addresses preferably. Implies --private
  --i2p          Resolve I2P addresses preferably. Implies --private
  --dns          Start a DNS server to resolve Namecoin names
  --dnsport      Port for the DNS server to listen on                                                    [default: 9053]
  --dnsip        IP address for the DNS server to listen on                                              [default: "127.0.0.1"]
  --dir, -d      Namecoin configuration directory
  --help, -h     Display this help message
  --version, -v  Show version number and exit
By default, NmcSocks will start listening for SOCKS proxy requests on port 9055.

It will attempt to chain connections into another local socks proxy on port 9050.
If such a proxy doesn't exist, connections are made directly.

To run in strict "Tor" mode, where DNS leaks are prevented and "tor" fields in Namecoin records are given priority, use

Code: Select all

./nmcsocks --tor
To start an experimental embedded DNS server on port 9053 that can resolve .bit domains, use

Code: Select all

./nmcsocks --dns
If you have a bind9 server, you can have it use this with a config like this

Code: Select all

zone "bit" { 
  type forward; 
  forwarders { 127.0.0.1 port 9053;};
};
If you don't have bind9 laying around, you can use dig to test it, with

Code: Select all

dig gg.bit @127.0.0.1 -p 9053
To see all the settings, try

Code: Select all

./nmcsocks -h
dependencies:

This proxy requires namecoin to be installed, configured and running.
You can get namecoin from https://github.com/vinced/namecoin
Optionally, you can get precompiled namecoin binaries from http://dot-bit.org/

If you are using the source version, you will also need: todo
  • ipv6 support
  • support for the whole spec
changelog

Code: Select all

v0.1: initial version
v0.2: better draft spec support (delegate/import/alias stuff), infinite loop mitigation
v0.3: embedded DNS server to resolve .bit domains
v0.4: better DNS server support, various bug fixes
*edit: Pasted the project's README.md, to keep the top post up-to-date.
Last edited by itsnotlupus on Sat Jul 16, 2011 3:28 am, edited 1 time in total.

itsnotlupus
Posts: 12
Joined: Mon Jul 04, 2011 12:55 am

Re: A local namecoin proxy to implement most of the draft sp

Post by itsnotlupus »

Oh hey there, itsnotlupus, you good-looking fellow you!

Erm.. yeah, ok. So the dns library NmcSocks is using to be able to process "dns"/"ns" fields happens to contain a mostly complete implementation of the DNS protocol, so the following tweak was a low hanging fruit:

NmcSocks can now be used as a DNS server. Use the --dns command-line switch to enable.

It's experimental, the usual euphemism for "OMG it's horribly broken", but don't let that deter you from gasping at its awesomeness.

It should be able to answer most type "A" requests in a way that's not entirely unusable.
It can be used it as a zone forwarder for .bit (see README.md)

Since it uses the same resolver as the socks proxy proper, you still get the same level of support for the namecoin spec.

Next, I'll be reading up on this "DNS" protocol I hear so much about, and banging on NmcSocks until it starts to behave like a real DNS server.

moa
Posts: 255
Joined: Mon May 23, 2011 6:13 am

Re: A local namecoin proxy to implement most of the draft sp

Post by moa »

itsnotlupus: so if we wanted to point the FoxyProxy add-on of Firefox at a local instance of your nmcsocks proxy

Is the port 9050?

(and does that work with a Tor instance also on 9050?)

I'm assuming the IP/Host will be 127.0.0.1 (127.0.0.1) ...

thnx.

itsnotlupus
Posts: 12
Joined: Mon Jul 04, 2011 12:55 am

Re: A local namecoin proxy to implement most of the draft sp

Post by itsnotlupus »

It's all configurable by command line switches, but the defaults are:
  • The socks proxy listens on port 9055 (same as ncproxy), bound to IP 127.0.0.1
  • The DNS server listens on port 9053
  • If another socks proxy is listening on port 9050 when NmcSocks starts, it will be used as a next hop.

itsnotlupus
Posts: 12
Joined: Mon Jul 04, 2011 12:55 am

Re: A local namecoin proxy to implement most of the draft sp

Post by itsnotlupus »

V0.4 is out. The resolver has been updated to work better with the DNS server, and the spec is better implemented.

There's now a tester.js file that runs a bunch of checks against a test namecoin DB located in name_scan.js, which should help avoid regressions.

So, don't be shy folks. Try it out and report bugs.

itsnotlupus
Posts: 12
Joined: Mon Jul 04, 2011 12:55 am

Re: A local namecoin proxy to implement most of the draft sp

Post by itsnotlupus »

Precompiled binaries for NmcSocks are now available for linux, os X and windows. See the first post for details and download location.

Also, I'm done replying to myself. I'll update the top post on this thread with changes as they happen.

JohnDoe
Posts: 94
Joined: Sat May 28, 2011 8:46 pm
os: linux

Re: A local namecoin proxy to implement most of the draft sp

Post by JohnDoe »

itsnotlupus wrote:So, don't be shy folks. Try it out and report bugs.
itsnotlupus wrote:Also, I'm done replying to myself. I'll update the top post on this thread with changes as they happen.
Don't think your efforts are not appreciated, they are. Personally I just haven't tried this out because it looks a little too advanced for me.

nodemaster
Posts: 172
Joined: Wed Jun 15, 2011 12:46 pm
os: linux

Re: A local namecoin proxy to implement most of the draft sp

Post by nodemaster »

JohnDoe wrote:
itsnotlupus wrote:So, don't be shy folks. Try it out and report bugs.
itsnotlupus wrote:Also, I'm done replying to myself. I'll update the top post on this thread with changes as they happen.
Don't think your efforts are not appreciated, they are. Personally I just haven't tried this out because it looks a little too advanced for me.
No definitely not! If I could clone myself I would have tested it already ;) But ATM im struggling with merged mining and preparing an alpha version for merged masterpool. But I definitely will test it! Promised! It is a shame I didn't find the time to test it for now. Unfortunately my family wants to see me too. If I could only live without sleep :D
Access .bit domains with Firefox in 4 easy steps: https://masterpool.eu/proxy
MasterPool Namecoin Mining Pool

khal
Site Admin
Posts: 708
Joined: Mon May 09, 2011 5:09 pm
os: linux

Re: A local namecoin proxy to implement most of the draft sp

Post by khal »

Is there a minimum required version for :
- nodejs (mine : 0.4.9-1)
- npm (0.2.19-1)

I tried to install optimist & binary without success, i then tried to install a recent npm with "curl http://npmjs.org/install.sh | sh ", no more success. Should i use a more recent nodejs too ? (debian testing inside)
JohnDoe wrote:Don't think your efforts are not appreciated, they are. Personally I just haven't tried this out because it looks a little too advanced for me.
Same, except my reason is "not enough time in one day :p". Go on !
NamecoinID: id/khal
GPG : 9CC5B92E965D69A9
NMC: N1KHAL5C1CRzy58NdJwp1tbLze3XrkFxx9
BTC: 1KHAL8bUjnkMRMg9yd2dNrYnJgZGH8Nj6T

Register Namecoin domains with BTC
My bitcoin Identity - Send messages to bitcoin users
Charity Ad - Make a good deed without paying a cent

itsnotlupus
Posts: 12
Joined: Mon Jul 04, 2011 12:55 am

Re: A local namecoin proxy to implement most of the draft sp

Post by itsnotlupus »

khal wrote:Is there a minimum required version for :
- nodejs (mine : 0.4.9-1)
- npm (0.2.19-1)

I tried to install optimist & binary without success, i then tried to install a recent npm with "curl http://npmjs.org/install.sh | sh ", no more success. Should i use a more recent nodejs too ? (debian testing inside)
Your node version is fine, but the npm version won't do.
You'll need to upgrade npm (current version is 1.0.15).

If you were on a box that had never seen npm, the curl | sh thingy would probably work fine, but it seems to have a hard time upgrading from older versions that way.

Two possibilities: change "|sh" into "|sudo sh" in the npm one-liner. Spooky, although chances are that's how you installed npm 0.2.19 to start with.
The alternative is to grab the npm source from git and build it, something like

Code: Select all

git clone http://github.com/isaacs/npm.git
cd npm
sudo make install
Beyond that, I'm not actually too worried about NmcSocks usage. Sorry if I came across a bit strong.
I do wish I'd have at least one or two guinea pigs to get some feedback, but I intent to keep going regardless.
The binary builds hopefully lowered the barrier to entry a bit, and I have a couple more ideas on the roadmap that should help as well.

Post Reply