1 | #
|
---|
2 | # Accepted parameters for 'rpmbuild':
|
---|
3 | #
|
---|
4 | # --with tests - make tests before building
|
---|
5 |
|
---|
6 | Summary: File integrity and host-based IDS
|
---|
7 | Name: @install_name@
|
---|
8 | Version: @VERSION@
|
---|
9 | Release: 1
|
---|
10 | License: GPL
|
---|
11 | Group: System Environment/Base
|
---|
12 | Source: samhain-%{version}.tar.gz
|
---|
13 | BuildRoot: %{_tmppath}/samhain-%{version}-root
|
---|
14 | Packager: Andre Oliveira da Costa <brblueser@uol.com.br>
|
---|
15 | Provides: %{name}
|
---|
16 |
|
---|
17 | # no quotes here - aparently will be expanded literally
|
---|
18 |
|
---|
19 | %define withpwd_prg x@clmytclient@
|
---|
20 | %define withstg_prg x@stegin_prg@
|
---|
21 |
|
---|
22 | # disable automatic stripping of binaries upon installation
|
---|
23 | %define __spec_install_post %{nil}
|
---|
24 | # required because DeadRat wants to package some debug info otherwise
|
---|
25 | # (this debug info would be created by debug_install_post called
|
---|
26 | # from spec_install_post)
|
---|
27 | %define debug_package %{nil}
|
---|
28 | # Use internal dependency generator rather than external helpers?
|
---|
29 | %define _use_internal_dependency_generator 0
|
---|
30 |
|
---|
31 | %description
|
---|
32 | @install_name@ is an open source file integrity and host-based intrusion
|
---|
33 | detection system for Linux and Unix. It can run as a daemon process, and
|
---|
34 | and thus can remember file changes -- contrary to a tool that runs from
|
---|
35 | cron, if a file is modified you will get only one report, while
|
---|
36 | subsequent checks of that file will ignore the modification as it is
|
---|
37 | already reported (unless the file is modified again).
|
---|
38 |
|
---|
39 | @install_name@ can optionally be used as client/server system to provide
|
---|
40 | centralized monitoring for multiple host. Logging to a (MySQL or
|
---|
41 | PostgreSQL) database is supported.
|
---|
42 |
|
---|
43 | NOTE: for security reasons, if you distribute binary executables to
|
---|
44 | third parties you should point out the use of the --add-key option to
|
---|
45 | modify the key material within the executable.
|
---|
46 | This spec file is intended to facilitate installation on YOUR system.
|
---|
47 | If you use this spec file to build a SRPM for distribution to third parties,
|
---|
48 | make sure to remove the --enable-base configure option below.
|
---|
49 |
|
---|
50 | %prep
|
---|
51 | %setup -q -n samhain-%{version}
|
---|
52 |
|
---|
53 | %build
|
---|
54 | %if %{?_with_tests:1}%{!?_with_tests:0}
|
---|
55 | # test installation (test #7 is only included if --with gpg has been
|
---|
56 | # specified)
|
---|
57 | for i in `seq 6` %{?_with_gpg:7}; do ./test/test.sh $i; done
|
---|
58 | %endif
|
---|
59 | #
|
---|
60 | # configure with the user-supplied arguments to './configure'
|
---|
61 | #
|
---|
62 | ./configure @mydefargs@
|
---|
63 | make
|
---|
64 |
|
---|
65 | %install
|
---|
66 |
|
---|
67 | rm -rf ${RPM_BUILD_ROOT}
|
---|
68 | # sstrip shouldn't be used since binaries will be stripped later
|
---|
69 | ## cat << EOF > sstrip
|
---|
70 | ## #!/bin/sh
|
---|
71 | ## echo "*** SSTRIP DISABLED ***"
|
---|
72 | ## EOF
|
---|
73 | make DESTDIR=${RPM_BUILD_ROOT} install
|
---|
74 | # copy script files to /var/lib/samhain so that we can use them right
|
---|
75 | # after the package is installed
|
---|
76 | #
|
---|
77 | install -m 700 samhain-install.sh init/samhain.startLinux init/samhain.startLSB ${RPM_BUILD_ROOT}@mydataroot@
|
---|
78 | #
|
---|
79 | # file list (helpful advice from Lars Kellogg-Stedman)
|
---|
80 | #
|
---|
81 | echo "@sbindir@/@install_name@" > sh_file_list
|
---|
82 | find %{buildroot}/lib/modules \! -type d -print | \
|
---|
83 | sed 's,%{buildroot},,' >> sh_file_list
|
---|
84 |
|
---|
85 | %clean
|
---|
86 | rm -rf ${RPM_BUILD_ROOT}
|
---|
87 |
|
---|
88 | %post
|
---|
89 | if test "x@sh_lkm@" = x; then
|
---|
90 | :
|
---|
91 | else
|
---|
92 | if test -f /sbin/depmod; then
|
---|
93 | /sbin/depmod -a
|
---|
94 | fi
|
---|
95 | fi
|
---|
96 | if [ "$1" -ge 1 ]; then
|
---|
97 | # Activate boot-time start up
|
---|
98 | cd @mydataroot@
|
---|
99 | ./samhain-install.sh --verbose install-boot
|
---|
100 | rm -f ./samhain.startLSB
|
---|
101 | rm -f ./samhain.startLinux
|
---|
102 | if [ -f @sbindir@/@install_name@_stealth ]; then
|
---|
103 | rm -f samhain-install.sh
|
---|
104 | fi
|
---|
105 | shkeep=yes
|
---|
106 | if test x"$shkeep" = xno; then
|
---|
107 | rm -f ./samhain-install.sh
|
---|
108 | rm -f @sbindir@/@install_name@_stealth
|
---|
109 | fi
|
---|
110 | fi
|
---|
111 | if [ "$1" = 1 ]; then
|
---|
112 | if test -f /usr/lib/lsb/install_initd; then
|
---|
113 | /usr/lib/lsb/install_initd /etc/init.d/@install_name@
|
---|
114 | fi
|
---|
115 | fi
|
---|
116 |
|
---|
117 | %if "%{name}" != "yule"
|
---|
118 | cat << EOF
|
---|
119 |
|
---|
120 | Samhain is installed but is NOT running yet, and the database of
|
---|
121 | file signatures is NOT initialized yet. Read the documentation,
|
---|
122 | review configuration files, and then (i) initialize it
|
---|
123 | (@sbindir@/samhain -t init)
|
---|
124 | and (ii) start it manually
|
---|
125 | (@sbindir@/samhain start).
|
---|
126 |
|
---|
127 | It is configured to start automatically on the next boot for runlevels
|
---|
128 | [2-5].
|
---|
129 |
|
---|
130 | EOF
|
---|
131 | %endif
|
---|
132 | %if "%{name}" == "yule"
|
---|
133 | cat << EOF
|
---|
134 |
|
---|
135 | Yule is installed but is NOT running yet, read the documentation,
|
---|
136 | review configuration files, and then start it
|
---|
137 | (@sbindir@/yule)
|
---|
138 |
|
---|
139 | It is configured to start automatically on the next boot for runlevels
|
---|
140 | [2-5].
|
---|
141 |
|
---|
142 | EOF
|
---|
143 | %endif
|
---|
144 |
|
---|
145 | %preun
|
---|
146 | # stop running instance of samhain, if any
|
---|
147 | if [ -f @mylockdir@/%{name}.pid ]; then
|
---|
148 | @sbindir@/@install_name@ stop
|
---|
149 | fi
|
---|
150 | if [ "$1" = 0 ]; then
|
---|
151 | # remove boot-time scripts and links
|
---|
152 | cd @mydataroot@
|
---|
153 | if [ -f ./samhain-install.sh ]; then
|
---|
154 | ./samhain-install.sh --verbose uninstall-boot
|
---|
155 | else
|
---|
156 | if test -f /usr/lib/lsb/remove_initd; then
|
---|
157 | /usr/lib/lsb/remove_initd /etc/init.d/@install_name@
|
---|
158 | fi
|
---|
159 | rm -f /etc/init.d/@install_name@
|
---|
160 | fi
|
---|
161 | fi
|
---|
162 |
|
---|
163 | %postun
|
---|
164 | if [ "$1" = 0 ]; then
|
---|
165 | # remove any kernel modules that might have been installed
|
---|
166 | RVER=`uname -r`
|
---|
167 | MODFILES=`ls /lib/modules/$RVER/@install_name@* 2>/dev/null`
|
---|
168 | if test "x$MODFILES" = x; then
|
---|
169 | :
|
---|
170 | else
|
---|
171 | rm -f /lib/modules/$RVER/@install_name@*
|
---|
172 | fi
|
---|
173 | fi
|
---|
174 |
|
---|
175 |
|
---|
176 | %files -f sh_file_list
|
---|
177 | %defattr(-,root,root)
|
---|
178 | %dir @mylockdir@
|
---|
179 | %dir @mylogdir@
|
---|
180 | %doc docs/BUGS COPYING docs/Changelog docs/TODO
|
---|
181 | %doc LICENSE docs/FAQ.html docs/HOWTO* docs/MANUAL-2_3.* docs/README*
|
---|
182 | @mydataroot@
|
---|
183 | %if "%{withstg_prg}" == "xsamhain_stealth"
|
---|
184 | @sbindir@/@install_name@_stealth
|
---|
185 | %endif
|
---|
186 | %if "%{withpwd_prg}" == "xDSH_WITH_CLIENT"
|
---|
187 | @sbindir@/@install_name@_setpwd
|
---|
188 | %endif
|
---|
189 | %if "%{withpwd_prg}" == "xDSH_WITH_SERVER"
|
---|
190 | @sbindir@/@install_name@ctl
|
---|
191 | %exclude @sbindir@/@install_name@_setpwd
|
---|
192 | %endif
|
---|
193 | %attr(644,root,root) @mandir@/man5/@install_name@*
|
---|
194 | %attr(644,root,root) @mandir@/man8/@install_name@*
|
---|
195 | %config(noreplace) @myrpmconffile@
|
---|
196 |
|
---|
197 | %changelog
|
---|
198 | * Tue May 16 2006 Rainer Wichmann
|
---|
199 | - fix manual version, noticed by Imre Gergely
|
---|
200 |
|
---|
201 | * Tue Apr 05 2005 Rainer Wichmann
|
---|
202 | - disable automatic stripping, use sstrip
|
---|
203 |
|
---|
204 | * Thu Mar 17 2005 Rainer Wichmann
|
---|
205 | - fixes for enable-khide
|
---|
206 |
|
---|
207 | * Wed Oct 20 2004 Rainer Wichmann
|
---|
208 | - more fixes for client/server detection
|
---|
209 | - fix for samhain_stealth
|
---|
210 |
|
---|
211 | * Sun Aug 15 2004 Rainer Wichmann
|
---|
212 | - fix detection of client/server
|
---|
213 |
|
---|
214 | * Sat Jun 19 2004 Rainer Wichmann
|
---|
215 | - replace ./test.sh $i with make test$i
|
---|
216 | - add logic for rpm-light (remove some more files after install)
|
---|
217 | - make postun posix compliant (avoid empty argument list for rm -f)
|
---|
218 |
|
---|
219 | * Wed Dec 31 2003 Stijn Jonker <sjcjonker@sjc.nl>
|
---|
220 | - Fixed correctly build of yule-*-rpm
|
---|
221 | - Fixed excluding of yule_setpwd, and including of yulectl on yule build
|
---|
222 | - Fixed including of samhain_setpwd in samhain client build
|
---|
223 | - Above changes required for correct build in newer rpms,
|
---|
224 | with defaults for abort on unpacked files due to
|
---|
225 | %_unpackaged_files_terminate_build 1 setting
|
---|
226 | - Fixed installation text for yule, not to display samhain text
|
---|
227 | - Added /sbin/chkconfig install_name on to enable the rc scripts
|
---|
228 |
|
---|
229 | * Thu Dec 11 2003 Christian Vanguers <cva at molis dot be>
|
---|
230 | - Fixed typo in samhain.spec
|
---|
231 | - Compiled on RedHat Enterprise Linux ES 3
|
---|
232 |
|
---|
233 | * Thu Mar 26 2003 Rainer Wichmann
|
---|
234 | - strip REQ_FROM_SERVER in config file path (%config(noreplace) ...)
|
---|
235 |
|
---|
236 | * Sun Jan 12 2003 Rainer Wichmann <support at la-samhna dot de>
|
---|
237 | - replace %configure with ./configure
|
---|
238 |
|
---|
239 | * Tue Dec 24 2002 Rainer Wichmann <support at la-samhna dot de>
|
---|
240 | - backported applicable changes to samhain.spec.in
|
---|
241 | - warn user that database must be initialized
|
---|
242 | - fix version of MANUAL in '%files'
|
---|
243 | - test for chkconfig, use only if found
|
---|
244 |
|
---|
245 | * Sun Dec 22 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.7.0
|
---|
246 | - fixed typo with _usr macro on ./configure
|
---|
247 | - stops running samhain before uninstall
|
---|
248 | - implemented conditionals to allow proper uninstalls/upgrades
|
---|
249 | - 'BuildPreReq: gpg' is considered only if '--with gpg' is provided
|
---|
250 | - run 'chkconfig' to activate samhain after installation
|
---|
251 | - warn user that samhain must be manually started after
|
---|
252 | install/upgrade
|
---|
253 |
|
---|
254 | * Fri Dec 20 2002 Rainer Wichmann <support at la-samhna dot de>
|
---|
255 | - backported to samhain.spec.in (take over user's choices from configure)
|
---|
256 | - also save samhain.startLSB and samhain.startSuSE for install-boot
|
---|
257 |
|
---|
258 | * Thu Dec 19 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
259 | - optional parameters '--with gpg' and '--with tests'
|
---|
260 | - use of pre-defined macros whenever possible
|
---|
261 |
|
---|
262 | * Wed Dec 18 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
263 | - Fixed installation process, avoiding hardcoded paths on the binaries
|
---|
264 | (thks to samhain's author Rainer Wichmann)
|
---|
265 |
|
---|
266 | * Mon Dec 16 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
267 | - First attempt to build from sources
|
---|
268 |
|
---|