Monday, November 15, 2010

thimbl-cli gets a thimbl daemon

I have had had no end of trouble trying to get a finger daemon set up on my Ubuntu EC2 account. There was always something wrong. efingerd crashed on me, and there were various configuration and other problems with the other finger daemons that were available.

In the end, I decided that the simplest solution was to write my own. Thimbl-CLI now has the directory "daemon", containing all the demonic fingering that is necessary to get a daemon going. It aint pretty, but it works. Here's the README file that I wrote in the daemon directory:

How to set up a crude finger server
I have trying ubuntu, and I have been most unstatisfied with the
finger daemons on offer. Instead of going an ultra-complicated route,
I have tried to opt for about the simplest thing that will work. It is
based on the assumption that there is only one real user on the
system, and that it is only him who has a .plan file that needs to be
published.
Here's what to do:
* REDIRECT PORT 79
Normal users can't bind below port 1000, so you need to redirect it to
some other port. In this case, use port 4214. As root, type:
   iptables -t nat -A PREROUTING -p tcp --dport 79 -j REDIRECT --to-port 4214
Don't change it from 4214 without good reason, because thimbld.c is
compiled under the assumption that you will be using 4214.
Other solutions, including 'authbind', are mentioned here:
http://serverfault.com/questions/112795/how-can-i-run-a-server-on-linux-on-port-80-as-a-normal-user
Security and other problems and limitations are also discussed there.
* COMPILE THE DAEMON
You will need gcc and the include files to compile the binary. On
Slackware, this wont be a problem. On other systems, you may need to
install them. To compile, issue the command:
   gcc -o thimbld thimbld.c
thimbld.c just executes a shell script. I have chosen to wrap the
script in a C file in this way so that I have an easily idintifiable
process that I can kill.
* LAUNCH THE DAEMON
Easy enough:
   ./launch-thimbld
It's a very simple script.
* KILL THE DAEMON
When you get fed up running the daemon, issue the command
   ./kill-thimbld
That should do the trick


Except, it doesn't quite work. The kill-thimbld doesn't quite seem to kill everything. Think of thimbld as only a stop-gap solution, anyway. I just want my EC2 account to transmit my .plan file so that I can do some testing from other accounts.

In order to checkout Thimbl-CLI, visit its page at github:
https://github.com/blippy/Thimbl-CLI

No comments: