initial commit of file from CVS for e-smith-dnscache on Wed 12 Jul 08:51:05 BST 2023
parent
6b9c45bdb1
commit
985fd9f0ab
@ -0,0 +1,4 @@
|
||||
*.rpm
|
||||
*.log
|
||||
*spec-20*
|
||||
*.tar.xz
|
@ -0,0 +1,21 @@
|
||||
# Makefile for source rpm: e-smith-dnscache
|
||||
# $Id: Makefile,v 1.1 2016/02/04 23:29:18 vip-ire Exp $
|
||||
NAME := e-smith-dnscache
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attept a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
@ -1,3 +1,17 @@
|
||||
# e-smith-dnscache
|
||||
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> e-smith-dnscache
|
||||
|
||||
SMEServer Koozali developed git repo for e-smith-dnscache smeserver
|
||||
SMEServer Koozali developed git repo for e-smith-dnscache smeserver
|
||||
|
||||
## Wiki
|
||||
<br />https://wiki.koozali.org/
|
||||
|
||||
## Bugzilla
|
||||
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=e-smith-dnscache&product=SME%20Server%2010.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||
|
||||
## Description
|
||||
|
||||
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
|
||||
*Once it has been checked, then this comment will be deleted*
|
||||
<br />
|
||||
|
||||
E-smith-dnscache is a free software package designed to provide the user with an effective DNS caching system. It is a powerful tool that can be used to speed up web browsing and reduce network traffic. It works by caching DNS lookups, so that frequently used DNS responses are stored in memory for quicker retrieval. This dramatically reduces the amount of time needed to make a successful DNS lookup. E-smith-dnscache can be easily installed and configured on most Linux systems, and is a great choice for those looking for an effective DNS caching solution.
|
||||
|
@ -0,0 +1 @@
|
||||
sme10
|
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use esmith::Build::CreateLinks qw(:all);
|
||||
|
||||
foreach (qw(root/servers/@ config))
|
||||
{
|
||||
templates2events("/var/service/dnscache.forwarder/$_",
|
||||
qw(bootstrap-console-save console-save dns-update e-smith-dnscache-update));
|
||||
}
|
||||
templates2events('/var/service/dnscache/root/servers/@',
|
||||
qw(bootstrap-console-save console-save dns-update e-smith-dnscache-update));
|
||||
|
||||
foreach my $event (qw(
|
||||
console-save
|
||||
network-create
|
||||
network-delete
|
||||
domain-create
|
||||
domain-delete
|
||||
domain-modify
|
||||
dns-update
|
||||
e-smith-dnscache-update
|
||||
))
|
||||
{
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/dnscache");
|
||||
}
|
||||
|
||||
foreach my $event (qw(
|
||||
console-save
|
||||
dns-update
|
||||
e-smith-dnscache-update
|
||||
))
|
||||
{
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/dnscache.forwarder");
|
||||
}
|
||||
|
||||
event_link("initialize-default-databases", "dns-update", "00");
|
||||
event_link("initialize-default-databases", "domain-modify", "00");
|
||||
|
||||
#--------------------------------------------------
|
||||
# other actions for e-smith-dnscache-update event
|
||||
#--------------------------------------------------
|
||||
$event = "e-smith-dnscache-update";
|
||||
templates2events("/etc/systemd/system-preset/49-koozali.preset", $event);
|
||||
event_link("systemd-reload", $event, "89");
|
||||
|
||||
|
@ -0,0 +1,514 @@
|
||||
# $Id: e-smith-dnscache.spec,v 1.10 2021/03/16 19:04:01 jpp Exp $
|
||||
|
||||
Summary: e-smith module to configure dnscache
|
||||
%define name e-smith-dnscache
|
||||
Name: %{name}
|
||||
%define version 2.6.0
|
||||
%define release 11
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
License: GPL
|
||||
Group: System Environment/Base
|
||||
Source: %{name}-%{version}.tar.xz
|
||||
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
||||
BuildArchitectures: noarch
|
||||
Requires: e-smith-lib >= 1.15.1-19
|
||||
Requires: djbdns
|
||||
BuildRequires: e-smith-devtools
|
||||
AutoReqProv: no
|
||||
|
||||
%description
|
||||
e-smith server enhancement to configure and run dnscache as a
|
||||
caching nameserver
|
||||
|
||||
%changelog
|
||||
* Wed Jul 12 2023 cvs2git.sh aka Brian Read <brianr@koozali.org> 2.6.0-11.sme
|
||||
- Roll up patches and move to git repo [SME: 12338]
|
||||
|
||||
* Wed Jul 12 2023 BogusDateBot
|
||||
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||
by assuming the date is correct and changing the weekday.
|
||||
|
||||
* Tue Mar 16 2021 Jean-Philippe Pialasse <tests@pialasse.com> 2.6.0-10.sme
|
||||
- cleanup in /etc/rc.d/ [SME: 9692]
|
||||
|
||||
* Fri Feb 12 2021 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-9.sme
|
||||
- remove /usr/lib/systemd/system-preset/80-koozali-dnscache.preset [SME: 10958]
|
||||
|
||||
* Thu Dec 10 2020 Michel Begue <mab974@gmail.com> 2.6.0-8.sme
|
||||
- add Requires=runit.service (dnscache & dnscache.forwarder) [SME: 11245]
|
||||
|
||||
* Thu Dec 03 2020 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-7.sme
|
||||
- execute systemd-reload before service adjust in events [SME: 11228]
|
||||
- remove S95reset-unsavedflag [SME: 11229]
|
||||
|
||||
* Mon Nov 30 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 2.6.0-5
|
||||
- remove createlink safesymlink in /etc/rc.d/init.d [SME: 11097]
|
||||
|
||||
* Thu Nov 19 2020 Michel Begue <mab974@gmail.com> 2.6.0-4.sme
|
||||
- remove rc7.d link [SME: 11097]
|
||||
- fix actions in e-smith-tinydns-update [SME: 11127]
|
||||
|
||||
* Sat Nov 14 2020 Michel Begue <mab974@gmail.com> 2.6.0-3.sme
|
||||
- Move dnscache, dnscache.forwarder services to systemd [SME: 11097]
|
||||
- Create e-smith-dnscache-update event [SME: 11127]
|
||||
|
||||
* Sat Jul 30 2016 Greg Zartman <gzartman@koozali.org> 2.6.0-2.sme
|
||||
- Modify run script to allow for loopback commmunications with other DNS
|
||||
servers on the local machine and DNS forwarding [SME: 9715]
|
||||
|
||||
* Fri Feb 5 2016 Daniel Berteaud <daniel@firewall-services.com> 2.6.0-1.sme
|
||||
- Roll new stream for sme10
|
||||
|
||||
* Thu Jan 31 2013 Shad L. Lords <slords@mail.com> 2.4.0-1.sme
|
||||
- Roll new stream for sme9
|
||||
|
||||
* Wed Dec 19 2012 Ian Wells <esmith@wellsi.com> 2.2.0-2.sme
|
||||
- D-root is changing its IPv4 address [SME: 7189]
|
||||
|
||||
* Tue Oct 7 2008 Shad L. Lords <slords@mail.com> 2.2.0-1.sme
|
||||
- Roll new stream to separate sme7/sme8 trees [SME: 4633]
|
||||
|
||||
* Fri Aug 08 2008 Charlie Brady <charlie_brady@mitel.com> 1.0.0-13
|
||||
- Add down file for dnscache.forwarder, and modify dnscache run file
|
||||
so that it brings up the dnscache.forwarder service when it
|
||||
is started. [SME: 4414]
|
||||
|
||||
* Fri Aug 08 2008 Charlie Brady <charlie_brady@mitel.com> 1.0.0-12
|
||||
- Ensure that forwarding instance of dnscache has random data
|
||||
available on stdin. [SME: 4416]
|
||||
|
||||
* Wed Jun 18 2008 Charlie Brady <charlie_brady@mitel.com> 1.0.0-11
|
||||
- Use new address for L root server, and delete included version of
|
||||
root/servers/@ file, since we template it. [SME: 4414]
|
||||
|
||||
* Wed Jun 18 2008 Charlie Brady <charlie_brady@mitel.com> 1.0.0-10
|
||||
- Fix validation of NameServer properties pulled from networks db.
|
||||
[SME: 1343]
|
||||
|
||||
* Wed Jun 18 2008 Charlie Brady <charlie_brady@mitel.com> 1.0.0-9
|
||||
- Fix delegation of reverse lookup for nets which aren't /8,
|
||||
/16 or /24. [SME: 4249]
|
||||
|
||||
* Tue Oct 16 2007 Charlie Brady <charlie_brady@mitel.com> 1.0.0-08
|
||||
- Increase default CacheSize to 10M, with corresponding increase
|
||||
in DataSize. [SME: 2371]
|
||||
|
||||
* Thu Sep 6 2007 Charlie Brady <charlie_brady@mitel.com> 1.0.0-07
|
||||
- Run dnscache with sigpipe ignored. [SME: 938]
|
||||
|
||||
* Mon May 21 2007 Shad L. Lords <slords@mail.com> 1.0.0-6
|
||||
- Ensure Forwarder has value and not just defined [SME: 3013]
|
||||
|
||||
* Sun Apr 29 2007 Shad L. Lords <slords@mail.com>
|
||||
- Clean up spec so package can be built by koji/plague
|
||||
|
||||
* Fri Apr 06 2007 Shad L. Lords <slords@mail.com> 1.0.0-5
|
||||
- Fix dnscache root server files [SME: 2721]
|
||||
|
||||
* Thu Dec 07 2006 Shad L. Lords <slords@mail.com>
|
||||
- Update to new release naming. No functional changes.
|
||||
- Make Packager generic
|
||||
|
||||
* Sun Jul 16 2006 Charlie Brady <charlie_brady@mitel.com> 1.0.0-03
|
||||
- Make dnslog user creation consistent with e-smith-tinydns. [SME: 1688]
|
||||
|
||||
* Sun Apr 30 2006 Charlie Brady <charlie_brady@mitel.com> 1.0.0-02
|
||||
- Don't use NameServer property from networks database if it would
|
||||
cause feedback loop. [SME: 1343]
|
||||
|
||||
* Thu Mar 16 2006 Charlie Brady <charlie_brady@mitel.com> 1.0.0-01
|
||||
- Roll (proper) stable stream version. [SME: 1016]
|
||||
|
||||
* Tue Mar 14 2006 Charlie Brady <charlie_brady@mitel.com> 0.6.0-01
|
||||
- Roll stable stream version. [SME: 1016]
|
||||
|
||||
* Wed Nov 30 2005 Gordon Rowell <gordonr@gormand.com.au> 0.5.1-06
|
||||
- Bump release number only
|
||||
|
||||
* Thu Oct 27 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.1-05]
|
||||
- Add default name server delegation for domains without a Nameservers property.
|
||||
[SF: 1339875]
|
||||
|
||||
* Mon Sep 19 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.1-04]
|
||||
- Add missing dnscache.forwarder config db record. [SF: 1290325]
|
||||
|
||||
* Thu Sep 15 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.1-03]
|
||||
- Expand templates and restart dnscache.forwarder in dns-update and console-save
|
||||
events. Expand templates in bootstrap-console-save rather than
|
||||
post-{install,upgrade} events. [SF: 1290325]
|
||||
- Add support for Forwarder2 property in template for root/servers/@ of
|
||||
dnscache.forwarder service.
|
||||
|
||||
* Thu Aug 25 2005 Gordon Rowell <gordonr@gormand.com.au>
|
||||
- [0.5.1-02]
|
||||
- Configure DNS servers for domains, depending on Nameservers
|
||||
property:
|
||||
- localhost: 127.0.0.1
|
||||
- corporate: dnscache{Forwarder}, dnscache{Forwarder2}
|
||||
- internet: <nothing>
|
||||
- Comma separated list of IPs : To those listed servers
|
||||
- Add dns-update event and reconfigure dnscache there
|
||||
- Call initialise-default-databases in dns-update to cater for
|
||||
domain db migration which might be required due to modification
|
||||
of the Corporate DNS Servers
|
||||
- Migrate db and reconfigure dnscache in domain-modify as well,
|
||||
since we might have changed nameservers.
|
||||
|
||||
* Thu Aug 25 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.1-01]
|
||||
- Roll new development stream prior to reworking Nameservers settings - 0.5.1
|
||||
|
||||
* Tue Aug 2 2005 Shad Lords <slords@email.com>
|
||||
- [0.5.0-23]
|
||||
- Add TCPPort/UDPPort/access properties to dnscache [SF: 1246986]
|
||||
- Add COPYING file to distribution
|
||||
|
||||
* Wed Jul 6 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-22]
|
||||
- Only delegate domains if SystemPrimaryDomain or if NameServer
|
||||
property is defined. [SF: 1233662]
|
||||
|
||||
* Mon Jun 6 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-21]
|
||||
- Add dnscache log file analysis script
|
||||
(from http://www.hungry.com/~fn/dnscache-log.pl.txt).
|
||||
|
||||
* Mon Jun 6 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-20]
|
||||
- Update ICANN root hint name server address list
|
||||
(s/128.9.0.107/192.228.79.201/). The 128.9.0.107 address will continue
|
||||
answering queries until Jan, 2006.
|
||||
|
||||
* Fri May 13 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-19]
|
||||
- Fix forwarder run script so that logs are captured.
|
||||
|
||||
* Mon May 9 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-18]
|
||||
- Expand dnscache.forwarder service's config in post-install and post-upgrade.
|
||||
|
||||
* Thu May 5 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-17]
|
||||
- Fix problem with migration of legacy Forwarder properties (type
|
||||
not specified).
|
||||
|
||||
* Tue Apr 26 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-16]
|
||||
- Really fix creation of root/ip/127 access list file (i.e. put it
|
||||
in the correct place).
|
||||
|
||||
* Tue Apr 26 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-15]
|
||||
- Fix creation of ip/127 access list file.
|
||||
|
||||
* Wed Apr 20 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-14]
|
||||
- Create ip/127 access allow file for dnscache.forwarder service.
|
||||
|
||||
* Wed Apr 20 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-13]
|
||||
- Adding missing execute permission on new run scripts.
|
||||
- Fix errors in config template for forwarding dnscache.
|
||||
|
||||
* Wed Apr 20 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-12]
|
||||
- Add missing /service symlink from previous change.
|
||||
|
||||
* Wed Apr 20 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-11]
|
||||
- Add missing file tree from previous change.
|
||||
|
||||
* Wed Apr 20 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-10]
|
||||
- Add second dnscache instance which does all Internet queries.
|
||||
We run the first instance with a small cache, which we
|
||||
can happily lose whenever we might have changed any delegations.
|
||||
|
||||
* Mon Apr 11 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-09]
|
||||
- Fix bug in delegation of local networks with NameServer
|
||||
property.
|
||||
- Fix bug in access list configuration.
|
||||
|
||||
* Tue Apr 5 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-08]
|
||||
- Avoid chdir in run script.
|
||||
- Allow delegation to an alternative listen address for tinydns.
|
||||
- Avoid unnecessary delegation for 127.in-addr.arpa.
|
||||
|
||||
* Wed Mar 30 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-07]
|
||||
- Fix pathname to root/servers/@ file in createlinks.
|
||||
|
||||
* Wed Mar 30 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-06]
|
||||
- Fix a few deficiencies with new perl run script.
|
||||
|
||||
* Wed Mar 30 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-05]
|
||||
- Use perl run script which does all env setup, access control and zone
|
||||
delegation without any templates.
|
||||
|
||||
* Wed Mar 30 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-04]
|
||||
- Fix delegation of reverse lookup of local network. [MN00062867]
|
||||
- Use generic_template_expand and adjust-services actions in place of
|
||||
dnscache-conf. Update e-smith-lib dependency. [MN00064130, MN00065576]
|
||||
- Update genfilelist call and move to install section.
|
||||
|
||||
* Wed Feb 23 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-03]
|
||||
- Don't run dnscache-conf at post-install, when $LocalIP is undefined.
|
||||
[MN00065717]
|
||||
|
||||
* Tue Feb 22 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-02]
|
||||
- Remove any left-behind env/FORWARDONLY file in post scriptlet, so we can
|
||||
later simplify config. [charlieb MN00045628]
|
||||
- Don't attempt to configure dnscache in post-install and post-upgrade.
|
||||
[MN00065717]
|
||||
- Only delegate reverse name lookup when we know of a suitable
|
||||
name server. [MN00062867]
|
||||
|
||||
* Fri Jan 21 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-01]
|
||||
- Changing version to development stream number - 0.5.0
|
||||
|
||||
* Tue Jan 4 2005 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.4.0-01]
|
||||
- rolling to stable - 0.4.0
|
||||
|
||||
* Thu Oct 21 2004 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.0-04]
|
||||
- Be sure to remove any left-behind env/FORWARDONLY file. [charlieb MN00045628]
|
||||
|
||||
* Thu Aug 26 2004 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.3.0-03]
|
||||
- Updated dnscache-conf for last change. [msoulier MN00045628]
|
||||
|
||||
* Thu Aug 26 2004 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.3.0-02]
|
||||
- Updated to handle FORWARDONLY env var properly, to prevent unwanted requests
|
||||
for recursion. [msoulier MN00045628]
|
||||
|
||||
* Thu Aug 26 2004 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.3.0-01]
|
||||
- rolling to dev - 0.3.0
|
||||
|
||||
* Wed Aug 27 2003 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.2.0-05]
|
||||
- Updated the shutdown ordering, and added runlevel 1. [msoulier 9761]
|
||||
|
||||
* Mon Aug 25 2003 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.2.0-04]
|
||||
- Moved the rc7 symlink creation to createlinks. [msoulier 9761]
|
||||
|
||||
* Mon Aug 25 2003 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.2.0-03]
|
||||
- Added K* script links for runlevels 0 and 6 for dnscache. [msoulier 9761]
|
||||
|
||||
* Tue Jul 15 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.2.0-02]
|
||||
- Remove bogus "Requires: supervise-scripts". [charlieb 9448]
|
||||
|
||||
* Thu Jun 26 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.2.0-01]
|
||||
- Changing version to stable stream number - 0.2.0
|
||||
|
||||
* Tue Jun 17 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-21]
|
||||
- Fix restart of dnscache. [charlieb 8745]
|
||||
|
||||
* Fri Jun 13 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-20]
|
||||
- Restart dnscache except after configuration is complete, except for
|
||||
certain events (when dnscache will not be running). [gordonr 6762]
|
||||
- If forwarder is enabled, don't delegate any lookups to local tinydns.
|
||||
[charlieb 9032]
|
||||
- Change Forwarder1 property to Forwarder. Do migration of legacy values here -
|
||||
previously done in fragment in e-smith-base RPM. [charlieb 9032]
|
||||
|
||||
* Fri Jun 6 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-19]
|
||||
- Add "down" file so that dnscache does not start until rc7.d script
|
||||
runs. [charlieb 8745]
|
||||
|
||||
* Wed Jun 4 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-18]
|
||||
- Use create-system-user in %pre to create required users. [charlieb 6033]
|
||||
|
||||
* Mon Apr 14 2003 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.8-17]
|
||||
- Add template for servers/@ and handle DNS forwarders [gordonr 8179]
|
||||
- Modify template for env/FORWARDONLY to handle DNS forwarders [gordonr 8179]
|
||||
- Restart dnscache in console-save in case we just changed forwarding
|
||||
policy [gordonr 8179]
|
||||
|
||||
* Mon Apr 7 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-16]
|
||||
- Well, it would help if the rc7.d symlink were named correctly. [charlieb 4085]
|
||||
|
||||
* Tue Apr 1 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-15]
|
||||
- Add rc7.d script so that dnscache comes up at boot time. [charlieb 4058]
|
||||
|
||||
* Thu Mar 27 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-14]
|
||||
- Add/delete dnscache delegations for off-site domains/networks if we
|
||||
know about them. [charlieb 7845]
|
||||
|
||||
* Thu Mar 13 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-13]
|
||||
- Add default db fragments to defaults, not default :-) [charlieb 7632]
|
||||
|
||||
* Tue Mar 11 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-12]
|
||||
- Add default db fragments, so dnscache is enabled by default.
|
||||
Updated e-smithlib dependency. [charlieb 7632]
|
||||
|
||||
* Thu Jan 30 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-11]
|
||||
- Replace Copyright header in spec file with "License: GPL". [charlieb]
|
||||
- Add /etc/resolv.conf template nameserver fragment. Corresponding
|
||||
fragment must be removed from e-smith-base. [charlieb 4058].
|
||||
- Remove debugging print from dnscache-conf. [charlieb 4058]
|
||||
- Add 127.in-addr.arpa file - it is constant. [charlieb 4058]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.8-10]
|
||||
- Updated address for J.ROOT-SERVERS.NET [gordonr 5530]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.8-09]
|
||||
- Skip servers/@ in dnscache-conf - the root name servers :-) [gordonr 4058]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.8-08]
|
||||
- Add service domain delegation [gordonr 4058]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.8-07]
|
||||
- Delegate domain-remote entries to the server defined in the
|
||||
Server property of that record.
|
||||
- Don't delegate remote subnets to the local nameserver - just
|
||||
skip them for now [gordonr 4058]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.8-06]
|
||||
- Wrong bug number last time
|
||||
- Standardised log/run script with mailfront/qmail/etc. [gordonr 4058]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.8-05]
|
||||
- Standardised log/run script with mailfront/qmail/etc. [gordonr 6365]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.8-04]
|
||||
- Call dnscache-conf in post-{install,upgrade} - we need this running
|
||||
from the start, even if we need to change details after the bootstrap
|
||||
console [gordonr 6365]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.8-03]
|
||||
- Add missing pipe in genfilelist call so sticky bit preserverved
|
||||
on /var/service/dnscache [gordonr 4058]
|
||||
|
||||
* Tue Dec 3 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-02]
|
||||
- Add sticky bit to dnscache service directory, so that svscan starts logging.
|
||||
- Create /service symlink, so that supervise of dnscache is started by svscan.
|
||||
[charlieb 4058]
|
||||
|
||||
* Thu Nov 21 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.8-01]
|
||||
- Rebuild to catch the createlinks update missed by last co2rpm build to 0.1.8
|
||||
|
||||
* Thu Nov 21 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.7-02]
|
||||
- Added root/servers/@ file - we will need to update this some time, as the
|
||||
list recently changed.
|
||||
- Rewrote conf-dnscache to use new DB access classes. Renamed to dnscache-conf.
|
||||
- Add conf-dnscache links to domain-create and domain-delete events.
|
||||
- Use links for acl files and delegation files.
|
||||
- Add code to do local domain delegation (to tinydns).
|
||||
- We currently do lame delegation for local networks reverse lookup. We
|
||||
need to fix this, but currently can't do any better - we don't know any
|
||||
name servers for those reverse domains.
|
||||
- Add sticky bit to dnscache service directory
|
||||
- Hide output of "id" in %pre script.
|
||||
[charlieb 4058]
|
||||
|
||||
* Thu May 23 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.1.7-01]
|
||||
- RPM rebuild forced by cvsroot2rpm
|
||||
|
||||
* Mon Apr 8 2002 Michael Schwern <schwern@e-smith.com>
|
||||
- [0.1.6-01]
|
||||
- Update access list manipulation to handle arbitrary bitmasks.
|
||||
|
||||
* Wed Mar 13 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.4-01]
|
||||
- Use correct esmith::utils function names for netmask manip stuff
|
||||
- Remove trailing dot from network prefixes before creating access
|
||||
allow files
|
||||
|
||||
* Wed Mar 13 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.3-01]
|
||||
- Allow dnscache/dnslog users to already exist in %pre script
|
||||
- Remove bogus -g args from useradd commands
|
||||
- Update conf-dnscache action script to set up permission to
|
||||
query dnscache
|
||||
- Require supervise-scripts
|
||||
|
||||
* Wed Mar 13 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.2-01]
|
||||
- Create dnscache and dnslog users
|
||||
- Fix path error in conf-dnscache
|
||||
- Create /var/log/dnscache directory with correct ownership
|
||||
|
||||
* Tue Mar 12 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.1-01]
|
||||
- Initial
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
perl createlinks
|
||||
|
||||
%pre
|
||||
/sbin/e-smith/create-system-user dnscache 410 \
|
||||
"DNScache user" /var/service/dnscache /bin/false
|
||||
/sbin/e-smith/create-system-user dnslog 411 \
|
||||
"DNS log user" /var/log /bin/false
|
||||
|
||||
%post
|
||||
# Remove any left over env/FORWARDONLY file
|
||||
rm -f /var/service/dnscache/env/FORWARDONLY
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
|
||||
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|
||||
--dir /var/service/dnscache 'attr(0755,root,root)' \
|
||||
--dir /var/service/dnscache/log 'attr(0755,root,root)' \
|
||||
--file /var/service/dnscache/run 'attr(0750,root,root)' \
|
||||
--file /var/service/dnscache/dnscache-log.pl 'attr(0750,root,root)' \
|
||||
--file /var/service/dnscache/log/run 'attr(0750,root,root)' \
|
||||
--dir /var/log/dnscache 'attr(02755,dnslog,dnslog)' \
|
||||
--dir /var/log/dnscache.forwarder 'attr(02755,dnslog,dnslog)' \
|
||||
--file /var/service/dnscache.forwarder/run 'attr(0750,root,root)' \
|
||||
--file /var/service/dnscache.forwarder/log/run 'attr(0750,root,root)' \
|
||||
> %{name}-%{version}-%{release}-filelist
|
||||
echo "%doc COPYING" >> %{name}-%{version}-%{release}-filelist
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files -f %{name}-%{version}-%{release}-filelist
|
||||
%defattr(-,root,root)
|
@ -0,0 +1 @@
|
||||
enabled
|
@ -0,0 +1 @@
|
||||
service
|
@ -0,0 +1 @@
|
||||
53
|
@ -0,0 +1 @@
|
||||
53
|
@ -0,0 +1 @@
|
||||
private
|
@ -0,0 +1 @@
|
||||
enabled
|
@ -0,0 +1 @@
|
||||
service
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
my %props;
|
||||
|
||||
my $forwarder = $DB->get_value_and_delete('DNSPrimaryIP') ||
|
||||
$DB->get_prop_and_delete('named', 'Forwarder1');
|
||||
|
||||
return "" unless defined $forwarder;
|
||||
|
||||
$props{'Forwarder'} = $forwarder;
|
||||
|
||||
$forwarder = $DB->get_value_and_delete('DNSSecondaryIP') ||
|
||||
$DB->get_prop_and_delete('named', 'Forwarder2');;
|
||||
|
||||
if (defined $forwarder)
|
||||
{
|
||||
warn "DNS forwarder $forwarder deleted - support provided for only one";
|
||||
}
|
||||
|
||||
my $dnscache = $DB->get('dnscache') || $DB->new_record('dnscache', { type => 'service' } );
|
||||
|
||||
$dnscache->merge_props(%props);
|
||||
}
|
@ -0,0 +1 @@
|
||||
nameserver { "$LocalIP" }
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
my $c = $dnscache{'CacheSize'} || 10000000;
|
||||
"export CACHESIZE=$c"
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
my $datalimit = $dnscache{'DataLimit'} || 12000000;
|
||||
"DATALIMIT=$datalimit";
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
(defined $dnscache{'Forwarder'} && $dnscache{'Forwarder'}) ?
|
||||
"export FORWARDONLY=1" : "";
|
||||
}
|
@ -0,0 +1 @@
|
||||
export IP=127.0.0.2
|
@ -0,0 +1 @@
|
||||
export IPSEND=0.0.0.0
|
@ -0,0 +1 @@
|
||||
export ROOT=/var/service/dnscache.forwarder/root
|
@ -0,0 +1,25 @@
|
||||
{
|
||||
my @servers = qw (
|
||||
198.41.0.4
|
||||
192.228.79.201
|
||||
192.33.4.12
|
||||
199.7.91.13
|
||||
192.203.230.10
|
||||
192.5.5.241
|
||||
192.112.36.4
|
||||
128.63.2.53
|
||||
192.36.148.17
|
||||
192.58.128.30
|
||||
193.0.14.129
|
||||
199.7.83.42
|
||||
202.12.27.33
|
||||
);
|
||||
|
||||
my $forwarder = $dnscache{Forwarder};
|
||||
|
||||
$OUT = $forwarder ? "$forwarder" : join("\n", @servers);
|
||||
if ($forwarder = $dnscache{Forwarder2})
|
||||
{
|
||||
$OUT .= "\n$forwarder";
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"127.0.0.2";
|
||||
}
|
@ -0,0 +1 @@
|
||||
/var/service/dnscache
|
@ -0,0 +1 @@
|
||||
/var/service/dnscache.forwarder
|
@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=dnscache.forwarder,
|
||||
After=network.target
|
||||
Requires=runit.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/sbin/e-smith/service-status dnscache.forwarder
|
||||
ExecStart=/usr/bin/sv u /service/dnscache.forwarder
|
||||
ExecStop=/usr/bin/sv stop /service/dnscache.forwarder
|
||||
ExecReload=/usr/bin/sv t /service/dnscache.forwarder
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=dnscache,
|
||||
After=network.target
|
||||
Requires=runit.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/sbin/e-smith/service-status dnscache
|
||||
ExecStart=/usr/bin/sv u /service/dnscache
|
||||
ExecStop=/usr/bin/sv stop /service/dnscache
|
||||
ExecReload=/usr/bin/sv t /service/dnscache
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
@ -0,0 +1 @@
|
||||
/var/service/dnscache/root
|
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 2005 Mitel Networks Corporation
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Technical support for this program is available from Mitel Networks
|
||||
# Please visit our web site www.mitel.com/sme/ for details.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
exec \
|
||||
/usr/local/bin/setuidgid dnslog \
|
||||
/usr/local/bin/multilog t s5000000 \
|
||||
/var/log/dnscache.forwarder
|
||||
|
@ -0,0 +1 @@
|
||||
127.0.0.1
|
@ -0,0 +1,12 @@
|
||||
#! /bin/sh
|
||||
exec 2>&1
|
||||
. ./config
|
||||
|
||||
# Ensure that dnscache has source of randomness to initialise its source
|
||||
# port RNG
|
||||
test -f ./seed || /bin/dd if=/dev/urandom bs=128 count=1 of=seed
|
||||
exec<./seed
|
||||
|
||||
# http://marc.theaimsgroup.com/?l=djbdns&m=104812086607532&w=2
|
||||
trap "" SIGPIPE
|
||||
exec envuidgid dnscache softlimit -o250 -d "$DATALIMIT" /usr/local/bin/dnscache
|
@ -0,0 +1,109 @@
|
||||
#!/usr/bin/perl -p
|
||||
|
||||
# usage: tail -f /service/dnscache/log/main/current | tai64nlocal | dnscache-log
|
||||
# use tail -F instead of tail -f if your tail supports it (linux, freebsd, etc)
|
||||
|
||||
$| = 1;
|
||||
|
||||
# strip off the year and the extra tai64 stuff.
|
||||
s/^\d{4}-(\d\d-\d\d) (\d\d:\d\d:\d\d).(\d*)/$1 $2/;
|
||||
|
||||
# convert addresses in hex to dotted decimal notation.
|
||||
# ugly fix (fn 2003 01 06)
|
||||
if (!m/ stats \d+ \d+ \d+ \d+/) {
|
||||
s/\b([a-f0-9]{8})\b/join(".", unpack("C*", pack("H8", $1)))/eg;
|
||||
}
|
||||
|
||||
# strip out length from sent messages.
|
||||
# sent slot-id length
|
||||
s/sent (\d+) \d+/sent $1/;
|
||||
|
||||
|
||||
### clean up some messages
|
||||
|
||||
# tx gluelessness qtype thing domain where.
|
||||
s/tx (\d+) (\d+) (\S+) (\S+) (.*)/"tx $1 " . queryType($2) . " $3 $4 $5"/e;
|
||||
|
||||
# nodata server ttl qtype thing.
|
||||
s/nodata (\S+) (\d+) (\d+) (\S+)/"nodata $1 " . queryType($2) . " $3 $4"/e;
|
||||
|
||||
# cached qtype info.
|
||||
s/cached (\d+)/"cached " . queryType($1)/e;
|
||||
|
||||
# convert stuff like 127.0.0.2:0422:05be 1 to something more descriptive.
|
||||
# query slot-id host:port qid qtype thing
|
||||
s/\b([\d.]+):(\w+):(\w+) (\d+) ([-.\w]+)/printQueryLine($1, $2, $3, $4, $5)/e;
|
||||
|
||||
# convert rr messages.
|
||||
s/rr (\S+) (\d+) (\S+) (\S+) (\S+)/printRRLine($1, $2, $3, $4, $5)/e;
|
||||
|
||||
### subs
|
||||
|
||||
sub printQueryLine {
|
||||
my ($host, $port, $query_id, $query_type, $query) = @_;
|
||||
|
||||
# pad hostname
|
||||
|
||||
my $ret = "$host:";
|
||||
$ret .= hex($port);
|
||||
$ret .= ":" . hex($query_id);
|
||||
$ret .= " " . queryType($query_type) . " $query";
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub printRRLine {
|
||||
my ($host, $ttl, $query_type, $thing, $data) = @_;
|
||||
|
||||
my $ret = "rr ";
|
||||
$ret .= "$host " . padd(6, $ttl) . " ";
|
||||
$ret .= queryType($query_type) . " $thing ";
|
||||
if ($query_type == 16) { # it's a txt record
|
||||
# the first byte is the length. we skip it.
|
||||
$data = substr($data, 2);
|
||||
$ret .= "\"" . unpack("A*", pack("H*", $data)) . "\"";
|
||||
} else {
|
||||
$ret .= "$data";
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
sub queryType {
|
||||
my ($type) = shift;
|
||||
|
||||
my $ret = "";
|
||||
|
||||
# i only list the ones that are in dnscache's dns.h.
|
||||
SWITCH: {
|
||||
($type == 1) && do { $ret = "a"; last SWITCH; };
|
||||
($type == 2) && do { $ret = "ns"; last SWITCH; };
|
||||
($type == 5) && do { $ret = "cname"; last SWITCH; };
|
||||
($type == 6) && do { $ret = "soa"; last SWITCH; };
|
||||
($type == 12) && do { $ret = "ptr"; last SWITCH; };
|
||||
($type == 13) && do { $ret = "hinfo"; last SWITCH; };
|
||||
($type == 15) && do { $ret = "mx"; last SWITCH; };
|
||||
($type == 16) && do { $ret = "txt"; last SWITCH; };
|
||||
($type == 17) && do { $ret = "rp"; last SWITCH; };
|
||||
($type == 24) && do { $ret = "sig"; last SWITCH; };
|
||||
($type == 25) && do { $ret = "key"; last SWITCH; };
|
||||
($type == 28) && do { $ret = "aaaa"; last SWITCH; };
|
||||
($type == 252) && do { $ret = "axfr"; last SWITCH; };
|
||||
($type == 255) && do { $ret = "any"; last SWITCH; };
|
||||
do { $ret .= "$type "; last SWITCH; };
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
# there has to be a better way
|
||||
sub pads {
|
||||
my ($amount, $item) = @_;
|
||||
|
||||
return sprintf "%" . $amount . "s", $item;
|
||||
}
|
||||
|
||||
sub padd {
|
||||
my ($amount, $item) = @_;
|
||||
|
||||
return sprintf "%0" . $amount . "d", $item;
|
||||
}
|
@ -0,0 +1 @@
|
||||
/var/service/dnscache/root
|
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 1999-2003 Mitel Networks Corporation
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Technical support for this program is available from Mitel Networks
|
||||
# Please visit our web site www.mitel.com/sme/ for details.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
exec \
|
||||
/usr/local/bin/setuidgid dnslog \
|
||||
/usr/local/bin/multilog t s5000000 \
|
||||
/var/log/dnscache
|
||||
|
@ -0,0 +1 @@
|
||||
127.0.0.2
|
@ -0,0 +1,233 @@
|
||||
#!/usr/bin/perl -w
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 1999-2008 Mitel Networks Corporation
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
package esmith;
|
||||
|
||||
use strict;
|
||||
use Errno;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::DomainsDB;
|
||||
use esmith::NetworksDB;
|
||||
use esmith::util;
|
||||
|
||||
sub allow_networks_2access_cache;
|
||||
sub delegate_domains_2DNS;
|
||||
|
||||
unless (-f "/var/service/dnscache/seed")
|
||||
{
|
||||
system(qw(/bin/dd
|
||||
if=/dev/urandom
|
||||
of=/var/service/dnscache/seed
|
||||
bs=128 count=1)) == 0
|
||||
or warn("Could not create seed file");
|
||||
}
|
||||
|
||||
open(STDIN, "<./seed") or warn "Failed to redirect input from seed file: $!";
|
||||
open(STDERR, ">&STDOUT") or warn "Failed to redirect stderr to stdout: $!";;
|
||||
|
||||
my $config = esmith::ConfigDB->open or die "Could not open config db.";
|
||||
my $dnscache = $config->get('dnscache');
|
||||
my $forwarders = $dnscache->prop("Forwarder") || "";
|
||||
if ($dnscache->prop("Forwarder2"))
|
||||
{
|
||||
$forwarders .= "," . $dnscache->prop("Forwarder2");
|
||||
}
|
||||
|
||||
unless ($dnscache)
|
||||
{
|
||||
die "dnscache not configured in configuration db\n";
|
||||
}
|
||||
|
||||
my $localip = $config->get('LocalIP');
|
||||
unless ($localip)
|
||||
{
|
||||
die "localip not configured in configuration db\n";
|
||||
}
|
||||
|
||||
my $tinydns = $config->get('tinydns');
|
||||
unless ($tinydns)
|
||||
{
|
||||
die "tinydns not configured in configuration db\n";
|
||||
}
|
||||
my $tinydns_ip = $tinydns->prop('ListenIP') || "127.0.0.1";
|
||||
|
||||
$ENV{FORWARDONLY} = '1';
|
||||
$ENV{IP} = $dnscache->prop('ListenIP') || $localip->value;
|
||||
$ENV{IPSEND} = $dnscache->prop('SendIP') || '0.0.0.0';
|
||||
$ENV{CACHESIZE} = 200000;
|
||||
$ENV{ROOT} = '/service/dnscache/root';
|
||||
|
||||
my $domains = esmith::DomainsDB->open or die "Could not open Domains db.";
|
||||
my $nets = esmith::NetworksDB->open or die "Could not open Networks db.";
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Configure DNS cache access.
|
||||
#------------------------------------------------------------
|
||||
|
||||
# allow my networks to access the nameserver cache
|
||||
my @localnetworks = ();
|
||||
my %reversenets = ();
|
||||
|
||||
foreach my $net ($nets->get_all_by_prop('type', 'network'))
|
||||
{
|
||||
my $mask = $net->prop('Mask');
|
||||
my $key = $net->key;
|
||||
my $systemlocalnetwork = $net->prop('SystemLocalNetwork') || 'no';
|
||||
my $nameserver = $net->prop('NameServer');
|
||||
if (defined $nameserver and $nameserver eq $ENV{IP})
|
||||
{
|
||||
warn("NameServer property for net $key ($nameserver) would create loop - ignoring\n");
|
||||
$nameserver = undef;
|
||||
}
|
||||
$nameserver ||= ($systemlocalnetwork eq 'yes') ? $tinydns_ip : 'none';
|
||||
my @all_network_prefixes = esmith::util::computeAllLocalNetworkPrefixes ($key, $mask);
|
||||
push @localnetworks, @all_network_prefixes;
|
||||
|
||||
unless ($nameserver eq 'none')
|
||||
{
|
||||
foreach (@all_network_prefixes)
|
||||
{
|
||||
my @quads = split(/\./, $_);
|
||||
my $reverse_zone = join('.', reverse @quads) . ".in-addr.arpa";
|
||||
$reversenets{$reverse_zone} = $nameserver;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allow_networks_2access_cache(@localnetworks);
|
||||
|
||||
delegate_domains_2DNS(
|
||||
%reversenets,
|
||||
map { $_->key => ($_->prop('Nameservers') || $tinydns_ip) }
|
||||
($domains->get_all_by_prop('type', 'domain'),
|
||||
$domains->get_all_by_prop('type', 'domain-remote')
|
||||
));
|
||||
|
||||
my $datalimit = $dnscache->prop('DataLimit') || 3000000;
|
||||
|
||||
# Ensure that forwarder instance is started
|
||||
system("sv", "u", "/service/dnscache.forwarder");
|
||||
|
||||
# http://marc.theaimsgroup.com/?l=djbdns&m=104812086607532&w=2
|
||||
$SIG{'PIPE'} = 'IGNORE';
|
||||
exec("envuidgid", "dnscache", "softlimit", "-o250", "-d", "$datalimit",
|
||||
"/usr/local/bin/dnscache")
|
||||
or die "failed to execute envuidgid/softlimit/dnscache: $!";
|
||||
# NOTREACHED
|
||||
exit (1);
|
||||
|
||||
sub allow_networks_2access_cache
|
||||
{
|
||||
my %access = map { $_ => 1 } @_;
|
||||
|
||||
my $dir = '/var/service/dnscache/root/ip';
|
||||
unless (-f "$dir/127.0.0")
|
||||
{
|
||||
open F,">$dir/127.0.0"
|
||||
|| die "Cannot add access file for loopback network: $!\n";
|
||||
close F;
|
||||
}
|
||||
|
||||
opendir(ACCESS, $dir) or
|
||||
die "Cannot read dnscache access directory: $!";
|
||||
|
||||
foreach my $aclfile (readdir (ACCESS))
|
||||
{
|
||||
next if "$aclfile" eq "127.0.0";
|
||||
next if -d "$aclfile";
|
||||
if (exists $access{$aclfile})
|
||||
{
|
||||
# Cross this one off the list so that we don't bother creating it
|
||||
delete $access{$aclfile};
|
||||
}
|
||||
else
|
||||
{
|
||||
# We no longer need this entry
|
||||
unlink "$dir/$aclfile" or
|
||||
warn "Could not delete dnscache access file $dir/$aclfile: $!\n";
|
||||
}
|
||||
}
|
||||
closedir(ACCESS);
|
||||
|
||||
foreach my $aclfile (keys %access)
|
||||
{
|
||||
link "$dir/127.0.0", "$dir/$aclfile" or
|
||||
die "Cannot add network access for $dir/$aclfile: $!\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub delegate_domains_2DNS
|
||||
{
|
||||
my %delegations = @_;
|
||||
my $serversdir = '/var/service/dnscache/root/servers';
|
||||
|
||||
opendir(SERVERS, $serversdir) or
|
||||
die "Cannot read dnscache servers directory: $!";
|
||||
|
||||
foreach my $delegatefile (readdir (SERVERS))
|
||||
{
|
||||
next if "$delegatefile" eq '@';
|
||||
|
||||
next if -d "$serversdir/$delegatefile";
|
||||
|
||||
unless (exists $delegations{$delegatefile})
|
||||
{
|
||||
# We no longer need this entry
|
||||
unlink "$serversdir/$delegatefile" or
|
||||
warn "Could not delete dnscache domain file $serversdir/$delegatefile: $!\n";
|
||||
}
|
||||
}
|
||||
closedir(SERVERS);
|
||||
|
||||
foreach my $delegatefile (keys %delegations)
|
||||
{
|
||||
if (-l "$serversdir/$delegatefile")
|
||||
{
|
||||
# Legacy symlink - we use files now
|
||||
unlink "$serversdir/$delegatefile" or
|
||||
warn "Could not delete dnscache domain link $serversdir/$delegatefile: $!\n";
|
||||
}
|
||||
|
||||
open DELEGATE, ">$serversdir/$delegatefile" or
|
||||
die "Couldn't create $serversdir/$delegatefile\n";
|
||||
|
||||
for my $ns ( split /,/, $delegations{$delegatefile} )
|
||||
{
|
||||
if ($ns =~ /^localhost$/)
|
||||
{
|
||||
print DELEGATE $tinydns_ip . "\n";
|
||||
}
|
||||
elsif ($ns =~ /^corporate$/)
|
||||
{
|
||||
print DELEGATE join("\n", split /,/, $forwarders) . "\n";
|
||||
}
|
||||
elsif ($ns =~ /^internet$/)
|
||||
{
|
||||
unlink "$serversdir/$delegatefile" or
|
||||
warn "Couldn't unlink $serversdir/$delegatefile\n"
|
||||
}
|
||||
else
|
||||
{
|
||||
print DELEGATE $ns . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
close DELEGATE;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue