nessus-tool.spec 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. ##
  2. ## nessus-tool.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: 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.0
  36. Release: 20041028
  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-%{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, glib, gtk, openssl
  54. PreReq: nessus-libs, glib, gtk, 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+)
  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+)
  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. cd nessus-core
  84. %patch -p0
  85. %build
  86. # build nessus-core part
  87. ( cd nessus-core
  88. CC="%{l_cc}" \
  89. CFLAGS="%{l_cflags -O}" \
  90. CPPFLAGS="%{l_cppflags}" \
  91. LDFLAGS="%{l_fsl_ldflags}" \
  92. LIBS="%{l_fsl_libs}" \
  93. ./configure \
  94. --prefix=%{l_prefix} \
  95. --localstatedir=%{l_prefix}/var \
  96. --sharedstatedir=%{l_prefix}/var \
  97. --enable-unix-socket=%{l_prefix}/var/nessus/nessusd.socket \
  98. --disable-syslog \
  99. --with-x \
  100. --x-includes=`%{l_rc} --query x11_incdir` \
  101. --x-libraries=`%{l_rc} --query x11_libdir` \
  102. --enable-save-sessions \
  103. --enable-save-kb \
  104. --enable-release
  105. %{l_make} %{l_mflags}
  106. ) || exit $?
  107. # temporarily install nessus-core for nessus-plugins building
  108. nessus_core=`pwd`/nessus-core
  109. ( cd nessus-core
  110. %{l_make} %{l_mflags} \
  111. install DESTDIR=${nessus_core}/tmp
  112. ) || exit $?
  113. # build nessus-plugins part
  114. ( cd nessus-plugins
  115. CC="%{l_cc}" \
  116. CFLAGS="-I${nessus_core}/tmp%{l_prefix}/include/nessus %{l_cflags -O}" \
  117. CPPFLAGS="-I${nessus_core}/tmp%{l_prefix}/include/nessus %{l_cppflags}" \
  118. LDFLAGS="%{l_fsl_ldflags}" \
  119. LIBS="%{l_fsl_libs}" \
  120. ./configure \
  121. --prefix=%{l_prefix} \
  122. --enable-install="`%{l_shtool} echo -e %u`" \
  123. --enable-shared
  124. %{l_shtool} subst \
  125. -e 's;getinterfaces;local_getinterfaces;g' \
  126. -e 's;routethrough;local_routethrough;g' \
  127. -e 's;ipaddr2devname;local_ipaddr2devname;g' \
  128. -e 's;islocalhost;local_islocalhost;g' \
  129. -e 's;get_random_bytes;local_get_random_bytes;g' \
  130. -e 's;getsourceip;local_getsourceip;g' \
  131. plugins/nmap_osfingerprint/*.[ch]
  132. %{l_make} %{l_mflags}
  133. ) || exit $?
  134. %install
  135. rm -rf $RPM_BUILD_ROOT
  136. # install nessus-core part
  137. ( cd nessus-core
  138. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  139. ) || exit $?
  140. # install nessus-plugins part
  141. ( cd nessus-plugins
  142. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  143. ) || exit $?
  144. # strip down installation
  145. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  146. # install default configuration
  147. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  148. %{SOURCE nessusd.conf} \
  149. %{SOURCE nessusd.rules} \
  150. %{SOURCE nessusd.users} \
  151. $RPM_BUILD_ROOT%{l_prefix}/etc/nessus/
  152. # install run-command script
  153. %{l_shtool} mkdir -f -p -m 755 \
  154. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl \
  155. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  156. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  157. %{SOURCE rc.nessus} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  158. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  159. %{SOURCE fsl.nessus} $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  160. # determine installation files
  161. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  162. %{l_files_std} \
  163. '%not %dir %{l_prefix}/etc/fsl' \
  164. '%config %{l_prefix}/etc/fsl/fsl.nessus' \
  165. '%config %{l_prefix}/etc/nessus/*' \
  166. '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/nessus/nessusd.conf'
  167. %files -f files
  168. %clean
  169. rm -rf $RPM_BUILD_ROOT
  170. %post
  171. # after upgrade, restart service
  172. if [ $1 -eq 2 ]; then
  173. eval `%{l_rc} nessus status 2>/dev/null`
  174. [ ".$nessus_active" = .yes ] && %{l_rc} nessus restart
  175. fi
  176. # on every install, announce certificate
  177. if [ $1 -le 2 ]; then
  178. if [ ! -f $RPM_INSTALL_PREFIX/var/nessus/CA/servercert.pem ]; then
  179. ( echo "For the SSL/TLS based remote client/server connections"
  180. echo "between the Nessus server and the Nessus clients, an"
  181. echo "X.509 server certificate/key pair is needed. Run the"
  182. echo "following command to create it once:"
  183. echo " \$ $RPM_INSTALL_PREFIX/sbin/nessus-mkcert"
  184. ) | %{l_rpmtool} msg -b -t info
  185. fi
  186. fi
  187. # on initial install, announce useradd
  188. if [ $1 -eq 1 ]; then
  189. ( echo "Each Nessus user has to be created on the Nessus server"
  190. echo "Run the following command to create an individual user:"
  191. echo " \$ $RPM_INSTALL_PREFIX/sbin/nessus-adduser"
  192. ) | %{l_rpmtool} msg -b -t info
  193. fi
  194. exit 0
  195. %preun
  196. # before erase, stop service and remove log files
  197. if [ $1 -eq 0 ]; then
  198. %{l_rc} nessus stop 2>/dev/null
  199. rm -f $RPM_INSTALL_PREFIX/var/nessus/logs/*.log* >/dev/null 2>&1 || true
  200. fi
  201. exit 0