[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}
|
---|
[390] | 72 | /bin/sh ./samhain-install.sh --verbose install-boot
|
---|
[1] | 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
|
---|
[390] | 102 | /bin/sh ./samhain-install.sh --verbose uninstall-boot
|
---|
[1] | 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 |
|
---|
| 112 | %files
|
---|
| 113 | %defattr(-,root,root)
|
---|
| 114 | %dir %{_localstatedir}/run
|
---|
| 115 | %dir %{_localstatedir}/log
|
---|
| 116 | %doc docs/BUGS COPYING docs/Changelog docs/TODO
|
---|
[481] | 117 | %doc LICENSE docs/HOWTO* docs/MANUAL-2_4.* docs/README*
|
---|
[1] | 118 | %{_localstatedir}/lib/%{name}
|
---|
| 119 | %{_sbindir}/%{name}
|
---|
| 120 | %attr(644,root,root) %{_mandir}/man5/samhain*
|
---|
| 121 | %attr(644,root,root) %{_mandir}/man8/samhain*
|
---|
[412] | 122 | %attr(644,root,root) /etc/logrotate.d/@install_name@
|
---|
[1] | 123 | %config(noreplace) %{_sysconfdir}/samhainrc
|
---|
| 124 |
|
---|
| 125 | %changelog
|
---|
| 126 | * Sat Jun 19 2004 Rainer Wichmann
|
---|
| 127 | - replace ./test.sh $i with make test$i
|
---|
| 128 |
|
---|
| 129 | * Sat Jan 03 2004 Rainer Wichmann
|
---|
| 130 | - Use /sbin/chkconfig as in ../samhain.spec.in
|
---|
| 131 |
|
---|
| 132 | * Thu Dec 11 2003 Christian Vanguers <cva at molis dot be>
|
---|
| 133 | - Fixed typo in samhain.spec
|
---|
| 134 |
|
---|
| 135 | * Tue Dec 24 2002 Rainer Wichmann
|
---|
| 136 | - warn user that database must be initialized
|
---|
| 137 | - fix version of MANUAL in '%files'
|
---|
| 138 | - test for chkconfig, use only if found
|
---|
| 139 |
|
---|
| 140 | * Sun Dec 22 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.7.0
|
---|
| 141 | - fixed typo with _usr macro on ./configure
|
---|
| 142 | - stops running samhain before uninstall
|
---|
| 143 | - implemented conditionals to allow proper uninstalls/upgrades
|
---|
| 144 | - 'BuildPreReq: gpg' is considered only if '--with gpg' is provided
|
---|
| 145 | - run 'chkconfig' to activate samhain after installation
|
---|
| 146 | - warn user that samhain must be manually started after
|
---|
| 147 | install/upgrade
|
---|
| 148 |
|
---|
| 149 | * Fri Dec 20 2002 Rainer Wichmann
|
---|
| 150 | - use 'configure' to set version string
|
---|
| 151 | - use standard macros for paths
|
---|
| 152 |
|
---|
| 153 | * Thu Dec 19 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
| 154 | - optional parameters '--with gpg' and '--with tests'
|
---|
| 155 | - use of pre-defined macros whenever possible
|
---|
| 156 |
|
---|
| 157 | * Wed Dec 18 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
| 158 | - Fixed installation process, avoiding hardcoded paths on the binaries
|
---|
| 159 | (thks to samhain's author Rainer Wichmann)
|
---|
| 160 |
|
---|
| 161 | * Mon Dec 16 2002 Andre Oliveira da Costa <brblueser@uol.com.br> 1.6.6
|
---|
| 162 | - First attempt to build from sources
|
---|