1# not ready yet
2%{?!with_python:      %global with_python      1}
3
4%if %{with_python}
5%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
6%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
7%endif
8
9Summary: Validating, recursive, and caching DNS(SEC) resolver
10Name: unbound
11Version: 1.4.13
12Release: 1%{?dist}
13License: BSD
14Url: http://www.nlnetlabs.nl/unbound/
15Source: http://www.unbound.net/downloads/%{name}-%{version}.tar.gz
16Source1: unbound.init
17Source2: unbound.conf
18Source3: unbound.munin
19Source4: unbound_munin_
20Source5: root.key
21Patch1: unbound-1.2-glob.patch
22
23Group: System Environment/Daemons
24BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
25BuildRequires: flex, openssl-devel , ldns-devel >= 1.5.0, 
26BuildRequires: libevent-devel expat-devel
27%if %{with_python}
28BuildRequires:  python-devel swig
29%endif
30# Required for SVN versions
31# BuildRequires: bison
32
33Requires(post): chkconfig
34Requires(preun): chkconfig
35Requires(preun): initscripts
36Requires(postun): initscripts
37Requires: ldns >= 1.5.0
38Requires(pre): shadow-utils
39
40Obsoletes:      dnssec-conf < 1.27-2
41Provides:       dnssec-conf = 1.27-1
42
43%description
44Unbound is a validating, recursive, and caching DNS(SEC) resolver.
45
46The C implementation of Unbound is developed and maintained by NLnet
47Labs. It is based on ideas and algorithms taken from a java prototype
48developed by Verisign labs, Nominet, Kirei and ep.net.
49
50Unbound is designed as a set of modular components, so that also
51DNSSEC (secure DNS) validation and stub-resolvers (that do not run
52as a server, but are linked into an application) are easily possible.
53
54%package munin
55Summary: Plugin for the munin / munin-node monitoring package
56Group:     System Environment/Daemons
57Requires: munin-node
58Requires: %{name} = %{version}-%{release}, bc
59
60%description munin
61Plugin for the munin / munin-node monitoring package
62
63%package devel
64Summary: Development package that includes the unbound header files
65Group: Development/Libraries
66Requires: %{name}-libs = %{version}-%{release}, openssl-devel, ldns-devel
67
68%description devel
69The devel package contains the unbound library and the include files
70
71%package libs
72Summary: Libraries used by the unbound server and client applications
73Group: Applications/System
74Requires(post): /sbin/ldconfig
75Requires(postun): /sbin/ldconfig
76Requires: openssl 
77
78%description libs
79Contains libraries used by the unbound server and client applications
80
81%if %{with_python}
82%package python
83Summary: Python modules and extensions for unbound
84Group: Applications/System
85Requires: %{name}-libs = %{version}-%{release}
86
87%description python
88Python modules and extensions for unbound
89%endif
90
91%prep
92%setup -q 
93%patch1 -p1
94
95%build
96%configure  --with-ldns= --with-libevent --with-pthreads --with-ssl \
97            --disable-rpath --disable-static \
98            --with-conf-file=%{_sysconfdir}/%{name}/unbound.conf \
99            --with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid \
100%if %{with_python}
101            --with-pythonmodule --with-pyunbound \
102%endif
103            --enable-sha2 --disable-gost
104%{__make} %{?_smp_mflags}
105
106%install
107rm -rf %{buildroot}
108%{__make} DESTDIR=%{buildroot} install
109install -d 0755 %{buildroot}%{_initrddir}
110install -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/unbound
111install -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/unbound
112# Install munin plugin and its softlinks
113install -d 0755 %{buildroot}%{_sysconfdir}/munin/plugin-conf.d
114install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/munin/plugin-conf.d/unbound
115install -d 0755 %{buildroot}%{_datadir}/munin/plugins/
116install -m 0755 %{SOURCE4} %{buildroot}%{_datadir}/munin/plugins/unbound
117for plugin in unbound_munin_hits unbound_munin_queue unbound_munin_memory unbound_munin_by_type unbound_munin_by_class unbound_munin_by_opcode unbound_munin_by_rcode unbound_munin_by_flags unbound_munin_histogram; do
118    ln -s unbound %{buildroot}%{_datadir}/munin/plugins/$plugin
119done 
120
121# install root and DLV key
122install -m 0644 %{SOURCE5} %{SOURCE6} %{buildroot}%{_sysconfdir}/unbound/
123
124# remove static library from install (fedora packaging guidelines)
125rm %{buildroot}%{_libdir}/*.la
126%if %{with_python}
127rm %{buildroot}%{python_sitearch}/*.la
128%endif
129
130mkdir -p %{buildroot}%{_localstatedir}/run/unbound
131
132%clean
133rm -rf ${RPM_BUILD_ROOT}
134
135%files 
136%defattr(-,root,root,-)
137%doc doc/README doc/CREDITS doc/LICENSE doc/FEATURES
138%attr(0755,root,root) %{_initrddir}/%{name}
139%attr(0755,root,root) %dir %{_sysconfdir}/%{name}
140%ghost %attr(0755,unbound,unbound) %dir %{_localstatedir}/run/%{name}
141%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/unbound.conf
142%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/root.key
143%{_sbindir}/*
144%{_mandir}/*/*
145
146%if %{with_python}
147%files python
148%defattr(-,root,root,-)
149%{python_sitearch}/*
150%doc libunbound/python/examples/*
151%doc pythonmod/examples/*
152%endif
153
154%files munin
155%defattr(-,root,root,-)
156%config(noreplace) %{_sysconfdir}/munin/plugin-conf.d/unbound
157%{_datadir}/munin/plugins/unbound*
158
159%files devel
160%defattr(-,root,root,-)
161%{_libdir}/libunbound.so
162%{_includedir}/unbound.h
163%doc README
164
165%files libs
166%defattr(-,root,root,-)
167%{_libdir}/libunbound.so.*
168%doc doc/README doc/LICENSE
169
170%pre
171getent group unbound >/dev/null || groupadd -r unbound
172getent passwd unbound >/dev/null || \
173useradd -r -g unbound -d %{_sysconfdir}/unbound -s /sbin/nologin \
174-c "Unbound DNS resolver" unbound
175exit 0
176
177%post
178/sbin/chkconfig --add %{name}
179
180%post libs -p /sbin/ldconfig
181
182%preun
183if [ "$1" -eq 0 ]; then
184        /sbin/service %{name} stop >/dev/null 2>&1
185        /sbin/chkconfig --del %{name} 
186fi
187
188%postun 
189if [ "$1" -ge "1" ]; then
190  /sbin/service %{name} condrestart >/dev/null 2>&1 || :
191fi
192
193%postun libs -p /sbin/ldconfig
194
195%changelog
196* Tue Sep 06 2011 Paul Wouters <paul@xelerance.com> - 1.4.13-1
197- Updated to 1.4.13
198- Fix install location of pythonmod from sitelib to sitearch
199- Removed patches merged in by upstream
200- Removed versioned openssl dep, it differs per branch
201 
202* Mon Aug 08 2011 Paul Wouters <paul@xelerance.com> - 1.4.12-3
203- Added pythonmod docs and examples
204- Fix for python module load in the server (Tom Hendrikx)
205- No longer enable --enable-debug as it causes degraded  performance
206  under load.
207
208* Mon Jul 18 2011 Paul Wouters <paul@xelerance.com> - 1.4.12-1
209- Updated to 1.4.12
210
211* Sun Jul 03 2011 Paul Wouters <paul@xelerance.com> - 1.4.11-1
212- Updated to 1.4.11
213- removed integrated CVE patch
214- updated stock unbound.conf for new options introduced
215
216* Mon Jun 06 2011 Paul Wouters <paul@xelerance.com> - 1.4.10-1
217- Added ghost for /var/run/unbound (bz#656710)
218
219* Mon Jun 06 2011 Paul Wouters <paul@xelerance.com> - 1.4.9-3
220- rebuilt
221
222* Wed May 25 2011 Paul Wouters <paul@xelerance.com> - 1.4.9-2
223- Applied patch for CVE-2011-1922 DoS vulnerability
224
225* Sun Mar 27 2011 Paul Wouters <paul@xelerance.com> - 1.4.9-1
226- Updated to 1.4.9
227
228* Sat Feb 12 2011 Paul Wouters <paul@xelerance.com> - 1.4.8-2
229- rebuilt
230
231* Tue Jan 25 2011 Paul Wouters <paul@xelerance.com> - 1.4.8-1
232- Updated to 1.4.8
233- Enable root key for DNSSEC
234- Fix unbound-munin to use proper file (could cause excessive logging)
235- Build unbound-python per default
236- Disable gost as Fedora/EPEL does not allow ECC and has mangled openssl
237
238* Tue Oct 26 2010 Paul Wouters <paul@xelerance.com> - 1.4.5-4
239- Revert last build - it was on the wrong branch
240
241* Tue Oct 26 2010 Paul Wouters <paul@xelerance.com> - 1.4.5-3
242- Disable do-ipv6 per default - causes severe degradation on non-ipv6 machines
243  (see comments in inbound.conf)
244
245* Tue Jun 15 2010 Paul Wouters <paul@xelerance.com> - 1.4.5-2
246- Bump release - forgot to upload the new tar ball.
247
248* Tue Jun 15 2010 Paul Wouters <paul@xelerance.com> - 1.4.5-1
249- Upgraded to 1.4.5
250
251* Mon May 31 2010 Paul Wouters <paul@xelerance.com> - 1.4.4-2
252- Added accidentally omitted svn patches to cvs 
253
254* Mon May 31 2010 Paul Wouters <paul@xelerance.com> - 1.4.4-1
255- Upgraded to 1.4.4 with svn patches
256- Obsolete dnssec-conf to ensure it is de-installed
257
258* Thu Mar 11 2010 Paul Wouters <paul@xelerance.com> - 1.4.3-1
259- Update to 1.4.3 that fixes 64bit crasher
260
261* Tue Mar 09 2010 Paul Wouters <paul@xelerance.com> - 1.4.2-1
262- Updated to 1.4.2 
263- Updated unbound.conf with new options
264- Enabled pre-fetching DNSKEY records (DNSSEC speedup)
265- Enabled re-fetching popular records before they expire
266- Enabled logging of DNSSEC validation errors
267
268* Mon Mar 01 2010 Paul Wouters <paul@xelerance.com> - 1.4.1-5
269- Overriding -D_GNU_SOURCE is no longer needed. This fixes DSO issues
270  with pthreads
271
272* Wed Feb 24 2010 Paul Wouters <paul@xelerance.com> - 1.4.1-3
273- Change make/configure lines to attempt to fix -lphtread linking issue
274
275* Thu Feb 18 2010 Paul Wouters <paul@xelerance.com> - 1.4.1-2
276- Removed dependency for dnssec-conf
277- Added ISC DLV key (formerly in dnssec-conf)
278- Fixup old DLV locations in unbound.conf file via %%post
279- Fix parent child disagreement handling and no-ipv6 present [svn r1953]
280
281* Tue Jan 05 2010 Paul Wouters <paul@xelerance.com> - 1.4.1-1
282- Updated to 1.4.1
283- Changed %%define to %%global
284
285* Thu Oct 08 2009 Paul Wouters <paul@xelerance.com> - 1.3.4-2
286- Bump version
287
288* Thu Oct 08 2009 Paul Wouters <paul@xelerance.com> - 1.3.4-1
289- Upgraded to 1.3.4. Security fix with validating NSEC3 records
290
291* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 1.3.3-2
292- rebuilt with new openssl
293
294* Mon Aug 17 2009 Paul Wouters <paul@xelerance.com> - 1.3.3-1
295- Updated to 1.3.3
296
297* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.0-3
298- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
299
300* Sat Jun 20 2009 Paul Wouters <paul@xelerance.com> - 1.3.0-2
301- Added missing glob patch to cvs
302- Place python macros within the %%with_python check
303
304* Sat Jun 20 2009 Paul Wouters <paul@xelerance.com> - 1.3.0-1
305- Updated to 1.3.0
306- Added unbound-python sub package. disabled for now
307- Patch from svn to fix DLV lookups
308- Patches from svn to detect wrong truncated response from BIND 9.6.1 with
309  minimal-responses)
310- Added Default-Start and Default-Stop to unbound.init
311- Re-enabled --enable-sha2
312- Re-enabled glob.patch
313
314* Wed May 20 2009 Paul Wouters <paul@xelerance.com> - 1.2.1-7
315- unbound-iterator.patch was not committed
316
317* Wed May 20 2009 Paul Wouters <paul@xelerance.com> - 1.2.1-6
318- Fix for https://bugzilla.redhat.com/show_bug.cgi?id=499793
319
320* Tue Mar 17 2009 Paul Wouters <paul@xelerance.com> - 1.2.1-5
321- Use --nocheck to avoid giving an error on missing unbound-remote certs/keys
322
323* Tue Mar 10 2009 Adam Tkac <atkac redhat com> - 1.2.1-4
324- enable DNSSEC only if it is enabled in sysconfig/dnssec
325
326* Mon Mar 09 2009 Adam Tkac <atkac redhat com> - 1.2.1-3
327- add DNSSEC support to initscript and enabled it per default
328- add requires dnssec-conf
329
330* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-2
331- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
332
333* Tue Feb 10 2009 Paul Wouters <paul@xelerance.com - 1.2.1-1
334- updated to 1.2.1
335
336* Sun Jan 18 2009 Tomas Mraz <tmraz@redhat.com> - 1.2.0-2
337- rebuild with new openssl
338
339* Wed Jan 14 2009 Paul Wouters <paul@xelerance.com - 1.2.0-1
340- Updated to 1.2.0
341- Added dependency on minimum SSL for CVE-2008-5077
342- Added dependency on bc for unbound-munin
343- Added minimum requirement of libevent 1.4.5. Crashes with older versions
344  (note: libevent is stale in EL-4 and not in EL-5, needs fixing there)
345- Removed dependency on selinux-policy (will get used when available)
346- Enable options as per draft-wijngaards-dnsext-resolver-side-mitigation-00.txt
347- Enable unwanted-reply-threshold to mitigate against a Kaminsky attack
348- Enable val-clean-additional to drop addition unsigned data from signed
349  response.
350- Removed patches (got merged into upstream)
351
352* Mon Jan  5 2009 Paul Wouters <paul@xelerance.com> - 1.1.1-7
353- Modified scandir patch to silently fail when wildcard matches nothing
354- Patch to allow unbound-checkconf to find empty wildcard matches
355
356* Mon Jan  5 2009 Paul Wouters <paul@xelerance.com> - 1.1.1-6
357- Added scandir patch for trusted-keys-file: option, which
358  is used to load multiple dnssec keys in bind file format
359
360* Mon Dec  8 2008 Paul Wouters <paul@xelerance.com> - 1.1.1-4
361- Added Requires: for selinux-policy >= 3.5.13-33 for proper SElinux rules.
362
363* Mon Dec  1 2008 Paul Wouters <paul@xelerance.com> - 1.1.1-3
364- We did not own the /etc/unbound directory (#474020)
365- Fixed cvs anomalies
366
367* Fri Nov 28 2008 Adam Tkac <atkac redhat com> - 1.1.1-2
368- removed all obsolete chroot related stuff
369- label control certs after generation correctly
370
371* Thu Nov 20 2008 Paul Wouters <paul@xelerance.com> - 1.1.1-1
372- Updated to unbound 1.1.1 which fixes a crasher and
373  addresses nlnetlabs bug #219
374
375* Wed Nov 19 2008 Paul Wouters <paul@xelerance.com> - 1.1.0-3
376- Remove the chroot, obsoleted by SElinux
377- Add additional munin plugin links supported by unbound plugin
378- Move configuration directory from /var/lib/unbound to /etc/unbound
379- Modified unbound.init and unbound.conf to account for chroot changes
380- Updated unbound.conf with new available options
381- Enabled dns-0x20 protection per default
382
383* Wed Nov 19 2008 Adam Tkac <atkac redhat com> - 1.1.0-2
384- unbound-1.1.0-log_open.patch
385  - make sure log is opened before chroot call
386  - tracked as http://www.nlnetlabs.nl/bugs/show_bug.cgi?id=219
387- removed /dev/log and /var/run/unbound and /etc/resolv.conf from
388  chroot, not needed
389- don't mount files in chroot, it causes problems during updates
390- fixed typo in default config file
391
392* Fri Nov 14 2008 Paul Wouters <paul@xelerance.com> - 1.1.0-1
393- Updated to version 1.1.0
394- Updated unbound.conf's statistics options and remote-control
395  to work properly for munin
396- Added unbound-munin package
397- Generate unbound remote-control  key/certs on first startup
398- Required ldns is now 1.4.0
399
400* Wed Oct 22 2008 Paul Wouters <paul@xelerance.com> - 1.0.2-5
401- Only call ldconfig in -libs package
402- Move configure into build section
403- devel subpackage should only depend on libs subpackage
404
405* Tue Oct 21 2008 Paul Wouters <paul@xelerance.com> - 1.0.2-4
406- Fix CFLAGS getting lost in build
407- Don't enable interface-automatic:yes because that
408  causes unbound to listen on 0.0.0.0 instead of 127.0.0.1
409
410* Sun Oct 19 2008 Paul Wouters <paul@xelerance.com> - 1.0.2-3
411- Split off unbound-libs, make build verbose 
412
413* Thu Oct  9 2008 Paul Wouters <paul@xelerance.com> - 1.0.2-2
414- FSB compliance, chroot fixes, initscript fixes
415
416* Thu Sep 11 2008 Paul Wouters <paul@xelerance.com> - 1.0.2-1
417- Upgraded to 1.0.2
418
419* Wed Jul 16 2008 Paul Wouters <paul@xelerance.com> - 1.0.1-1
420- upgraded to new release
421
422* Wed May 21 2008 Paul Wouters <paul@xelerance.com> - 1.0.0-2
423- Build against ldns-1.3.0
424
425* Wed May 21 2008 Paul Wouters <paul@xelerance.com> - 1.0.0-1
426- Split of -devel package, fixed dependencies, make rpmlint happy
427
428* Thu Apr 25 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 0.12
429- Using parts from ports collection entry by Jaap Akkerhuis.
430- Using Fedoraproject wiki guidelines.
431
432* Wed Apr 23 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 0.11
433- Initial version.
434