nessus-tool.spec 7.7 KB

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