%bcond_with systemd Name: dnsmasq Version: 2.84 Release: 2%{?_dist_release}%{?with_systemd:.systemd} Summary: A lightweight DHCP/caching DNS server Summary(ja): 軽量 DHCP/DNSキャッシュサーバ Group: servers Vendor: Project Vine Distribution: Vine Linux License: GPLv2 or GPLv3 URL: http://www.thekelleys.org.uk/dnsmasq/ Source0: http://www.thekelleys.org.uk/dnsmasq/%{name}-%{version}.tar.xz Source1: %{name}.service Source2: dnsmasq-systemd-sysusers.conf Patch0: %{name}-2.33-initscript.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: dbus-devel, libidn2-devel, nettle-devel BuildRequires: pkgconfig Requires(pre): shadow-utils Requires(post): /bin/sed /bin/grep %if %{with systemd} BuildRequires: systemd %{?systemd_requires} %else Requires(post): /sbin/chkconfig Requires(post): /sbin/service Requires(preun): /sbin/chkconfig Requires(preun): /sbin/service Requires(postun): /sbin/service %endif %description Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server. It is designed to provide DNS and, optionally, DHCP, to a small network. It can serve the names of local machines which are not in the global DNS. The DHCP server integrates with the DNS server and allows machines with DHCP-allocated addresses to appear in the DNS with names configured either in each host or in a central configuration file. Dnsmasq supports static and dynamic DHCP leases and BOOTP for network booting of diskless machines. %debug_package %prep %setup -q -n %{name}-%{version} %if !%{with systemd} %patch0 -p1 %endif # use /var/lib/dnsmasq instead of /var/lib/misc for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do sed -i 's|/var/lib/misc/dnsmasq.leases|/var/lib/dnsmasq/dnsmasq.leases|g' "$file" done # fix the path to the trust anchor sed -i 's|%%%%PREFIX%%%%|%{_prefix}|' dnsmasq.conf.example #set dnsmasq user / group sed -i 's|#user=|user=dnsmasq|' dnsmasq.conf.example sed -i 's|#group=|group=dnsmasq|' dnsmasq.conf.example #set default user /group in src/config.h sed -i 's|#define CHUSER "nobody"|#define CHUSER "dnsmasq"|' src/config.h sed -i 's|#define CHGRP "dip"|#define CHGRP "dnsmasq"|' src/config.h #enable dbus sed -i 's|/\* #define HAVE_DBUS \*/|#define HAVE_DBUS|g' src/config.h #enable libidn2 support sed -i 's|/\* #define HAVE_LIBIDN2 \*/|#define HAVE_LIBIDN2|g' src/config.h #enable DNSSEC support sed -i 's|/\* #define HAVE_DNSSEC \*/|#define HAVE_DNSSEC|g' src/config.h #enable /etc/dnsmasq.d fix bz 526703, ignore RPM backup files cat << EOF >> dnsmasq.conf.example # Include all files in /etc/dnsmasq.d except RPM backup files conf-dir=%{_sysconfdir}/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig EOF sed -i \ -e '/^#interface=/a # Listen only on localhost by default\ninterface=lo\n' \ -e '/^#no-dhcp-interface=/a \\n# Serve DNS and DHCP only to networks directly connected to this machine.\n# Any interface= line will override it.\n#local-service\n' \ -e '/^#bind-interfaces/a #\n# To listen only on localhost and do not receive packets on other\n# interfaces, bind only to lo device. Comment out to bind on single\n# wildcard socket.\nbind-interfaces\n' \ -e '/^#bind-interfaces/d' \ -e 's|/var/lib/misc/|/var/lib/dnsmasq/|' \ dnsmasq.conf.example %build make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" make %{?_smp_mflags} -C contrib/lease-tools CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" %install rm -rf $RPM_BUILD_ROOT # normally i'd do 'make install'...it's a bit messy, though mkdir -p $RPM_BUILD_ROOT%{_sbindir} \ $RPM_BUILD_ROOT%{_mandir}/man8 \ $RPM_BUILD_ROOT%{_var}/lib/dnsmasq \ $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.d \ $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d install src/dnsmasq $RPM_BUILD_ROOT%{_sbindir}/dnsmasq install dnsmasq.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/dnsmasq.conf install dbus/dnsmasq.conf $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/ install -m 644 man/dnsmasq.8 $RPM_BUILD_ROOT%{_mandir}/man8/ install -D trust-anchors.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/trust-anchors.conf # utils sub package mkdir -p $RPM_BUILD_ROOT%{_bindir} \ $RPM_BUILD_ROOT%{_mandir}/man1 install -m 755 contrib/lease-tools/dhcp_release $RPM_BUILD_ROOT%{_bindir}/dhcp_release install -m 644 contrib/lease-tools/dhcp_release.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_release.1 install -m 755 contrib/lease-tools/dhcp_release6 $RPM_BUILD_ROOT%{_bindir}/dhcp_release6 install -m 644 contrib/lease-tools/dhcp_release6.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_release6.1 install -m 755 contrib/lease-tools/dhcp_lease_time $RPM_BUILD_ROOT%{_bindir}/dhcp_lease_time install -m 644 contrib/lease-tools/dhcp_lease_time.1 $RPM_BUILD_ROOT%{_mandir}/man1/dhcp_lease_time.1 %if %{with systemd} # Systemd mkdir -p %{buildroot}%{_unitdir} install -m644 %{SOURCE1} %{buildroot}%{_unitdir} rm -rf %{buildroot}%{_initrddir} #install systemd sysuser file install -Dpm 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf %else mkdir -p $RPM_BUILD_ROOT%{_initrddir} install rpm/dnsmasq.init $RPM_BUILD_ROOT%{_initrddir}/dnsmasq %endif %clean rm -rf $RPM_BUILD_ROOT %pre %if %{with systemd} #precreate users so that rpm can install files owned by that user %sysusers_create_package %{name} %{SOURCE2} %else getent group dnsmasq >/dev/null || groupadd -r dnsmasq getent passwd dnsmasq >/dev/null || \ useradd -r -g dnsmasq -d /var/lib/dnsmasq -s /sbin/nologin \ -c "Dnsmasq DHCP and DNS server" dnsmasq exit 0 %endif %post %if %{with systemd} %systemd_post dnsmasq.service %endif if [ "$1" = "2" ]; then # if we're being upgraded # if using the old leases location, move the file to the new one # but only if we're not clobbering another file # if [ -f /var/lib/misc/dnsmasq.leases -a ! -f /var/lib/dnsmasq/dnsmasq.leases ]; then # causes rpmlint to report dangerous-command-in-post, # but that's the price of selinux compliance :-( mv -f /var/lib/misc/dnsmasq.leases /var/lib/dnsmasq/dnsmasq.leases || : fi # ugly, but kind of necessary if [ ! `grep -q dhcp-leasefile=/var/lib/misc/dnsmasq.leases %{_sysconfdir}/dnsmasq.conf` ]; then cp %{_sysconfdir}/dnsmasq.conf %{_sysconfdir}/dnsmasq.conf.tmp || : sed -e 's/var\/lib\/misc/var\/lib\/dnsmasq/' < %{_sysconfdir}/dnsmasq.conf.tmp > %{_sysconfdir}/dnsmasq.conf || : rm -f %{_sysconfdir}/dnsmasq.conf.tmp || : fi %if !%{with systemd} else # if we're being installed /sbin/chkconfig --add dnsmasq %endif fi %preun %if %{with systemd} %systemd_preun dnsmasq.service %else if [ "$1" = "0" -o -x /bin/systemctl ]; then # execute this only if we are NOT doing an upgrade /sbin/service dnsmasq stop >/dev/null 2>&1 || : /sbin/chkconfig --del dnsmasq fi %endif %postun %if %{with systemd} %systemd_postun_with_restart dnsmasq.service %else if [ "$1" -gt "0" ]; then /sbin/service dnsmasq condrestart >/dev/null 2>&1 || : fi %endif %files %defattr(-,root,root,-) %license COPYING* %doc CHANGELOG FAQ doc.html setup.html dbus/DBus-interface %config(noreplace) %attr(644,root,root) %{_sysconfdir}/dnsmasq.conf %dir /etc/dnsmasq.d %dir %{_var}/lib/dnsmasq %config(noreplace) %attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/dnsmasq.conf %dir %{_datadir}/dnsmasq %{_datadir}/dnsmasq/* %{_sbindir}/dnsmasq %{_mandir}/man8/dnsmasq* %if %{with systemd} %{_unitdir}/%{name}.service %{_sysusersdir}/dnsmasq.conf %else %{_initrddir}/dnsmasq %endif %{_bindir}/dhcp_* %{_mandir}/man1/dhcp_* %changelog * Thu Mar 25 2021 Tomohiro "Tomo-p" KATO 2.84-2 - updated the configuration file to fix CVE-2020-14312. * Thu Jan 28 2021 Tomohiro "Tomo-p" KATO 2.84-1 - new upstream release. * Tue Sep 08 2020 Tomohiro "Tomo-p" KATO 2.82-1 - new upstream release. * Sat May 23 2020 Tomohiro "Tomo-p" KATO 2.81-1 - new upstream release. - added systemd support (disabled as default). * Sat Mar 21 2020 Tomohiro "Tomo-p" KATO 2.80-2 - rebuilt with libidn2. * Sat May 25 2019 Tomohiro "Tomo-p" KATO 2.80-1 - new upstream release. * Tue Jul 5 2016 Tomohiro "Tomo-p" KATO 2.76-1 - new upstream release. * Sat Dec 28 2013 Yoji TOYODA 2.45-3 - rebuild with VineSeed environment * Sun Apr 17 2011 Shu KONNO 2.45-2 - rebuilt with rpm-4.8.1-3 * Thu Jul 31 2008 Daisuke SUZUKI 2.45-1 - initial build for Vine Linux * Mon Jul 21 2008 Patrick "Jima" Laughton 2.45-1 - Upstream release (bugfixes) * Wed Jul 16 2008 Patrick "Jima" Laughton 2.43-2 - New upstream release, contains fixes for CVE-2008-1447/CERT VU#800113 - Dropped patch for newer glibc (merged upstream) * Wed Feb 13 2008 Patrick "Jima" Laughton 2.41-0.8 - Added upstream-authored patch for newer glibc (thanks Simon!) * Wed Feb 13 2008 Patrick "Jima" Laughton 2.41-0.7 - New upstream release * Wed Jan 30 2008 Patrick "Jima" Laughton 2.41-0.6.rc1 - Release candidate - Happy Birthday Isaac! * Wed Jan 23 2008 Patrick "Jima" Laughton 2.41-0.5.test30 - Bugfix update * Mon Dec 31 2007 Patrick "Jima" Laughton 2.41-0.4.test26 - Bugfix/feature enhancement update * Thu Dec 13 2007 Patrick "Jima" Laughton 2.41-0.3.test24 - Upstream fix for fairly serious regression * Tue Dec 04 2007 Patrick "Jima" Laughton 2.41-0.2.test20 - New upstream test release - Moving dnsmasq.leases to /var/lib/dnsmasq/ as per BZ#407901 - Ignoring dangerous-command-in-%%post rpmlint warning (as per above fix) - Patch consolidation/cleanup - Removed conditionals for Fedora <= 3 and Aurora 2.0 * Tue Sep 18 2007 Patrick "Jima" Laughton 2.40-1 - Finalized upstream release - Removing URLs from patch lines (CVS is the authoritative source) - Added more magic to make spinning rc/test packages more seamless * Sun Aug 26 2007 Patrick "Jima" Laughton 2.40-0.1.rc2 - New upstream release candidate (feature-frozen), thanks Simon! - License clarification * Tue May 29 2007 Patrick "Jima" Laughton 2.39-1 - New upstream version (bugfixes, enhancements) * Mon Feb 12 2007 Patrick "Jima" Laughton 2.38-1 - New upstream version with bugfix for potential hang * Tue Feb 06 2007 Patrick "Jima" Laughton 2.37-1 - New upstream version * Wed Jan 24 2007 Patrick "Jima" Laughton 2.36-1 - New upstream version * Mon Nov 06 2006 Patrick "Jima" Laughton 2.35-2 - Stop creating /etc/sysconfig on %%install - Create /etc/dnsmasq.d on %%install * Mon Nov 06 2006 Patrick "Jima" Laughton 2.35-1 - Update to 2.35 - Removed UPGRADING_to_2.0 from %%doc as per upstream change - Enabled conf-dir in default config as per RFE BZ#214220 (thanks Chris!) - Added %%dir /etc/dnsmasq.d to %%files as per above RFE * Tue Oct 24 2006 Patrick "Jima" Laughton 2.34-2 - Fixed BZ#212005 - Moved %%postun scriptlet to %%post, where it made more sense - Render scriptlets safer - Minor cleanup for consistency * Thu Oct 19 2006 Patrick "Jima" Laughton 2.34-1 - Hardcoded version in patches, as I'm getting tired of updating them - Update to 2.34 * Mon Aug 28 2006 Patrick "Jima" Laughton 2.33-2 - Rebuild for FC6 * Tue Aug 15 2006 Patrick "Jima" Laughton 2.33-1 - Update * Sat Jul 22 2006 Patrick "Jima" Laughton 2.32-3 - Added pkgconfig BuildReq due to reduced buildroot * Thu Jul 20 2006 Patrick "Jima" Laughton 2.32-2 - Forced update due to dbus version bump * Mon Jun 12 2006 Patrick "Jima" Laughton 2.32-1 - Update from upstream - Patch from Dennis Gilmore fixed the conditionals to detect Aurora Linux * Mon May 8 2006 Patrick "Jima" Laughton 2.31-1 - Removed dbus config patch (now provided upstream) - Patched in init script (no longer provided upstream) - Added DBus-interface to docs * Tue May 2 2006 Patrick "Jima" Laughton 2.30-4.2 - More upstream-recommended cleanups :) - Killed sysconfig file (provides unneeded functionality) - Tweaked init script a little more * Tue May 2 2006 Patrick "Jima" Laughton 2.30-4 - Moved options out of init script and into /etc/sysconfig/dnsmasq - Disabled DHCP_LEASE in sysconfig file, fixing bug #190379 - Simon Kelley provided dbus/dnsmasq.conf, soon to be part of the tarball * Thu Apr 27 2006 Patrick "Jima" Laughton 2.30-3 - Un-enabled HAVE_ISC_READER, a hack to enable a deprecated feature (request) - Split initscript & enable-dbus patches, conditionalized dbus for FC3 - Tweaked name field in changelog entries (trying to be consistent) * Mon Apr 24 2006 Patrick "Jima" Laughton 2.30-2 - Disabled stripping of binary while installing (oops) - Enabled HAVE_ISC_READER/HAVE_DBUS via patch - Added BuildReq for dbus-devel * Mon Apr 24 2006 Patrick "Jima" Laughton 2.30-1 - Initial Fedora Extras RPM