honeyd/honeyd.spec

Tue, 28 Aug 2012 18:35:30 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:35:30 +0200
changeset 574
1074e5934dd9
child 575
6e491d7671a4
permissions
-rw-r--r--

Import package vendor original specs for necessary manipulations.

michael@574 1 ##
michael@574 2 ## honeyd.spec -- OpenPKG RPM Package Specification
michael@574 3 ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@574 4 ##
michael@574 5 ## Permission to use, copy, modify, and distribute this software for
michael@574 6 ## any purpose with or without fee is hereby granted, provided that
michael@574 7 ## the above copyright notice and this permission notice appear in all
michael@574 8 ## copies.
michael@574 9 ##
michael@574 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@574 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@574 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@574 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@574 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@574 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@574 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@574 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@574 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@574 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@574 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@574 21 ## SUCH DAMAGE.
michael@574 22 ##
michael@574 23
michael@574 24 # package version
michael@574 25 %define V_honeyd 1.5b
michael@574 26 %define V_libdnsres 0.1a
michael@574 27
michael@574 28 # package information
michael@574 29 Name: honeyd
michael@574 30 Summary: Creates a Virtual Host on Network
michael@574 31 URL: http://www.honeyd.org/
michael@574 32 Vendor: Niels Provos
michael@574 33 Packager: OpenPKG Foundation e.V.
michael@574 34 Distribution: OpenPKG Community
michael@574 35 Class: EVAL
michael@574 36 Group: Security
michael@574 37 License: BSD
michael@574 38 Version: %{V_honeyd}
michael@574 39 Release: 20080101
michael@574 40
michael@574 41 # package options
michael@574 42 %option with_fsl yes
michael@574 43 %option with_gui no
michael@574 44
michael@574 45 # list of sources
michael@574 46 Source0: http://www.citi.umich.edu/u/provos/honeyd/honeyd-%{V_honeyd}.tar.gz
michael@574 47 Source1: http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/ftp.sh
michael@574 48 Source2: http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/pop3.sh
michael@574 49 Source3: http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/smtp.sh
michael@574 50 Source4: http://www.citi.umich.edu/u/provos/papers/honeyd-eabstract.pdf
michael@574 51 Source5: http://www.citi.umich.edu/u/provos/papers/honeyd-eabstract.ps
michael@574 52 Source6: http://www.citi.umich.edu/u/provos/honeyd/ch01-results/1/honeydGUI.tar.gz
michael@574 53 Source7: honey
michael@574 54 Source8: svcs.sh
michael@574 55 Source9: rc.honeyd
michael@574 56 Source10: fsl.honeyd
michael@574 57 Source11: honeyd.conf
michael@574 58 Source12: cdefs.h
michael@574 59 Source13: setenv.h
michael@574 60 Source14: setenv.c
michael@574 61 Source15: vasprintf.c
michael@574 62 Source16: vasprintf.h
michael@574 63 Source17: http://www.monkey.org/~provos/libdnsres-%{V_libdnsres}.tar.gz
michael@574 64 Patch0: honeyd.patch
michael@574 65
michael@574 66 # build information
michael@574 67 Prefix: %{l_prefix}
michael@574 68 BuildRoot: %{l_buildroot}
michael@574 69 BuildPreReq: OpenPKG, openpkg >= 20060823, make
michael@574 70 PreReq: OpenPKG, openpkg >= 20060823
michael@574 71 BuildPreReq: libdnet, libpcap, libevent, libedit, zlib, pcre
michael@574 72 PreReq: libdnet, libpcap, libevent, libedit, zlib, pcre
michael@574 73 %if "%{with_fsl}" == "yes"
michael@574 74 BuildPreReq: fsl
michael@574 75 PreReq: fsl
michael@574 76 %endif
michael@574 77 %if "%{with_gui}" == "yes"
michael@574 78 PreReq: java, JAVA-JDK
michael@574 79 %endif
michael@574 80 AutoReq: no
michael@574 81 AutoReqProv: no
michael@574 82
michael@574 83 %description
michael@574 84 Honeyd is a small daemon that creates virtual hosts on a network.
michael@574 85 The hosts can be configured to run arbitrary services, and their
michael@574 86 TCP personality can be adapted so that they appear to be running
michael@574 87 certain versions of operating systems. Honeyd enables a single host
michael@574 88 to claim multiple addresses on a LAN for network simulation. It is
michael@574 89 possible to ping the virtual machines, or to traceroute them. Any
michael@574 90 type of service on the virtual machine can be simulated according to
michael@574 91 a simple configuration file. Instead of simulating a service, it is
michael@574 92 also possible to proxy it to another machine. The package arpd will
michael@574 93 most certainly be useful as well, although it is not a technical
michael@574 94 requirement for this package.
michael@574 95
michael@574 96 %track
michael@574 97 prog honeyd:honeyd = {
michael@574 98 version = %{V_honeyd}
michael@574 99 url = http://www.citi.umich.edu/u/provos/honeyd/
michael@574 100 regex = honeyd-(__VER__)\.tar\.gz
michael@574 101 }
michael@574 102 prog honeyd:libdnsres = {
michael@574 103 version = %{V_libdnsres}
michael@574 104 url = http://www.monkey.org/~provos/libdnsres/
michael@574 105 regex = libdnsres-(__VER__)\.tar\.gz
michael@574 106 }
michael@574 107
michael@574 108 %prep
michael@574 109 %setup -q
michael@574 110 %setup -q -D -T -a 17
michael@574 111 %patch -p0
michael@574 112 %{l_shtool} subst \
michael@574 113 -e 's;AF_LOCAL;AF_UNIX;' \
michael@574 114 *.c
michael@574 115 %{l_shtool} subst \
michael@574 116 -e 's;^\(honeyd_SOURCES *=[^\\]*\);\1 setenv.c vasprintf.c;' \
michael@574 117 -e 's;^\(honeyd_OBJECTS *=[^\\]*\);\1 setenv.o vasprintf.o ;' \
michael@574 118 Makefile.in
michael@574 119 cp -f %{SOURCE setenv.c} .
michael@574 120 cp -f %{SOURCE setenv.h} .
michael@574 121 cp -f %{SOURCE vasprintf.c} .
michael@574 122 cp -f %{SOURCE vasprintf.h} .
michael@574 123 cp -f %{SOURCE cdefs.h} .
michael@574 124 %{l_shtool} subst \
michael@574 125 -e 's;/var/run/honeyd.pid;%{l_prefix}/var/honeyd/honeyd.pid;' \
michael@574 126 honeyd.h
michael@574 127 %{l_shtool} subst \
michael@574 128 -e 's/\(user_target=no\)/\1; pic_mode=no;/' \
michael@574 129 -e 's;test "*$\(hardcode_into_libs\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \
michael@574 130 -e 's;test "*$\(build_libtool_need_lc\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \
michael@574 131 ltmain.sh
michael@574 132 case "%{l_platform -t}" in
michael@574 133 *-sunos* )
michael@574 134 %{l_shtool} subst \
michael@574 135 -e 's;-levent;-levent -lsocket -lnsl;g' \
michael@574 136 configure
michael@574 137 %{l_shtool} subst \
michael@574 138 -e 's;\(\$(honeydctl_LDADD)\);\1 -lsocket -lnsl;g' \
michael@574 139 Makefile.in
michael@574 140 ;;
michael@574 141 esac
michael@574 142
michael@574 143 %build
michael@574 144 ( cd libdnsres-%{V_libdnsres}
michael@574 145 CC="%{l_cc}" \
michael@574 146 CFLAGS="%{l_cflags -O}" \
michael@574 147 CPPFLAGS="%{l_cppflags}" \
michael@574 148 ./configure \
michael@574 149 --with-libevent=%{l_prefix} \
michael@574 150 --disable-shared
michael@574 151 %{l_make} %{l_mflags}
michael@574 152 ln .libs/libdnsres.a .
michael@574 153 ) || exit $?
michael@574 154 CC="%{l_cc}" \
michael@574 155 CFLAGS="%{l_cflags -O}" \
michael@574 156 CPPFLAGS="%{l_cppflags} -DREPLACE_GETOPT" \
michael@574 157 LDFLAGS="%{l_fsl_ldflags}" \
michael@574 158 LIBS="%{l_fsl_libs}" \
michael@574 159 ./configure \
michael@574 160 --prefix=%{l_prefix} \
michael@574 161 --with-libevent=%{l_prefix} \
michael@574 162 --with-libdnet=%{l_prefix} \
michael@574 163 --with-libdnsres=`pwd`/libdnsres-%{V_libdnsres} \
michael@574 164 --with-libpcre=%{l_prefix} \
michael@574 165 --without-python
michael@574 166 %{l_make} %{l_mflags}
michael@574 167
michael@574 168 %install
michael@574 169 rm -rf $RPM_BUILD_ROOT
michael@574 170
michael@574 171 # create directories
michael@574 172 %{l_shtool} mkdir -f -p -m 755 \
michael@574 173 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
michael@574 174 $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd \
michael@574 175 $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd \
michael@574 176 $RPM_BUILD_ROOT%{l_prefix}/var/honeyd \
michael@574 177 $RPM_BUILD_ROOT%{l_prefix}/share/honeyd \
michael@574 178 $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd
michael@574 179
michael@574 180 # install files
michael@574 181 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@574 182 %{l_shtool} install -c -m 750 %{l_value -s -a} \
michael@574 183 -e 's;^log=/\(.*/\)*\(.*\)-.*\.log;log=%{l_prefix}/var/honeyd/\2.log;g' \
michael@574 184 -e 's;^\(host=\).*;\1`%{l_shtool} echo -e %h`;g' \
michael@574 185 -e 's;^\(domain=\).*;\1`%{l_shtool} echo -e %d | cut -c2-`;g' \
michael@574 186 -e 's; gawk ; awk ;g' \
michael@574 187 %{SOURCE ftp.sh} \
michael@574 188 %{SOURCE pop3.sh} \
michael@574 189 %{SOURCE smtp.sh} \
michael@574 190 %{SOURCE svcs.sh} \
michael@574 191 $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd/
michael@574 192 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@574 193 %{SOURCE honeyd.conf} \
michael@574 194 $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd/
michael@574 195 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@574 196 %{SOURCE rc.honeyd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@574 197 %{l_shtool} install -c -m 644 \
michael@574 198 %{SOURCE honeyd-eabstract.ps} \
michael@574 199 $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/honeyd.ps
michael@574 200 %{l_shtool} install -c -m 644 \
michael@574 201 %{SOURCE honeyd-eabstract.pdf} \
michael@574 202 $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/honeyd.pdf
michael@574 203
michael@574 204 # optionally install the Java GUI
michael@574 205 %if "%{with_gui}" == "yes"
michael@574 206 %{l_tar} zxf %{SOURCE honeydGUI.tar.gz}
michael@574 207 mv -f honeydGUI/exec $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd/javagui
michael@574 208 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@574 209 %{SOURCE honey} \
michael@574 210 $RPM_BUILD_ROOT%{l_prefix}/bin/
michael@574 211 %endif
michael@574 212
michael@574 213 # install OSSP fsl configuration
michael@574 214 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
michael@574 215 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@574 216 %{SOURCE fsl.honeyd} \
michael@574 217 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
michael@574 218
michael@574 219 # remove unwanted files
michael@574 220 rm -rf $RPM_BUILD_ROOT%{l_prefix}/include
michael@574 221 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd
michael@574 222 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/README
michael@574 223 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/config.sample
michael@574 224
michael@574 225 # determine file list
michael@574 226 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@574 227 %{l_files_std} \
michael@574 228 '%config %attr(0750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/honeyd' \
michael@574 229 '%config %{l_prefix}/etc/fsl/fsl.honeyd' \
michael@574 230 '%config %attr(0750,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/honeyd/honeyd.conf'
michael@574 231
michael@574 232 %files -f files
michael@574 233
michael@574 234 %clean
michael@574 235 rm -rf $RPM_BUILD_ROOT
michael@574 236
michael@574 237 %pre
michael@574 238 # before upgrade, save status and stop service
michael@574 239 [ $1 -eq 2 ] || exit 0
michael@574 240 eval `%{l_rc} honeyd status 2>/dev/null | tee %{l_tmpfile}`
michael@574 241 %{l_rc} honeyd stop 2>/dev/null
michael@574 242 exit 0
michael@574 243
michael@574 244 %post
michael@574 245 if [ $1 -eq 1 ]; then
michael@574 246 # display final hints on initial installation
michael@574 247 ( echo "Before starting Honey daemon, please set the configuration variable"
michael@574 248 echo "\"honeyd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the"
michael@574 249 echo "used network interface."
michael@574 250 ) | %{l_rpmtool} msg -b -t notice
michael@574 251 fi
michael@574 252 if [ $1 -eq 2 ]; then
michael@574 253 # after upgrade, restore status
michael@574 254 eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
michael@574 255 [ ".$honeyd_active" = .yes ] && %{l_rc} honeyd start
michael@574 256 fi
michael@574 257 exit 0
michael@574 258
michael@574 259 %preun
michael@574 260 # before erase, stop service and remove log files
michael@574 261 [ $1 -eq 0 ] || exit 0
michael@574 262 %{l_rc} honeyd stop 2>/dev/null
michael@574 263 rm -f $RPM_INSTALL_PREFIX/var/honeyd/*.log* >/dev/null 2>&1 || true
michael@574 264 exit 0
michael@574 265

mercurial