Showing posts with label MicroDNS. Show all posts
Showing posts with label MicroDNS. Show all posts

Wednesday, March 25, 2009

I've got a working Windows service running

I can't say I've mastered the black art of making a Windows service, but I now have a simple working Windows service that compiles in my MinGW-3.1.0/MSYS-1.0.10 setup. The "service" version of MicroDNS can be downloaded here (that's a link to click on) or looked at by clicking on this link.

MicroDNS is a tiny DNS server that does only one thing: It always sends a given IPv4 IP to any and all queries sent to the server.

The ip the Windows service version of this program sends is 10.11.12.13, and the service binds to the IP 127.0.0.1

This program is a Windows service; I would like to thank Steve Friedl who put a public domain simple Windows service on his web site at unixwiz.net; his public domain code made it possible for me to write the Win32 service code.

To compile:
gcc -O3 -DMINGW -o microdns-service microdns-service.c -lwsock32

After compiling, one needs to install this service:

microdns-service.exe --install

Then one can start the service:

net start MicroDNS

(It can also be started from Control Panel -> Administrative tools -> Services; look for the "MicroDNS server" service)

To stop the service:

net stop MicroDNS

(Or from the Services control panel)

To remove the service:
microdns-service.exe --remove

This program has been verified to compile and run in a MinGW-3.1.0-1 + MSYS-1.0.10 environment; for details on how to set up this environment in Windows, go to this page:

http://maradns.blogspot.com/2009/03/mingw-310-1-last-real-mingw-release.html

Now that I have the basics of Windows service programming down, the next step is to make Deadwood a proper Windows service.

Tuesday, March 24, 2009

MaraDNS snapshot update

I have made a couple of changes to MaraDNS today:
  • I have removed deadwood-1 and updated deadwood-2 to be deadwood-2.1.01 in the MaraDNS tree; this syncs the MaraDNS and Deadwood releases. This saves me from having to maintain two Deadwood trees (Deadwood-1's TCP code didn't work). One of my plans for Deadwood-2.3 is to have it be modular, so people who don't want caching can remove all caching code from Deadwood-2
  • Since I got yet another request for having a "all DNS queries return the same IP" setup, I have added microdns to the tools/misc directory of MaraDNS
The snapshot can be downloaded here.

Thursday, March 19, 2009

Radio Gatun cryptanalysis (NOT broken) ; Deadwood minor update

Over two years have passed since RadioGatún was published; there finally has been some cryptanalysis of RadioGatún. In the first attack (PDF file), Dmitry Khovratovich and Alex Biryukov were able to attack RadioGatún with a complexity of 2^576 for the 32-bit version of RadioGatún. This attack is clearly not practical, and is only slightly less complex than the claimed security for RadioGatún32, 2^608.

Thomas Fuhr and Thomas Peyrin have a more successful attack; they claim to be able to break RG32 with a complexity of 2^352 (and actually break the 2-bit version of Radio Gatún in their paper). Again, the attack is not practical, but is significantly less complex that RG32's security claim of 2^608. Even if this attack can be extended to the 32-bit version of RadioGatún, RG32 can still be used to make secure 512-bit hashes (a birthday attack on a 512-bit hash has a complexity of 2^256). I personally use it for 256-bit hashes and feel that there will not be any cryptanalysis that makes a collision attack for RG32 easier than 2^128 (and probably no attack easier than 2^256).

There has been no cryptanalysis against using RG32 as a stream cipher (like I do in Deadwood), and RadioGatún's close relative, Panama, has been around since the late 1990s and never has been broken when used as a stream cipher.
I am working on making Deadwood a bona fide Windows service. The first step of this work, porting MicroDNS to Windows (so I have a very simple server to make a service out of), has been done and can be downloaded as microdns-simple.c. Compile this program as gcc -DMINGW -o microdns-simple microdns-simple.c -lwsock32 on a Windows system with MinGW.

Tuesday, March 17, 2009

MicroDNS and Deadwood updates

The MicroDNS code I posted last week had some bugs that made it not work (when I changed the code to use sub-functions instead of a single main() function, I did not do all of the needed changes); when working on Deadwood, I discovered and fixed these bugs today, and MicroDNS now works. The corrected version of MicroDNS can be downloaded here

I have added another test to Deadwood: The "Roy Arends" test. This test make sure that the Deadwood DNS server doesn't answer DNS answers (otherwise the server would be vulnerable to a denial-of-service attack). Deadwood passed the test with flying colors. Deadwood can be looked at here, and today's snapshot (20090317) can be downloaded here.

- Sam

Friday, March 13, 2009

MicroDNS and NanoDNS

I have been posting a small program for real programmers that is a simple DNS server that always returns the same IP reply to any query sent. I also have a version of this program for wanna-be programmers; this program is properly indented, has comments, descriptive variable names, and other things real programmers prefer to do without. It even gives usage information if incorrectly invoked. It is available at samiam.org/software/microdns.html

However, if the comments and coding style of MicroDNS bothers you, I have managed to get rid of even more bloat from NanoDNS, and have the updated program posted here:

/*Placed in the public domain by Sam Trenholme*/
#include <arpa/inet.h>
#include <string.h>
#define Z struct sockaddr
#define Y sizeof(d)
int main(int a,char **b){int i;char q[512],p[17
]="\xc0\f\0\x01\0\x01\0\0\0\0\0\x04";if(a>1){a=
socket(AF_INET,SOCK_DGRAM,0);struct sockaddr_in
d;bzero(&d,Y);d.sin_port=htons(53);*((int *)(p+
12))=inet_addr(b[1]);d.sin_family=AF_INET;bind(
a,(Z*)&d,Y);socklen_t f=511;for(;;){i=recvfrom(
a,q,255,0,(Z*)&d,&f);if(i>9&&q[2]>=0){q[7]++;q[
2]|=128;memcpy(q+i,p,16);sendto(a,q,i+16,0,(Z*)
&d,Y);}}}return 0;}