samhain.spec 5.5 KB

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