initial commit of file from CVS for e-smith-tinydns on Wed 12 Jul 09:11:00 BST 2023
parent
4d5bb6a2a3
commit
1cdaede0de
@ -0,0 +1,4 @@
|
||||
*.rpm
|
||||
*.log
|
||||
*spec-20*
|
||||
*.tar.xz
|
@ -0,0 +1,21 @@
|
||||
# Makefile for source rpm: e-smith-tinydns
|
||||
# $Id: Makefile,v 1.1 2016/02/05 17:04:37 stephdl Exp $
|
||||
NAME := e-smith-tinydns
|
||||
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-tinydns
|
||||
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> e-smith-tinydns
|
||||
|
||||
SMEServer Koozali developed git repo for e-smith-tinydns smeserver
|
||||
SMEServer Koozali developed git repo for e-smith-tinydns smeserver
|
||||
|
||||
## Wiki
|
||||
<br />https://wiki.koozali.org/
|
||||
|
||||
## Bugzilla
|
||||
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=e-smith-tinydns&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-TinyDNS is a free software package designed to provide an authoritative DNS server for a small dynamic network. It is based on the TinyDNS software developed by the renowned DJB Software. This software package is easy to install and configure, making it a great choice for those who want a quick and simple DNS server solution. The package is also versatile, allowing users to configure any number of distinct DNS zones for their network, including reverse DNS lookups. E-smith-TinyDNS is widely used in small-scale networks, as it is reliable, efficient, and secure.
|
||||
|
@ -0,0 +1 @@
|
||||
sme10
|
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/perl -w
|
||||
# This script creates the symlinks needed by this RPM
|
||||
|
||||
use strict;
|
||||
use esmith::Build::CreateLinks qw(:all);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# actions for bootstrap-console-save event, e-smith-tinydns-update :
|
||||
#-------------------------------------------------------------------
|
||||
foreach (qw(
|
||||
env/IP
|
||||
env/DATALIMIT
|
||||
root/data
|
||||
))
|
||||
{
|
||||
templates2events("/var/service/tinydns/$_", qw(
|
||||
bootstrap-console-save
|
||||
e-smith-tinydns-update
|
||||
));
|
||||
}
|
||||
|
||||
#--------------------------------------------------
|
||||
# actions for ip-change event
|
||||
#--------------------------------------------------
|
||||
my $event = "ip-change";
|
||||
safe_symlink("sigusr2", "root/etc/e-smith/events/$event/services2adjust/tinydns");
|
||||
|
||||
#--------------------------------------------------
|
||||
# actions for e-smith-tinydns-update event
|
||||
#--------------------------------------------------
|
||||
$event = "e-smith-tinydns-update";
|
||||
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/tinydns");
|
||||
templates2events("/etc/systemd/system-preset/49-koozali.preset", $event);
|
||||
event_link("systemd-reload", $event, "89");
|
||||
|
@ -0,0 +1,431 @@
|
||||
# $Id: e-smith-tinydns.spec,v 1.9 2021/03/16 19:09:36 jpp Exp $
|
||||
|
||||
Summary: e-smith module to configure tinydns
|
||||
%define name e-smith-tinydns
|
||||
Name: %{name}
|
||||
%define version 2.6.0
|
||||
%define release 10
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
License: GPL
|
||||
Group: Networking/Daemons
|
||||
Source: %{name}-%{version}.tar.xz
|
||||
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
||||
BuildRequires: e-smith-devtools
|
||||
BuildArchitectures: noarch
|
||||
Requires: e-smith-base
|
||||
Requires: djbdns
|
||||
Requires: e-smith-lib >= 1.15.1-19
|
||||
Requires: e-smith-daemontools >= 1.1.0-02
|
||||
Requires: iptables
|
||||
Obsoletes: tinydns-initscripts
|
||||
AutoReqProv: no
|
||||
|
||||
%changelog
|
||||
* Wed Jul 12 2023 cvs2git.sh aka Brian Read <brianr@koozali.org> 2.6.0-10.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-9.sme
|
||||
- cleanup in /etc/rc.d [SME: 9692]
|
||||
|
||||
* Fri Feb 12 2021 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-8.sme
|
||||
- remove /usr/lib/systemd/system-preset/80-koozali-tinydns.preset [SME: 10958]
|
||||
|
||||
* Thu Dec 10 2020 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-7.sme
|
||||
- Add 'Requires=runit.service' [SME: 11245]
|
||||
|
||||
* Thu Dec 03 2020 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-6.sme
|
||||
- remove S95reset-unsavedflag [SME: 11229]
|
||||
|
||||
* Thu Dec 03 2020 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-5.sme
|
||||
- execute systemd-reload before service adjust in events [SME: 11228]
|
||||
|
||||
* Mon Nov 30 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 2.6.0-4.sme
|
||||
- remove createlink safesymlink in /etc/rc.d/init.d [SME: 11098]
|
||||
|
||||
* Thu Nov 19 2020 Michel Begue <mab974@gmail.com> 2.6.0-3.sme
|
||||
- remove rc7.d link [SME: 11098]
|
||||
- fix date in changelog
|
||||
- fix actions in e-smith-tinydns-update [SME: 11159]
|
||||
|
||||
* Sat Nov 14 2020 Michel Begue <mab974@gmail.com> 2.6.0-2.sme
|
||||
- Move tinydns service to systemd [SME: 11098]
|
||||
- Create e-smith-tinydns-update event [SME: 11159]
|
||||
|
||||
* Fri Feb 05 2016 stephane de Labrusse <stephdl@de-labrusse.fr> 2.6.0-1.sme
|
||||
- Initial release to sme10
|
||||
|
||||
* Sat Jan 24 2015 stephane de labrusse <stephdl@de-labrusse.fr> 2.4.0-8.sme
|
||||
- Revert the patch e-smith-tinydns-2.4.0_add_hostname_following_dhcpdleases_hostname.patch
|
||||
- [SME: 2388]
|
||||
|
||||
* Sat Jan 17 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-7.sme
|
||||
- Duplicate hostnames with different IP are not used, a warn in log is printed
|
||||
- The server hostname can not be used by a dhcp client, a warn in log is printed
|
||||
- [SME: 2388]
|
||||
|
||||
* Fri Jan 9 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-5.sme
|
||||
- Changed the name of /tmp/dhcpd.leases to /tmp/tmpdhcpd.leases [SME: 2388]
|
||||
|
||||
* Fri Jan 9 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-4.sme
|
||||
- When the dhcpd lease is modified
|
||||
- Do template-expand of /var/service/tinydns/root/data
|
||||
- Do sigus1 of dhcp-dns & dnscache
|
||||
- Forked DHCPparse for parsing the end of lease and remove old entry of dnscache
|
||||
- Require perl-Text-DHCPparse removed
|
||||
- Timestamp added in tinydns, the entry in dnscache is cleared when the lease is over
|
||||
- [SME: 2388]
|
||||
|
||||
* Wed Jun 18 2014 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-3.sme
|
||||
- add new feature 'Parse dhcpd.leases and feed to tinydns'
|
||||
- e-smith-tinydns-2.4.0_add_hostname_following_dhcpdleases_hostname.patch
|
||||
- made from the solution of Stefano Zamboni [SME:2388]
|
||||
- Thanks also for all other implicated members in this bug report
|
||||
|
||||
* Thu Jan 31 2013 Shad L. Lords <slords@mail.com> 2.4.0-1.sme
|
||||
- Roll new stream for sme9
|
||||
|
||||
* Thu Jul 29 2010 Filippo Carletti <filippo.carletti@gmail.com> 2.2.0-2.sme
|
||||
- Allow use of CNAME in remote hosts [SME: 3132]
|
||||
|
||||
* 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]
|
||||
|
||||
* Sun Apr 29 2007 Shad L. Lords <slords@mail.com>
|
||||
- Clean up spec so package can be built by koji/plague
|
||||
|
||||
* Fri Feb 16 2007 Shad L. Lords <slords@mail.com> 1.0.0-7
|
||||
- Change runsvctrl to sv to support runit v1.7.x [SME: 1179]
|
||||
|
||||
* Fri Jan 19 2007 Shad L. Lords <slords@mail.com> 1.0.0-6
|
||||
- Fix last patch to remove warnings.
|
||||
|
||||
* Sun Jan 14 2007 Shad L. Lords <slords@mail.com> 1.0.0-5
|
||||
- Make us authoritative for 127.0.0.x [SME: 2223]
|
||||
|
||||
* Thu Dec 07 2006 Shad L. Lords <slords@mail.com>
|
||||
- Update to new release naming. No functional changes.
|
||||
- Make Packager generic
|
||||
|
||||
* Thu Sep 14 2006 Charlie Brady <charlie_brady@mitel.com> 1.0.0-03
|
||||
- Ensure that ListenIP property is clear in serveronly mode. [SME: 1912]
|
||||
|
||||
* Sun Jul 16 2006 Charlie Brady <charlie_brady@mitel.com> 1.0.0-02
|
||||
- Make dnslog user creation consistent with e-smith-dnscache. [SME: 1688]
|
||||
|
||||
* Fri Mar 17 2006 Gordon Rowell <gordonr@gormand.com.au> 1.0.0-01
|
||||
- Bump stable stream number to 1.0.0 [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.0-21
|
||||
- Remove % from (percent)prep in 0.2.0-01 changelog to keep
|
||||
mezzanine/RPM happy. No code change.
|
||||
|
||||
* Wed Nov 30 2005 Gordon Rowell <gordonr@gormand.com.au> 0.5.0-20
|
||||
- Bump release number only
|
||||
|
||||
* Wed Aug 17 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-19]
|
||||
- Fix access default property for tinydns. [SF: 1246986]
|
||||
- Add missing control/2 script, possibly required for ip-change
|
||||
event handling.
|
||||
|
||||
* Tue Aug 16 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-18]
|
||||
- Add defaults vals for UDPPort and access. [SF: 1246986]
|
||||
|
||||
* Mon Jun 6 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-17]
|
||||
- Add tinydns stats file digester and pretty printer (from
|
||||
http://www.campin.net/DNS/tinydns-readstats.txt).
|
||||
|
||||
* Mon Jun 6 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-16]
|
||||
- Add tinydns log file parser program (from
|
||||
http://tinydns.org/tinydns-log.pl.txt).
|
||||
|
||||
* Wed Apr 13 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-15]
|
||||
- Work around ordering problem between template expansion and
|
||||
hosts db migration scripts in e-smith-hosts rpm, by calling
|
||||
expand-template from tinydns/control/1. TODO: fix properly
|
||||
by moving hosts db munging scripts into migrate fragments.
|
||||
|
||||
* Mon Apr 11 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-14]
|
||||
- Switch to updated calling convention for genfilelist.
|
||||
- Add control/1 script to rebuild data cdb file. Call ./control/1
|
||||
from run script, before starting tinydns.
|
||||
- Use generic_template_expand action in place of tinydns-conf.
|
||||
Update e-smith-lib dependency. [MN00064130]
|
||||
- Remove unused tinydns-restart.
|
||||
|
||||
* Tue Mar 15 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-13]
|
||||
- Remove unnecessary warning from 20tinydns fragment.
|
||||
[MN00035059]
|
||||
|
||||
* Thu Mar 10 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-12]
|
||||
- Always create generic hosts for internal IPs
|
||||
|
||||
* Thu Jan 20 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-11]
|
||||
- Still another couple of fixes required to 20tinydns fragment.
|
||||
[charlieb MN00035059]
|
||||
|
||||
* Wed Jan 5 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-10]
|
||||
- Further fix and more simplification to 20tinydns fragment.
|
||||
[charlieb MN00035059]
|
||||
|
||||
* Mon May 31 2004 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.5.0-09]
|
||||
- Beautified 20tinydns fragment, and s/exit/return, as it was killing
|
||||
initialize-default-databases processing in post-install.
|
||||
[msoulier MN00035059]
|
||||
|
||||
* Thu May 20 2004 Mark Knox <markk@e-smith.com>
|
||||
- [0.5.0-08]
|
||||
- Don't die in post-install if there's no host record for the server [markk
|
||||
MN00034226]
|
||||
|
||||
* Tue Jan 13 2004 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.5.0-07]
|
||||
- Changed the name of the DNSAlias property to ReverseDNS, and reversed the
|
||||
logic, to improve readability. [msoulier 10890]
|
||||
|
||||
* Tue Jan 13 2004 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.5.0-06]
|
||||
- Added logic to key off of DNSAlias property in hosts db, so that the host
|
||||
that the PTR record is configured to for reverse DNS lookups can be
|
||||
configured, with the server itself defaulting to its proper name, via a
|
||||
migration fragment. [msoulier 10890]
|
||||
|
||||
* Tue Jan 13 2004 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.5.0-05]
|
||||
- Modified the previous fix to ensure that each IP resolves to only one
|
||||
hostname, followed by zero or more aliases. [msoulier 10890]
|
||||
|
||||
* Mon Jan 12 2004 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.5.0-04]
|
||||
- Fixed broken reverse DNS lookups for configured hosts. [msoulier 10890]
|
||||
|
||||
* Thu Aug 28 2003 Michael Soulier <msoulier@e-smith.com>
|
||||
- [0.5.0-03]
|
||||
- Added K* init symlinks for runlevels 0, 1 and 6. [msoulier 9761]
|
||||
|
||||
* Thu Aug 21 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-02]
|
||||
- Replace tinydns-conf-startup action with default db fragments.
|
||||
[charlieb 9553]
|
||||
|
||||
* Thu Aug 21 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.5.0-01]
|
||||
- Changing version to development stream number - 0.5.0
|
||||
|
||||
* Thu Jun 26 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.4.0-01]
|
||||
- Changing version to stable stream number - 0.4.0
|
||||
|
||||
* Wed Jun 25 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.5-05]
|
||||
- Various fixes to 00functions fragment of tinydns data file. Eliminate
|
||||
duplicate records for local domain. Fix non-empty output of fragment.
|
||||
Re-organise. [charlieb 9169]
|
||||
|
||||
* Wed Jun 4 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.5-04]
|
||||
- Add Requires header to ensure that %pre script can run. [charlieb 6033]
|
||||
|
||||
* Tue Jun 3 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.5-03]
|
||||
- Change %pre script which creates required userid, so that it uses
|
||||
preferred userids. [charlieb 6033]
|
||||
|
||||
* Mon Jun 2 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.5-02]
|
||||
- Remove deprecated LocalDomainPrefix handling. [charlieb 4812]
|
||||
|
||||
* Thu Apr 10 2003 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.3.5-01]
|
||||
- Clean out handling of domains now in domains db [gordonr 8097]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.3.4-15]
|
||||
- Also use plain A records for domain entries [gordonr 4058]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.3.4-14]
|
||||
- Use A, not A/PTR records for the hostname aliases [gordonr 4058]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.3.4-13]
|
||||
- Renamed conf-tinydns{,-startup} to tinydns-conf{,-startup} to match
|
||||
tinydns-restart [gordonr 4058]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.3.4-12]
|
||||
- Added use esmith::util to tinydns-restart [gordonr 4058]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.3.4-11]
|
||||
- Standardised log/run script with mailfront/qmail/etc. [gordonr 4058]
|
||||
|
||||
* Tue Dec 31 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.3.4-10]
|
||||
- Add missing pipe in genfilelist call so sticky bit preserverved
|
||||
on /var/service/tinydns [gordonr 4058]
|
||||
|
||||
* Wed Dec 4 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.4-09]
|
||||
- Add name server record for local reverse domain. [charlieb 4058]
|
||||
|
||||
* Tue Dec 3 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.4-08]
|
||||
- Add sticky bit to tinydns service directory, so that svscan starts logging.
|
||||
[charlieb 4058]
|
||||
|
||||
* Thu Nov 21 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.4-07]
|
||||
- Remove bogus reverse DNS records from tinydns/root/data template - the
|
||||
correct records are implicit in "=" records. [charlieb 4058]
|
||||
- Remove A records for generic hostnames from all except the primary domain.
|
||||
This change is provisional - we will need to discuss the implications of
|
||||
doing this. [charlieb 5805]
|
||||
|
||||
* Wed Nov 20 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.4-06]
|
||||
- Eliminate use of deprecated db_get_prop from templates for env files.
|
||||
[charlieb 4058]
|
||||
|
||||
* Wed Nov 20 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.4-05]
|
||||
- Create "down" file to prevent scsvan from starting tinydns at initial
|
||||
boot time (before it is configured), and add rc7.d symlink to bring
|
||||
it up after bootstrap console runs. [charlieb 4058]
|
||||
|
||||
* Fri Nov 15 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.4-04]
|
||||
- Change default listen address to 127.0.0.1 [charlieb 4058]
|
||||
- Hide irrelevant output in %pre script.
|
||||
|
||||
* Wed Nov 13 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.4-03]
|
||||
- Add %pre actions to create dns and dnslog users if required.
|
||||
- Move root/data templates into correct directory and change
|
||||
conf-tinydns action script accordingly.
|
||||
- Create ROOT environment file required by tinydns
|
||||
- Create /service symlink.
|
||||
- Remove requirement on e-smith-packetfilter.
|
||||
- All changes done to get into running state. [charlieb 4058]
|
||||
|
||||
* Tue Nov 12 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.4-02]
|
||||
- Add template fragments for local domain tinydns configuration (from
|
||||
Zac's e-smith-djbdns contrib). [charlieb 4058]
|
||||
- Convert all code to use current preferred APIs. [charlieb 4058]
|
||||
- Update Copyright notices in action scripts.
|
||||
- Change Copyright RPM header to License.
|
||||
- Remove masq template fragment as we now use connection tracking.
|
||||
[charlieb 4499]
|
||||
|
||||
* Tue Jul 23 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.4-01]
|
||||
- Convert packet filter fragment to iptables syntax [charlieb 1268]
|
||||
|
||||
* Thu May 23 2002 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.3.3-01]
|
||||
- RPM rebuild forced by cvsroot2rpm
|
||||
|
||||
* Mon Mar 18 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.2-01]
|
||||
- Add missing /var/service/tinydns run scripts.
|
||||
- Add /var/service/tinydns/root directory.
|
||||
|
||||
* Mon Mar 18 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.1-01]
|
||||
- Rebuild with .../env/IP and .../env/DATASIZE templates included.
|
||||
|
||||
* Wed Mar 13 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.3.0-01]
|
||||
- Don't use tinydns-conf, instead include files and templates.
|
||||
- Move config db init to conf-tinydns-startup.
|
||||
- Remove tinydns-startup script.
|
||||
- Reorganise %build to create init symlink, and to build log
|
||||
directory.
|
||||
|
||||
* Wed Mar 13 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.2.2-01]
|
||||
- Fix '' quoting of variable in restart script.
|
||||
- Remove SL specific code.
|
||||
|
||||
* Wed Mar 13 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.2.1-01]
|
||||
- Test build to verify CVS conversion.
|
||||
|
||||
* Wed Mar 13 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.2.0-01]
|
||||
- rollRPM: Rolled version number to 0.2.0-01. Includes patches up to 0.1.5-02.
|
||||
- added mkdir commands to prep section to create all required empty
|
||||
directories.
|
||||
|
||||
* Fri Oct 12 2001 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.5-02]
|
||||
- Trim changelog previous to 0.1.5-01.
|
||||
|
||||
* Fri Oct 12 2001 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.1.5-01]
|
||||
- Rolled version number to 0.1.5-01. Includes patches upto 0.1.4-05.
|
||||
|
||||
%description
|
||||
SME server enhancement to configure and run the tinydns
|
||||
components of djbdns.
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
perl createlinks
|
||||
|
||||
%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/tinydns 'attr(0755,root,root)' \
|
||||
--dir /var/service/tinydns/log 'attr(0755,root,root)' \
|
||||
--file /var/service/tinydns/run 'attr(0750,root,root)' \
|
||||
--file /var/service/tinydns/tinydns-log.pl 'attr(0750,root,root)' \
|
||||
--file /var/service/tinydns/tinydns-readstats 'attr(0750,root,root)' \
|
||||
--file /var/service/tinydns/control/1 'attr(0750,root,root)' \
|
||||
--file /var/service/tinydns/control/2 'attr(0750,root,root)' \
|
||||
--file /var/service/tinydns/log/run 'attr(0750,root,root)' \
|
||||
--dir /var/log/tinydns 'attr(02755,dnslog,dnslog)' \
|
||||
--file /var/service/dhcp-dns/dhcp-dns 'attr(0750,root,root)' \
|
||||
--file /var/service/dhcp-dns/run 'attr(0750,root,root)' \
|
||||
> %{name}-%{version}-%{release}-filelist
|
||||
echo "%doc COPYING" >> %{name}-%{version}-%{release}-filelist
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%pre
|
||||
/sbin/e-smith/create-system-user dns 53 "Name server" /var/service/tinydns /bin/false
|
||||
/sbin/e-smith/create-system-user dnslog 411 "DNS log user" /var/log /bin/false
|
||||
exit 0
|
||||
|
||||
%preun
|
||||
|
||||
%post
|
||||
|
||||
%postun
|
||||
|
||||
%files -f %{name}-%{version}-%{release}-filelist
|
||||
%defattr(-,root,root)
|
@ -0,0 +1 @@
|
||||
53
|
@ -0,0 +1 @@
|
||||
localhost
|
@ -0,0 +1 @@
|
||||
enabled
|
@ -0,0 +1 @@
|
||||
service
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
# $tinydns{ListenIP} must not be set in serveronly mode
|
||||
my $tinydns = $DB->get('tinydns');
|
||||
return unless $tinydns;
|
||||
my $mode = $DB->get_value('SystemMode');
|
||||
return unless $mode;
|
||||
if ($mode eq 'serveronly')
|
||||
{
|
||||
$tinydns->delete_prop("ListenIP");
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
{
|
||||
use esmith::ConfigDB;
|
||||
my $confdb = esmith::ConfigDB->open_ro;
|
||||
return unless $confdb;
|
||||
|
||||
my $systemname = $confdb->get_value('SystemName');
|
||||
my $domainname = $confdb->get_value('DomainName');
|
||||
return unless $systemname && $domainname; # nothing to do
|
||||
|
||||
my $fqdn = "$systemname.$domainname";
|
||||
|
||||
# Make sure that the ReverseDNS property of the proper name of the server
|
||||
# is set to "yes", unless the $LocalIP has a configured PTR record already.
|
||||
my $self_host = undef;
|
||||
foreach my $host ( $DB->get_all() )
|
||||
{
|
||||
next unless $host->prop('HostType') eq 'Self';
|
||||
if ( $host->{key} eq $fqdn )
|
||||
{
|
||||
$self_host = $host;
|
||||
}
|
||||
if ( $host->prop('ReverseDNS')
|
||||
&& ( $host->prop('ReverseDNS') eq 'yes' ) )
|
||||
{
|
||||
# It already has one configured. Nothing to do.
|
||||
return;
|
||||
}
|
||||
}
|
||||
$self_host->set_prop( 'ReverseDNS', 'yes' ) if $self_host;
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
my $datalimit = $tinydns{'DataLimit'} || "300000";
|
||||
"$datalimit";
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
$OUT = $tinydns{'ListenIP'} || "127.0.0.1";
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
{
|
||||
|
||||
use esmith::HostsDB;
|
||||
$hosts = esmith::HostsDB->open_ro;
|
||||
|
||||
use esmith::DomainsDB;
|
||||
my $ddb = esmith::DomainsDB->open_ro;
|
||||
|
||||
use esmith::util;
|
||||
|
||||
#--------------------------------------------------------
|
||||
# Returns a hash of hostnames with IP addresses as values
|
||||
#--------------------------------------------------------
|
||||
|
||||
sub get_generic_hostentries
|
||||
{
|
||||
#--------------------------------------------------
|
||||
# Compute local IP address, netmask and network values.
|
||||
#--------------------------------------------------
|
||||
|
||||
my $ipaddrBits = esmith::util::IPquadToAddr ($LocalIP);
|
||||
my $netmaskBits = esmith::util::IPquadToAddr ($LocalNetmask);
|
||||
my $networkBits = $ipaddrBits & $netmaskBits;
|
||||
|
||||
#--------------------------------------------------
|
||||
# Compute our hostid, and the highest hostid, limiting range
|
||||
# to a class B at most (so we don't get a huge output file).
|
||||
#--------------------------------------------------
|
||||
|
||||
my $myHostid = (~ $netmaskBits) & $ipaddrBits;
|
||||
|
||||
my $maxHostid = ((~ $netmaskBits) & 0xffffff) - 1;
|
||||
$maxHostid = ($maxHostid <= 65534) ? $maxHostid : 65534;
|
||||
|
||||
my %name2ip;
|
||||
#--------------------------------------------------
|
||||
# Generate A records for the entire local network
|
||||
# We can then override particular entries if we need to
|
||||
# However, multiple A records are not an issue
|
||||
# as long as there is a PTR record pointing to the correct
|
||||
# hostname
|
||||
#--------------------------------------------------
|
||||
|
||||
for ($i = 1; $i <= $maxHostid; $i++)
|
||||
{
|
||||
my $ip = esmith::util::IPaddrToQuad ($networkBits | $i);
|
||||
my $hostname = sprintf ("pc-%.5d", $i);
|
||||
|
||||
$name2ip{$hostname} = $ip;
|
||||
}
|
||||
|
||||
return %name2ip;
|
||||
}
|
||||
|
||||
#--------------------------------------------------------
|
||||
# Calculates an array of domains that require DNS
|
||||
#--------------------------------------------------------
|
||||
@domains = map { $_->key } $ddb->get_all_by_prop('type' => 'domain');
|
||||
|
||||
#--------------------------------------------------------
|
||||
# Returns an array of domains that require DNS
|
||||
#--------------------------------------------------------
|
||||
sub get_domains { return @domains; }
|
||||
|
||||
sub get_local_domainname { return $DomainName; }
|
||||
|
||||
|
||||
#--------------------------------------------------------
|
||||
# Returns the IP Address of the host in question.
|
||||
#--------------------------------------------------------
|
||||
sub host2ip
|
||||
{
|
||||
my $host = shift;
|
||||
my $ip = undef;
|
||||
die "Host record must have HostType prop!"
|
||||
unless my $hosttype = $host->prop('HostType');
|
||||
|
||||
if ($hosttype eq 'Self')
|
||||
{
|
||||
$ip = $LocalIP;
|
||||
}
|
||||
$ip ||= $host->prop('ExternalIP') || $host->prop('InternalIP');
|
||||
return $ip;
|
||||
}
|
||||
|
||||
#--------------------------------------------------------
|
||||
# Returns a hash of IPs to hostnames, representing the
|
||||
# chosen hostnames for reverse dns lookups for each IP.
|
||||
#--------------------------------------------------------
|
||||
sub get_reverse_lookup_choices
|
||||
{
|
||||
my %reverse_lookups = ();
|
||||
foreach my $host ($hosts->hosts())
|
||||
{
|
||||
# A remote host must be a DNS alias.
|
||||
next if $host->prop('HostType') eq 'Remote';
|
||||
|
||||
my $alias = $host->prop('ReverseDNS') || "no";
|
||||
if ($alias eq "yes")
|
||||
{
|
||||
# This host is not a DNS alias, so we should make note of it
|
||||
# for reverse DNS lookup purposes.
|
||||
my $ip = host2ip($host);
|
||||
$reverse_lookups{$ip} = $host->{key};
|
||||
# Note: Here we clobber any existing key/value pair, so if
|
||||
# there is more than one host with the same ip flagged as
|
||||
# being the reversedns host, the last one entered in this hash
|
||||
# will win. Don't do that. ;-)
|
||||
}
|
||||
}
|
||||
return %reverse_lookups;
|
||||
}
|
||||
|
||||
$OUT = '';
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
$OUT .= "# NS Records\n";
|
||||
foreach my $domain (get_domains())
|
||||
{
|
||||
$OUT .= ".$domain:\:$SystemName." . get_local_domainname(). "\n";
|
||||
}
|
||||
|
||||
use esmith::util;
|
||||
# Add name server record for local reverse zone
|
||||
my $reverse =
|
||||
esmith::util::computeLocalNetworkReversed ($LocalIP, $LocalNetmask);
|
||||
$reverse =~ s/\.$//;
|
||||
$OUT .= ".$reverse\:\:127.0.0.1\n";
|
||||
$reverse =
|
||||
esmith::util::computeLocalNetworkReversed ('127.0.0.1', '255.255.255.0');
|
||||
$reverse =~ s/\.$//;
|
||||
$OUT .= ".$reverse\:\:127.0.0.1\n";
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
$OUT .= "# MX Records\n";
|
||||
foreach my $domain (get_domains())
|
||||
{
|
||||
$OUT .= "\@$domain:\:$SystemName." . get_local_domainname(). "\n";
|
||||
}
|
||||
$OUT .= "\n";
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
$OUT .= "# A Records for domains\n";
|
||||
foreach my $domain (get_domains())
|
||||
{
|
||||
$OUT .= "+$domain:$LocalIP\n";
|
||||
}
|
||||
$OUT .= "\n";
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
{
|
||||
%allocated_ips = ();
|
||||
foreach my $domain (get_domains())
|
||||
{
|
||||
|
||||
$OUT .= "# A Records for Hosts in $domain\n";
|
||||
foreach my $h ($hosts->get_hosts_by_domain($domain))
|
||||
{
|
||||
my $anIP = host2ip($h);
|
||||
|
||||
my $prefixchar = '+';
|
||||
if ($anIP !~ /^\d+\.\d+\.\d+\.\d+$/)
|
||||
{
|
||||
$prefixchar = 'C';
|
||||
}
|
||||
else
|
||||
{
|
||||
my %reverse_lookups = get_reverse_lookup_choices();
|
||||
# If this IP is spoken for, then we know which host to use for the
|
||||
# reverse DNS lookup PTR.
|
||||
if (exists $reverse_lookups{$anIP})
|
||||
{
|
||||
my $reverse_host = $reverse_lookups{$anIP};
|
||||
if ($reverse_host eq $h->key)
|
||||
{
|
||||
$prefixchar = '=';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# Otherwise, we'll just use the first host that comes along.
|
||||
# Have we picked one already?
|
||||
unless (exists $allocated_ips{$anIP})
|
||||
{
|
||||
$prefixchar = '=';
|
||||
}
|
||||
}
|
||||
# Note that this ip is taken.
|
||||
$allocated_ips{$anIP} = 1;
|
||||
|
||||
}
|
||||
$OUT .= $prefixchar . $h->key . ":$anIP\n";
|
||||
}
|
||||
$OUT .= "\n";
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
my %name2ip = get_generic_hostentries();
|
||||
|
||||
my $domain = $DomainName;
|
||||
|
||||
$OUT .= "# Generic A Records for $domain\n";
|
||||
foreach (sort keys %name2ip)
|
||||
{
|
||||
$prefixchar = '=';
|
||||
$prefixchar = '+' if exists $allocated_ips{$name2ip{$_}};
|
||||
$OUT .= $prefixchar . "$_.$domain" . ":" . $name2ip{$_} . "\n";
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
/var/service/tinydns
|
@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=tinydns,
|
||||
After=network.target
|
||||
Requires=runit.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStartPre=/sbin/e-smith/service-status tinydns
|
||||
ExecStart=/usr/bin/sv u /service/tinydns
|
||||
ExecStop=/usr/bin/sv stop /service/tinydns
|
||||
ExecReload=/usr/bin/sv t /service/tinydns
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
@ -0,0 +1,4 @@
|
||||
#! /bin/sh
|
||||
|
||||
/sbin/e-smith/expand-template /var/service/tinydns/root/data
|
||||
cd "/var/service/tinydns/root" && /usr/local/bin/tinydns-data
|
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 2002-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.
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
package esmith;
|
||||
|
||||
use strict;
|
||||
use Errno;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::util;
|
||||
use esmith::templates;
|
||||
|
||||
my $conf = esmith::ConfigDB->open;
|
||||
#--------------------------------------------------------------
|
||||
# If tinydns is running on the external interface IP,
|
||||
# then update the ListenIP property, expand the IP
|
||||
# config file, and restart the process.
|
||||
#--------------------------------------------------------------
|
||||
|
||||
my $tinydns = $conf->get('tinydns')
|
||||
or die("No tinydns entry in config db\n");
|
||||
my $listen_ip = $tinydns->prop("ListenIP");
|
||||
exit 0 unless defined $listen_ip;
|
||||
|
||||
my $external_ip = $conf->get('ExternalIP')
|
||||
or die("No ExternalIP entry in config db\n");
|
||||
$external_ip = $external_ip->value;
|
||||
exit 0 if ($external_ip eq $listen_ip);
|
||||
|
||||
$tinydns->merge_props('ListenIP' => $external_ip);
|
||||
|
||||
esmith::templates::processTemplate ({
|
||||
TEMPLATE_PATH => "/var/service/tinydns/env/IP",
|
||||
PERMS => 0644,
|
||||
});
|
||||
|
||||
exec "sv", "t", "/service/tinydns" or
|
||||
die "Could not exec sv: $!";
|
@ -0,0 +1 @@
|
||||
/var/service/tinydns/root
|
@ -0,0 +1,27 @@
|
||||
#!/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/tinydns
|
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
exec 2>&1
|
||||
./control/1
|
||||
exec envdir ./env sh -c '
|
||||
exec envuidgid dns \
|
||||
softlimit -d "$DATALIMIT" \
|
||||
/usr/local/bin/tinydns
|
||||
'
|
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/perl -p
|
||||
|
||||
# tinydns log formatting utility
|
||||
# based on Faried Nawaz's logfile formatter for dnscache
|
||||
# by Kenji Rikitake <kenji.rikitake@acm.org> 29-JUL-2000
|
||||
# please put this on dnscache.com ftp site.
|
||||
|
||||
# convert addresses in hex to dotted decimal notation.
|
||||
s/\b([a-f0-9]{8})\b/join(".", unpack("C*", pack("H8", $1)))/eg;
|
||||
|
||||
### clean up some messages
|
||||
# convert stuff like 127.0.0.2:0422:05be to something more descriptive.
|
||||
# query tai64n host:port:qid flag qtype thing
|
||||
# keep tai64n header as is - use tai64nlocal to convert it to TAI
|
||||
|
||||
s/^(@[a-f0-9]+) \b([\d.]+):(\w+):(\w+) ([\+\-\I\/]) \b([a-f0-9]+) \b([-.\w]+)/$1." ".printQueryLine($2,$3,$4,$5,$6,$7)/e;
|
||||
|
||||
### subs
|
||||
|
||||
sub printQueryLine {
|
||||
my ($host, $port, $query_id, $flag, $query_type, $query) = @_;
|
||||
|
||||
# pad hostname
|
||||
|
||||
my $ret = "$host:";
|
||||
$ret .= hex($port);
|
||||
$ret .= ":" . hex($query_id);
|
||||
$ret .= " " . $flag;
|
||||
$ret .= " " . queryType(hex($query_type)) . " $query";
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -0,0 +1,319 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# $Id: tinydns-readstats.txt,v 1.9 2005/02/01 14:40:22 nate Exp $
|
||||
#
|
||||
# Formatting functionality adapted from:
|
||||
# tinydns log formatting utility
|
||||
# based on Faried Nawaz's logfile formatter for dnscache
|
||||
# by Kenji Rikitake <kenji.rikitake@acm.org> 29-JUL-2000
|
||||
#
|
||||
# The idea of opening up multilog for writing and sending
|
||||
# log output to it was taken from tinydns-rrd by Ask Bjørn
|
||||
# Hansen, along with a code snippit or two.
|
||||
#
|
||||
# What's left was written by me, Nate Campi <nate@campin.net>
|
||||
##################################################################
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# If you have a high traffic tinydns server leave out the --log
|
||||
# option and pipe to multilog in order to minimize I/O. This is
|
||||
# an example daemontools log run file (e.g. /service/tinydns/log/run):
|
||||
#
|
||||
# #!/bin/sh
|
||||
# exec setuidgid dnslog tinydns-readstats.pl
|
||||
#
|
||||
# If you want pretty logs sent to multilog use the option --logpretty.
|
||||
# To run multilog you need a log run script something like this:
|
||||
#
|
||||
# #!/bin/sh
|
||||
# exec setuidgid dnslog tinydns-readstats.pl --logpretty -- multilog t ./main
|
||||
#
|
||||
# If you simply want to use this script to prettify your logs, use the
|
||||
# --nostats option in your log/run script:
|
||||
#
|
||||
# #!/bin/sh
|
||||
# exec setuidgid dnslog tinydns-readstats.pl --nostats --logpretty -- multilog t ./main
|
||||
#
|
||||
# You can use this with dnscache now as well,just add the --dnscache
|
||||
# option (/service/dnscache/log/run):
|
||||
#
|
||||
# #!/bin/sh
|
||||
# exec setuidgid dnslog tinydns-readstats.pl --dnscache --log -- multilog t ./main
|
||||
#
|
||||
##################################################################
|
||||
#
|
||||
# To query these stats over SNMP use these lines in net-snmp snmpd.conf:
|
||||
#
|
||||
# exec VALUES /bin/echo A PTR ANY MX NS CNAME SOA SRV AAAA TOTAL
|
||||
# exec bindstats /bin/cat /home/zoneaxfr/stats/stats_file
|
||||
#
|
||||
# See http://www.campin.net/DNS/graph.html for the rest of what you need to
|
||||
# graph the stats.
|
||||
#
|
||||
##################################################################
|
||||
#
|
||||
# Hmm, each time I implemented this on a box, the stats file was already
|
||||
# in place and valid from a prototype version of these scripts. I totally
|
||||
# spaced on whether it did the right thing when no file existed, the
|
||||
# script should take some care to make sure things are in order.
|
||||
#
|
||||
# Make sure the file is there, readable, and has some valid values in
|
||||
# it by running UNIX commands like this:
|
||||
#
|
||||
# $ mkdir -p /home/zoneaxfr/stats
|
||||
# $ echo 0 0 0 0 0 0 0 0 0 0 > /home/zoneaxfr/stats/stats_file
|
||||
# $ chown -R dnslog /home/zoneaxfr/stats
|
||||
#
|
||||
# Just be sure that if your logging account isn't named "dnslog" that
|
||||
# you substitute the correct username in the chown command ("Gdnslog"
|
||||
# perhaps).
|
||||
#
|
||||
##################################################################
|
||||
|
||||
use Getopt::Long;
|
||||
use Fcntl qw(:DEFAULT :flock);
|
||||
use strict;
|
||||
|
||||
my $stats_file = "/home/zoneaxfr/stats/stats_file";
|
||||
my $stats_file_temp = "/home/zoneaxfr/stats/stats_file.temp";
|
||||
my $stats_flush_interval = 60; # between 60 and 300 seconds is probably best
|
||||
my $time = time();
|
||||
my $stats_flush_time = ( $time + $stats_flush_interval );
|
||||
|
||||
# Scott Middlebrooks <scott DOT middlebrooks AT harrynorman DOT com> had
|
||||
# a problem with zombies, contributed the following to reap them
|
||||
$SIG{CHLD} = \&REAPER;
|
||||
sub REAPER {
|
||||
my $waitedpid;
|
||||
while (($waitedpid = waitpid(-1, &WNOHANG)) > 0) {
|
||||
}
|
||||
$SIG{CHLD} = \&REAPER;
|
||||
}
|
||||
|
||||
my ( $total, $srv, $any, $a, $ns,
|
||||
$cname, $soa, $aaaa, $mx, $ptr,
|
||||
$other, @line,
|
||||
|
||||
$oldtotal, $oldsrv, $oldany, $olda, $oldns,
|
||||
$oldcname, $oldsoa, $oldaaaa, $oldmx, $oldptr,
|
||||
|
||||
$total_a, $total_any, $total_srv, $total_total,
|
||||
$total_ns, $total_soa, $total_cname, $total_aaaa,
|
||||
$total_mx, $total_ptr,
|
||||
) = 0;
|
||||
|
||||
my (
|
||||
$DEBUG, $query_types, %opts, $pid, $i, @stats, $dnscache,
|
||||
);
|
||||
|
||||
|
||||
%opts = ('log' => 0,
|
||||
'logpretty' => 0,
|
||||
'nostats' => 0,
|
||||
'dnscache' => $dnscache,
|
||||
'debug' => $DEBUG,
|
||||
);
|
||||
|
||||
GetOptions (\%opts,
|
||||
'log!',
|
||||
'nostats!',
|
||||
'dnscache!',
|
||||
'logpretty!',
|
||||
'debug!',
|
||||
)
|
||||
or exit 2;
|
||||
|
||||
$DEBUG = $opts{debug};
|
||||
$dnscache = $opts{dnscache};
|
||||
|
||||
die "Can't use both --log and --logpretty at once\n" if $opts{log} and $opts{logpretty};
|
||||
|
||||
if ( $opts{log} || $opts{logpretty} ) { # pipe to multilog
|
||||
|
||||
$| = 1;
|
||||
my $command = join " ", @ARGV;
|
||||
open (MULTI, "|$command") or die "Could not open $command: $!";
|
||||
|
||||
my $oldfh = select MULTI;
|
||||
$| = 1;
|
||||
select $oldfh;
|
||||
}
|
||||
|
||||
while (<STDIN>) {
|
||||
|
||||
$time = time();
|
||||
|
||||
# increment the running total - unless it is a "starting tinydns" line,
|
||||
# I don't know of any other non-query lines, let me know if there are any
|
||||
if ($dnscache) {
|
||||
$total++ if /^query/ ;
|
||||
} else { # then we're running tinydns
|
||||
$total++ unless /starting tinydns/ ;
|
||||
}
|
||||
|
||||
print "INPUT before transformation is $_\n" if $DEBUG;
|
||||
|
||||
print MULTI "$_" if $opts{log}; # output for multilog's pleasure
|
||||
|
||||
unless ($dnscache) {
|
||||
|
||||
# convert addresses in hex to dotted decimal notation.
|
||||
s/\b([a-f0-9]{8})\b/join(".", unpack("C*", pack("H8", $1)))/eg;
|
||||
|
||||
# clean up the rest
|
||||
s/^([\d.]+):(\w+):(\w+) ([\+\-\/]) \b([a-f0-9]+) \b([-.\w]+)/printQueryLine($1,$2,$3,$4,$5,$6)/e;
|
||||
|
||||
print "INPUT after transformation is $_\n" if $DEBUG;
|
||||
|
||||
print MULTI "$_" if $opts{logpretty}; # output in pretty format for multilog's pleasure
|
||||
|
||||
@line = split(/\s+/); # split it for easy parsing
|
||||
|
||||
SWITCH: {
|
||||
if ( $line[2] eq "soa" ) { $soa++; last SWITCH; }
|
||||
if ( $line[2] eq "ptr" ) { $ptr++; last SWITCH; }
|
||||
if ( $line[2] eq "mx" ) { $mx++; last SWITCH; }
|
||||
if ( $line[2] eq "a" ) { $a++; last SWITCH; }
|
||||
if ( $line[2] eq "srv" ) { $srv++; last SWITCH; }
|
||||
if ( $line[2] eq "ns" ) { $ns++; last SWITCH; }
|
||||
if ( $line[2] eq "cname" ) { $cname++; last SWITCH; }
|
||||
if ( $line[2] eq "any" ) { $any++; last SWITCH; }
|
||||
if ( $line[2] eq "aaaa" ) { $aaaa++; last SWITCH; }
|
||||
$other++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !($opts{nostats}) && ($time >= $stats_flush_time) ) { #flush the stats with a child proc
|
||||
|
||||
$stats_flush_time += $stats_flush_interval; # set the time to flush stats again
|
||||
|
||||
$pid = fork();
|
||||
die "Cannot fork: $!" unless defined($pid);
|
||||
if ($pid == 0) {
|
||||
# Child process
|
||||
updateStats();
|
||||
exit(0); # Child process exits when it is done.
|
||||
}
|
||||
|
||||
# clear out the stats now that we've flushed them to disk
|
||||
|
||||
( $total, $srv, $any, $a, $ns,
|
||||
$cname, $soa, $aaaa, $mx, $ptr,
|
||||
$other, @line, ) = 0;
|
||||
|
||||
|
||||
} # else 'tis the parent process, which goes back to processing logs
|
||||
|
||||
}
|
||||
|
||||
|
||||
### subs
|
||||
|
||||
sub printQueryLine {
|
||||
my ($host, $port, $query_id, $flag, $query_type, $query) = @_;
|
||||
|
||||
# pad hostname
|
||||
|
||||
my $ret = "$host:";
|
||||
$ret .= hex($port);
|
||||
$ret .= ":" . hex($query_id);
|
||||
$ret .= " " . $flag;
|
||||
$ret .= " " . queryType(hex($query_type)) . " $query";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
sub updateStats {
|
||||
|
||||
sysopen(STATS_FILE,"$stats_file", O_RDWR|O_CREAT) ||
|
||||
die "Sorry, I couldn't open $stats_file for writing: $!\n";
|
||||
|
||||
flock(STATS_FILE, LOCK_EX)
|
||||
or die "Can't write-lock $stats_file: $!\n";
|
||||
|
||||
sysopen(STATS_FILE_TEMP,"$stats_file_temp", O_RDWR|O_CREAT) ||
|
||||
die "Sorry, I couldn't open $stats_file_temp for writing: $!\n";
|
||||
|
||||
flock(STATS_FILE_TEMP, LOCK_EX)
|
||||
or die "Can't write-lock $stats_file_temp: $!\n";
|
||||
|
||||
while (<STATS_FILE>) {
|
||||
chomp;
|
||||
@stats = split(/\s+/); # split it for easy parsing
|
||||
|
||||
$olda = $stats[0];
|
||||
$oldptr = $stats[1];
|
||||
$oldany = $stats[2];
|
||||
$oldmx = $stats[3];
|
||||
$oldns = $stats[4];
|
||||
$oldcname = $stats[5];
|
||||
$oldsoa = $stats[6];
|
||||
$oldsrv = $stats[7];
|
||||
$oldaaaa = $stats[8];
|
||||
$oldtotal = $stats[9];
|
||||
}
|
||||
|
||||
print "oldA oldPTR oldANY oldMX oldNS oldCNAME oldSOA oldSRV oldAAAA oldTOTAL\n" if $DEBUG;
|
||||
print "$olda $oldptr $oldany $oldmx $oldns $oldcname $oldsoa $oldsrv $oldaaaa $oldtotal\n" if $DEBUG;
|
||||
|
||||
print "A PTR ANY MX NS CNAME SOA SRV AAAA TOTAL\n" if $DEBUG;
|
||||
print "$a $ptr $any $mx $ns $cname $soa $srv $aaaa $total\n" if $DEBUG;
|
||||
|
||||
$total_a = ( $olda + $a );
|
||||
$total_ptr = ( $oldptr + $ptr );
|
||||
$total_any = ( $oldany + $any );
|
||||
$total_any = ( $oldany + $any );
|
||||
$total_mx = ( $oldmx + $mx );
|
||||
$total_ns = ( $oldns + $ns );
|
||||
$total_cname = ( $oldcname + $cname );
|
||||
$total_soa = ( $oldsoa + $soa );
|
||||
$total_srv = ( $oldsrv + $srv );
|
||||
$total_aaaa = ( $oldaaaa + $aaaa );
|
||||
$total_total = ( $oldtotal + $total );
|
||||
|
||||
# be careful and truncate it
|
||||
seek(STATS_FILE_TEMP, 0, 0) or die "can't rewind numfile : $!";
|
||||
truncate(STATS_FILE_TEMP, 0) or die "can't truncate $stats_file: $!";
|
||||
|
||||
print STATS_FILE_TEMP "$total_a $total_ptr $total_any $total_mx $total_ns $total_cname $total_soa $total_srv $total_aaaa $total_total\n";
|
||||
|
||||
rename("$stats_file_temp","$stats_file") || die "Can't rename $stats_file_temp to $stats_file: $!";
|
||||
|
||||
close(STATS_FILE);
|
||||
close(STATS_FILE_TEMP);
|
||||
|
||||
print "$total_a $total_ptr $total_any $total_mx $total_ns $total_cname $total_soa $total_srv $total_aaaa $total_total\n" if $DEBUG;
|
||||
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue