HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Errors after following The Perfect SpamSnake (Ubuntu 8.04) (http://www.howtoforge.com/forums/showthread.php?t=23820)

hvrossum 1st June 2008 14:34

Errors after following The Perfect SpamSnake (Ubuntu 8.04)
 
I followed The Perfect SpamSnake - Ubuntu 8.04 LTS

But after chapter 8 I wanted to test the Postfix and tailed the log file
I get this output

Jun 1 14:00:22 mussorubuntu MailScanner[7707]: Read 817 hostnames from the phishing whitelist

Jun 1 14:00:22 mussorubuntu MailScanner[7707]: Read 310 hostnames from the phishing blacklist

Jun 1 14:00:22 mussorubuntu MailScanner[7707]: SpamAssassin temporary working directory is /tmp

Jun 1 14:00:22 mussorubuntu MailScanner[7707]: Using SpamAssassin results cache

Jun 1 14:00:23 mussorubuntu MailScanner[7707]: Could not create SpamAssassin cache database /var/spool/MailScanner/incoming/SpamAssassin.cache.db

Jun 1 14:00:23 mussorubuntu MailScanner[7707]: Enabling SpamAssassin auto-whitelist functionality...

Jun 1 14:00:26 mussorubuntu MailScanner[7707]: /var/spool/mqueue is not owned by user 108 !

Jun 1 14:00:26 mussorubuntu MailScanner[7713]: MailScanner E-Mail Virus Scanner version 4.68.8 starting...

Jun 1 14:00:26 mussorubuntu MailScanner[7713]: Could not read directory /var/spool/MailScanner/incoming

Jun 1 14:00:26 mussorubuntu MailScanner[7713]: Error in configuration file line 166, directory /var/spool/MailScanner/incoming for incomingworkdir does not exist (or is not readable)

Jun 1 14:00:27 mussorubuntu MailScanner[7713]: Could not read directory /var/lock/subsys/MailScanner

Jun 1 14:00:27 mussorubuntu MailScanner[7713]: Error in configuration file line 2559, directory /var/lock/subsys/MailScanner for lockfiledir does not exist (or is not readable)

Jun 1 14:00:27 mussorubuntu MailScanner[7713]: Could not read directory /var/spool/mqueue

Jun 1 14:00:27 mussorubuntu MailScanner[7713]: Error in configuration file line 156, directory /var/spool/mqueue for outqueuedir does not exist (or is not readable)

Jun 1 14:00:28 mussorubuntu MailScanner[7713]: Could not read directory /var/spool/MailScanner/quarantine

Jun 1 14:00:28 mussorubuntu MailScanner[7713]: Error in configuration file line 170, directory /var/spool/MailScanner/quarantine for quarantinedir does not exist (or is not readable)


Anybody have any idea what I need to do tho solve this.
I followed avery step on the How-to so strange. I have updated to Ubuntu 8.04 eventhough my signature says different (need to update this too)

thx
Harry

Rocky 1st June 2008 17:04

Try this
 
Hi hvrossum,

I'm happy to know that someone else is trying to install The SpamSnake. About your problem, what do you have as your Run As User and Group in MailScanner.conf?

Rocky

hvrossum 1st June 2008 17:14

Hi Rocky,

I tried the chown commands

I get two error messages

chown -R postfix:www-data /var/lock/subsys/MailScanner
chown: cannot access `/var/lock/subsys/MailScanner': No such file or directory
(I changed the capital letters of MailScanner to small, that did work)

chown -R postfix:www-data /var/run/MailScanner
chown: cannot access `/var/run/MailScanner': No such file or directory
(Which is correct because does not exist)


When I restart I get the following error
root@mussorubuntu:/home/harry# /etc/init.d/mailscanner restart
* Restarting mail spam/virus scanner MailScanner Could not read directory /var/lock/subsys/MailScanner at /usr/share/MailScanner//MailScanner/Config.pm line 2488
Error in configuration file line 2559, directory /var/lock/subsys/MailScanner for lockfiledir does not exist (or is not readable) at /usr/share/MailScanner//MailScanner/Config.pm line 2812

The list of errors gets smaller :)

Jun 1 17:13:40 mussorubuntu MailScanner[11167]: SpamAssassin temporary working directory is /var/spool/MailScanner/incoming/SpamAssassin-Temp
Jun 1 17:13:40 mussorubuntu MailScanner[11167]: Using SpamAssassin results cache
Jun 1 17:13:40 mussorubuntu MailScanner[11167]: Connected to SpamAssassin cache database
Jun 1 17:13:40 mussorubuntu MailScanner[11167]: Enabling SpamAssassin auto-whitelist functionality...
Jun 1 17:13:44 mussorubuntu MailScanner[11167]: /var/spool/mqueue is not owned by user 108 !
Jun 1 17:13:44 mussorubuntu MailScanner[11172]: MailScanner E-Mail Virus Scanner version 4.68.8 starting...
Jun 1 17:13:44 mussorubuntu MailScanner[11172]: Could not read directory /var/lock/subsys/MailScanner
Jun 1 17:13:45 mussorubuntu MailScanner[11172]: Error in configuration file line 2559, directory /var/lock/subsys/MailScanner for lockfiledir does not exist (or is not readable)

Thanks so far

I Have Postfix As User and Group in MailScanner.conf

Harry

Rocky 1st June 2008 17:19

Harry,

Try this:

9.17 Fix for Ubuntu 8.04 (kept removing directories upon reboot)

Edit /etc/rc.local and add the following before the exit line:
Code:

mkdir /var/run/MailScanner
mkdir /var/lock/subsys
mkdir /var/lock/subsys/MailScanner
chown -R postfix:www-data /var/run/MailScanner
chown -R postfix:www-data /var/lock/subsys/MailScanner
/etc/init.d/postfix restart
/etc/init.d/mailscanner restart

Reboot and let me know what happens when you check the log.

hvrossum 1st June 2008 17:35

Hi Rocky,

I tried your steps, rebooted and this is what I get on messages in my mail.log file


Jun 1 17:33:26 mussorubuntu MailScanner[7369]: SpamAssassin temporary working directory is /var/spool/MailScanner/incoming/SpamAssassin-Temp
Jun 1 17:33:26 mussorubuntu MailScanner[7369]: Using SpamAssassin results cache
Jun 1 17:33:26 mussorubuntu MailScanner[7369]: Connected to SpamAssassin cache database
Jun 1 17:33:26 mussorubuntu MailScanner[7369]: Enabling SpamAssassin auto-whitelist functionality...
Jun 1 17:33:29 mussorubuntu MailScanner[7369]: /var/spool/mqueue is not owned by user 108 !
Jun 1 17:33:30 mussorubuntu MailScanner[7390]: MailScanner E-Mail Virus Scanner version 4.68.8 starting...
Jun 1 17:33:30 mussorubuntu MailScanner[7390]: Could not read directory /var/lock/subsys/MailScanner
Jun 1 17:33:30 mussorubuntu MailScanner[7390]: Error in configuration file line 2559, directory /var/lock/subsys/MailScanner for lockfiledir does not exist (or is not readable)

Rocky 1st June 2008 17:41

Harry,

Did you comment out the following in /etc/rc2.d/S20mailscanner?

Code:

#check_dir /var/spool/MailScanner      ${user:-mail} ${group:-mail}
#check_dir /var/lib/MailScanner        ${user:-mail} ${group:-mail}
#check_dir /var/run/MailScanner        ${user:-mail} ${group:-mail}
#check_dir /var/lock/subsys/MailScanner ${user:-mail} ${group:-mail}

If not, edit it so that it looks like the above and restart your system. Check your log and let me know if that worked.

Rocky

hvrossum 1st June 2008 17:54

I did, but I cannot find the file in this directory anymore.

Rocky 1st June 2008 18:08

Have you deleted the file by accident?

The content of my /etc/rc2.d/S20mailscanner file looks like:

Code:


#! /bin/sh
### BEGIN INIT INFO
# Provides:          MailScanner daemon
# Required-Start:    $local_fs $remote_fs
# Required-Stop:    $local_fs $remote_fs
# Default-Start:    2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Controls mailscanner instances
# Description:      MailScanner is a queue-based spam/virus filter
### END INIT INFO
# Author: Simon Walter <simon.walter@hp-factory.de>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/sbin:/usr/bin:/bin:/sbin
DESC="mail spam/virus scanner"
NAME=MailScanner
PNAME=mailscanner
DAEMON=/usr/sbin/$NAME
STARTAS=MailScanner
SCRIPTNAME=/etc/init.d/$PNAME
CONFFILE=/etc/MailScanner/MailScanner.conf

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
run_mailscanner=0
run_nice=0
stopped_lockfile=/var/lock/subsys/MailScanner.off
# Read configuration variable file if it is present
[ -r /etc/default/$PNAME ] && . /etc/default/$PNAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
# Don't start if MailScanner is not configured
if [ $run_mailscanner = 0 ]; then
    if [ -z "$satisfy_nitpicking_on_removal" ]; then
        cat <<-EOF
        Please edit the file /etc/MailScanner/MailScanner.conf according to
        your needs.  Then configure sendmail or exim for use with mailscanner.
        After you are done you will have to edit /etc/default/mailscanner as
        well. There you will have to set the variable run_mailscanner to 1,
        and then type "/etc/init.d/mailscanner start" to start the mailscanner
        daemon.
        EOF
    fi
    exit 0
fi
# sanity check for permissions
fail()
{
    echo >&2 "$0: $1"
    exit 1
}
check_dir()
{
    if [ ! -d $1 ]; then
        mkdir -p "$1" || \
            fail "directory $1: does not exist and cannot be created"
    fi
    actual="$(stat -c %U $1)"
    if [ "$actual" != "$2" ]; then
        chown -R "$2" "$1" || \
            fail "directory $1: wrong owner (expected $2 but is $actual)"
    fi
    actual="$(stat -c %G $1)"
    if [ "$actual" != "$3" ]; then
        chgrp -R "$3" "$1" || \
            fail "directory $1: wrong group (expected $3 but is $actual)"
    fi
}
user=$(echo $(awk -F= '/^Run As User/ {print $2; exit}' $CONFFILE))
group=$(echo $(awk -F= '/^Run As Group/ {print $2; exit}' $CONFFILE))
#check_dir /var/spool/MailScanner      ${user:-mail} ${group:-mail}
#check_dir /var/lib/MailScanner        ${user:-mail} ${group:-mail}
#check_dir /var/run/MailScanner        ${user:-mail} ${group:-mail}
#check_dir /var/lock/subsys/MailScanner ${user:-mail} ${group:-mail}
#
# Function that starts the daemon/service
#
do_start()
{
        # Return
        #  0 if daemon has been started
        #  1 if daemon was already running
        #  2 if daemon could not be started
        start-stop-daemon --start --quiet --startas $STARTAS --name $NAME --test > /dev/null \
                || return 1
        start-stop-daemon --start --quiet --nicelevel $run_nice --exec $DAEMON --name $NAME -- $DAEMON_ARGS \
                || return 2
        # Add code here, if necessary, that waits for the process to be ready
        # to handle requests from services started subsequently which depend
        # on this one.  As a last resort, sleep for some time.
  # Set lockfile to inform cronjobs about the running daemon
        RETVAL="$?"
        if [ $RETVAL -eq 0 ]; then
            touch /var/lock/subsys/mailscanner
            rm -f $stopped_lockfile
        fi
}
#
# Function that stops the daemon/service
#
do_stop()
{
        # Return
        #  0 if daemon has been stopped
        #  1 if daemon was already stopped
        #  2 if daemon could not be stopped
        #  other if a failure occurred
  start-stop-daemon --stop --retry=TERM/30 --name $NAME
        RETVAL="$?"
        [ "$RETVAL" = 2 ] && return 2
  # Remove lockfile for cronjobs
        if [ $RETVAL -eq 0 ]; then
            rm -f /var/lock/subsys/mailscanner
            touch $stopped_lockfile
        fi
}
case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
                0|1)
                                        [ "$VERBOSE" != no ] && log_end_msg 0
                                        exit 0
                                        ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
                0|1)
                                        [ "$VERBOSE" != no ] && log_end_msg 0
                                        exit 0
                                        ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  #reload|force-reload)
        #
        # If do_reload() is not implemented then leave this commented out
        # and leave 'force-reload' as an alias for 'restart'.
        #
        #log_daemon_msg "Reloading $DESC" "$NAME"
        #do_reload
        #log_end_msg $?
 #;;
  restart|force-reload)
        #
        # If the "reload" option is implemented then remove the
        # 'force-reload' alias
        #
        log_daemon_msg "Restarting $DESC" "$NAME"
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
                ;;
          *)
                # Failed to stop
                log_end_msg 1
                ;;
        esac
        ;;
  *)
        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac


hvrossum 1st June 2008 18:28

I found the file expect is called S50mailscanner in /etc/rc2.d
The four lines you mentioned have ben uncommented with a #-sign

Rocky 1st June 2008 18:36

Ok, maybe it's a bit different on the 64-bit system.. Anyway, do you still get errors in your mail.log after rebooting? If so, please post them here. By the way, which user is 108?


All times are GMT +2. The time now is 15:15.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.