samhain.spec 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. ##
  2. ## samhain.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 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 [PLUS]
  32. Group: System
  33. License: GPL
  34. Version: 1.8.0
  35. Release: 20031101
  36. # package options
  37. %option with_fsl yes
  38. # list of sources
  39. Source0: http://la-samhna.de/samhain/samhain-current.tar.gz
  40. Source1: rc.samhain
  41. Source2: fsl.samhain
  42. Patch0: samhain.patch
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20030909, gcc
  47. PreReq: OpenPKG, openpkg >= 20030909
  48. %if "%{with_fsl}" == "yes"
  49. BuildPreReq: fsl >= 1.2.0
  50. PreReq: fsl >= 1.2.0
  51. %endif
  52. AutoReq: no
  53. AutoReqProv: no
  54. %description
  55. Samhain is an open source file integrity and intrusion detection
  56. system for Unix that uses cryptographic checksums of files to
  57. detect modifications, and allows you to trace: what changes have
  58. occured in your system, when these changes have occured, and who
  59. was logged into the system at the respective time.
  60. %prep
  61. %setup -q -c samhain-%{version}
  62. %{l_gzip} -d -c samhain-%{version}.tar.gz | %{l_tar} xf -
  63. %patch -p0
  64. %build
  65. cd samhain-%{version}
  66. enable_static=""
  67. case "%{l_platform -t}" in
  68. *-freebsd* | *-linux* ) enable_static="--enable-static" ;;
  69. esac
  70. CC="%{l_cc}" \
  71. CFLAGS="%{l_cflags -O}" \
  72. LDFLAGS="%{l_fsl_ldflags}" \
  73. LIBS="%{l_fsl_libs}" \
  74. ./configure \
  75. --prefix=%{l_prefix} \
  76. --mandir=%{l_prefix}/man \
  77. --with-config-file=%{l_prefix}/etc/samhain/samhainrc \
  78. --with-state-dir=%{l_prefix}/var/samhain \
  79. --with-html-file=%{l_prefix}/var/samhain/samhain.html \
  80. --with-data-file=%{l_prefix}/var/samhain/samhain.data \
  81. --with-pid-file=%{l_prefix}/var/samhain/samhain.pid \
  82. --with-log-file=%{l_prefix}/var/samhain/samhain.log \
  83. --enable-login-watch \
  84. --disable-khide \
  85. --enable-suidcheck \
  86. --with-trusted=0,%{l_muid} \
  87. $enable_static
  88. %{l_make} %{l_mflags}
  89. %install
  90. rm -rf $RPM_BUILD_ROOT
  91. %{l_shtool} mkdir -f -p -m 755 \
  92. $RPM_BUILD_ROOT%{l_prefix}/var/samhain
  93. ( cd samhain-%{version}
  94. %{l_make} %{l_mflags} \
  95. install-program install-man install-data \
  96. DESTDIR=$RPM_BUILD_ROOT
  97. ) || exit $?
  98. chmod -R a+r $RPM_BUILD_ROOT%{l_prefix}/man
  99. case "%{l_platform -t}" in
  100. *-freebsd* ) rc="samhainrc.freebsd" ;;
  101. *-linux* ) rc="samhainrc.linux" ;;
  102. *-sunos* ) rc="samhainrc.solaris" ;;
  103. * ) echo "ERROR: platform \"%{l_platform -t}\" not supported" 1>&2; exit 1 ;;
  104. esac
  105. %{l_shtool} install -c -m 644 \
  106. samhain-%{version}/$rc \
  107. $RPM_BUILD_ROOT%{l_prefix}/etc/samhain/samhainrc
  108. # install run-command script
  109. %{l_shtool} mkdir -f -p -m 755 \
  110. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  111. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  112. %{SOURCE rc.samhain} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  113. # install OSSP fsl configuration
  114. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  115. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  116. %{SOURCE fsl.samhain} \
  117. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  118. # determine installation files
  119. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  120. %{l_files_std} \
  121. '%not %dir %{l_prefix}/etc/fsl' \
  122. '%config %{l_prefix}/etc/fsl/fsl.samhain' \
  123. '%config %{l_prefix}/etc/samhain/samhainrc'
  124. %files -f files
  125. %clean
  126. rm -rf $RPM_BUILD_ROOT
  127. %post
  128. # after upgrade, restart service
  129. [ $1 -eq 2 ] || exit 0
  130. eval `%{l_rc} samhain status 2>/dev/null`
  131. [ ".$samhain_active" = .yes ] && %{l_rc} samhain restart
  132. exit 0
  133. %preun
  134. # before erase, stop service and remove log files and database
  135. [ $1 -eq 0 ] || exit 0
  136. %{l_rc} samhain stop 2>/dev/null
  137. rm -f $RPM_INSTALL_PREFIX/var/samhain/samhain.data 2>/dev/null || true
  138. rm -f $RPM_INSTALL_PREFIX/var/samhain/samhain.log* 2>/dev/null || true
  139. exit 0