1 | #! /bin/sh
|
---|
2 |
|
---|
3 |
|
---|
4 | # The following two are the ANSI sequences for start and end embolden
|
---|
5 | case $TERM in
|
---|
6 | vt*|ansi*|con*|xterm*|linux*|screen*)
|
---|
7 | S=[1m
|
---|
8 | E=[m
|
---|
9 | ;;
|
---|
10 | *)
|
---|
11 | S=
|
---|
12 | E=
|
---|
13 | ;;
|
---|
14 | esac
|
---|
15 |
|
---|
16 | PW_DIR=`pwd`
|
---|
17 |
|
---|
18 | if test x$UID != x; then
|
---|
19 | TRUST="--with-trusted=0,2,$UID"
|
---|
20 | else
|
---|
21 | TRUST="--with-trusted=0,2"
|
---|
22 | fi
|
---|
23 |
|
---|
24 | echo; echo "${S}__ STARTING TEST RUN STEALTH W/GPG STANDALONE __${E}"; echo;
|
---|
25 | echo Working directory: $PW_DIR
|
---|
26 |
|
---|
27 | MAKE=`which gmake`
|
---|
28 | if test "x$?" = x1 ; then
|
---|
29 | MAKE="make -s"
|
---|
30 | else
|
---|
31 | MAKE=`which gmake | sed -e "s%\([a-z:]\) .*%\1%g"`
|
---|
32 | if test "x$MAKE" = x; then
|
---|
33 | MAKE="make -s"
|
---|
34 | elif test "x$MAKE" = xno; then
|
---|
35 | MAKE="make -s"
|
---|
36 | else
|
---|
37 | if test "x$MAKE" = "xwhich:"; then
|
---|
38 | MAKE="make -s"
|
---|
39 | else
|
---|
40 | MAKE="gmake -s"
|
---|
41 | gmake -v >/dev/null 2>&1 || MAKE="make -s"
|
---|
42 | fi
|
---|
43 | fi
|
---|
44 | fi
|
---|
45 | echo MAKE is $MAKE
|
---|
46 |
|
---|
47 | # $GPG_PATH _must_ be an absolute path
|
---|
48 | #
|
---|
49 | if test x${GPG_PATH} = x; then
|
---|
50 | GPG_PATH=`which gpg | sed -e "s%\([a-z:]\) .*%\1%g"`
|
---|
51 | fi
|
---|
52 |
|
---|
53 | if test x${GPG_PATH} = x; then
|
---|
54 | echo "ERROR: gpg (GnuPG) not found"
|
---|
55 | exit
|
---|
56 | else
|
---|
57 | GPG_OK=`echo ${GPG_PATH} | sed -e "s%\(/.*\)%OK%g"`
|
---|
58 | if test x${GPG_OK} = xOK; then
|
---|
59 | echo "GPG_PATH is ${GPG_PATH}"
|
---|
60 | else
|
---|
61 | echo "ERROR: GPG_PATH (${GPG_PATH}) is _not_ an absolute path."
|
---|
62 | echo
|
---|
63 | echo " Apparently the command 'which gpg' did not yield an absolute path."
|
---|
64 | echo " You can fix the problem by setting the environment variable GPG_PATH"
|
---|
65 | echo " to the absolute path to gpg (GnuPG) and start the test again."
|
---|
66 | exit
|
---|
67 | fi
|
---|
68 | fi
|
---|
69 |
|
---|
70 | echo
|
---|
71 |
|
---|
72 | testrun1 ()
|
---|
73 | {
|
---|
74 | #
|
---|
75 | # test standalone compilation
|
---|
76 | #
|
---|
77 | echo "${S}Building standalone agent${E}"; echo;
|
---|
78 | #
|
---|
79 | if test -r "Makefile"; then
|
---|
80 | $MAKE distclean
|
---|
81 | fi
|
---|
82 | #
|
---|
83 | GPG_HASH=`${GPG_PATH} --load-extension tiger --print-md TIGER192 ${GPG_PATH}`
|
---|
84 | #
|
---|
85 | echo GPG_HASH is ${GPG_HASH}
|
---|
86 | #
|
---|
87 | ${TOP_SRCDIR}/configure --quiet $TRUST --enable-debug --with-gpg=${GPG_PATH} --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/testrc_1.signed --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file
|
---|
88 | #
|
---|
89 | # --with-prelude --enable-xml-log
|
---|
90 | # --with-checksum="${GPG_HASH}"
|
---|
91 | #
|
---|
92 | if test x$? = x0; then
|
---|
93 | echo "configure completed, exit status 0"; echo;
|
---|
94 | $MAKE > /dev/null
|
---|
95 | if test x$? = x0; then
|
---|
96 | echo "$MAKE completed, exit status $?"; echo;
|
---|
97 | else
|
---|
98 | echo "${S}ERROR:${E} make failed, exit status $?"; echo;
|
---|
99 | exit
|
---|
100 | fi
|
---|
101 |
|
---|
102 | else
|
---|
103 | echo "${S}ERROR:${E} configure failed, exit status $?"; echo;
|
---|
104 | exit
|
---|
105 | fi
|
---|
106 |
|
---|
107 | cp $PW_DIR/test/testrc_1 $PW_DIR/testrc_1.signed
|
---|
108 | echo "--- You need to sign the config file testrc_1.signed now ---"
|
---|
109 | echo
|
---|
110 | ${GPG_PATH} -a --clearsign $PW_DIR/testrc_1.signed
|
---|
111 | mv $PW_DIR/testrc_1.signed.asc $PW_DIR/testrc_1.signed
|
---|
112 |
|
---|
113 | rm -f ./.samhain_file
|
---|
114 | rm -f ./.samhain_log
|
---|
115 | rm -f ./.samhain_lock
|
---|
116 |
|
---|
117 | ./samhain -t init
|
---|
118 |
|
---|
119 | if test x$? = x0; then
|
---|
120 |
|
---|
121 | echo
|
---|
122 | echo "--- You need to sign the database .samhain_file now ---"
|
---|
123 | echo
|
---|
124 | ${GPG_PATH} -a --clearsign --not-dash-escaped $PW_DIR/.samhain_file
|
---|
125 | mv $PW_DIR/.samhain_file.asc $PW_DIR/.samhain_file
|
---|
126 |
|
---|
127 | ./samhain -t check
|
---|
128 | if test x$? = x0; then
|
---|
129 | echo "${S}check completed${E}"
|
---|
130 | else
|
---|
131 | echo "${S}ERROR:${E} -- check -- failed, exit status $?"
|
---|
132 | echo
|
---|
133 | exit
|
---|
134 | fi
|
---|
135 | else
|
---|
136 | echo "${S}ERROR:${E} -- init -- failed, exit status $?"; echo;
|
---|
137 | exit
|
---|
138 | fi
|
---|
139 |
|
---|
140 | }
|
---|
141 |
|
---|
142 |
|
---|
143 |
|
---|
144 | testrun1
|
---|
145 |
|
---|
146 |
|
---|
147 | echo; echo "${S}__ END TEST RUN STANDALONE __${E}"; echo;
|
---|
148 |
|
---|
149 | exit
|
---|
150 |
|
---|