Errors after following The Perfect SpamSnake (Ubuntu 8.04)

Discussion in 'HOWTO-Related Questions' started by hvrossum, Jun 1, 2008.

  1. hvrossum

    hvrossum New Member

    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
     
  2. Rocky

    Rocky Member

    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
     
    Last edited: Jun 1, 2008
  3. hvrossum

    hvrossum New Member

    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
     
    Last edited: Jun 1, 2008
  4. Rocky

    Rocky Member

    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.
     
  5. hvrossum

    hvrossum New Member

    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)
     
  6. Rocky

    Rocky Member

    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
     
  7. hvrossum

    hvrossum New Member

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

    Rocky Member

    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 <[EMAIL="[email protected]"][email protected][/EMAIL]>
    # 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))
    [B]#[/B]check_dir /var/spool/MailScanner       ${user:-mail} ${group:-mail}
    [B]#[/B]check_dir /var/lib/MailScanner         ${user:-mail} ${group:-mail}
    [B]#[/B]check_dir /var/run/MailScanner         ${user:-mail} ${group:-mail}
    [B]#[/B]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
    
     
  9. hvrossum

    hvrossum New Member

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

    Rocky Member

    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?
     
  11. hvrossum

    hvrossum New Member

    research on errors learns me this
    /var/spool/mqueue is not owned by user 108 !

    user 108 does not exist. the dir is owned by user root en group root

    Could not read directory /var/lock/subsys/MailScanner
    This directory does not exist (in subsys I only have bastille-firewall as a sub dir) and I can;t add the directory ,even though I did the su command
     
  12. hvrossum

    hvrossum New Member

    Last error is /var/spool/mqueue is not owned by user 108

    I changed the conf file so that the other error is gone as the directory it was point to did not exists.

    In webmin I can look at Mailscanner but it says it is not running, when trying to start it it doesnot change.

    strange!!
     
  13. hvrossum

    hvrossum New Member

    I changed the owner and grp of the mentioned queue to postfix

    (stop mailscanner before you try this)

    Now I get the error

    Could not test file ownership abilities on /var/lock/subsys/MailScanner.ownertest.18545, please delete the file

    The file can't be found in this dir. hmmm??
     
  14. Rocky

    Rocky Member

    Harry,

    Have you disabled apparmor? Also, do the following and your system should create the missing directories at boot up with the proper permissions.

    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:postfix /var/run/MailScanner
    chown -R postfix:postfix /var/lock/subsys/MailScanner
    /etc/init.d/postfix restart
    /etc/init.d/mailscanner restart
    
    After you've done that, reboot your system and see what happens. If you're still getting errors, please post them here.
     
  15. hvrossum

    hvrossum New Member

    Hi Rocky

    I did both disables apprmor and put the lins in the etc/rc.local file.

    Reboot

    Jun 2 14:01:47 ubuntu freshclam[6723]: See the FAQ at http://www.clamav.net/support/faq for an explanation.
    Jun 2 14:01:47 ubuntu freshclam[6723]: Your ClamAV installation is OUTDATED!
    Jun 2 14:01:47 ubuntu freshclam[6723]: Local version: 0.91.2 Recommended version: 0.93
    Jun 2 14:01:47 ubuntu freshclam[6723]: DON'T PANIC! Read http://www.clamav.net/support/faq
    Jun 2 14:01:47 ubuntu freshclam[6723]: main.inc is up to date (version: 46, sigs: 231834, f-level: 26, builder: sven)
    Jun 2 14:01:47 ubuntu freshclam[6723]: daily.inc is up to date (version: 7321, sigs: 75070, f-level: 26, builder: ccordes)
    Jun 2 14:01:47 ubuntu freshclam[6723]: --------------------------------------


    All error messages seem to have solved.

    Now I still need to get Imap back up, can't connect. And telnet is also still disconnecting
     
  16. Rocky

    Rocky Member

    Ok, so is postfix working or are you still getting errors in your mail.log? Don't worry about the clamav messages.
     
  17. mdumdei

    mdumdei New Member

    I had that problem trying to load it on an 8.04 jeos setup. I didn't comment out the 1st and 4th check_dir lines and instead changed the user and group to 'postfix' and 'www-data' and the set the MailScanner.conf 'Run as Group' to 'www-data' as well. That fixed the missing /var/lock/subsys/MailScanner problem and both MailScanner and postfix start without errors now. I'm not completely finished with the rest of Rocky's setup so not totally sure I didn't break something else with the Run As Group change but don't think so. Rocky would probably know. I also edited the init.d version of mailscanner rather than going at it through the S20 link under /etc/rc2.d -- same difference. So far that's the only snag I hit -- good instructions!
     
  18. Rocky

    Rocky Member

    Glad to hear!

    The Run As Group was left as postfix for those users who opt not to install MailWatch. It should not be a problem at all to change it to www-data.

    mdumdei, I'm assuming you didn't have to do certain steps, but can you fill me in? I'll update the guide with them to save people some time when installing.

    Rocky
     
  19. mdumdei

    mdumdei New Member

    jeos doesn't load apparmor so I didn't have to take that out. Other than that, I think it I followed everything else as written for 8.04 server -- other than the modifying the check_dirs instead of commenting them. That eliminated the need to load anything into rc.local.

    I have a question now though. I'm working on the do_message_ops.php code and hit the line:

    if ($quarantined=quarantine_list_items($id,RPC_ONLY)) {
    ...

    Is that a single '=' there like the if is evaluating for a non-zero value from quarantine_list_items (how it is now) or a double == for a compare?? I looked around in the forum and saw no complaints so am assuming it is correct as is.
     
  20. Rocky

    Rocky Member

    This is exactly what I have:
    Code:
     if($quarantined = quarantine_list_items($id,RPC_ONLY)) {
     

Share This Page