samhain.spec 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. ##
  2. ## samhain.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: samhain
  27. Summary: File Integrity and Intrusion Detection System
  28. URL: http://la-samhna.de/samhain/
  29. Vendor: Samhain Labs
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: PLUS
  33. Group: System
  34. License: GPL
  35. Version: 1.8.5
  36. Release: 20040406
  37. # package options
  38. %option with_fsl yes
  39. # list of sources
  40. Source0: http://la-samhna.de/samhain/samhain-current.tar.gz
  41. Source1: rc.samhain
  42. Source2: fsl.samhain
  43. Patch0: samhain.patch
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc
  48. PreReq: OpenPKG, openpkg >= 20040130
  49. %if "%{with_fsl}" == "yes"
  50. BuildPreReq: fsl >= 1.2.0
  51. PreReq: fsl >= 1.2.0
  52. %endif
  53. AutoReq: no
  54. AutoReqProv: no
  55. %description
  56. Samhain is an open source file integrity and intrusion detection
  57. system for Unix that uses cryptographic checksums of files to
  58. detect modifications, and allows you to trace: what changes have
  59. occured in your system, when these changes have occured, and who
  60. was logged into the system at the respective time.
  61. %prep
  62. %setup -q -c samhain-%{version}
  63. %{l_gzip} -d -c samhain-%{version}.tar.gz | %{l_tar} xf -
  64. %patch -p0
  65. %build
  66. cd samhain-%{version}
  67. enable_static=""
  68. case "%{l_platform -t}" in
  69. *-freebsd* | *-linux* ) enable_static="--enable-static" ;;
  70. esac
  71. CC="%{l_cc}" \
  72. CFLAGS="%{l_cflags -O}" \
  73. LDFLAGS="%{l_fsl_ldflags}" \
  74. LIBS="%{l_fsl_libs}" \
  75. ./configure \
  76. --prefix=%{l_prefix} \
  77. --mandir=%{l_prefix}/man \
  78. --with-config-file=%{l_prefix}/etc/samhain/samhainrc \
  79. --with-state-dir=%{l_prefix}/var/samhain \
  80. --with-html-file=%{l_prefix}/var/samhain/samhain.html \
  81. --with-data-file=%{l_prefix}/var/samhain/samhain.data \
  82. --with-pid-file=%{l_prefix}/var/samhain/samhain.pid \
  83. --with-log-file=%{l_prefix}/var/samhain/samhain.log \
  84. --enable-login-watch \
  85. --disable-khide \
  86. --enable-suidcheck \
  87. --with-trusted=0,%{l_muid} \
  88. $enable_static
  89. %{l_make} %{l_mflags}
  90. %install
  91. rm -rf $RPM_BUILD_ROOT
  92. %{l_shtool} mkdir -f -p -m 755 \
  93. $RPM_BUILD_ROOT%{l_prefix}/var/samhain
  94. ( cd samhain-%{version}
  95. %{l_make} %{l_mflags} \
  96. install-program install-man install-data \
  97. DESTDIR=$RPM_BUILD_ROOT
  98. ) || exit $?
  99. chmod -R a+r $RPM_BUILD_ROOT%{l_prefix}/man
  100. case "%{l_platform -t}" in
  101. *-freebsd* ) rc="samhainrc.freebsd" ;;
  102. *-linux* ) rc="samhainrc.linux" ;;
  103. *-sunos* ) rc="samhainrc.solaris" ;;
  104. * ) echo "ERROR: platform \"%{l_platform -t}\" not supported" 1>&2; exit 1 ;;
  105. esac
  106. %{l_shtool} install -c -m 644 \
  107. samhain-%{version}/$rc \
  108. $RPM_BUILD_ROOT%{l_prefix}/etc/samhain/samhainrc
  109. # install run-command script
  110. %{l_shtool} mkdir -f -p -m 755 \
  111. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  112. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  113. %{SOURCE rc.samhain} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  114. # install OSSP fsl configuration
  115. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  116. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  117. %{SOURCE fsl.samhain} \
  118. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  119. # determine installation files
  120. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  121. %{l_files_std} \
  122. '%not %dir %{l_prefix}/etc/fsl' \
  123. '%config %{l_prefix}/etc/fsl/fsl.samhain' \
  124. '%config %{l_prefix}/etc/samhain/samhainrc'
  125. %files -f files
  126. %clean
  127. rm -rf $RPM_BUILD_ROOT
  128. %post
  129. # after upgrade, restart service
  130. [ $1 -eq 2 ] || exit 0
  131. eval `%{l_rc} samhain status 2>/dev/null`
  132. [ ".$samhain_active" = .yes ] && %{l_rc} samhain restart
  133. exit 0
  134. %preun
  135. # before erase, stop service and remove log files and database
  136. [ $1 -eq 0 ] || exit 0
  137. %{l_rc} samhain stop 2>/dev/null
  138. rm -f $RPM_INSTALL_PREFIX/var/samhain/samhain.data 2>/dev/null || true
  139. rm -f $RPM_INSTALL_PREFIX/var/samhain/samhain.log* 2>/dev/null || true
  140. exit 0