4324d99
Name:		maradns
6c14ecd
Version:	2.0.09
c755a29
Release:	1%{?dist}
4324d99
Summary:	Authoritative and recursive DNS server made with security in mind
4324d99
# recursive resolver is shipped in versioned directory
6c14ecd
%global dwood_ver	3.2.05
4324d99
2907e9f
Source0:	http://www.maradns.org/download/2.0/%{version}/%{name}-%{version}.tar.bz2
bc93a4b
# http://maradns.samiam.org/download/patches/3rd_party/Thomasz-Torcz-systemd-2013-10-14.patch
a64f362
Patch0:		%{name}-0001-add-systemd-unit-files.patch
4324d99
License:	BSD
4324d99
URL:		http://www.maradns.org/
4324d99
4324d99
BuildRequires:		systemd-units
4324d99
Requires(pre):		shadow-utils
Tomasz Torcz aca5c4d
Requires(pre): systemd
Tomasz Torcz aca5c4d
Requires(post): systemd
Tomasz Torcz aca5c4d
Requires(preun): systemd
Tomasz Torcz aca5c4d
Requires(postun): systemd
4324d99
4324d99
%description
4324d99
MaraDNS is a package that implements the Domain Name Service (DNS), an
4324d99
essential internet service. MaraDNS has the following advantages:
4324d99
	* Secure.
4324d99
	* Supported.
4324d99
	* Easy to use.
4324d99
	* Small.
4324d99
	* Open Source.
4324d99
4324d99
%prep
4324d99
%setup -q
4324d99
%patch0 -p1
4324d99
4324d99
# wrong permissions
4324d99
chmod 0644 doc/en/man/make.pdf
4324d99
chmod 0644 doc/en/tutorial/make.index
4324d99
chmod 0644 doc/en/webpage/make.page
4324d99
4324d99
%build
4324d99
4324d99
# We don't use %%configure here because this is a homebrew configure not generated by autoconf
4324d99
./configure --ipv6 --libdir=%{_libdir}
4324d99
4324d99
# first compile Deadwood, otherwise we have no control over make flags
4324d99
pushd deadwood-%{dwood_ver}/src
4324d99
make %{?_smp_mflags} FLAGS="%{optflags} -DIPV6 -lrt"
4324d99
popd
4324d99
make %{?_smp_mflags} FLAGS="%{optflags} -DSELECT_PROBLEM -DAUTHONLY"
4324d99
4324d99
4324d99
%install
4324d99
# create /etc/maradns, /etc/mararc and /etc/dwood3rc first
4324d99
install -p -d -m 0755 %{buildroot}%{_sysconfdir}/maradns/logger/
4324d99
install -p -D -m 0644 build/rpm.mararc %{buildroot}%{_sysconfdir}/mararc
4324d99
install -p -D -m 0644 deadwood-%{dwood_ver}/doc/dwood3rc %{buildroot}%{_sysconfdir}/dwood3rc
4324d99
4324d99
# cache dir
4324d99
install -p -d -m 0755 %{buildroot}/var/cache/deadwood
4324d99
4324d99
# sbin files
4324d99
install -p -D -m 0755 server/maradns %{buildroot}%{_sbindir}/maradns
4324d99
install -p -D -m 0755 tcp/zoneserver %{buildroot}%{_sbindir}/zoneserver
4324d99
install -p -D -m 0755 deadwood-%{dwood_ver}/src/Deadwood %{buildroot}%{_sbindir}/Deadwood
4324d99
4324d99
# bin files
4324d99
install -p -D -m 0755 tcp/getzone %{buildroot}%{_bindir}/getzone
4324d99
install -p -D -m 0755 tcp/fetchzone %{buildroot}%{_bindir}/fetchzone
4324d99
install -p -D -m 0755 tools/askmara %{buildroot}%{_bindir}/askmara
4324d99
4324d99
# man pages
4324d99
install -p -d -m 0755 %{buildroot}%{_mandir}/man{1,5,8}
4324d99
install -p -D -m 0644 -t %{buildroot}%{_mandir}/man1/ \
4324d99
	doc/en/man/askmara.1 \
4324d99
	doc/en/man/getzone.1 \
4324d99
	doc/en/man/fetchzone.1
4324d99
install -p -D -m 0644 -t %{buildroot}%{_mandir}/man1/ \
4324d99
	deadwood-%{dwood_ver}/doc/Deadwood.1
4324d99
install -p -D -m 0644 -t %{buildroot}%{_mandir}/man5/ \
4324d99
	doc/en/man/csv1.5 \
4324d99
	doc/en/man/csv2.5 \
4324d99
	doc/en/man/csv2_txt.5 \
4324d99
	doc/en/man/mararc.5
4324d99
install -p -D -m 0644 -t %{buildroot}%{_mandir}/man8/ \
4324d99
	doc/en/man/maradns.8 \
4324d99
	doc/en/man/zoneserver.8 \
4324d99
4324d99
# systemd units
4324d99
mkdir -p %{buildroot}%{_unitdir}
4324d99
install -p -D -m 0644 -t %{buildroot}%{_unitdir}/ \
4324d99
	build/maradns.service \
4324d99
	build/maradns-zoneserver.service \
4324d99
	build/maradns-deadwood.service
4324d99
4324d99
%files
4324d99
%doc COPYING doc/en/changelog.txt doc/en/credits.txt doc/en/faq.txt doc/en/{examples,tutorial,webpage}
4324d99
%config(noreplace) %{_sysconfdir}/mararc
4324d99
%config(noreplace) %{_sysconfdir}/dwood3rc
4324d99
%attr(-,maradns,maradns) %{_sysconfdir}/maradns/ 
4324d99
%attr(-,maradns,maradns) /var/cache/deadwood/
4324d99
%{_unitdir}/%{name}.service
4324d99
%{_unitdir}/%{name}-zoneserver.service
4324d99
%{_unitdir}/%{name}-deadwood.service
4324d99
4324d99
%{_bindir}/askmara
4324d99
%{_bindir}/fetchzone
4324d99
%{_bindir}/getzone
4324d99
%{_sbindir}/maradns
4324d99
%{_sbindir}/zoneserver
4324d99
%{_sbindir}/Deadwood
4324d99
4324d99
%{_mandir}/man1/askmara.1*
4324d99
%{_mandir}/man1/getzone.1*
4324d99
%{_mandir}/man1/fetchzone.1*
4324d99
%{_mandir}/man1/Deadwood.1*
4324d99
%{_mandir}/man5/csv1.5*
4324d99
%{_mandir}/man5/csv2.5*
4324d99
%{_mandir}/man5/csv2_txt.5*
4324d99
%{_mandir}/man5/mararc.5*
4324d99
%{_mandir}/man8/maradns.8*
4324d99
%{_mandir}/man8/zoneserver.8*
4324d99
4324d99
4324d99
%pre
4324d99
if [ $1 -eq 1 ]; then
4324d99
	getent group maradns >/dev/null || groupadd -r maradns
4324d99
	getent passwd maradns >/dev/null || \
4324d99
	useradd -r -g maradns -d /etc/maradns -s /sbin/nologin \
4324d99
		-c "MaraDns chroot user" maradns
4324d99
	exit 0
4324d99
fi
4324d99
4324d99
4324d99
%post
4324d99
if [ $1 -eq 1 ]; then
4324d99
	# correct UID/GID of maradns user
4324d99
	sed --in-place -e "s/^maradns_uid.*/maradns_uid = $(id -u maradns)/" %{_sysconfdir}/mararc
4324d99
	sed --in-place -e "s/^maradns_gid.*/maradns_gid = $(id -g maradns)/" %{_sysconfdir}/mararc
4324d99
	sed --in-place -e "s/^maradns_uid.*/maradns_uid = $(id -u maradns)/" %{_sysconfdir}/dwood3rc
4324d99
	sed --in-place -e "s/^maradns_gid.*/maradns_gid = $(id -g maradns)/" %{_sysconfdir}/dwood3rc
4324d99
	# correct cache file directory
4324d99
	sed --in-place -e 's@/etc/deadwood@/var/cache/deadwood@' %{_sysconfdir}/dwood3rc
4324d99
fi
4324d99
%systemd_post maradns.service maradns-zoneserver.service maradns-deadwood.service
4324d99
4324d99
%preun
4324d99
%systemd_preun maradns.service maradns-zoneserver.service maradns-deadwood.service
4324d99
4324d99
%postun
4324d99
%systemd_postun_with_restart maradns.service maradns-zoneserver.service maradns-deadwood.service
4324d99
4324d99
%triggerun -- maradns < 1.3.07.09-6
4324d99
# Save the current service runlevel info
4324d99
# User must manually run systemd-sysv-convert --apply maradns
4324d99
#			 systemd-sysv-convert --apply maradns-zoneserver
4324d99
# to migrate them to systemd targets
4324d99
/usr/bin/systemd-sysv-convert --save maradns >/dev/null 2>&1 ||:
4324d99
/usr/bin/systemd-sysv-convert --save maradns-zoneserver >/dev/null 2>&1 ||:
4324d99
4324d99
# Run these because the SysV package being removed won't do them
4324d99
/sbin/chkconfig --del maradns >/dev/null 2>&1 || :
4324d99
/bin/systemctl try-restart maradns.service >/dev/null 2>&1 || :
4324d99
/sbin/chkconfig --del maradns-zoneserver >/dev/null 2>&1 || :
4324d99
/bin/systemctl try-restart maradns-zoneserver.service >/dev/null 2>&1 || :
4324d99
4324d99
4324d99
%changelog
6c14ecd
* Thu Feb 13 2014 Tomasz Torcz <ttorcz@fedoraproject.org> - 2.0.09-1
6c14ecd
- new release, fixing denial-of-service vulnerability  
6c14ecd
  ( http://samiam.org/blog/2014-02-12.html )
6c14ecd
bc93a4b
* Thu Jan 16 2014 Tomasz Torcz <ttorcz@fedoraproject.org> - 2.0.08-1
bc93a4b
- new upstream release ( http://samiam.org/blog/2014-01-14.html )
bc93a4b
c755a29
* Mon Dec 02 2013 Tomasz Torcz <ttorcz@fedoraproject.org> - 2.0.07d-1
c755a29
- fix against possible blind spoof attack
c755a29
a64f362
* Sun Oct 13 2013 Tomasz Torcz <ttorcz@fedoraproject.org> - 2.0.07c-2
a64f362
- refresh systemd patch, introduce additional deps on network-online (#1015282)
a64f362
2907e9f
* Sat Sep 21 2013 Tomasz Torcz <ttorcz@fedoraproject.org> - 2.0.07c-1
2907e9f
- new upstream version
2907e9f
3240929
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.07-3
3240929
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
3240929
f4029a5
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.07-2
f4029a5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
f4029a5
Tomasz Torcz aca5c4d
* Tue Jan 22 2013 Tomasz Torcz <ttorcz@fedoraproject.org> - 2.0.07-1
Tomasz Torcz aca5c4d
- new upstream version
Tomasz Torcz aca5c4d
- use explicit systemd requires, macro is considered bad
Tomasz Torcz aca5c4d
4324d99
* Mon Oct 22 2012 Tomasz Torcz <ttorcz@fedoraproject.org> - 2.0.06-3
4324d99
- fix review issues
4324d99
  - use name macro in Patch, rename Patch itself
4324d99
  - add "-p" to install lines
4324d99
  - add --libdir... to configure
4324d99
- use macros for systemd operations
4324d99
4324d99
* Tue Aug 21 2012 Tomasz Torcz <ttorcz@fedoraproject.org> - 2.0.06-2
4324d99
- provide link to patch sent upstream
4324d99
- review remarks:
4324d99
  - removed grouptag
4324d99
  - do not use macros for system executables
4324d99
  - use more readable version of sed command in post
4324d99
  - remove maradns.gpg.key
4324d99
  - be more specific in doc line
4324d99
4324d99
* Mon Jul 16 2012 Tomasz Torcz <ttorcz@fedoraproject.org> - 2.0.06-1
4324d99
- initial package for 2.0 branch