initial commit of file from CVS for e-smith-dnscache on Wed 12 Jul 08:51:05 BST 2023

This commit is contained in:
Brian Read 2023-07-12 08:51:05 +01:00
parent 6b9c45bdb1
commit 985fd9f0ab
46 changed files with 1461 additions and 2 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.rpm
*.log
*spec-20*
*.tar.xz

21
Makefile Normal file
View File

@ -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)

View File

@ -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.

340
additional/COPYING Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

1
contriborbase Normal file
View File

@ -0,0 +1 @@
sme10

46
createlinks Executable file
View File

@ -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");

514
e-smith-dnscache.spec Normal file
View File

@ -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)

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
service

View File

@ -0,0 +1 @@
53

View File

@ -0,0 +1 @@
53

View File

@ -0,0 +1 @@
private

View File

@ -0,0 +1 @@
enabled

View File

@ -0,0 +1 @@
service

View File

@ -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);
}

View File

View File

View File

@ -0,0 +1 @@
nameserver { "$LocalIP" }

View File

@ -0,0 +1,4 @@
{
my $c = $dnscache{'CacheSize'} || 10000000;
"export CACHESIZE=$c"
}

View File

@ -0,0 +1,4 @@
{
my $datalimit = $dnscache{'DataLimit'} || 12000000;
"DATALIMIT=$datalimit";
}

View File

@ -0,0 +1,4 @@
{
(defined $dnscache{'Forwarder'} && $dnscache{'Forwarder'}) ?
"export FORWARDONLY=1" : "";
}

View File

@ -0,0 +1 @@
export IP=127.0.0.2

View File

@ -0,0 +1 @@
export IPSEND=0.0.0.0

View File

@ -0,0 +1 @@
export ROOT=/var/service/dnscache.forwarder/root

View File

@ -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";
}
}

View File

@ -0,0 +1,3 @@
{
"127.0.0.2";
}

1
root/service/dnscache Symbolic link
View File

@ -0,0 +1 @@
/var/service/dnscache

View File

@ -0,0 +1 @@
/var/service/dnscache.forwarder

View File

@ -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

View File

@ -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

View File

0
root/var/log/dnscache/.gitignore vendored Normal file
View File

View File

View File

@ -0,0 +1 @@
/var/service/dnscache/root

View File

@ -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

View File

@ -0,0 +1 @@
127.0.0.1

View File

@ -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

View File

@ -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;
}

View File

1
root/var/service/dnscache/env/ROOT vendored Normal file
View File

@ -0,0 +1 @@
/var/service/dnscache/root

View File

@ -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

View File

View File

@ -0,0 +1 @@
127.0.0.2

233
root/var/service/dnscache/run Executable file
View File

@ -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;
}
}