Subject: Internal Server Error

From: "dan1" <[email-masked]>
Date: Tue, 15 Nov 2005 11:54:25 +0100

Hello.
I am having a problem setting up Argus on a CentOS 4 linux box.
The argusd service is running properly when I type top, but when accessing 
the results page on the webserver on the following address 
http://192.168.0.1/cgi-bin/arguscgi I get the following error:
500 Internal Server Error

I am using Apache/2.0.52.
I have already seen a post telling that this is not an argus problem but 
merely an apache misconfiguration, but I have checked everything in the 
config file and the files permissions and all seems ok.

When I look in the apache error log I see those 3 errors:
ERROR: could not connect to argusd on unix socket '/var/argus/control': 
Permission denied
cannot tie auth '/var/argus/auth': Permission denied
Premature end of script headers: arguscgi

I have checked the '/var/argus/control' permissions and they are as 
following:
srwxrwxrwx  1 root root      0 Nov 15 11:44 control

I cannot change that user and group name, because it is set by the 
/usr/local/sbin/argusd program when we run the service. The problem probably 
comes from here: it sets permissions to root:root, and Apache cannot access 
to it.
Can somebody tell me how to change those permissions at the launch of the 
argusd service ? Also, am I doing something wrong or is there an error in 
the script ?

Thank you.
Regards,
Daniel

---

From: "dan1" <[email-masked]>
Date: Tue, 15 Nov 2005 12:24:30 +0100

>/usr/local/sbin/argusd program when we run the service. The problem 
>probably comes from here: it sets permissions to root:root, and Apache 
>cannot access to it.

To continue debugging, I have found a way to set the proper permissions on 
that /var/argus/control file, by inserting the following line in the 
/usr/local/sbin/argusd file:
chown (0, 48, '/var/argus/control');
Just after that line:
Control->Server::new_local( "$datadir/control", 
oct($Conf::Config{chmod_control}) );

Now, the permissions are setup properly to display root:apache, but it 
doesn't change anything to the problem, the errors in the logs are exactly 
the same.

This itime, I wonder if there would not be a problem in the UNIX socket to 
connect to that /var/argus/control file. Maybe Apache cannot communicate 
with unix socket files ? Would someone know what happens and how to solve 
that, even if it's in the apache configuration ? As it is still argus 
related, I think that we should find out the problem, so that others might 
also install argus and benefit from it.

Regards,
Daniel

---

From: "dan1" <[email-masked]>
Date: Tue, 15 Nov 2005 13:09:38 +0100

>also install argus and benefit from it.

Ok, I finally found the problem. I had SELinux enabled. If this is enabled 
then you get all those errors.
DISABLE SElinux !!
You can disable it just by edition the /etc/sysconfig/selinux file and 
changing the state to:
SELINUX=disabled
You need however to restart the linux box.
There is no need to change any permission as stated above or anything else. 
Just disable it and it's ok.
Else, you can also add seliux commands to that you have the proper rights, 
but I don't know yet how to do that and I had decided to get rid of SElinux 
due to bad experiences with strange things happening, but I had forgot this 
last box where SElinux was still enabled. It's one more bad experience with 
SElinux..
If some of you could tell what selinux command we should type to make argus 
compatible, that would be great.
Also, at least a warning in the installation documentation would be 
necessary, as all RHEL users having enabled Selinux will get that problem.

Best regards,
Daniel

---

From: "dan1" <[email-masked]>
Date: Tue, 15 Nov 2005 16:24:38 +0100

Hello.
I have changed a bit the current argusd file so that it fits for RedHat 8,9, 
RHEL likes systems (CentOS 3+4, ubuntu, and so forth).
It seems to be working well. Could you put that in the distribution ? If you 
do, please don't mention my e-mail.
The name of the script is argusd as it is more common to type 'service 
argusd start'. It allows a restart, querying the status, adds a nice [OK] 
message when ok, and also uses a lockfile so that only one instance can run. 
I don't know if that is a bad idea, but I think it is ok to my point of 
view.
It also allows to use the 'chkconfig' program to turn the service on and off 
at boot-up.
Hope this helps a bit the others.

Best regards,
Daniel

/etc/rc.d/init.d/argusd
--------------------------------

#!/bin/bash

# Argus

# chkconfig: - 88 12
# description: Argus is a tcp/udp monitoring program that allows you to 
watch \
#              the status of several servers and report it as HTML pages.
# processname: argusd
# config: /var/argus/config
# pidfile: /var/run/argusd.pid

# Copyright (c) 2002 by Jeff Weisberg
# Author: Jeff Weisberg <argus @ tcp4me.com>
# Date: 2002-Jun-21 18:43 (EDT)
# Function: argusd startup rc script

# $Id: rc.argusd,v 1.5 2002/11/19 23:42:07 jaw Exp $

# Source function library.
. /etc/rc.d/init.d/functions

prog=argusd
lockfile=/var/lock/subsys/$prog
RETVAL=0;
start() {
        # ulimit does not have a standard/portable syntax
        # if you need more file descriptors, put the command here
        # eg: ulimit -n 1000

        # since rc files normally run as root, and
        # you may not want argus running as root,
        # to run argus as a certain user or group
        # add  -u user and/or -g group  below

        if [ ! -f /var/lock/subsys/$prog ]; then
                echo -n $"Starting $prog: "
                /usr/local/sbin/argusd
                RETVAL=$?
                if [ $RETVAL = 0 ]; then
                        echo -n "                       [  "
                        echo -en '\E[;32m'"\033[1mOK\033[0m"
                        echo "  ]"
                        [ $RETVAL -eq 0 ] && touch $lockfile
                else
                        echo -n "                       ["
                        echo -en '\E[;31m'"\033[1mFailed\033[0m"
                        echo "]"
                fi
        else
                echo "Argus is already running..."
        fi
        return $RETVAL
}
stop() {
        echo -n $"Stopping $prog: "
        /usr/local/sbin/argusctl shutdown reason="argusd stop"
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f $lockfile

}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    status)
        status argusd
        RETVAL=$?
        exit $RETVAL;
        ;;

    *)
        echo usage: $0 'start|stop|restart|status'
        RETVAL=1
        ;;
esac
exit $RETVAL