1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/honeyd/honeyd.spec Tue Aug 28 18:35:30 2012 +0200 1.3 @@ -0,0 +1,265 @@ 1.4 +## 1.5 +## honeyd.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package version 1.28 +%define V_honeyd 1.5b 1.29 +%define V_libdnsres 0.1a 1.30 + 1.31 +# package information 1.32 +Name: honeyd 1.33 +Summary: Creates a Virtual Host on Network 1.34 +URL: http://www.honeyd.org/ 1.35 +Vendor: Niels Provos 1.36 +Packager: OpenPKG Foundation e.V. 1.37 +Distribution: OpenPKG Community 1.38 +Class: EVAL 1.39 +Group: Security 1.40 +License: BSD 1.41 +Version: %{V_honeyd} 1.42 +Release: 20080101 1.43 + 1.44 +# package options 1.45 +%option with_fsl yes 1.46 +%option with_gui no 1.47 + 1.48 +# list of sources 1.49 +Source0: http://www.citi.umich.edu/u/provos/honeyd/honeyd-%{V_honeyd}.tar.gz 1.50 +Source1: http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/ftp.sh 1.51 +Source2: http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/pop3.sh 1.52 +Source3: http://www.citi.umich.edu/u/provos/honeyd/contrib/mael/smtp.sh 1.53 +Source4: http://www.citi.umich.edu/u/provos/papers/honeyd-eabstract.pdf 1.54 +Source5: http://www.citi.umich.edu/u/provos/papers/honeyd-eabstract.ps 1.55 +Source6: http://www.citi.umich.edu/u/provos/honeyd/ch01-results/1/honeydGUI.tar.gz 1.56 +Source7: honey 1.57 +Source8: svcs.sh 1.58 +Source9: rc.honeyd 1.59 +Source10: fsl.honeyd 1.60 +Source11: honeyd.conf 1.61 +Source12: cdefs.h 1.62 +Source13: setenv.h 1.63 +Source14: setenv.c 1.64 +Source15: vasprintf.c 1.65 +Source16: vasprintf.h 1.66 +Source17: http://www.monkey.org/~provos/libdnsres-%{V_libdnsres}.tar.gz 1.67 +Patch0: honeyd.patch 1.68 + 1.69 +# build information 1.70 +Prefix: %{l_prefix} 1.71 +BuildRoot: %{l_buildroot} 1.72 +BuildPreReq: OpenPKG, openpkg >= 20060823, make 1.73 +PreReq: OpenPKG, openpkg >= 20060823 1.74 +BuildPreReq: libdnet, libpcap, libevent, libedit, zlib, pcre 1.75 +PreReq: libdnet, libpcap, libevent, libedit, zlib, pcre 1.76 +%if "%{with_fsl}" == "yes" 1.77 +BuildPreReq: fsl 1.78 +PreReq: fsl 1.79 +%endif 1.80 +%if "%{with_gui}" == "yes" 1.81 +PreReq: java, JAVA-JDK 1.82 +%endif 1.83 +AutoReq: no 1.84 +AutoReqProv: no 1.85 + 1.86 +%description 1.87 + Honeyd is a small daemon that creates virtual hosts on a network. 1.88 + The hosts can be configured to run arbitrary services, and their 1.89 + TCP personality can be adapted so that they appear to be running 1.90 + certain versions of operating systems. Honeyd enables a single host 1.91 + to claim multiple addresses on a LAN for network simulation. It is 1.92 + possible to ping the virtual machines, or to traceroute them. Any 1.93 + type of service on the virtual machine can be simulated according to 1.94 + a simple configuration file. Instead of simulating a service, it is 1.95 + also possible to proxy it to another machine. The package arpd will 1.96 + most certainly be useful as well, although it is not a technical 1.97 + requirement for this package. 1.98 + 1.99 +%track 1.100 + prog honeyd:honeyd = { 1.101 + version = %{V_honeyd} 1.102 + url = http://www.citi.umich.edu/u/provos/honeyd/ 1.103 + regex = honeyd-(__VER__)\.tar\.gz 1.104 + } 1.105 + prog honeyd:libdnsres = { 1.106 + version = %{V_libdnsres} 1.107 + url = http://www.monkey.org/~provos/libdnsres/ 1.108 + regex = libdnsres-(__VER__)\.tar\.gz 1.109 + } 1.110 + 1.111 +%prep 1.112 + %setup -q 1.113 + %setup -q -D -T -a 17 1.114 + %patch -p0 1.115 + %{l_shtool} subst \ 1.116 + -e 's;AF_LOCAL;AF_UNIX;' \ 1.117 + *.c 1.118 + %{l_shtool} subst \ 1.119 + -e 's;^\(honeyd_SOURCES *=[^\\]*\);\1 setenv.c vasprintf.c;' \ 1.120 + -e 's;^\(honeyd_OBJECTS *=[^\\]*\);\1 setenv.o vasprintf.o ;' \ 1.121 + Makefile.in 1.122 + cp -f %{SOURCE setenv.c} . 1.123 + cp -f %{SOURCE setenv.h} . 1.124 + cp -f %{SOURCE vasprintf.c} . 1.125 + cp -f %{SOURCE vasprintf.h} . 1.126 + cp -f %{SOURCE cdefs.h} . 1.127 + %{l_shtool} subst \ 1.128 + -e 's;/var/run/honeyd.pid;%{l_prefix}/var/honeyd/honeyd.pid;' \ 1.129 + honeyd.h 1.130 + %{l_shtool} subst \ 1.131 + -e 's/\(user_target=no\)/\1; pic_mode=no;/' \ 1.132 + -e 's;test "*$\(hardcode_into_libs\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \ 1.133 + -e 's;test "*$\(build_libtool_need_lc\)"* *\([!=]*\) *"*\([a-zA-Z_][a-zA-Z_]*\)"*;test ".$\1" \2 ".$\3";g' \ 1.134 + ltmain.sh 1.135 + case "%{l_platform -t}" in 1.136 + *-sunos* ) 1.137 + %{l_shtool} subst \ 1.138 + -e 's;-levent;-levent -lsocket -lnsl;g' \ 1.139 + configure 1.140 + %{l_shtool} subst \ 1.141 + -e 's;\(\$(honeydctl_LDADD)\);\1 -lsocket -lnsl;g' \ 1.142 + Makefile.in 1.143 + ;; 1.144 + esac 1.145 + 1.146 +%build 1.147 + ( cd libdnsres-%{V_libdnsres} 1.148 + CC="%{l_cc}" \ 1.149 + CFLAGS="%{l_cflags -O}" \ 1.150 + CPPFLAGS="%{l_cppflags}" \ 1.151 + ./configure \ 1.152 + --with-libevent=%{l_prefix} \ 1.153 + --disable-shared 1.154 + %{l_make} %{l_mflags} 1.155 + ln .libs/libdnsres.a . 1.156 + ) || exit $? 1.157 + CC="%{l_cc}" \ 1.158 + CFLAGS="%{l_cflags -O}" \ 1.159 + CPPFLAGS="%{l_cppflags} -DREPLACE_GETOPT" \ 1.160 + LDFLAGS="%{l_fsl_ldflags}" \ 1.161 + LIBS="%{l_fsl_libs}" \ 1.162 + ./configure \ 1.163 + --prefix=%{l_prefix} \ 1.164 + --with-libevent=%{l_prefix} \ 1.165 + --with-libdnet=%{l_prefix} \ 1.166 + --with-libdnsres=`pwd`/libdnsres-%{V_libdnsres} \ 1.167 + --with-libpcre=%{l_prefix} \ 1.168 + --without-python 1.169 + %{l_make} %{l_mflags} 1.170 + 1.171 +%install 1.172 + rm -rf $RPM_BUILD_ROOT 1.173 + 1.174 + # create directories 1.175 + %{l_shtool} mkdir -f -p -m 755 \ 1.176 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ 1.177 + $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd \ 1.178 + $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd \ 1.179 + $RPM_BUILD_ROOT%{l_prefix}/var/honeyd \ 1.180 + $RPM_BUILD_ROOT%{l_prefix}/share/honeyd \ 1.181 + $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd 1.182 + 1.183 + # install files 1.184 + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT 1.185 + %{l_shtool} install -c -m 750 %{l_value -s -a} \ 1.186 + -e 's;^log=/\(.*/\)*\(.*\)-.*\.log;log=%{l_prefix}/var/honeyd/\2.log;g' \ 1.187 + -e 's;^\(host=\).*;\1`%{l_shtool} echo -e %h`;g' \ 1.188 + -e 's;^\(domain=\).*;\1`%{l_shtool} echo -e %d | cut -c2-`;g' \ 1.189 + -e 's; gawk ; awk ;g' \ 1.190 + %{SOURCE ftp.sh} \ 1.191 + %{SOURCE pop3.sh} \ 1.192 + %{SOURCE smtp.sh} \ 1.193 + %{SOURCE svcs.sh} \ 1.194 + $RPM_BUILD_ROOT%{l_prefix}/libexec/honeyd/ 1.195 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.196 + %{SOURCE honeyd.conf} \ 1.197 + $RPM_BUILD_ROOT%{l_prefix}/etc/honeyd/ 1.198 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.199 + %{SOURCE rc.honeyd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.200 + %{l_shtool} install -c -m 644 \ 1.201 + %{SOURCE honeyd-eabstract.ps} \ 1.202 + $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/honeyd.ps 1.203 + %{l_shtool} install -c -m 644 \ 1.204 + %{SOURCE honeyd-eabstract.pdf} \ 1.205 + $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/honeyd.pdf 1.206 + 1.207 + # optionally install the Java GUI 1.208 +%if "%{with_gui}" == "yes" 1.209 + %{l_tar} zxf %{SOURCE honeydGUI.tar.gz} 1.210 + mv -f honeydGUI/exec $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd/javagui 1.211 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.212 + %{SOURCE honey} \ 1.213 + $RPM_BUILD_ROOT%{l_prefix}/bin/ 1.214 +%endif 1.215 + 1.216 + # install OSSP fsl configuration 1.217 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.218 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.219 + %{SOURCE fsl.honeyd} \ 1.220 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.221 + 1.222 + # remove unwanted files 1.223 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/include 1.224 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/honeyd 1.225 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/README 1.226 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/honeyd/config.sample 1.227 + 1.228 + # determine file list 1.229 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.230 + %{l_files_std} \ 1.231 + '%config %attr(0750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/honeyd' \ 1.232 + '%config %{l_prefix}/etc/fsl/fsl.honeyd' \ 1.233 + '%config %attr(0750,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/honeyd/honeyd.conf' 1.234 + 1.235 +%files -f files 1.236 + 1.237 +%clean 1.238 + rm -rf $RPM_BUILD_ROOT 1.239 + 1.240 +%pre 1.241 + # before upgrade, save status and stop service 1.242 + [ $1 -eq 2 ] || exit 0 1.243 + eval `%{l_rc} honeyd status 2>/dev/null | tee %{l_tmpfile}` 1.244 + %{l_rc} honeyd stop 2>/dev/null 1.245 + exit 0 1.246 + 1.247 +%post 1.248 + if [ $1 -eq 1 ]; then 1.249 + # display final hints on initial installation 1.250 + ( echo "Before starting Honey daemon, please set the configuration variable" 1.251 + echo "\"honeyd_if\" in $RPM_INSTALL_PREFIX/etc/rc.conf to the name of the" 1.252 + echo "used network interface." 1.253 + ) | %{l_rpmtool} msg -b -t notice 1.254 + fi 1.255 + if [ $1 -eq 2 ]; then 1.256 + # after upgrade, restore status 1.257 + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} 1.258 + [ ".$honeyd_active" = .yes ] && %{l_rc} honeyd start 1.259 + fi 1.260 + exit 0 1.261 + 1.262 +%preun 1.263 + # before erase, stop service and remove log files 1.264 + [ $1 -eq 0 ] || exit 0 1.265 + %{l_rc} honeyd stop 2>/dev/null 1.266 + rm -f $RPM_INSTALL_PREFIX/var/honeyd/*.log* >/dev/null 2>&1 || true 1.267 + exit 0 1.268 +