Mon, 17 Sep 2012 19:10:10 +0200
Update to new version of vendor software although Oracle fails to deliver.
More specifically, newer db(3) patch revisions exist but Oracle has
removed them from the canonical download server URI for Berkely DB.
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@575 | 25 | %define V_honeyd 1.5c |
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@575 | 39 | Release: 20120800 |
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@575 | 63 | Source17: evbuffer.h |
michael@575 | 64 | Source18: http://www.monkey.org/~provos/libdnsres-%{V_libdnsres}.tar.gz |
michael@574 | 65 | Patch0: honeyd.patch |
michael@574 | 66 | |
michael@574 | 67 | # build information |
michael@671 | 68 | BuildPreReq: OpenPKG, openpkg >= 20100101, make |
michael@671 | 69 | PreReq: OpenPKG, openpkg >= 20100101 |
michael@574 | 70 | BuildPreReq: libdnet, libpcap, libevent, libedit, zlib, pcre |
michael@574 | 71 | PreReq: libdnet, libpcap, libevent, libedit, zlib, pcre |
michael@574 | 72 | %if "%{with_fsl}" == "yes" |
michael@574 | 73 | BuildPreReq: fsl |
michael@574 | 74 | PreReq: fsl |
michael@574 | 75 | %endif |
michael@574 | 76 | %if "%{with_gui}" == "yes" |
michael@574 | 77 | PreReq: java, JAVA-JDK |
michael@574 | 78 | %endif |
michael@574 | 79 | |
michael@574 | 80 | %description |
michael@574 | 81 | Honeyd is a small daemon that creates virtual hosts on a network. |
michael@574 | 82 | The hosts can be configured to run arbitrary services, and their |
michael@574 | 83 | TCP personality can be adapted so that they appear to be running |
michael@574 | 84 | certain versions of operating systems. Honeyd enables a single host |
michael@574 | 85 | to claim multiple addresses on a LAN for network simulation. It is |
michael@574 | 86 | possible to ping the virtual machines, or to traceroute them. Any |
michael@574 | 87 | type of service on the virtual machine can be simulated according to |
michael@574 | 88 | a simple configuration file. Instead of simulating a service, it is |
michael@574 | 89 | also possible to proxy it to another machine. The package arpd will |
michael@574 | 90 | most certainly be useful as well, although it is not a technical |
michael@574 | 91 | requirement for this package. |
michael@574 | 92 | |
michael@574 | 93 | %track |
michael@574 | 94 | prog honeyd:honeyd = { |
michael@574 | 95 | version = %{V_honeyd} |
michael@574 | 96 | url = http://www.citi.umich.edu/u/provos/honeyd/ |
michael@574 | 97 | regex = honeyd-(__VER__)\.tar\.gz |
michael@574 | 98 | } |
michael@574 | 99 | prog honeyd:libdnsres = { |
michael@574 | 100 | version = %{V_libdnsres} |
michael@574 | 101 | url = http://www.monkey.org/~provos/libdnsres/ |
michael@574 | 102 | regex = libdnsres-(__VER__)\.tar\.gz |
michael@574 | 103 | } |
michael@574 | 104 | |
michael@574 | 105 | %prep |
michael@574 | 106 | %setup -q |
michael@575 | 107 | %setup -q -D -T -a 18 |
michael@574 | 108 | %patch -p0 |
michael@575 | 109 | cp -f %{SOURCE setenv.c} . |
michael@575 | 110 | cp -f %{SOURCE setenv.h} . |
michael@575 | 111 | cp -f %{SOURCE vasprintf.c} . |
michael@575 | 112 | cp -f %{SOURCE vasprintf.h} . |
michael@575 | 113 | cp -f %{SOURCE evbuffer.h} . |
michael@575 | 114 | cp -f %{SOURCE cdefs.h} . |
michael@575 | 115 | %{l_shtool} mkdir -f -p -m 755 libdnsres-%{V_libdnsres}/sys |
michael@575 | 116 | cp -f %{SOURCE cdefs.h} libdnsres-%{V_libdnsres}/sys/ |
michael@574 | 117 | %{l_shtool} subst \ |
michael@574 | 118 | -e 's;AF_LOCAL;AF_UNIX;' \ |
michael@574 | 119 | *.c |
michael@574 | 120 | %{l_shtool} subst \ |
michael@575 | 121 | -e 's;\(for ac_header in stdarg.h errno.h fcntl.h paths.h stdlib.h string.h time.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/ioccom.h sys/file.h net/bpf.h syslog.h unistd.h assert.h\);\1 sys/cdefs.h;' \ |
michael@575 | 122 | -e 's;\(for ac_func in asprintf dup2 fgetln gettimeofday memmove memset strcasecmp strchr strdup strncasecmp strtoul strspn getaddrinfo getnameinfo freeaddrinfo setgroups sendmsg recvmsg setregid setruid\) \(kqueue\);\1 setenv \2;' \ |
michael@575 | 123 | configure |
michael@575 | 124 | %{l_shtool} subst \ |
michael@574 | 125 | -e 's;^\(honeyd_SOURCES *=[^\\]*\);\1 setenv.c vasprintf.c;' \ |
michael@574 | 126 | -e 's;^\(honeyd_OBJECTS *=[^\\]*\);\1 setenv.o vasprintf.o ;' \ |
michael@574 | 127 | Makefile.in |
michael@574 | 128 | %{l_shtool} subst \ |
michael@574 | 129 | -e 's;/var/run/honeyd.pid;%{l_prefix}/var/honeyd/honeyd.pid;' \ |
michael@574 | 130 | honeyd.h |
michael@574 | 131 | %{l_shtool} subst \ |
michael@575 | 132 | -e 's;\(encode_int\);loc_\1;g' \ |
michael@575 | 133 | tagging.[ch] |
michael@575 | 134 | %{l_shtool} subst \ |
michael@575 | 135 | -e '/#include <event.h>/a#include "evbuffer.h"' \ |
michael@575 | 136 | honeydstats.c \ |
michael@575 | 137 | untagging.c \ |
michael@575 | 138 | ui.c |
michael@575 | 139 | %{l_shtool} subst \ |
michael@575 | 140 | -e 's;flock(fd, [^)][^)]*);lockf(fd, F_LOCK, 0);g' \ |
michael@575 | 141 | subsystems/smtp.c |
michael@575 | 142 | %{l_shtool} subst \ |
michael@574 | 143 | -e 's/\(user_target=no\)/\1; pic_mode=no;/' \ |
michael@574 | 144 | -e 's;test "*$\(hardcode_into_libs\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \ |
michael@574 | 145 | -e 's;test "*$\(build_libtool_need_lc\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \ |
michael@574 | 146 | ltmain.sh |
michael@574 | 147 | case "%{l_platform -t}" in |
michael@574 | 148 | *-sunos* ) |
michael@574 | 149 | %{l_shtool} subst \ |
michael@574 | 150 | -e 's;-levent;-levent -lsocket -lnsl;g' \ |
michael@574 | 151 | configure |
michael@574 | 152 | %{l_shtool} subst \ |
michael@574 | 153 | -e 's;\(\$(honeydctl_LDADD)\);\1 -lsocket -lnsl;g' \ |
michael@574 | 154 | Makefile.in |
michael@575 | 155 | %{l_shtool} subst \ |
michael@575 | 156 | -e 's;-lsocket;-lsocket -lnsl -lresolv;g' \ |
michael@575 | 157 | libdnsres-%{V_libdnsres}/configure |
michael@574 | 158 | ;; |
michael@574 | 159 | esac |
michael@575 | 160 | %{l_shtool} subst \ |
michael@575 | 161 | -e 's;#if \((!defined(BSD))\) || \((BSD < [0-9][0-9]*)\);#if (!defined(__sun)) \&\& (!defined(__SVR4)) \&\& \1 \&\& \2;' \ |
michael@575 | 162 | libdnsres-%{V_libdnsres}/dnsres.h \ |
michael@575 | 163 | libdnsres-%{V_libdnsres}/resolv.h |
michael@575 | 164 | %{l_shtool} subst \ |
michael@575 | 165 | -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \ |
michael@575 | 166 | libdnsres-%{V_libdnsres}/dnsres.h \ |
michael@575 | 167 | libdnsres-%{V_libdnsres}/resolv.h \ |
michael@575 | 168 | libdnsres-%{V_libdnsres}/res_random.c |
michael@575 | 169 | %{l_shtool} subst \ |
michael@575 | 170 | -e 's;top_buildir;top_builddir;' \ |
michael@575 | 171 | -e 's;\(am_simple_test_OBJECTS = simple_test\.\$(OBJEXT)\);\1 arc4random.$(OBJEXT);' \ |
michael@575 | 172 | libdnsres-%{V_libdnsres}/Makefile.in |
michael@575 | 173 | %{l_shtool} subst \ |
michael@575 | 174 | -e '/#include "config.h"/a#ifndef HAVE_ARC4RANDOM' \ |
michael@575 | 175 | libdnsres-%{V_libdnsres}/arc4random.c |
michael@575 | 176 | echo '#endif' >>libdnsres-%{V_libdnsres}/arc4random.c |
michael@575 | 177 | echo '#ifndef MIN' >>keycount.h |
michael@575 | 178 | echo '#define MIN(a,b) (((a) < (b)) ? (a) : (b))' >>keycount.h |
michael@575 | 179 | echo '#endif' >>keycount.h |
michael@574 | 180 | |
michael@574 | 181 | %build |
michael@574 | 182 | ( cd libdnsres-%{V_libdnsres} |
michael@575 | 183 | loc_cppflags= |
michael@575 | 184 | case "%{l_platform -t}" in |
michael@575 | 185 | *-sunos* ) |
michael@575 | 186 | loc_cppflags="-D_KERNEL" |
michael@575 | 187 | ;; |
michael@575 | 188 | esac |
michael@574 | 189 | CC="%{l_cc}" \ |
michael@574 | 190 | CFLAGS="%{l_cflags -O}" \ |
michael@575 | 191 | CPPFLAGS="%{l_cppflags} $loc_cppflags" \ |
michael@574 | 192 | ./configure \ |
michael@574 | 193 | --with-libevent=%{l_prefix} \ |
michael@574 | 194 | --disable-shared |
michael@574 | 195 | %{l_make} %{l_mflags} |
michael@574 | 196 | ) || exit $? |
michael@574 | 197 | CC="%{l_cc}" \ |
michael@574 | 198 | CFLAGS="%{l_cflags -O}" \ |
michael@574 | 199 | CPPFLAGS="%{l_cppflags} -DREPLACE_GETOPT" \ |
michael@574 | 200 | LDFLAGS="%{l_fsl_ldflags}" \ |
michael@574 | 201 | LIBS="%{l_fsl_libs}" \ |
michael@574 | 202 | ./configure \ |
michael@574 | 203 | --prefix=%{l_prefix} \ |
michael@574 | 204 | --with-libevent=%{l_prefix} \ |
michael@574 | 205 | --with-libdnet=%{l_prefix} \ |
michael@574 | 206 | --with-libdnsres=`pwd`/libdnsres-%{V_libdnsres} \ |
michael@574 | 207 | --with-libpcre=%{l_prefix} \ |
michael@574 | 208 | --without-python |
michael@575 | 209 | %{l_make} %{l_mflags -O} |
michael@574 | 210 | |
michael@574 | 211 | %install |
michael@574 | 212 | # create directories |
michael@574 | 213 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@574 | 214 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
michael@574 | 215 | $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd \ |
michael@574 | 216 | $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd \ |
michael@574 | 217 | $RPM_BUILD_ROOT%{l_prefix}/var/honeyd \ |
michael@574 | 218 | $RPM_BUILD_ROOT%{l_prefix}/share/honeyd \ |
michael@574 | 219 | $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd |
michael@574 | 220 | |
michael@574 | 221 | # install files |
michael@574 | 222 | %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT |
michael@574 | 223 | %{l_shtool} install -c -m 750 %{l_value -s -a} \ |
michael@574 | 224 | -e 's;^log=/\(.*/\)*\(.*\)-.*\.log;log=%{l_prefix}/var/honeyd/\2.log;g' \ |
michael@574 | 225 | -e 's;^\(host=\).*;\1`%{l_shtool} echo -e %h`;g' \ |
michael@574 | 226 | -e 's;^\(domain=\).*;\1`%{l_shtool} echo -e %d | cut -c2-`;g' \ |
michael@574 | 227 | -e 's; gawk ; awk ;g' \ |
michael@574 | 228 | %{SOURCE ftp.sh} \ |
michael@574 | 229 | %{SOURCE pop3.sh} \ |
michael@574 | 230 | %{SOURCE smtp.sh} \ |
michael@574 | 231 | %{SOURCE svcs.sh} \ |
michael@574 | 232 | $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd/ |
michael@574 | 233 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@574 | 234 | %{SOURCE honeyd.conf} \ |
michael@574 | 235 | $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd/ |
michael@574 | 236 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@574 | 237 | %{SOURCE rc.honeyd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@574 | 238 | %{l_shtool} install -c -m 644 \ |
michael@574 | 239 | %{SOURCE honeyd-eabstract.ps} \ |
michael@574 | 240 | $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/honeyd.ps |
michael@574 | 241 | %{l_shtool} install -c -m 644 \ |
michael@574 | 242 | %{SOURCE honeyd-eabstract.pdf} \ |
michael@574 | 243 | $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/honeyd.pdf |
michael@574 | 244 | |
michael@574 | 245 | # optionally install the Java GUI |
michael@574 | 246 | %if "%{with_gui}" == "yes" |
michael@574 | 247 | %{l_tar} zxf %{SOURCE honeydGUI.tar.gz} |
michael@574 | 248 | mv -f honeydGUI/exec $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd/javagui |
michael@574 | 249 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@574 | 250 | %{SOURCE honey} \ |
michael@574 | 251 | $RPM_BUILD_ROOT%{l_prefix}/bin/ |
michael@574 | 252 | %endif |
michael@574 | 253 | |
michael@574 | 254 | # install OSSP fsl configuration |
michael@574 | 255 | %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@574 | 256 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@574 | 257 | %{SOURCE fsl.honeyd} \ |
michael@574 | 258 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@574 | 259 | |
michael@574 | 260 | # remove unwanted files |
michael@574 | 261 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/include |
michael@574 | 262 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd |
michael@574 | 263 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/README |
michael@574 | 264 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/config.sample |
michael@574 | 265 | |
michael@574 | 266 | # determine file list |
michael@574 | 267 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@574 | 268 | %{l_files_std} \ |
michael@574 | 269 | '%config %attr(0750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/honeyd' \ |
michael@574 | 270 | '%config %{l_prefix}/etc/fsl/fsl.honeyd' \ |
michael@574 | 271 | '%config %attr(0750,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/honeyd/honeyd.conf' |
michael@574 | 272 | |
michael@574 | 273 | %files -f files |
michael@574 | 274 | |
michael@574 | 275 | %clean |
michael@574 | 276 | |
michael@574 | 277 | %pre |
michael@574 | 278 | # before upgrade, save status and stop service |
michael@574 | 279 | [ $1 -eq 2 ] || exit 0 |
michael@574 | 280 | eval `%{l_rc} honeyd status 2>/dev/null | tee %{l_tmpfile}` |
michael@574 | 281 | %{l_rc} honeyd stop 2>/dev/null |
michael@574 | 282 | exit 0 |
michael@574 | 283 | |
michael@574 | 284 | %post |
michael@574 | 285 | if [ $1 -eq 1 ]; then |
michael@574 | 286 | # display final hints on initial installation |
michael@574 | 287 | ( echo "Before starting Honey daemon, please set the configuration variable" |
michael@574 | 288 | echo "\"honeyd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" |
michael@574 | 289 | echo "used network interface." |
michael@574 | 290 | ) | %{l_rpmtool} msg -b -t notice |
michael@574 | 291 | fi |
michael@574 | 292 | if [ $1 -eq 2 ]; then |
michael@574 | 293 | # after upgrade, restore status |
michael@574 | 294 | eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} |
michael@574 | 295 | [ ".$honeyd_active" = .yes ] && %{l_rc} honeyd start |
michael@574 | 296 | fi |
michael@574 | 297 | exit 0 |
michael@574 | 298 | |
michael@574 | 299 | %preun |
michael@574 | 300 | # before erase, stop service and remove log files |
michael@574 | 301 | [ $1 -eq 0 ] || exit 0 |
michael@574 | 302 | %{l_rc} honeyd stop 2>/dev/null |
michael@574 | 303 | rm -f $RPM_INSTALL_PREFIX/var/honeyd/*.log* >/dev/null 2>&1 || true |
michael@574 | 304 | exit 0 |
michael@574 | 305 |