nessus-tool.spec 6.2 KB

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