Thursday, December 8, 2011

how to enable mod_speling on directadmin


mod_speling how to
Enabling mod_speling in directadmin

[root@www custombuild]# cd /usr/local/directadmin/custombuild
[root@www custombuild]# mkdir -p custom/ap2
[root@www custombuild]# cp -Rp configure/ap2/configure.apache custom/ap2/configure.apache
[root@www custombuild]# vi custom/ap2/configure.apache
add     "--enable-speling" \ after    "--enable-so" \
save the file
[root@www custombuild]# ./build apache

add the following lines to /etc/httpd/conf/httpd.conf
[root@www custombuild]#  vi /etc/httpd/conf/httpd.conf
CheckSpelling On
CheckCaseOnly On
then save the file

Restart httpd
[root@www custombuild]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: [Fri Dec 09 00:10:58 2011]
[root@www custombuild]#

Checking
[root@www custombuild]# httpd -l | grep spel
  mod_speling.c
[root@www custombuild]#

How to remove the spam mails from qmail queue


How to remove spam mails from qmail mail queue

This post helps you to remove spam mails containing a string (subject) or from a particular user from the qmail mail queue. You have to install a open source

software qmail-remove.

Go to the directory /usr/local/src
[root@host ~]# cd /usr/local/src

Download the qmail-remove package
[root@host ~]# wget http://www.linuxmagic.com/opensource/qmail/qmail-remove/qmail-remove-0.95.tar.gz

Untar the package
[root@host ~]# tar xvzf qmail-remove-0.95.tar.gz

cd to the untared directory
[root@host ~]# cd qmail-remove-0.95/

compile
[root@host ~]# make

Install
[root@host ~]# make install

You can check the options with -h option
[root@host ~]# qmail-remove -h

Now the package is installed but you have to create a yanked directory to store the mails you are removing. You have to create it in the qmail base

directory. In this case it is /var/qmail/queue/ yours may differ.
[root@host ~]# cd /var/qmail/queue/
[root@host ~]# mkdir yanked

And before running the commands using this package you must stop qmail
[root@host ~]# /etc/init.d/qmail stop

There is one helpful tool with you can count and list the spam mails. Install it. You can get the directions from here
http://www.atomicorp.com/wiki/index.php/Spam

You can use -s option to get the total no.of spam mails in queue
[root@host ~]# /usr/bin/qmhandle.pl -s
Total messages: 253998
Messages with local recipients: 17
Messages with remote recipients: 253965
Messages with bounces: 1
Messages in preprocess: 16
[root@host ~]# /usr/bin/qmhandle.pl -s
Total messages: 185000
Messages with local recipients: 17
Messages with remote recipients: 184962
Messages with bounces: 1
Messages in preprocess: 20
[root@host ~]#

You can use -l option to list the spam mails in queue
[root@host ~]# /usr/bin/qmhandle.pl -l

You can read a message using the option -m
[root@host ~]# /usr/bin/qmhandle.pl -m22616314
 --------------
MESSAGE NUMBER 22616314
 --------------
Received: (qmail 25932 invoked by uid 502); 7 Dec 2011 12:17:40 +1100
Date: 7 Dec 2011 12:17:40 +1100
Message-ID: <20111207011740.25927.qmail@host.xxxxxx.com>
To: lyttmab@ppppp.com
Subject: I WISH TO HAVE YOU AS A PERSONAL ASSISTANT.
From: Mr.Morgan Kent <mr.morgankent2@ppppp.com>
Reply-To: morgankent202@ppppp.com
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
morgankent2011@ppppp.com
mr.morgankent2011@ppppp.com
######OUTPUT TRUNCATED########

You can read the headers of the mails in the queue using the following command
[root@host ~]# /var/qmail/bin/qmail-qread
7 Dec 2011 14:22:43 GMT  #22708222  3232  <anonymous@host.xxxxxx.com>
        remote  crehkow@ppppp.com
7 Dec 2011 12:12:16 GMT  #22609322  3233  <anonymous@host.xxxxxx.com>
        remote  jbilodeau1@ppppp.com
7 Dec 2011 10:55:48 GMT  #14396666  3237  <anonymous@host.xxxxxx.com>
        remote  izzy46martinez@ppppp.com

For listing the mails in the mail queue with a particular content use the following command
[root@host ~]# qmail-remove -i -p "I WISH TO HAVE YOU AS A PERSONAL ASSISTANT"
It will list the mails with content I WISH TO HAVE YOU AS A PERSONAL ASSISTANT in it

The above command will only list the mails. for deleting them use option -r. Then all those mails will be moved to yanked directory.
[root@host ~]# qmail-remove -i -p "I WISH TO HAVE YOU AS A PERSONAL ASSISTANT"  -r
[root@host yanked]# pwd
/var/qmail/queue/yanked
[root@host yanked]# ls | wc -l
593379
[root@host yanked]#

Useful links
http://www.atomicorp.com/wiki/index.php/Spam
http://kb.parallels.com/en/1711
http://kb.parallels.com/en/766
http://www.linuxmagic.com/opensource/qmail/qmail-remove

NRPE: Command 'check_mem' not defined

This error is coming because the missing of check_mem command on the client machine

open the following file and add the command as follows

root@server1 [/opt/Nagios/Nagios_NRPE/nrpe-2.12]# vi /usr/local/nagios/etc/nrpe.cfg
command[check_mem]=/usr/local/nagios/libexec/check_mem 85 95
save the file. That it.

root@server1 [~]# /usr/local/nagios/libexec/check_mem 85 95
OK - Memory usage is 2.000%
root@server1 [~]#

NRPE: Command 'check_disk' not defined

This error is coming because the missing of check_disk command on the client machine
open the following file and add the check_disk command as follows

root@server1 [/opt/Nagios/Nagios_NRPE/nrpe-2.12]# vi /usr/local/nagios/etc/nrpe.cfg
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda
save the file. That it.

You can also test the command as below on the client server.
root@server1 [/opt/Nagios/Nagios_NRPE/nrpe-2.12]# /usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda
DISK OK - free space: / 863034 MB (99% inode=99%);| /=4696MB;731966;823462;0;914958

CHECK_NRPE: Error - Could not complete SSL handshake

You may get an error like this while configuring nrpe with nagios
root@server1 [/opt/Nagios/Nagios_NRPE/nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H x.x.x.x
CHECK_NRPE: Error - Could not complete SSL handshake.
root@server1 [/opt/Nagios/Nagios_NRPE/nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H localhost
CHECK_NRPE: Error - Could not complete SSL handshake.
The problem is you didnt give the ip address in /etc/xinetd.d/nrpe