[1] | 1 | #
|
---|
| 2 | # Accepted parameters for 'rpmbuild':
|
---|
| 3 | #
|
---|
| 4 | # --with gpg - enables gpg support
|
---|
| 5 | # --with tests - make tests before building
|
---|
| 6 |
|
---|
| 7 | Summary: File integrity and host-based IDS
|
---|
| 8 | Name: samhain
|
---|
| 9 | Version: @VERSION@
|
---|
| 10 | Release: 1
|
---|
| 11 | License: GPL
|
---|
| 12 | Group: System Environment/Base
|
---|
| 13 | Source: %{name}-%{version}.tar.gz
|
---|
| 14 | BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
---|
| 15 | Packager: Andre Oliveira da Costa <brblueser@uol.com.br>
|
---|
| 16 | Provides: %{name}
|
---|
| 17 | %if %{?_with_gpg:1}%{!?_with_gpg:0}
|
---|
| 18 | BuildPreReq: gpg
|
---|
| 19 | %endif
|
---|
| 20 |
|
---|
| 21 | %description
|
---|
| 22 | samhain is an open source file integrity and host-based intrusion
|
---|
| 23 | detection system for Linux and Unix. It can run as a daemon process, and
|
---|
| 24 | and thus can remember file changes -- contrary to a tool that runs from
|
---|
| 25 | cron, if a file is modified you will get only one report, while
|
---|
| 26 | subsequent checks of that file will ignore the modification as it is
|
---|
| 27 | already reported (unless the file is modified again).
|
---|
| 28 |
|
---|
| 29 | samhain can optionally be used as client/server system to provide
|
---|
| 30 | centralized monitoring for multiple host. Logging to a (MySQL or
|
---|
| 31 | PostgreSQL) database is supported.
|
---|
| 32 |
|
---|
| 33 | This package contains only the single host version.
|
---|
| 34 |
|
---|
| 35 | %prep
|
---|
| 36 | %setup -q -n samhain-%{version}
|
---|
| 37 |
|
---|
| 38 | %build
|
---|
| 39 | %if %{?_with_tests:1}%{!?_with_tests:0}
|
---|
| 40 | # test installation (test #7 is only included if --with gpg has been
|
---|
| 41 | # specified)
|
---|
| 42 | for i in `seq 6` %{?_with_gpg:7}; do ./test/test.sh $i; done
|
---|
| 43 | %endif
|
---|
| 44 | ./configure --prefix=%{_usr} \
|
---|
| 45 | --sbindir=%{_sbindir} \
|
---|
| 46 | --sysconfdir=%{_sysconfdir} \
|
---|
| 47 | --localstatedir=%{_localstatedir} \
|
---|
| 48 | --mandir=%{_mandir} \
|
---|
| 49 | %{?_with_gpg: --with-gpg=`type -p gpg`}
|
---|
| 50 |
|
---|
| 51 | make
|
---|
| 52 |
|
---|
| 53 | %install
|
---|
| 54 | rm -rf $RPM_BUILD_ROOT
|
---|
| 55 | # sstrip shouldn't be used since binaries will be stripped later
|
---|
| 56 | cat << EOF > sstrip
|
---|
| 57 | #!/bin/sh
|
---|
| 58 | echo "*** SSTRIP DISABLED ***"
|
---|
| 59 | EOF
|
---|
| 60 | make DESTDIR=${RPM_BUILD_ROOT} install
|
---|
| 61 | # copy script files to /var/lib/samhain so that we can use them right
|
---|
| 62 | # after the package is installed
|
---|
| 63 | install -m 700 samhain-install.sh init/samhain.startLinux init/samhain.startLSB ${RPM_BUILD_ROOT}%{_localstatedir}/lib/%{name}
|
---|
| 64 |
|
---|
| 65 | %clean
|
---|
| 66 | rm -rf ${RPM_BUILD_ROOT}
|
---|
| 67 |
|
---|
| 68 | %post
|
---|
| 69 | if [ "$1" = 1 ]; then
|
---|
| 70 | # Activate boot-time start up
|
---|
| 71 | cd %{_localstatedir}/lib/%{name}
|
---|
| 72 | ./samhain-install.sh --verbose install-boot
|
---|
| 73 | if test -f /sbin/chkconfig; then
|
---|
| 74 | /sbin/chkconfig --add samhain
|
---|
| 75 | /sbin/chkconfig samhain on
|
---|
| 76 | fi
|
---|
| 77 | fi
|
---|
| 78 | cat << EOF
|
---|
| 79 |
|
---|
| 80 | Samhain is installed but is NOT running yet, and the database of
|
---|
| 81 | file signatures is NOT initialized yet. Read the documentation,
|
---|
| 82 | review configuration files, and then (i) initialize it
|
---|
| 83 | (%{_sbindir}/samhain -t init)
|
---|
| 84 | and (ii) start it manually
|
---|
| 85 | (%{_sysconfdir}/init.d/samhain start).
|
---|
| 86 |
|
---|
| 87 | It is configured to start automatically on the next boot for runlevels
|
---|
| 88 | [2-5].
|
---|
| 89 |
|
---|
| 90 | EOF
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 | %preun
|
---|
| 94 | # stop running instance of samhain, if any
|
---|
| 95 | if [ -f %{_localstatedir}/run/%{name}.pid ]; then
|
---|
| 96 | %{_sysconfdir}/init.d/samhain stop
|
---|
| 97 | fi
|
---|
| 98 | if [ "$1" = 0 ]; then
|
---|
| 99 | # remove boot-time scripts and links
|
---|
| 100 | cd %{_localstatedir}/lib/samhain
|
---|
| 101 | if [ -f ./samhain-install.sh ]; then
|
---|
| 102 | ./samhain-install.sh --verbose uninstall-boot
|
---|
| 103 | else
|
---|
| 104 | if [ -f /sbin/chkconfig ]; then
|
---|
| 105 | /sbin/chkconfig samhain off
|
---|
| 106 | /sbin/chkconfig --del samhain
|
---|
| 107 | fi
|
---|
| 108 | fi
|
---|
| 109 | fi
|
---|
| 110 |
|
---|
| 111 | %postun
|
---|
| 112 | if [ "$1" = 0 ]; then
|
---|
| 113 | # remove any kernel modules that might have been installed
|
---|
| 114 | RVER=`uname -r`
|
---|
| 115 | rm -f /lib/modules/$RVER/samhain*
|
---|
| 116 | fi
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 | %files
|
---|
| 120 | %defattr(-,root,root)
|
---|
| 121 | %dir %{_localstatedir}/run
|
---|
| 122 | %dir %{_localstatedir}/log
|
---|
| 123 | %doc docs/BUGS COPYING docs/Changelog docs/TODO
|
---|
[68] | 124 | %doc LICENSE docs/HOWTO* docs/MANUAL-2_3.* docs/README*
|
---|
[1] | 125 | %{_localstatedir}/lib/%{name}
|
---|
| 126 | %{_sbindir}/%{name}
|
---|
| 127 | %attr(644,root,root) %{_mandir}/man5/samhain*
|
---|
| 128 | %attr(644,root,root) %{_mandir}/man8/samhain*
|
---|
| 129 | %config(noreplace) %{_sysconfdir}/samhainrc
|
---|
| 130 |
|
---|
| 131 | %changelog
|
---|
| 132 | * Sat Jun 19 2004 Rainer Wichmann
|
---|
| 133 | - replace ./test.sh $i with make test$i
|
---|
| 134 |
|
---|
| 135 | * Sat Jan 03 2004 Rainer Wichmann
|
---|
| 136 | - Use /sbin/chkconfig as in ../samhain.spec.in
|
---|
| 137 |
|
---|
| 138 | * Thu Dec 11 2003 Christian Vanguers <cva at molis dot be>
|
---|
| 139 | - Fixed typo in samhain.spec
|
---|
| 140 |
|
---|
| 141 | * Tue Dec 24 2002 Rainer Wichmann
|
---|
| 142 | - warn user that database must be initialized
|
---|
| 143 | - fix version of MANUAL in '%files'
|
---|
| 144 | - test for chkconfig, use only if found
|
---|
| 145 |
|
---|
| 146 | * Sun Dec 22 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.7.0
|
---|
| 147 | - fixed typo with _usr macro on ./configure
|
---|
| 148 | - stops running samhain before uninstall
|
---|
| 149 | - implemented conditionals to allow proper uninstalls/upgrades
|
---|
| 150 | - 'BuildPreReq: gpg' is considered only if '--with gpg' is provided
|
---|
| 151 | - run 'chkconfig' to activate samhain after installation
|
---|
| 152 | - warn user that samhain must be manually started after
|
---|
| 153 | install/upgrade
|
---|
| 154 |
|
---|
| 155 | * Fri Dec 20 2002 Rainer Wichmann
|
---|
| 156 | - use 'configure' to set version string
|
---|
| 157 | - use standard macros for paths
|
---|
| 158 |
|
---|
| 159 | * Thu Dec 19 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
| 160 | - optional parameters '--with gpg' and '--with tests'
|
---|
| 161 | - use of pre-defined macros whenever possible
|
---|
| 162 |
|
---|
| 163 | * Wed Dec 18 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
| 164 | - Fixed installation process, avoiding hardcoded paths on the binaries
|
---|
| 165 | (thks to samhain's author Rainer Wichmann)
|
---|
| 166 |
|
---|
| 167 | * Mon Dec 16 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
| 168 | - First attempt to build from sources
|
---|