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