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