nessus-tool.spec 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. ##
  2. ## nessus-tool.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: nessus-tool
  27. Summary: Nessus Security Scanner (Tool)
  28. URL: http://www.nessus.org/
  29. Vendor: Renaud Deraison
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [EVAL]
  32. Group: Security
  33. License: GPL
  34. Version: 2.0.9
  35. Release: 20031113
  36. # package options
  37. %option with_fsl yes
  38. # list of sources
  39. Source0: ftp://ftp.nessus.org/pub/nessus/nessus-%{version}/src/nessus-core-%{version}.tar.gz
  40. Source1: ftp://ftp.nessus.org/pub/nessus/nessus-%{version}/src/nessus-plugins-%{version}.tar.gz
  41. Source2: nessusd.conf
  42. Source3: nessusd.rules
  43. Source4: nessusd.users
  44. Source5: rc.nessus
  45. Source6: fsl.nessus
  46. Patch0: nessus-tool.patch
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20030103, X11, gcc, make
  51. PreReq: OpenPKG, openpkg >= 20030103, X11
  52. BuildPreReq: nessus-libs, glib, gtk, openssl
  53. PreReq: nessus-libs, glib, gtk, openssl
  54. %if "%{with_fsl}" == "yes"
  55. BuildPreReq: fsl >= 1.3.0
  56. PreReq: fsl >= 1.3.0
  57. %endif
  58. AutoReq: no
  59. AutoReqProv: no
  60. %description
  61. This is the Tool package of the Nessus Security Scanner, a security
  62. scanner which will audit remotely a given network and determine
  63. whether attackers may break into it, or misuse it in some way.
  64. %prep
  65. %setup0 -q -c
  66. %setup1 -q -T -D -a 1
  67. cd nessus-core
  68. %patch0 -p0
  69. %build
  70. # build nessus-core part
  71. ( cd nessus-core
  72. CC="%{l_cc}" \
  73. CFLAGS="%{l_cflags -O}" \
  74. CPPFLAGS="%{l_cppflags}" \
  75. LDFLAGS="%{l_fsl_ldflags}" \
  76. LIBS="%{l_fsl_libs}" \
  77. ./configure \
  78. --prefix=%{l_prefix} \
  79. --localstatedir=%{l_prefix}/var \
  80. --sharedstatedir=%{l_prefix}/var \
  81. --enable-unix-socket=%{l_prefix}/var/nessus/nessusd.socket \
  82. --disable-syslog \
  83. --with-x \
  84. --x-includes=`%{l_prefix}/etc/rc --query x11_incdir` \
  85. --x-libraries=`%{l_prefix}/etc/rc --query x11_libdir` \
  86. --enable-save-sessions \
  87. --enable-save-kb \
  88. --enable-release
  89. %{l_make} %{l_mflags -O}
  90. ) || exit $?
  91. # temporarily install nessus-core for nessus-plugins building
  92. nessus_core=`pwd`/nessus-core
  93. ( cd nessus-core
  94. %{l_make} %{l_mflags -O} \
  95. install DESTDIR=${nessus_core}/tmp
  96. ) || exit $?
  97. # build nessus-plugins part
  98. ( cd nessus-plugins
  99. CC="%{l_cc}" \
  100. CFLAGS="-I${nessus_core}/tmp%{l_prefix}/include/nessus %{l_cflags -O}" \
  101. CPPFLAGS="-I${nessus_core}/tmp%{l_prefix}/include/nessus %{l_cppflags}" \
  102. LDFLAGS="%{l_fsl_ldflags}" \
  103. LIBS="%{l_fsl_libs}" \
  104. ./configure \
  105. --prefix=%{l_prefix} \
  106. --enable-install="`%{l_shtool} echo -e %u`" \
  107. --enable-shared
  108. %{l_shtool} subst \
  109. -e 's;getinterfaces;local_getinterfaces;g' \
  110. -e 's;routethrough;local_routethrough;g' \
  111. -e 's;ipaddr2devname;local_ipaddr2devname;g' \
  112. -e 's;islocalhost;local_islocalhost;g' \
  113. -e 's;get_random_bytes;local_get_random_bytes;g' \
  114. -e 's;getsourceip;local_getsourceip;g' \
  115. plugins/nmap_osfingerprint/*.[ch]
  116. %{l_make} %{l_mflags -O}
  117. ) || exit $?
  118. %install
  119. rm -rf $RPM_BUILD_ROOT
  120. # install nessus-core part
  121. ( cd nessus-core
  122. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  123. ) || exit $?
  124. # install nessus-plugins part
  125. ( cd nessus-plugins
  126. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  127. ) || exit $?
  128. # strip down installation
  129. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  130. # install default configuration
  131. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  132. %{SOURCE nessusd.conf} \
  133. %{SOURCE nessusd.rules} \
  134. %{SOURCE nessusd.users} \
  135. $RPM_BUILD_ROOT%{l_prefix}/etc/nessus/
  136. # install run-command script
  137. %{l_shtool} mkdir -f -p -m 755 \
  138. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl \
  139. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  140. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  141. %{SOURCE rc.nessus} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  142. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  143. %{SOURCE fsl.nessus} $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  144. # determine installation files
  145. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  146. %{l_files_std} \
  147. '%not %dir %{l_prefix}/etc/fsl' \
  148. '%config %{l_prefix}/etc/fsl/fsl.nessus' \
  149. '%config %{l_prefix}/etc/nessus/*' \
  150. '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/nessus/nessusd.conf'
  151. %files -f files
  152. %clean
  153. rm -rf $RPM_BUILD_ROOT
  154. %post
  155. # after upgrade, restart service
  156. if [ $1 -eq 2 ]; then
  157. eval `%{l_rc} nessus status 2>/dev/null`
  158. [ ".$nessus_active" = .yes ] && %{l_rc} nessus restart
  159. fi
  160. # on every install, announce certificate
  161. if [ $1 -le 2 ]; then
  162. if [ ! -f $RPM_INSTALL_PREFIX/var/nessus/CA/servercert.pem ]; then
  163. ( echo "For the SSL/TLS based remote client/server connections"
  164. echo "between the Nessus server and the Nessus clients, an"
  165. echo "X.509 server certificate/key pair is needed. Run the"
  166. echo "following command to create it once:"
  167. echo " \$ $RPM_INSTALL_PREFIX/sbin/nessus-mkcert"
  168. ) | %{l_rpmtool} msg -b -t info
  169. fi
  170. fi
  171. # on initial install, announce useradd
  172. if [ $1 -eq 1 ]; then
  173. ( echo "Each Nessus user has to be created on the Nessus server"
  174. echo "Run the following command to create an individual user:"
  175. echo " \$ $RPM_INSTALL_PREFIX/sbin/nessus-adduser"
  176. ) | %{l_rpmtool} msg -b -t info
  177. fi
  178. exit 0
  179. %preun
  180. # before erase, stop service and remove log files
  181. if [ $1 -eq 0 ]; then
  182. %{l_rc} nessus stop 2>/dev/null
  183. rm -f $RPM_INSTALL_PREFIX/var/nessus/logs/*.log* >/dev/null 2>&1 || true
  184. fi
  185. exit 0