# HG changeset patch # User Michael Schloh von Bennewitz # Date 1346171730 -7200 # Node ID 1074e5934dd9bfd5c667f9b326844f40f368ff1c # Parent 37c544fc0159e9ceabb91e89666c3fc5efc00194 Import package vendor original specs for necessary manipulations. diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/cdefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/cdefs.h Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,139 @@ +/* +** cdefs.h: ISO C interface +** Most of this file was developed by Sendmail, Incorporated, so: +** +** Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers. +** +** Permission to use, copy, modify, and distribute this software for +** any purpose with or without fee is hereby granted, provided that +** the above copyright notice and this permission notice appear in all +** copies. +** +** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +** +*/ + +/* +** BSD and Linux already have which defines a set of C +** language portability macros that are a defacto standard in the open +** source community. This file allows for building on platforms lacking +** these definitions. +*/ +#ifndef HOND_CDEFS_H +# define HOND_CDEFS_H + +# if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS }; +# else /* defined(__cplusplus) */ +# define __BEGIN_DECLS +# define __END_DECLS +# endif /* defined(__cplusplus) */ +# if defined(__STDC__) || defined(__cplusplus) +# ifndef __P +# define __P(protos) protos +# endif /* __P */ +# define __CONCAT(x,y) x ## y +# define __STRING(x) #x +# else /* defined(__STDC__) || defined(__cplusplus) */ +# define __P(protos) () +# define __CONCAT(x,y) x/**/y +# define __STRING(x) "x" +# define const +# define signed +# define volatile +# endif /* defined(__STDC__) || defined(__cplusplus) */ + +/* +** Define HOND_DEAD, a macro used to declare functions that do not return +** to their caller. +*/ +# ifndef HOND_DEAD +# if __GNUC__ >= 2 +# if __GNUC__ == 2 && __GNUC_MINOR__ < 5 +# define HOND_DEAD(proto) volatile proto +# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */ +# define HOND_DEAD(proto) proto __attribute__((__noreturn__)) +# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 5 */ +# else /* __GNUC__ >= 2 */ +# define HOND_DEAD(proto) proto +# endif /* __GNUC__ >= 2 */ +# endif /* HOND_DEAD */ + +/* +** Define HOND_UNUSED, a macro used to declare variables that may be unused. +*/ +# ifndef HOND_UNUSED +# if __GNUC__ >= 2 +# if __GNUC__ == 2 && __GNUC_MINOR__ < 7 +# define HOND_UNUSED(decl) decl +# else /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */ +# define HOND_UNUSED(decl) decl __attribute__((__unused__)) +# endif /* __GNUC__ == 2 && __GNUC_MINOR__ < 7 */ +# else /* __GNUC__ >= 2 */ +# define HOND_UNUSED(decl) decl +# endif /* __GNUC__ >= 2 */ +# endif /* HOND_UNUSED */ + +/* +** The HOND_NONVOLATILE macro is used to declare variables that are not +** volatile, but which must be declared volatile when compiling with +** gcc -O -Wall in order to suppress bogus warning messages. +** +** Variables that actually are volatile should be declared volatile +** using the "volatile" keyword. If a variable actually is volatile, +** then HOND_NONVOLATILE should not be used. +** +** To compile source code with gcc and see all non-bogus warnings use: +** +** gcc -O -Wall -DHOND_OMIT_BOGUS_WARNINGS ... +** +** Do not use -DHOND_OMIT_BOGUS_WARNINGS when compiling production +** software, because there is a performance hit. +*/ +# ifdef HOND_OMIT_BOGUS_WARNINGS +# define HOND_NONVOLATILE volatile +# else /* HOND_OMIT_BOGUS_WARNINGS */ +# define HOND_NONVOLATILE +# endif /* HOND_OMIT_BOGUS_WARNINGS */ + +/* +** Turn on format string argument checking. +*/ +# ifndef HOND_CONF_FORMAT_TEST +# if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 +# define HOND_CONF_FORMAT_TEST 1 +# else /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */ +# define HOND_CONF_FORMAT_TEST 0 +# endif /* __GNUC__ == 2 && __GNUC_MINOR__ >= 7 */ +# endif /* HOND_CONF_FORMAT_TEST */ + +# ifndef PRINTFLIKE +# if HOND_CONF_FORMAT_TEST +# define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, x, y))) +# else /* HOND_CONF_FORMAT_TEST */ +# define PRINTFLIKE(x,y) +# endif /* HOND_CONF_FORMAT_TEST */ +# endif /* ! PRINTFLIKE */ + +# ifndef SCANFLIKE +# if HOND_CONF_FORMAT_TEST +# define SCANFLIKE(x,y) __attribute__ ((__format__ (__scanf__, x, y))) +# else /* HOND_CONF_FORMAT_TEST */ +# define SCANFLIKE(x,y) +# endif /* HOND_CONF_FORMAT_TEST */ +# endif /* ! SCANFLIKE */ + +#endif /* ! HOND_CDEFS_H */ + diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/evbuffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/evbuffer.h Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,11 @@ +struct evbuffer { + u_char *buffer; + u_char *orig_buffer; + + size_t misalign; + size_t totallen; + size_t off; + + void (*cb)(struct evbuffer *, size_t, size_t, void *); + void *cbarg; +}; diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/fsl.honeyd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/fsl.honeyd Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,16 @@ +## +## fsl.honeyd -- OSSP fsl configuration +## + +ident (honeyd)/.+ q{ + prefix( + prefix="%b %d %H:%M:%S %N <%L> $1[%P]: " + ) + -> { + debug: file( + path="@l_prefix@/var/honeyd/honeyd.log", + perm=0644 + ) + } +}; + diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/honey --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/honey Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,7 @@ +#!/bin/sh +## +## honey -- Java GUI launcher +## + +@l_prefix@/bin/java -Vsun-jdk -cp @l_prefix@/lib/honeyd/javagui HostFrame + diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/honeyd.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/honeyd.conf Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,62 @@ +## +## honeyd.conf +## + +# Linux 2.4.x host definition +create linuxhost +set linuxhost personality "Linux Kernel 2.4.0 - 2.4.18 (X86)" +add linuxhost tcp port 21 "@l_prefix@/libexec/honeyd/ftp.sh" +add linuxhost tcp port 25 "@l_prefix@/libexec/honeyd/smtp.sh" +add linuxhost tcp port 110 "@l_prefix@/libexec/honeyd/pop3.sh" +add linuxhost tcp port 22 "@l_prefix@/libexec/honeyd/svcs.sh ssh" +add linuxhost tcp port 80 "@l_prefix@/libexec/honeyd/svcs.sh http" +add linuxhost tcp port 53 open +add linuxhost udp port 53 open +add linuxhost tcp port 69 open +add linuxhost udp port 69 open +add linuxhost tcp port 554 open +add linuxhost udp port 554 open +add linuxhost tcp port 23 proxy $ipsrc:23 +set linuxhost default tcp action reset +set linuxhost default udp action reset +set linuxhost uptime 2655300 +set linuxhost uid @l_muid@ gid @l_mgid@ + +# AIX 4.X host definition +create unixhost +set unixhost personality "AIX 4.0 - 4.2" +add unixhost tcp port 21 "@l_prefix@/libexec/honeyd/ftp.sh" +add unixhost tcp port 25 "@l_prefix@/libexec/honeyd/smtp.sh" +add unixhost tcp port 110 "@l_prefix@/libexec/honeyd/pop3.sh" +add unixhost tcp port 22 "@l_prefix@/libexec/honeyd/svcs.sh ssh" +add unixhost tcp port 80 "@l_prefix@/libexec/honeyd/svcs.sh http" +add unixhost tcp port 53 open +add unixhost udp port 53 open +add unixhost tcp port 111 open +add unixhost udp port 111 open +add unixhost tcp port 123 open +add unixhost udp port 123 open +add unixhost tcp port 23 proxy $ipsrc:23 +set unixhost default tcp action reset +set unixhost default udp action reset +set unixhost uptime 3284460 +set unixhost uid @l_muid@ gid @l_mgid@ + +# Windows NT 4.0 host definition +create winhost +set winhost personality "Windows NT 4.0 Server SP5-SP6" +add winhost tcp port 21 "@l_prefix@/libexec/honeyd/ftp.sh" +add winhost tcp port 25 "@l_prefix@/libexec/honeyd/smtp.sh" +add winhost tcp port 110 "@l_prefix@/libexec/honeyd/pop3.sh" +add winhost tcp port 137 open +add winhost udp port 137 open +set winhost default tcp action reset +set winhost default udp action reset +set winhost uptime 663825 +set winhost uid @l_muid@ gid @l_mgid@ + +# Bind hosts +bind 192.168.100.201 linuxhost +bind 192.168.100.202 unixhost +bind 192.168.100.203 winhost + diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/honeyd.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/honeyd.patch Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,213 @@ +Index: command.c +--- command.c.orig 2006-08-19 09:10:40 +0200 ++++ command.c 2006-08-24 12:14:21 +0200 +@@ -72,6 +72,9 @@ + #include "pyextend.h" + #include "honeyd_overload.h" + #include "util.h" ++#ifndef HAVE_SETENV ++#include "setenv.h" ++#endif + + ssize_t atomicio(ssize_t (*)(), int, void *, size_t); + +Index: compat/getopt.h +--- compat/getopt.h.orig 2006-08-19 09:10:40 +0200 ++++ compat/getopt.h 2006-08-24 12:14:21 +0200 +@@ -40,7 +40,11 @@ + #ifndef _GETOPT_H_ + #define _GETOPT_H_ + ++#ifdef HAVE_SYS_CDEFS_H + #include ++#else ++#include "cdefs.h" ++#endif + + /* + * GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions +Index: compat/sha1.h +--- compat/sha1.h.orig 2006-08-19 09:10:40 +0200 ++++ compat/sha1.h 2006-08-24 12:14:21 +0200 +@@ -15,7 +15,11 @@ + unsigned char buffer[64]; + } SHA1_CTX; + ++#ifdef HAVE_SYS_CDEFS_H + #include ++#else ++#include "cdefs.h" ++#endif + + __BEGIN_DECLS + void SHA1Transform(u_int32_t [5], const unsigned char [64]) +Index: config.h.in +--- config.h.in.orig 2006-01-17 18:11:44 +0100 ++++ config.h.in 2006-08-24 12:14:21 +0200 +@@ -222,6 +222,9 @@ + /* Define to 1 if you have the `strtoul' function. */ + #undef HAVE_STRTOUL + ++/* Define to 1 if you have the `setenv' function. */ ++#undef HAVE_SETENV ++ + /* Define if your system defines struct sockaddr_storage */ + #undef HAVE_STRUCT_SOCKADDR_STORAGE + +@@ -255,6 +258,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_SYS_TYPES_H + ++/* Define to 1 if you have the header file. */ ++#undef HAVE_SYS_CDEFS_H ++ + /* Define to 1 if you have that is POSIX.1 compatible. */ + #undef HAVE_SYS_WAIT_H + +Index: configure +--- configure.orig 2006-08-19 09:11:11 +0200 ++++ configure 2006-08-24 12:14:21 +0200 +@@ -22317,7 +22317,7 @@ + + + +-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 syslog.h unistd.h assert.h ++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 syslog.h unistd.h assert.h sys/cdefs.h + do + as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` + if eval "test \"\${$as_ac_Header+set}\" = set"; then +@@ -23483,7 +23483,7 @@ + + + +-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 ++for ac_func in asprintf dup2 fgetln gettimeofday memmove memset strcasecmp strchr strdup strncasecmp strtoul strspn getaddrinfo getnameinfo freeaddrinfo setgroups sendmsg recvmsg setregid setruid setenv kqueue + do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` + echo "$as_me:$LINENO: checking for $ac_func" >&5 +Index: dhcpclient.c +--- dhcpclient.c.orig 2006-08-19 09:10:41 +0200 ++++ dhcpclient.c 2006-08-24 12:14:21 +0200 +@@ -94,6 +94,13 @@ + + #define NTRIES 10 + ++#ifndef MIN ++# define MIN(a,b) (((a) < (b)) ? (a) : (b)) ++#endif /* MIN */ ++#ifndef MAX ++# define MAX(a,b) (((a) > (b)) ? (a) : (b)) ++#endif /* MAX */ ++ + static int _pack_request(struct dhcpclient_req *, void *, size_t *); + static int _pack_release(struct dhcpclient_req *, void *, size_t *); + static int _bcast(struct template *, +Index: honeyd.c +--- honeyd.c.orig 2006-08-19 09:14:36 +0200 ++++ honeyd.c 2006-08-24 12:14:21 +0200 +@@ -101,6 +101,9 @@ + #include "histogram.h" + #include "update.h" + #include "util.h" ++#ifndef HAVE_SETENV ++#include "setenv.h" ++#endif + + #ifdef HAVE_PYTHON + #include +Index: honeyd_overload.c +--- honeyd_overload.c.orig 2006-08-19 09:10:41 +0200 ++++ honeyd_overload.c 2006-08-24 12:14:21 +0200 +@@ -295,7 +295,7 @@ + struct fd *nfd; + int pair[2]; + +- if (socketpair(AF_LOCAL, type, 0, pair) == -1) { ++ if (socketpair(AF_UNIX, type, 0, pair) == -1) { + warn("%s: socketpair", __func__); + return (NULL); + } +@@ -625,7 +625,7 @@ + } + + /* Get another socketpair */ +- if (socketpair(AF_LOCAL, SOCK_STREAM, 0, pair) == -1) { ++ if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) { + DPRINTF((stderr, "%s: socketpair failed", __func__)); + errno = ETIMEDOUT; /* XXX */ + return (-1); +@@ -732,6 +732,7 @@ + } + #endif /* !__FreeBSD__ */ + ++#ifndef sun + ssize_t + recvfrom(int sock, void *buf, size_t len, int flags, struct sockaddr *from, + socklen_t *fromlen) +@@ -759,6 +760,7 @@ + out: + return (ret); + } ++#endif /* !sun */ + + ssize_t + sendto(int sock, const void *buf, size_t len, int flags, +@@ -795,6 +797,7 @@ + return (ret); + } + ++#ifndef sun + int + getsockname(int sock, struct sockaddr *to, socklen_t *tolen) + { +@@ -832,6 +835,7 @@ + + return (0); + } ++#endif /* !sun */ + + ssize_t + recvmsg(int sock, struct msghdr *msg, int flags) +@@ -1120,6 +1124,7 @@ + return (ret); + } + ++#ifndef sun + int + accept(int sock, struct sockaddr *addr, socklen_t *addrlen) + { +@@ -1169,6 +1174,7 @@ + + return (fd); + } ++#endif /* !sun */ + + #if 0 + +Index: personality.c +--- personality.c.orig 2006-08-19 09:10:40 +0200 ++++ personality.c 2006-08-24 12:14:21 +0200 +@@ -32,6 +32,9 @@ + + #include + #include ++#ifndef UINT_MAX ++#define UINT_MAX 4294967295U ++#endif + + #include "config.h" + +Index: pf_osfp.c +--- pf_osfp.c.orig 2006-08-19 09:10:40 +0200 ++++ pf_osfp.c 2006-08-24 12:14:21 +0200 +@@ -50,6 +50,10 @@ + # define DPFPRINTF(format, x...) ((void)0) + # endif /* PFDEBUG */ + ++#ifndef MAX ++# define MAX(a,b) (((a) > (b)) ? (a) : (b)) ++#endif ++ + SLIST_HEAD(pf_osfp_list, pf_os_fingerprint) pf_osfp_list; + pool_t pf_osfp_entry_pl; + pool_t pf_osfp_pl; diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/honeyd.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/honeyd.spec Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,265 @@ +## +## honeyd.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# package version +%define V_honeyd 1.5b +%define V_libdnsres 0.1a + +# package information +Name: honeyd +Summary: Creates a Virtual Host on Network +URL: http://www.honeyd.org/ +Vendor: Niels Provos +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: EVAL +Group: Security +License: BSD +Version: %{V_honeyd} +Release: 20080101 + +# package options +%option with_fsl yes +%option with_gui no + +# list of sources +Source0: http://www.citi.umich.edu/u/provos/honeyd/honeyd-%{V_honeyd}.tar.gz +Source1: http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/ftp.sh +Source2: http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/pop3.sh +Source3: http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/smtp.sh +Source4: http://www.citi.umich.edu/u/provos/papers/honeyd-eabstract.pdf +Source5: http://www.citi.umich.edu/u/provos/papers/honeyd-eabstract.ps +Source6: http://www.citi.umich.edu/u/provos/honeyd/ch01-results/1/honeydGUI.tar.gz +Source7: honey +Source8: svcs.sh +Source9: rc.honeyd +Source10: fsl.honeyd +Source11: honeyd.conf +Source12: cdefs.h +Source13: setenv.h +Source14: setenv.c +Source15: vasprintf.c +Source16: vasprintf.h +Source17: http://www.monkey.org/~provos/libdnsres-%{V_libdnsres}.tar.gz +Patch0: honeyd.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20060823, make +PreReq: OpenPKG, openpkg >= 20060823 +BuildPreReq: libdnet, libpcap, libevent, libedit, zlib, pcre +PreReq: libdnet, libpcap, libevent, libedit, zlib, pcre +%if "%{with_fsl}" == "yes" +BuildPreReq: fsl +PreReq: fsl +%endif +%if "%{with_gui}" == "yes" +PreReq: java, JAVA-JDK +%endif +AutoReq: no +AutoReqProv: no + +%description + Honeyd is a small daemon that creates virtual hosts on a network. + The hosts can be configured to run arbitrary services, and their + TCP personality can be adapted so that they appear to be running + certain versions of operating systems. Honeyd enables a single host + to claim multiple addresses on a LAN for network simulation. It is + possible to ping the virtual machines, or to traceroute them. Any + type of service on the virtual machine can be simulated according to + a simple configuration file. Instead of simulating a service, it is + also possible to proxy it to another machine. The package arpd will + most certainly be useful as well, although it is not a technical + requirement for this package. + +%track + prog honeyd:honeyd = { + version = %{V_honeyd} + url = http://www.citi.umich.edu/u/provos/honeyd/ + regex = honeyd-(__VER__)\.tar\.gz + } + prog honeyd:libdnsres = { + version = %{V_libdnsres} + url = http://www.monkey.org/~provos/libdnsres/ + regex = libdnsres-(__VER__)\.tar\.gz + } + +%prep + %setup -q + %setup -q -D -T -a 17 + %patch -p0 + %{l_shtool} subst \ + -e 's;AF_LOCAL;AF_UNIX;' \ + *.c + %{l_shtool} subst \ + -e 's;^\(honeyd_SOURCES *=[^\\]*\);\1 setenv.c vasprintf.c;' \ + -e 's;^\(honeyd_OBJECTS *=[^\\]*\);\1 setenv.o vasprintf.o ;' \ + Makefile.in + cp -f %{SOURCE setenv.c} . + cp -f %{SOURCE setenv.h} . + cp -f %{SOURCE vasprintf.c} . + cp -f %{SOURCE vasprintf.h} . + cp -f %{SOURCE cdefs.h} . + %{l_shtool} subst \ + -e 's;/var/run/honeyd.pid;%{l_prefix}/var/honeyd/honeyd.pid;' \ + honeyd.h + %{l_shtool} subst \ + -e 's/\(user_target=no\)/\1; pic_mode=no;/' \ + -e 's;test "*$\(hardcode_into_libs\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \ + -e 's;test "*$\(build_libtool_need_lc\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \ + ltmain.sh + case "%{l_platform -t}" in + *-sunos* ) + %{l_shtool} subst \ + -e 's;-levent;-levent -lsocket -lnsl;g' \ + configure + %{l_shtool} subst \ + -e 's;\(\$(honeydctl_LDADD)\);\1 -lsocket -lnsl;g' \ + Makefile.in + ;; + esac + +%build + ( cd libdnsres-%{V_libdnsres} + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags}" \ + ./configure \ + --with-libevent=%{l_prefix} \ + --disable-shared + %{l_make} %{l_mflags} + ln .libs/libdnsres.a . + ) || exit $? + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags} -DREPLACE_GETOPT" \ + LDFLAGS="%{l_fsl_ldflags}" \ + LIBS="%{l_fsl_libs}" \ + ./configure \ + --prefix=%{l_prefix} \ + --with-libevent=%{l_prefix} \ + --with-libdnet=%{l_prefix} \ + --with-libdnsres=`pwd`/libdnsres-%{V_libdnsres} \ + --with-libpcre=%{l_prefix} \ + --without-python + %{l_make} %{l_mflags} + +%install + rm -rf $RPM_BUILD_ROOT + + # create directories + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ + $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd \ + $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd \ + $RPM_BUILD_ROOT%{l_prefix}/var/honeyd \ + $RPM_BUILD_ROOT%{l_prefix}/share/honeyd \ + $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd + + # install files + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT + %{l_shtool} install -c -m 750 %{l_value -s -a} \ + -e 's;^log=/\(.*/\)*\(.*\)-.*\.log;log=%{l_prefix}/var/honeyd/\2.log;g' \ + -e 's;^\(host=\).*;\1`%{l_shtool} echo -e %h`;g' \ + -e 's;^\(domain=\).*;\1`%{l_shtool} echo -e %d | cut -c2-`;g' \ + -e 's; gawk ; awk ;g' \ + %{SOURCE ftp.sh} \ + %{SOURCE pop3.sh} \ + %{SOURCE smtp.sh} \ + %{SOURCE svcs.sh} \ + $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd/ + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE honeyd.conf} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd/ + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.honeyd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + %{l_shtool} install -c -m 644 \ + %{SOURCE honeyd-eabstract.ps} \ + $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/honeyd.ps + %{l_shtool} install -c -m 644 \ + %{SOURCE honeyd-eabstract.pdf} \ + $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/honeyd.pdf + + # optionally install the Java GUI +%if "%{with_gui}" == "yes" + %{l_tar} zxf %{SOURCE honeydGUI.tar.gz} + mv -f honeydGUI/exec $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd/javagui + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE honey} \ + $RPM_BUILD_ROOT%{l_prefix}/bin/ +%endif + + # install OSSP fsl configuration + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE fsl.honeyd} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ + + # remove unwanted files + rm -rf $RPM_BUILD_ROOT%{l_prefix}/include + rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/README + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/config.sample + + # determine file list + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%config %attr(0750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/honeyd' \ + '%config %{l_prefix}/etc/fsl/fsl.honeyd' \ + '%config %attr(0750,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/honeyd/honeyd.conf' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%pre + # before upgrade, save status and stop service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} honeyd status 2>/dev/null | tee %{l_tmpfile}` + %{l_rc} honeyd stop 2>/dev/null + exit 0 + +%post + if [ $1 -eq 1 ]; then + # display final hints on initial installation + ( echo "Before starting Honey daemon, please set the configuration variable" + echo "\"honeyd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" + echo "used network interface." + ) | %{l_rpmtool} msg -b -t notice + fi + if [ $1 -eq 2 ]; then + # after upgrade, restore status + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} + [ ".$honeyd_active" = .yes ] && %{l_rc} honeyd start + fi + exit 0 + +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} honeyd stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/honeyd/*.log* >/dev/null 2>&1 || true + exit 0 + diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/rc.honeyd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/rc.honeyd Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,77 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.honeyd -- Run-Commands +## + +%config + honeyd_enable="$openpkg_rc_def" + honeyd_log_prolog="true" + honeyd_log_epilog="true" + honeyd_log_numfiles="10" + honeyd_log_minsize="1M" + honeyd_log_complevel="9" + honeyd_ip_network="192.168.100.0/24" + honeyd_if="" + +%common + honeyd_pidfile="@l_prefix@/var/honeyd/honeyd.pid" + honeyd_cfgfile="@l_prefix@/etc/honeyd/honeyd.conf" + honeyd_prnfile="@l_prefix@/share/honeyd/nmap.prints" + honeyd_xpbfile="@l_prefix@/share/honeyd/xprobe2.conf" + honeyd_assfile="@l_prefix@/share/honeyd/nmap.assoc" + honeyd_signal () { + [ -f $honeyd_pidfile ] && kill -$1 `cat $honeyd_pidfile` + } + +%status -u @l_susr@ -o + honeyd_usable="no" + honeyd_active="no" + rcService honeyd enable yes && \ + honeyd_chroot && honeyd_usable="yes" + rcService honeyd enable yes && \ + honeyd_signal 0 && honeyd_active="yes" + echo "honeyd_enable=\"$honeyd_enable\"" + echo "honeyd_usable=\"$honeyd_usable\"" + echo "honeyd_active=\"$honeyd_active\"" + +%start -u @l_susr@ + rcService honeyd enable yes || exit 0 + rcService honeyd active yes && exit 0 + if [ ".$honeyd_if" != . ]; then + arpd_interface="-i $honeyd_if" + fi + @l_prefix@/bin/honeyd \ + -p $honeyd_prnfile \ + -x $honeyd_xpbfile \ + -a $honeyd_assfile \ + -f $honeyd_cfgfile \ + $honeyd_interface \ + $honeyd_ip_network \ + >/dev/null 2>&1 + +%stop -u @l_susr@ + rcService honeyd enable yes || exit 0 + rcService honeyd active no && exit 0 + honeyd_signal TERM + +%restart -u @l_susr@ + rcService honeyd enable yes || exit 0 + rcService honeyd active no && exit 0 + rc honeyd stop + sleep 2 + rc honeyd start + +%reload -u @l_susr@ + rcService honeyd enable yes || exit 0 + rcService honeyd active no && exit 0 + honeyd_signal HUP + +%daily -u @l_susr@ + rcService honeyd enable yes || exit 0 + shtool rotate -f \ + -n ${honeyd_log_numfiles} -s ${honeyd_log_minsize} -d \ + -z ${honeyd_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \ + -P "${honeyd_log_prolog}" \ + -E "${honeyd_log_epilog}; rc honeyd restart" \ + @l_prefix@/var/honeyd/honeyd.log + diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/setenv.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/setenv.c Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,26 @@ + +#ifndef HAVE_SETENV +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include +#include +#include + +int setenv(const char *kszName, const char *kszValue, int nOverwrite) +{ + char *szPair = NULL; + + if (nOverwrite == 0 && getenv(kszName) != 0) + return 0; + szPair = malloc(strlen(kszName) + 1 + strlen(kszValue) + 1); + if (szPair == NULL) + return -1; + strcpy(szPair, kszName); + strcat(szPair, "="); + strcat(szPair, kszValue); + putenv(szPair); + return 0; +} +#endif /* !HAVE_SETENV */ + diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/setenv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/setenv.h Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,4 @@ +#ifndef LOC_SETENV_H +# define LOC_SETENV_H +int setenv(const char *, const char *, int); +#endif /* not LOC_SETENV_H */ diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/svcs.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/svcs.sh Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,37 @@ +#! /bin/sh +## +## honeyd.service -- small honeyd(8) service faking script +## Copyright (c) 2003 The OpenPKG Project +## + +# honeyd(8) provides: +# $HONEYD_PERSONALITY +# $HONEYD_IP_SRC, $HONEYD_SRC_PORT +# $HONEYD_IP_DST, $HONEYD_DST_PORT + +service="$1" +shift + +case $service in + http ) + line="true" + while $line; do + read line + done + echo "HTTP/1.1 404 Not Found" + echo "Date: `date`" + echo "Server: Apache" + echo "Connection: close" + echo "Content-Type: text/plain; charset=iso-8859-1" + echo "" + echo "Error: 404 Not Found" + exit 0 + ;; + ssh ) + echo "SSH-1.5-2.40" + read line + echo "Protocol mismatch." + exit 0 + ;; +esac + diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/vasprintf.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/vasprintf.c Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,133 @@ +/* Like vsprintf but provides a pointer to malloc'd storage, which must + be freed by the caller. + Copyright (C) 1994, 2003 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include "vasprintf.h" + +/* + +@deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args}) + +Like @code{vsprintf}, but instead of passing a pointer to a buffer, +you pass a pointer to a pointer. This function will compute the size +of the buffer needed, allocate memory with @code{malloc}, and store a +pointer to the allocated memory in @code{*@var{resptr}}. The value +returned is the same as @code{vsprintf} would return. If memory could +not be allocated, minus one is returned and @code{NULL} is stored in +@code{*@var{resptr}}. + +@end deftypefn + +*/ + +static int int_vasprintf(char **, const char *, va_list); + +static int +int_vasprintf (result, format, args) + char **result; + const char *format; + va_list args; +{ + const char *p = format; + /* Add one to make sure that it is never zero, which might cause malloc + to return NULL. */ + int total_width = strlen (format) + 1; + va_list ap; + + memcpy ((void *) &ap, (const void *) &args, sizeof (va_list)); + + while (*p != '\0') + { + if (*p++ == '%') + { + while (strchr ("-+ #0", *p)) + ++p; + if (*p == '*') + { + ++p; + total_width += abs (va_arg (ap, int)); + } + else + total_width += strtoul (p, (char **) &p, 10); + if (*p == '.') + { + ++p; + if (*p == '*') + { + ++p; + total_width += abs (va_arg (ap, int)); + } + else + total_width += strtoul (p, (char **) &p, 10); + } + while (strchr ("hlL", *p)) + ++p; + /* Should be big enough for any format specifier except %s and floats. */ + total_width += 30; + switch (*p) + { + case 'd': + case 'i': + case 'o': + case 'u': + case 'x': + case 'X': + case 'c': + (void) va_arg (ap, int); + break; + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + (void) va_arg (ap, double); + /* Since an ieee double can have an exponent of 307, we'll + make the buffer wide enough to cover the gross case. */ + total_width += 307; + break; + case 's': + total_width += strlen (va_arg (ap, char *)); + break; + case 'p': + case 'n': + (void) va_arg (ap, char *); + break; + } + p++; + } + } + *result = (char *) malloc (total_width); + if (*result != NULL) + return vsprintf (*result, format, args); + else + return -1; +} + +int +vasprintf (result, format, args) + char **result; + const char *format; + va_list args; +{ + return int_vasprintf (result, format, args); +} diff -r 37c544fc0159 -r 1074e5934dd9 honeyd/vasprintf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/honeyd/vasprintf.h Tue Aug 28 18:35:30 2012 +0200 @@ -0,0 +1,21 @@ +/* Like vsprintf but provides a pointer to malloc'd storage, which must + be freed by the caller. + Copyright (C) 1994, 2003 Free Software Foundation, Inc. + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +int vasprintf(char **, const char *, va_list);