Changeset 27 for trunk/test/testrun_2.sh


Ignore:
Timestamp:
Apr 6, 2006, 8:55:51 PM (18 years ago)
Author:
rainer
Message:

Support for server-to-server relay and more user policies

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/testrun_2.sh

    r22 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
     
    1635        rm -f test_log_valgrind
    1736
    18         ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
     37        ${VALGRIND} ./yule.2 -l info -p none >/dev/null 2>>test_log_valgrind &
     38        PROC_Y2=$!
     39        sleep 5
     40
     41        [ -z "$verbose" ] || {
     42            echo;
     43            echo "${S}Start Server #2${E}: ./yule.2 -l info -p none &";
     44            echo;
     45        }
     46
     47        ${VALGRIND} ./yule -l info -p none -e info --bind-address=127.0.0.1 \
     48            --server-port=49778 >/dev/null 2>>test_log_valgrind &
    1949        PROC_Y=$!
    2050        sleep 5
     
    3262            [ -z "$quiet" ]   && log_msg_fail  "samhain.new -t check";
    3363            kill $PROC_Y
     64            kill $PROC_Y2
    3465            return 1
    3566        fi
    3667
    3768        kill $PROC_Y
    38         sleep 5
     69        kill $PROC_Y2
     70        sleep 5
     71
     72        # cp ${LOGFILE}  triple_test
     73        # cp ${LOGFILE}2 triple_test_2
     74
     75        egrep "START(>|\").*Yule(>|\")" ${LOGFILE}2 >/dev/null 2>&1
     76        if [ $? -ne 0 ]; then
     77            [ -z "$verbose" ] || log_msg_fail "Server #2 start";
     78            return 1
     79        fi
     80        egrep "remote_host.*Checking.*/bin" ${LOGFILE}2 >/dev/null 2>&1
     81        if [ $? -ne 0 ]; then
     82            [ -z "$verbose" ] || log_msg_fail "Client file check (relayed)";
     83            return 1
     84        fi
     85        egrep "remote_host.*EXIT.*Samhain" ${LOGFILE}2 >/dev/null 2>&1
     86        if [ $? -ne 0 ]; then
     87            [ -z "$verbose" ] || log_msg_fail "Client exit (relayed)";
     88            return 1
     89        fi
     90        egrep "EXIT.*Yule.*SIGTERM" ${LOGFILE}2 >/dev/null 2>&1
     91        if [ $? -ne 0 ]; then
     92            [ -z "$verbose" ] || log_msg_fail "Server #2 exit";
     93            return 1
     94        fi
     95
    3996
    4097        egrep "START(>|\").*Yule(>|\")" $LOGFILE >/dev/null 2>&1
     
    195252        rm -f test_log_valgrind
    196253
    197         ${VALGRIND} ./yule -p none >/dev/null 2>>test_log_valgrind &
     254        ${VALGRIND} ./yule -p none -e none >/dev/null 2>>test_log_valgrind &
    198255        PROC_Y=$!
    199256        sleep 5
     
    292349        rm -f test_log_valgrind
    293350
    294         ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
     351        ${VALGRIND} ./yule -l info -p none -e none \
     352            >/dev/null 2>>test_log_valgrind &
    295353        PROC_Y=$!
    296354        sleep 5
     
    427485) >entry.html
    428486
    429         ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
     487        ${VALGRIND} ./yule -l info -p none -e none \
     488            >/dev/null 2>>test_log_valgrind &
    430489        PROC_Y=$!
    431490        sleep 5
    432491
    433492        egrep '<!-- head -->' $HTML >/dev/null 2>&1
     493        if [ $? -ne 0 ]; then
     494            # rm -f head.html; rm -f foot.html; rm -f entry.html;
     495            kill $PROC_Y
     496            [ -z "$verbose" ] || log_msg_fail "head.html (1)";
     497            return 1
     498        fi
     499
     500        egrep '<!-- foot -->' $HTML >/dev/null 2>&1
    434501        if [ $? -ne 0 ]; then
    435502            rm -f head.html; rm -f foot.html; rm -f entry.html;
    436503            kill $PROC_Y
    437             [ -z "$verbose" ] || log_msg_fail "head.html";
    438             return 1
    439         fi
    440 
    441         egrep '<!-- foot -->' $HTML >/dev/null 2>&1
    442         if [ $? -ne 0 ]; then
    443             rm -f head.html; rm -f foot.html; rm -f entry.html;
    444             kill $PROC_Y
    445             [ -z "$verbose" ] || log_msg_fail "foot.html";
     504            [ -z "$verbose" ] || log_msg_fail "foot.html (1)";
    446505            return 1
    447506        fi
     
    500559        egrep '<!-- ehead -->' $HTML >/dev/null 2>&1
    501560        if [ $? -ne 0 ]; then
    502             [ -z "$verbose" ] || log_msg_fail "head.html";
     561            [ -z "$verbose" ] || log_msg_fail "end head.html";
    503562            return 1
    504563        fi
     
    511570        egrep '<!-- eentry -->' $HTML >/dev/null 2>&1
    512571        if [ $? -ne 0 ]; then
    513             [ -z "$verbose" ] || log_msg_fail "entry.html";
     572            [ -z "$verbose" ] || log_msg_fail "end entry.html";
    514573            return 1
    515574        fi
     
    522581        egrep '<!-- efoot -->' $HTML >/dev/null 2>&1
    523582        if [ $? -ne 0 ]; then
    524             [ -z "$verbose" ] || log_msg_fail "foot.html";
     583            [ -z "$verbose" ] || log_msg_fail "end foot.html";
    525584            return 1
    526585        fi
     
    571630        fi
    572631
    573         # save binary and build server
     632        # save binary and build server2
    574633        #
    575634        cp samhain samhain.build || return 1
    576635        make clean >/dev/null || return 1
    577636
    578         ${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=server  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --with-html-file=$HTML --enable-encrypt=2
     637        ${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=server  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=${RCFILE}2  --with-log-file=${LOGFILE}2 --with-pid-file=$PW_DIR/.samhain_lock2 --with-html-file=${HTML}2 --with-state-dir=$PW_DIR --enable-encrypt=2 --with-port=49778
    579638        #
    580639        if test x$? = x0; then
     
    593652        fi
    594653
     654        # save binary and build server
     655        #
     656        cp yule yule.2 || return 1
     657        make clean >/dev/null || return 1
     658
     659        ${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=server  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-html-file=$HTML --with-state-dir=$PW_DIR --enable-encrypt=2
     660        #
     661        if test x$? = x0; then
     662                [ -z "$verbose" ] ||     log_msg_ok "configure...";
     663                $MAKE  > /dev/null 2>>test_log
     664                if test x$? = x0; then
     665                    [ -z "$verbose" ] || log_msg_ok "make...";
     666                else
     667                    [ -z "$quiet" ] &&   log_msg_fail "make...";
     668                    return 1
     669                fi
     670
     671        else
     672                [ -z "$quiet" ] &&       log_msg_fail "configure...";
     673                return 1
     674        fi
     675
    595676
    596677        #####################################################################
     
    633714        mv samhain.build.new  samhain.new || return 1
    634715
    635         rm -f ./.samhain_log.*
    636         rm -f ./.samhain_lock
     716        # Set in server
     717
     718        ./samhain_setpwd yule new $SHPW >/dev/null
     719
     720        if test x$? = x0; then
     721            [ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd yule new $SHPW";
     722        else
     723            [ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd yule new $SHPW";
     724            return 1
     725        fi
     726
     727        mv yule.new yule || return 1
     728
     729        #
     730
     731        rm -f ./.samhain_log*
     732        rm -f ./.samhain_lock*
    637733
    638734        SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
     
    646742
    647743        echo $SHCLT >> testrc_2
     744        cp testrc_2 testrc_22
    648745
    649746        do_test_1
Note: See TracChangeset for help on using the changeset viewer.