Posts Tagged ‘daemontools’

How to install and configure djbdns from source as a Cachening Localhost Proxy resolver to increase resolving efficiency on Debian 6 Squeeze

Monday, August 1st, 2011

Reading Time: 3minutes

It seems DjbDNS on Debian Squeeze has been not included as a Debian package. There is still possibility to install djbdns from an older deb package or install it from source. I however decided to install it from source as finding the old Debian package for Lenny and Etch takes time, plus I'm running an amd64 version of Debian and this might even more complicate the situation.
Installing it from source is not really a Debian way but at least it works.

In this article I assume that daemontools and ucspi-tcp are preliminary installed, if not one needs to install them with:

debian:~# apt-get install ucspi-tcp daemontools daemontools-run

The above two ones are required as DJBDNS is originally made to run through djb's daemontools.

Here is the exact step I took to have it installed as local caching DNS server on a Debian Squeeze server:

1. Download and untar DjbDNS

debian:~# wget -q debian:~# tar -zxvvf djbdns-1.05.tar.gz

2. Add DjbDNS users to /etc/passwd

Creating the below two users is not arbitrary but it's recommendable.

echo 'dnscache:*:54321:54321:dnscache:/dev/null:/dev/null' >> /etc/passwd
echo 'dnslog:*:54322:54322:dnslog:/dev/null:/dev/null' >> /etc/passwd

3. Compile DJBDNS nameserver

First it's necessery to use the below echo command to work around a common Linux bug:

debian:~# cd djbdns-1.05
debian:/root/djbdns-1.05# echo gcc -O2 -include /usr/include/errno.h > conf-cc

Next let's make it:

debian:/root/djbdns-1.05# make

4. Install the compiled djbdns binaries

debian:/root/djbdns-1.05# make setup check
# here comes some long install related output

If no errors are produced by make setup check this means that the djbdns should have installed itself fine.

As installation is compileted it's a good idea to report about the newly installed DjbDNS server if running a mail server. This info is used by Dan Bernstein to gather statistical data about the number of installations of djbdns servers throughout the world.

5. Do some general configurations to the newly installed DJBDNS

Now let's copy the list of the IP addresses of the global DNS root servers in /etc/.

debian:/root/djbdns-1.05# cp -rpf /etc/ debian:/root/djbdns-1.05# ./dnscache-conf dnscache dnslog /etc/dnscache

dnscache-conf will generate some default configuration files for djbdns in /etc/dnscache

Next allow the networks which should be able to use the just installed djbdns server as a caching server:

debian:/root/djbdns-1.05# cd /etc/dnscache/root/ip
debian:/etc/dnscache/root# touch 192.168.1
debian:/root/djbdns-1.05# touch 123.123

First command will allow all ips in range 192.168.1.* to be able to access the DNS server and the second command will allow all ips from 123.123.1-255.1-255 to be able to query the server.

Some further fine tunning can be done from the files:

/etc/dnscache/env/CACHESIZE and /etc/dnscache/env/DATALIMIT

As a last step, before it's running, we have to link the /etc/dnscache to daemontools like so:

debian:/root/djbdns-1.05# ln -sf /etc/dnscache /etc/service/dnscache

If the daemontools is not linked to be accessible via /etc/service it's also a good to link it there:

debian:~# ln -sf /etc/service /

Now the DJBDNS should be running fine, to test if it's running without errors through daemontools I used:

debian:~# ps ax|grep -i readproc
5358 pts/18 R+ 0:00 grep -i readproc
11824 ? S 0:00 readproctitle service errors: ...........

If no errors are displayed it's configured and running to also test if it's capable of resolving I used the host command:

debian:~# host localhost
Using domain server:
Name: localhost
Aliases: has address mail is handled by 0

Now the DJBDNS is properly installed and if you test it for a while with time host localhost , you will see how quick it is in resolving.

The advantage of running DJBDNS is it does not require almost no maintance, its rock solid and great just like all other Dan Bernstein's written software.
Enjoy 😉

Mount ISO Image file in Windows 7 and Windows Vista ( Virtual Clone Drive )

Saturday, September 21st, 2013

Reading Time: 2minutes

Virtual Clone drive logo open iso files Microsoft Windows

In Microsoft Windows 8, there is embedded way to mount ISO files. However in Windows 7 still there is no way to mount ISO image files. I just installed a new Windows 7 on my office work notebook given by Hewlett Packard and had to mount an ISO with Microsoft Visio. Normally all know the two standard programs to mount ISO images in Windows;

1. DaemonTools Lite
2. MagicISO
3. Virtual CD-ROM (Microsoft program)

After consulting my colleague I was recommended to rather install Virtual Clone Drive, for the reason Daemontool's latest versions install Spyware on Computer. On the other hand MagicISO is nice one but a bit obsolete already.
Launching installation prompts opens below install Window;

Virtual Clonedrive 2 on microsoft windows 7 screenshot great program to mount iso files
As you can see from installationVirtual Clone Drivesupports ISO / IMG / UDF / BIN and CCD images. Once installation complete to Mount an ISO into separate drive quickest way is to Double click on Image. Also it can be done from program by navigating to:

Virtual Clone Drive Windows 7 mount drive open iso files

From my little experience so far with Virtual Clone Drive I would recommend Windows users to better install it instead of freeware alternatives. VCD feels more robust.

Linux: Fixing Qmail server qmail-smtpd port 25 slow (lagged) connect problem

Thursday, May 16th, 2013

Reading Time: 3minutes

qmail logo fixing qmail mail SMTP port 25 connect delays

After updating my Debian Squeeze to latest stable packages from repository with standard:
# apt-get update && apt-get upgrade

I routinely checked, if afterwards all is fine with Qmail?, just to find out connect to port 25 was hell delayed about 40-50 seconds before qmail responds with standard assigned Mail Greeting.
I Googled long time to see if I can find a post or forum thread discussing, exact issue, but though I found similar discussions I didn't found anything that exactly match problem. Thus I decided to follow the good old experimental try / fail method to figure out what causes it.

elow is pastes from telnet, illustrating delays in Qmail SMTP greeting respond:

# telnet localhost 25
Connected to localhost.
Escape character is '^]'.

# telnet localhost 25
Connected to localhost.
Escape character is '^]'.

# telnet localhost 25
Connected to localhost.
Escape character is '^]'.

I spend about 2 hours, checking Qmail for the standard so common errors, usually causing it to not work properly following my previous article testing qmail installation problems

After going, through all of possible causes the only clue for problems, were some slowness with spamassassin. This brought me the idea that something is done wrong with spamassassin .I tried disabling, Spamassassin Razon and Pyzor restarting spamd through (in my case done not via the standard start/stop debian script) but through daemontools with svc and qmailctl i.e.:

# svc -d /service/spamd
# svc -u /service/spamd
# svc -a /service/spamd

qmailctl restart
* Stopping qmail-smtpdssl.
* Stopping qmail-smtpd.
* Sending qmail-send SIGTERM and restarting.
* Restarting qmail-smtpd.
* Restarting qmail-smtpdssl.
* Restarting qmail-pop3d.
This doesn't help, so I continued trying to figure out, what is wrong .One assumption for slow  qmail-smtpd responce was of course slow DNS resolve issues. I checked /etc/resolv.conf to find out server is configured to use local  configured DJBDNS server as first line DNS resolver. I used djbdns for it is simple and easy to configure, however it is a bit obsolete so it was possible bottleneck. After commenting line to use localhost
and settings as primary DNS Google Public DNS, problem persisted so problems with hosts resolving was obviously not the problem.

I pondered for about 30 minutes, checking again all logs and checking machine processes. Just to remember before I experienced similar issues caused by unresolving RBL (blacklist IP) hosts. I checked configured SPF records in
(process list) and noticed following 4 hosts;

# ps auxwwf

7190 ?        S      0:00 tcpserver -vR -l /var/qmail/control/me -c 30 -u 89 -g 89 -x /etc/tcp.smtp.cdb 0 25 rblsmtpd -t0 -r -r -r -r qmail-smtpd /var/qmail/control/me /home/vpopmail/bin/vchkpw /bin/true

I checked one by one hosts and find out 1st two hosts in line are no longer resolving (blacklist is no longer accessible) as before:,

DNSBL (DNS blocklist) is configured on this host via /service/qmail-smtpd/run, hence to remove two unresolvable hosts forcing the weird qmail-smtpd connect delay I had to modify in it:




After a close examinations in mail server config /var/qmail/control/spfrules, found one other Unresolvable SPF Blacklist host configured ;
# cat /var/qmail/control/spfrules

To move that one I null-ed file:

# cat /dev/null > /var/qmail/control/spfrules

Finally to take affect all changes, launched Qmail start:

# qmailctl restart
Restarting qmail:
* Stopping qmail-smtpdssl.
* Stopping qmail-smtpd.
* Sending qmail-send SIGTERM and restarting.
* Restarting qmail-smtpd.
* Restarting qmail-smtpdssl.
* Restarting qmail-pop3d.

To check all was fine afterwards, again used telnet:

# telnet localhost 25
Connected to localhost.
Escape character is '^]'.
220 This is Mail Pc-Freak.NET ESMTP

Mail greeting now appears in about 2-3 seconds time.



Windows Daemontools like Linux GUI software or How to mount ISO files in Linux and BSD

Saturday, September 26th, 2009

Reading Time: < 1minute
Ever wondered if Linux allows you to open ISO’s with a nice graphic interface like the famousDaemontools on Windows. Cause I did and I found the software that enables you to do so:
First and most popular option especially for Gnome users is:
1. Acetoneiso , it’s really famous between mainly Ubuntu users
2. KDE users might be interesting into The kiso program 3. Another program I found being used among Ubuntu users is called gmountiso .
Still if you’re mostly a console guy like I am and want to mount your iso into some directory on Linux here is how:
# mkdir /mnt/disk# mount -o loop disk1.iso /mnt/disk
Now your iso is mounted in /mnt/disk.

The way to mount an iso file in FreeBSD is a bit different.
Here is how to do it in FreeBSD:
# mdconfig -a -t vnode -f /path/to/image.iso -u 1# mount -t cd9660 /dev/md1 /mnt/cdromNow your iso stays mounted in /mnt/cdromIn case you’d like to unmount it, you need to execute:# mount -u /mnt/cdrom# mdconfig -d -u 1
On FreeBSD there is one more oddity:
For instance if you’d like to mount some Windows FAT filesystem you need oralternatively an MSDOS file system, here is how:
# vnconfig /dev/vn0c ./image.iso# mount -t msdos /dev/vn0c /cdrom
The last method to mount your iso is said to be compatible with all type of filesystems, so youmight be a good idea to use it always