nessus-tool/nessus-tool.spec

Fri, 16 Jan 2009 22:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2009 22:39:09 +0100
changeset 102
8db7071256b6
child 103
35f0b90c0457
permissions
-rw-r--r--

Import package vendor original specs for necessary manipulations.

michael@102 1 ##
michael@102 2 ## nessus-tool.spec -- OpenPKG RPM Package Specification
michael@102 3 ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@102 4 ##
michael@102 5 ## Permission to use, copy, modify, and distribute this software for
michael@102 6 ## any purpose with or without fee is hereby granted, provided that
michael@102 7 ## the above copyright notice and this permission notice appear in all
michael@102 8 ## copies.
michael@102 9 ##
michael@102 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@102 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@102 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@102 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@102 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@102 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@102 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@102 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@102 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@102 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@102 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@102 21 ## SUCH DAMAGE.
michael@102 22 ##
michael@102 23
michael@102 24 # package information
michael@102 25 Name: nessus-tool
michael@102 26 Summary: Nessus Security Scanner (Tool)
michael@102 27 URL: http://www.nessus.org/
michael@102 28 Vendor: Renaud Deraison
michael@102 29 Packager: OpenPKG Foundation e.V.
michael@102 30 Distribution: OpenPKG Community
michael@102 31 Class: EVAL
michael@102 32 Group: Monitoring
michael@102 33 License: GPL
michael@102 34 Version: 2.2.11
michael@102 35 Release: 20081120
michael@102 36
michael@102 37 # package options
michael@102 38 %option with_fsl yes
michael@102 39
michael@102 40 # list of sources
michael@102 41 Source0: ftp://ftp.nessus.org/pub/nessus/nessus-%{version}/src/nessus-core-%{version}.tar.gz
michael@102 42 Source1: ftp://ftp.nessus.org/pub/nessus/nessus-%{version}/src/nessus-plugins-GPL-%{version}.tar.gz
michael@102 43 Source2: nessusd.conf
michael@102 44 Source3: nessusd.rules
michael@102 45 Source4: nessusd.users
michael@102 46 Source5: rc.nessus
michael@102 47 Source6: fsl.nessus
michael@102 48 Patch0: nessus-tool.patch
michael@102 49
michael@102 50 # build information
michael@102 51 Prefix: %{l_prefix}
michael@102 52 BuildRoot: %{l_buildroot}
michael@102 53 BuildPreReq: OpenPKG, openpkg >= 20060823, X11, gcc, make
michael@102 54 PreReq: OpenPKG, openpkg >= 20060823, X11
michael@102 55 BuildPreReq: nessus-libs, glib2, gtk2, openssl
michael@102 56 PreReq: nessus-libs, glib2, gtk2, openssl
michael@102 57 %if "%{with_fsl}" == "yes"
michael@102 58 BuildPreReq: fsl >= 1.3.0
michael@102 59 PreReq: fsl >= 1.3.0
michael@102 60 %endif
michael@102 61 AutoReq: no
michael@102 62 AutoReqProv: no
michael@102 63
michael@102 64 %description
michael@102 65 This is the Tool package of the Nessus Security Scanner, a security
michael@102 66 scanner which will audit remotely a given network and determine
michael@102 67 whether attackers may break into it, or misuse it in some way.
michael@102 68
michael@102 69 %track
michael@102 70 prog nessus-tool:nessus-core = {
michael@102 71 version = %{version}
michael@102 72 url = ftp://ftp.nessus.org/pub/nessus/
michael@102 73 regex = (nessus-\d+\.\d+\.\d+[a-z]?)
michael@102 74 url = ftp://ftp.nessus.org/pub/nessus/__NEWVER__/src/
michael@102 75 regex = nessus-core-(__VER__)\.tar\.gz
michael@102 76 }
michael@102 77 prog nessus-tool:nessus-plugins = {
michael@102 78 version = %{version}
michael@102 79 url = ftp://ftp.nessus.org/pub/nessus/
michael@102 80 regex = (nessus-\d+\.\d+\.\d+[a-z]?)
michael@102 81 url = ftp://ftp.nessus.org/pub/nessus/__NEWVER__/src/
michael@102 82 regex = nessus-core-(__VER__)\.tar\.gz
michael@102 83 }
michael@102 84
michael@102 85 %prep
michael@102 86 %setup -q -c
michael@102 87 %setup -q -T -D -a 1
michael@102 88 %patch -p0
michael@102 89
michael@102 90 %build
michael@102 91 # build nessus-core part
michael@102 92 ( cd nessus-core
michael@102 93 CC="%{l_cc}" \
michael@102 94 CFLAGS="%{l_cflags -O}" \
michael@102 95 CPPFLAGS="%{l_cppflags}" \
michael@102 96 LDFLAGS="%{l_fsl_ldflags}" \
michael@102 97 LIBS="%{l_fsl_libs}" \
michael@102 98 ./configure \
michael@102 99 --prefix=%{l_prefix} \
michael@102 100 --localstatedir=%{l_prefix}/var \
michael@102 101 --sharedstatedir=%{l_prefix}/var \
michael@102 102 --enable-unix-socket=%{l_prefix}/var/nessus/nessusd.socket \
michael@102 103 --disable-syslog \
michael@102 104 --with-x \
michael@102 105 --x-includes=`%{l_rc} --query x11_incdir` \
michael@102 106 --x-libraries=`%{l_rc} --query x11_libdir` \
michael@102 107 --enable-save-sessions \
michael@102 108 --enable-save-kb \
michael@102 109 --enable-release
michael@102 110 %{l_make} %{l_mflags}
michael@102 111 ) || exit $?
michael@102 112
michael@102 113 # temporarily install nessus-core for nessus-plugins building
michael@102 114 nessus_core=`pwd`/nessus-core
michael@102 115 ( cd nessus-core
michael@102 116 %{l_make} %{l_mflags} \
michael@102 117 install DESTDIR=${nessus_core}/tmp
michael@102 118 ) || exit $?
michael@102 119
michael@102 120 # build nessus-plugins part
michael@102 121 ( cd nessus-plugins
michael@102 122 CC="%{l_cc}" \
michael@102 123 CFLAGS="-I${nessus_core}/tmp%{l_prefix}/include/nessus %{l_cflags -O}" \
michael@102 124 CPPFLAGS="-I${nessus_core}/tmp%{l_prefix}/include/nessus %{l_cppflags}" \
michael@102 125 LDFLAGS="%{l_fsl_ldflags}" \
michael@102 126 LIBS="%{l_fsl_libs}" \
michael@102 127 ./configure \
michael@102 128 --prefix=%{l_prefix} \
michael@102 129 --enable-install="`%{l_shtool} echo -e %u`" \
michael@102 130 --enable-shared
michael@102 131 %{l_shtool} subst \
michael@102 132 -e 's;getinterfaces;local_getinterfaces;g' \
michael@102 133 -e 's;routethrough;local_routethrough;g' \
michael@102 134 -e 's;ipaddr2devname;local_ipaddr2devname;g' \
michael@102 135 -e 's;islocalhost;local_islocalhost;g' \
michael@102 136 -e 's;get_random_bytes;local_get_random_bytes;g' \
michael@102 137 -e 's;getsourceip;local_getsourceip;g' \
michael@102 138 plugins/nmap_osfingerprint/*.[ch]
michael@102 139 %{l_make} %{l_mflags}
michael@102 140 ) || exit $?
michael@102 141
michael@102 142 %install
michael@102 143 rm -rf $RPM_BUILD_ROOT
michael@102 144
michael@102 145 %{l_shtool} mkdir -f -p -m 755 \
michael@102 146 $RPM_BUILD_ROOT%{l_prefix}/bin
michael@102 147
michael@102 148 # install nessus-core part
michael@102 149 ( cd nessus-core
michael@102 150 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@102 151 ) || exit $?
michael@102 152
michael@102 153 # install nessus-plugins part
michael@102 154 ( cd nessus-plugins
michael@102 155 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@102 156 ) || exit $?
michael@102 157
michael@102 158 # strip down installation
michael@102 159 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@102 160
michael@102 161 # install default configuration
michael@102 162 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@102 163 %{SOURCE nessusd.conf} \
michael@102 164 %{SOURCE nessusd.rules} \
michael@102 165 %{SOURCE nessusd.users} \
michael@102 166 $RPM_BUILD_ROOT%{l_prefix}/etc/nessus/
michael@102 167
michael@102 168 # install run-command script
michael@102 169 %{l_shtool} mkdir -f -p -m 755 \
michael@102 170 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl \
michael@102 171 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@102 172 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@102 173 %{SOURCE rc.nessus} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@102 174 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@102 175 %{SOURCE fsl.nessus} $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
michael@102 176
michael@102 177 # determine installation files
michael@102 178 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@102 179 %{l_files_std} \
michael@102 180 '%config %{l_prefix}/etc/fsl/fsl.nessus' \
michael@102 181 '%config %{l_prefix}/etc/nessus/*' \
michael@102 182 '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/nessus/nessusd.conf'
michael@102 183
michael@102 184 %files -f files
michael@102 185
michael@102 186 %clean
michael@102 187 rm -rf $RPM_BUILD_ROOT
michael@102 188
michael@102 189 %post
michael@102 190 # after upgrade, restart service
michael@102 191 if [ $1 -eq 2 ]; then
michael@102 192 eval `%{l_rc} nessus status 2>/dev/null`
michael@102 193 [ ".$nessus_active" = .yes ] && %{l_rc} nessus restart
michael@102 194 fi
michael@102 195
michael@102 196 # on every install, announce certificate
michael@102 197 if [ $1 -le 2 ]; then
michael@102 198 if [ ! -f $RPM_INSTALL_PREFIX/var/nessus/CA/servercert.pem ]; then
michael@102 199 ( echo "For the SSL/TLS based remote client/server connections"
michael@102 200 echo "between the Nessus server and the Nessus clients, an"
michael@102 201 echo "X.509 server certificate/key pair is needed. Run the"
michael@102 202 echo "following command to create it once:"
michael@102 203 echo " \$ $RPM_INSTALL_PREFIX/sbin/nessus-mkcert"
michael@102 204 ) | %{l_rpmtool} msg -b -t info
michael@102 205 fi
michael@102 206 fi
michael@102 207
michael@102 208 # on initial install, announce useradd
michael@102 209 if [ $1 -eq 1 ]; then
michael@102 210 ( echo "Each Nessus user has to be created on the Nessus server"
michael@102 211 echo "Run the following command to create an individual user:"
michael@102 212 echo " \$ $RPM_INSTALL_PREFIX/sbin/nessus-adduser"
michael@102 213 ) | %{l_rpmtool} msg -b -t info
michael@102 214 fi
michael@102 215 exit 0
michael@102 216
michael@102 217 %preun
michael@102 218 # before erase, stop service and remove log files
michael@102 219 if [ $1 -eq 0 ]; then
michael@102 220 %{l_rc} nessus stop 2>/dev/null
michael@102 221 rm -f $RPM_INSTALL_PREFIX/var/nessus/logs/*.log* >/dev/null 2>&1 || true
michael@102 222 fi
michael@102 223 exit 0
michael@102 224

mercurial