#! /bin/sh SERVER_BUILDOPTS="--quiet $TRUST --enable-xml-log --enable-debug --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST} --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-database=postgresql"; export SERVER_BUILDOPTS CLIENT_BUILDOPTS="--quiet $TRUST --prefix=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS check_psql_log () { DATE="$1" rm -f test_log_db PGPASSWORD=samhain; export PGPASSWORD psql -U samhain -d samhain -c "SELECT * FROM log WHERE entry_status = 'NEW' and log_time > '${DATE}';" >test_log_db # egrep "START.*Yule" test_log_db >/dev/null 2>&1 if [ $? -ne 0 ]; then [ -z "$verbose" ] || log_msg_fail "Server start"; return 1 fi egrep "NEW CLIENT" test_log_db >/dev/null 2>&1 if [ $? -ne 0 ]; then [ -z "$verbose" ] || log_msg_fail "Client connect"; return 1 fi egrep "Checking.*/bin" test_log_db >/dev/null 2>&1 if [ $? -ne 0 ]; then [ -z "$verbose" ] || log_msg_fail "Client file check"; return 1 fi egrep "EXIT.*Samhain" test_log_db >/dev/null 2>&1 if [ $? -ne 0 ]; then [ -z "$verbose" ] || log_msg_fail "Client exit"; return 1 fi egrep "EXIT.*Yule.*SIGTERM" test_log_db >/dev/null 2>&1 if [ $? -ne 0 ]; then [ -z "$verbose" ] || log_msg_fail "Server exit"; return 1 fi return 0 } MAXTEST=1; export MAXTEST testrun2d () { log_start "RUN FULL CLIENT/SERVER W/POSTGRESQL" # if [ -z "$doall" ]; then log_skip 1 $MAXTEST 'Client/server w/postgresql (or use --really-all)' return 0 fi if [ x"$1" = x ]; then [ -z "$quiet" ] && log_msg_fail "Missing hostname" fi PSQL=`find_path psql` if [ -z "$PSQL" ]; then log_skip 1 $MAXTEST "psql not found"; return 1 else PGPASSWORD="samhain"; export PGPASSWORD TEST=`psql -U samhain -d samhain -c "SELECT * FROM log LIMIT 1;" 2>/dev/null` if [ $? -ne 0 -o -z "$TEST" ]; then log_skip 1 $MAXTEST "psql not default setup" return 1 fi fi # SH_LOCALHOST=$1; export SH_LOCALHOST # DATE=`date '+%Y-%m-%d %T'` # testrun2a_internal # ORIGINAL="DatabaseSeverity=none" REPLACEMENT="DatabaseSeverity=info" ex $RCFILE <