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.

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

mercurial