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: samhain-client
|
---|
8 | Version: @VERSION@
|
---|
9 | Release: 5
|
---|
10 | License: GPL
|
---|
11 | Group: System Environment/Base
|
---|
12 | Source: %{name}-%{version}.tar.gz
|
---|
13 | BuildRoot: %{_tmppath}/samhain-client-%{version}-root
|
---|
14 | Packager: Andre Oliveira da Costa <brblueser@uol.com.br>
|
---|
15 | Provides: %{name}
|
---|
16 |
|
---|
17 |
|
---|
18 | %description
|
---|
19 | samhain is an open source file integrity and host-based intrusion
|
---|
20 | detection system for Linux and Unix. It can run as a daemon process, and
|
---|
21 | and thus can remember file changes -- contrary to a tool that runs from
|
---|
22 | cron, if a file is modified you will get only one report, while
|
---|
23 | subsequent checks of that file will ignore the modification as it is
|
---|
24 | already reported (unless the file is modified again).
|
---|
25 |
|
---|
26 | samhain can optionally be used as client/server system to provide
|
---|
27 | centralized monitoring for multiple host. Logging to a (MySQL or
|
---|
28 | PostgreSQL) database is supported.
|
---|
29 |
|
---|
30 | NOTE: for security reasons, if you distribute binary executables to
|
---|
31 | third parties you should point out the use of the --add-key option to
|
---|
32 | modify the key material within the executable.
|
---|
33 | This spec file is intended to facilitate installation on YOUR system.
|
---|
34 | If you use this spec file to build a SRPM for distribution to third parties,
|
---|
35 | make sure to remove the --enable-base configure option below.
|
---|
36 |
|
---|
37 | %prep
|
---|
38 | %setup -q
|
---|
39 |
|
---|
40 | %build
|
---|
41 | %if %{?_with_tests:1}%{!?_with_tests:0}
|
---|
42 | # test installation (test #7 is only included if --with gpg has been
|
---|
43 | # specified)
|
---|
44 | for i in `seq 6` %{?_with_gpg:7}; do ./test/test.sh $i; done
|
---|
45 | %endif
|
---|
46 | #
|
---|
47 | #./configure --prefix=%{_usr} \
|
---|
48 | # --sysconfdir=%{_sysconfdir} \
|
---|
49 | # --localstatedir=%{_localstatedir} \
|
---|
50 | # --mandir=%{_mandir}
|
---|
51 | #
|
---|
52 | ./configure '--enable-network=client' \
|
---|
53 | '--with-port=@myport@' \
|
---|
54 | '--with-logserver=@mylogsrv@' \
|
---|
55 | '--with-data-file=REQ_FROM_SERVER/etc/samclient.data' \
|
---|
56 | '--with-config-file=REQ_FROM_SERVER/etc/samclient.conf' \
|
---|
57 | '--with-kcheck=/boot/System.map' \
|
---|
58 | '--enable-khide=/boot/System.map' \
|
---|
59 | '--enable-suidcheck' \
|
---|
60 | '--enable-static' \
|
---|
61 | '--enable-login-watch' \
|
---|
62 | '--enable-ptrace' \
|
---|
63 | '--enable-db-reload' \
|
---|
64 | '--enable-base=@my_key_A@,@my_key_B@' \
|
---|
65 | '--enable-xml-log'
|
---|
66 |
|
---|
67 | make
|
---|
68 |
|
---|
69 | %install
|
---|
70 | rm -rf ${RPM_BUILD_ROOT}
|
---|
71 | # sstrip shouldn't be used since binaries will be stripped later
|
---|
72 | cat << EOF > sstrip
|
---|
73 | #!/bin/sh
|
---|
74 | echo "*** SSTRIP DISABLED ***"
|
---|
75 | EOF
|
---|
76 | make DESTDIR=${RPM_BUILD_ROOT} install
|
---|
77 | # copy script files to /var/lib/samhain so that we can use them right
|
---|
78 | # after the package is installed
|
---|
79 | install -m 700 samhain-install.sh init/samhain.startLinux init/samhain.startLSB ${RPM_BUILD_ROOT}/etc
|
---|
80 | install -m 640 -o 0 -g 0 samhain_kmem.ko ${RPM_BUILD_ROOT}/lib/modules/`uname -r`/samhain_kmem.ko
|
---|
81 | install -m 640 -o 0 -g 0 samhain_hide.ko ${RPM_BUILD_ROOT}/lib/modules/`uname -r`/samhain_hide.ko
|
---|
82 | install -m 700 -o 0 -g 0 samhain_setpwd ${RPM_BUILD_ROOT}/usr/local/sbin/samhain_setpwd
|
---|
83 |
|
---|
84 | %clean
|
---|
85 | rm -rf ${RPM_BUILD_ROOT}
|
---|
86 |
|
---|
87 | %post
|
---|
88 | if [ "$1" = 1 ]; then
|
---|
89 | # Activate boot-time start up
|
---|
90 | cd /etc
|
---|
91 | ./samhain-install.sh --verbose install-boot
|
---|
92 | if test -f /sbin/chkconfig; then
|
---|
93 | /sbin/chkconfig --add samhain
|
---|
94 | fi
|
---|
95 | fi
|
---|
96 | rm -rf /etc/samclient.conf
|
---|
97 | rm -rf /etc/samhain.startLinux
|
---|
98 | rm -rf /etc/samhain.startLSB
|
---|
99 |
|
---|
100 | cat << EOF
|
---|
101 |
|
---|
102 | Samhain is installed but is NOT running yet, and the database of
|
---|
103 | file signatures is NOT initialized yet. Read the documentation,
|
---|
104 | review configuration files, and then (i) initialize it
|
---|
105 | (/usr/local/sbin/samhain -t init)
|
---|
106 | and (ii) start it manually
|
---|
107 | (/usr/local/sbin/samhain start).
|
---|
108 |
|
---|
109 | It is configured to start automatically on the next boot for runlevels
|
---|
110 | [2-5].
|
---|
111 |
|
---|
112 | EOF
|
---|
113 |
|
---|
114 | %preun
|
---|
115 | # stop running instance of samhain, if any
|
---|
116 | if [ -f /var/run/%{name}.pid ]; then
|
---|
117 | /usr/local/sbin/samhain stop
|
---|
118 | fi
|
---|
119 | if [ "$1" = 0 ]; then
|
---|
120 | # remove boot-time scripts and links
|
---|
121 | cd /etc
|
---|
122 | ./samhain-install.sh --verbose uninstall-boot
|
---|
123 | fi
|
---|
124 |
|
---|
125 | %postun
|
---|
126 | if [ "$1" = 0 ]; then
|
---|
127 | # remove any kernel modules that might have been installed
|
---|
128 | RVER=`uname -r`
|
---|
129 | rm -f /lib/modules/$RVER/samhain*
|
---|
130 | fi
|
---|
131 |
|
---|
132 |
|
---|
133 | %files
|
---|
134 | %defattr(-,root,root)
|
---|
135 | %dir /var/run
|
---|
136 | %dir /var/log
|
---|
137 | #%doc docs/BUGS COPYING docs/Changelog docs/TODO
|
---|
138 | #%doc LICENSE docs/HOWTO* docs/MANUAL-2_3.* docs/README*
|
---|
139 | /etc
|
---|
140 | /usr/local/sbin/samhain
|
---|
141 | /usr/local/sbin/samhain_setpwd
|
---|
142 | /lib/modules
|
---|
143 | %attr(644,root,root) /etc/logrotate.d/@install_name@
|
---|
144 | #%attr(644,root,root) /usr/local/man/man5/samhain*
|
---|
145 | #%attr(644,root,root) /usr/local/man/man8/samhain*
|
---|
146 | #%config(noreplace) REQ_FROM_SERVER/etc/samclient.conf
|
---|
147 |
|
---|
148 | %changelog
|
---|
149 | * Thu Apr 3 2003 Rainer Wichmann <support at la-samhna dot de>
|
---|
150 | - adapt for configure
|
---|
151 |
|
---|
152 | * Wed Mar 26 2003 Philipp Stadler <philipp@stadler.priv.at>
|
---|
153 | - add samhain modules installation
|
---|
154 | - stops installation of documentation to server
|
---|
155 | - replace %config entry for /etc/samclient.conf
|
---|
156 | - remove samhain.startLinux and samhain.startLSB after installation
|
---|
157 |
|
---|
158 | * Sun Jan 12 2003 Rainer Wichmann <support at la-samhna dot de>
|
---|
159 | - replace %configure with ./configure
|
---|
160 |
|
---|
161 | * Tue Dec 24 2002 Rainer Wichmann <support at la-samhna dot de>
|
---|
162 | - backported applicable changes to samhain.spec.in
|
---|
163 | - warn user that database must be initialized
|
---|
164 | - fix version of MANUAL in '%files'
|
---|
165 | - test for chkconfig, use only if found
|
---|
166 |
|
---|
167 | * Sun Dec 22 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.7.0
|
---|
168 | - fixed typo with _usr macro on ./configure
|
---|
169 | - stops running samhain before uninstall
|
---|
170 | - implemented conditionals to allow proper uninstalls/upgrades
|
---|
171 | - 'BuildPreReq: gpg' is considered only if '--with gpg' is provided
|
---|
172 | - run 'chkconfig' to activate samhain after installation
|
---|
173 | - warn user that samhain must be manually started after
|
---|
174 | install/upgrade
|
---|
175 |
|
---|
176 | * Fri Dec 20 2002 Rainer Wichmann <support at la-samhna dot de>
|
---|
177 | - backported to samhain.spec.in (take over user's choices from configure)
|
---|
178 | - also save samhain.startLSB and samhain.startSuSE for install-boot
|
---|
179 |
|
---|
180 | * Thu Dec 19 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
181 | - optional parameters '--with gpg' and '--with tests'
|
---|
182 | - use of pre-defined macros whenever possible
|
---|
183 |
|
---|
184 | * Wed Dec 18 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
185 | - Fixed installation process, avoiding hardcoded paths on the binaries
|
---|
186 | (thks to samhain's author Rainer Wichmann)
|
---|
187 |
|
---|
188 | * Mon Dec 16 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
189 | - First attempt to build from sources
|
---|
190 |
|
---|