diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e594810 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.rpm +*.log +*spec-20* +*.tar.xz diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a7333a5 --- /dev/null +++ b/Makefile @@ -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) diff --git a/README.md b/README.md index b932f31..ddcaed3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ -# e-smith-tinydns +# e-smith-tinydns -SMEServer Koozali developed git repo for e-smith-tinydns smeserver \ No newline at end of file +SMEServer Koozali developed git repo for e-smith-tinydns smeserver + +## Wiki +
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 + +
*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* +
+ +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. diff --git a/additional/COPYING b/additional/COPYING new file mode 100644 index 0000000..eeb586b --- /dev/null +++ b/additional/COPYING @@ -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. + + + Copyright (C) 19yy + + 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. + + , 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. diff --git a/contriborbase b/contriborbase new file mode 100644 index 0000000..ef36a67 --- /dev/null +++ b/contriborbase @@ -0,0 +1 @@ +sme10 diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..e421081 --- /dev/null +++ b/createlinks @@ -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"); + diff --git a/e-smith-tinydns.spec b/e-smith-tinydns.spec new file mode 100644 index 0000000..50096fe --- /dev/null +++ b/e-smith-tinydns.spec @@ -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 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 2.6.0-9.sme +- cleanup in /etc/rc.d [SME: 9692] + +* Fri Feb 12 2021 Jean-Philipe Pialasse 2.6.0-8.sme +- remove /usr/lib/systemd/system-preset/80-koozali-tinydns.preset [SME: 10958] + +* Thu Dec 10 2020 Jean-Philipe Pialasse 2.6.0-7.sme +- Add 'Requires=runit.service' [SME: 11245] + +* Thu Dec 03 2020 Jean-Philipe Pialasse 2.6.0-6.sme +- remove S95reset-unsavedflag [SME: 11229] + +* Thu Dec 03 2020 Jean-Philipe Pialasse 2.6.0-5.sme +- execute systemd-reload before service adjust in events [SME: 11228] + +* Mon Nov 30 2020 John Crisp 2.6.0-4.sme +- remove createlink safesymlink in /etc/rc.d/init.d [SME: 11098] + +* Thu Nov 19 2020 Michel Begue 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 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 2.6.0-1.sme +- Initial release to sme10 + +* Sat Jan 24 2015 stephane de labrusse 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 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 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 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 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 2.4.0-1.sme +- Roll new stream for sme9 + +* Thu Jul 29 2010 Filippo Carletti 2.2.0-2.sme +- Allow use of CNAME in remote hosts [SME: 3132] + +* Tue Oct 7 2008 Shad L. Lords 2.2.0-1.sme +- Roll new stream to separate sme7/sme8 trees [SME: 4633] + +* Sun Apr 29 2007 Shad L. Lords +- Clean up spec so package can be built by koji/plague + +* Fri Feb 16 2007 Shad L. Lords 1.0.0-7 +- Change runsvctrl to sv to support runit v1.7.x [SME: 1179] + +* Fri Jan 19 2007 Shad L. Lords 1.0.0-6 +- Fix last patch to remove warnings. + +* Sun Jan 14 2007 Shad L. Lords 1.0.0-5 +- Make us authoritative for 127.0.0.x [SME: 2223] + +* Thu Dec 07 2006 Shad L. Lords +- Update to new release naming. No functional changes. +- Make Packager generic + +* Thu Sep 14 2006 Charlie Brady 1.0.0-03 +- Ensure that ListenIP property is clear in serveronly mode. [SME: 1912] + +* Sun Jul 16 2006 Charlie Brady 1.0.0-02 +- Make dnslog user creation consistent with e-smith-dnscache. [SME: 1688] + +* Fri Mar 17 2006 Gordon Rowell 1.0.0-01 +- Bump stable stream number to 1.0.0 [SME: 1016] + +* Tue Mar 14 2006 Charlie Brady 0.6.0-01 +- Roll stable stream version. [SME: 1016] + +* Wed Nov 30 2005 Gordon Rowell 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 0.5.0-20 +- Bump release number only + +* Wed Aug 17 2005 Charlie Brady +- [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 +- [0.5.0-18] +- Add defaults vals for UDPPort and access. [SF: 1246986] + +* Mon Jun 6 2005 Charlie Brady +- [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 +- [0.5.0-16] +- Add tinydns log file parser program (from + http://tinydns.org/tinydns-log.pl.txt). + +* Wed Apr 13 2005 Charlie Brady +- [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 +- [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 +- [0.5.0-13] +- Remove unnecessary warning from 20tinydns fragment. + [MN00035059] + +* Thu Mar 10 2005 Charlie Brady +- [0.5.0-12] +- Always create generic hosts for internal IPs + +* Thu Jan 20 2005 Charlie Brady +- [0.5.0-11] +- Still another couple of fixes required to 20tinydns fragment. + [charlieb MN00035059] + +* Wed Jan 5 2005 Charlie Brady +- [0.5.0-10] +- Further fix and more simplification to 20tinydns fragment. + [charlieb MN00035059] + +* Mon May 31 2004 Michael Soulier +- [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 +- [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 +- [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 +- [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 +- [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 +- [0.5.0-04] +- Fixed broken reverse DNS lookups for configured hosts. [msoulier 10890] + +* Thu Aug 28 2003 Michael Soulier +- [0.5.0-03] +- Added K* init symlinks for runlevels 0, 1 and 6. [msoulier 9761] + +* Thu Aug 21 2003 Charlie Brady +- [0.5.0-02] +- Replace tinydns-conf-startup action with default db fragments. + [charlieb 9553] + +* Thu Aug 21 2003 Charlie Brady +- [0.5.0-01] +- Changing version to development stream number - 0.5.0 + +* Thu Jun 26 2003 Charlie Brady +- [0.4.0-01] +- Changing version to stable stream number - 0.4.0 + +* Wed Jun 25 2003 Charlie Brady +- [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 +- [0.3.5-04] +- Add Requires header to ensure that %pre script can run. [charlieb 6033] + +* Tue Jun 3 2003 Charlie Brady +- [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 +- [0.3.5-02] +- Remove deprecated LocalDomainPrefix handling. [charlieb 4812] + +* Thu Apr 10 2003 Gordon Rowell +- [0.3.5-01] +- Clean out handling of domains now in domains db [gordonr 8097] + +* Tue Dec 31 2002 Gordon Rowell +- [0.3.4-15] +- Also use plain A records for domain entries [gordonr 4058] + +* Tue Dec 31 2002 Gordon Rowell +- [0.3.4-14] +- Use A, not A/PTR records for the hostname aliases [gordonr 4058] + +* Tue Dec 31 2002 Gordon Rowell +- [0.3.4-13] +- Renamed conf-tinydns{,-startup} to tinydns-conf{,-startup} to match + tinydns-restart [gordonr 4058] + +* Tue Dec 31 2002 Gordon Rowell +- [0.3.4-12] +- Added use esmith::util to tinydns-restart [gordonr 4058] + +* Tue Dec 31 2002 Gordon Rowell +- [0.3.4-11] +- Standardised log/run script with mailfront/qmail/etc. [gordonr 4058] + +* Tue Dec 31 2002 Gordon Rowell +- [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 +- [0.3.4-09] +- Add name server record for local reverse domain. [charlieb 4058] + +* Tue Dec 3 2002 Charlie Brady +- [0.3.4-08] +- Add sticky bit to tinydns service directory, so that svscan starts logging. + [charlieb 4058] + +* Thu Nov 21 2002 Charlie Brady +- [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 +- [0.3.4-06] +- Eliminate use of deprecated db_get_prop from templates for env files. + [charlieb 4058] + +* Wed Nov 20 2002 Charlie Brady +- [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 +- [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 +- [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 +- [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 +- [0.3.4-01] +- Convert packet filter fragment to iptables syntax [charlieb 1268] + +* Thu May 23 2002 Gordon Rowell +- [0.3.3-01] +- RPM rebuild forced by cvsroot2rpm + +* Mon Mar 18 2002 Charlie Brady +- [0.3.2-01] +- Add missing /var/service/tinydns run scripts. +- Add /var/service/tinydns/root directory. + +* Mon Mar 18 2002 Charlie Brady +- [0.3.1-01] +- Rebuild with .../env/IP and .../env/DATASIZE templates included. + +* Wed Mar 13 2002 Charlie Brady +- [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 +- [0.2.2-01] +- Fix '' quoting of variable in restart script. +- Remove SL specific code. + +* Wed Mar 13 2002 Charlie Brady +- [0.2.1-01] +- Test build to verify CVS conversion. + +* Wed Mar 13 2002 Charlie Brady +- [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 +- [0.1.5-02] +- Trim changelog previous to 0.1.5-01. + +* Fri Oct 12 2001 Charlie Brady +- [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) diff --git a/root/etc/e-smith/db/configuration/defaults/tinydns/UDPPorts b/root/etc/e-smith/db/configuration/defaults/tinydns/UDPPorts new file mode 100644 index 0000000..59343b0 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/tinydns/UDPPorts @@ -0,0 +1 @@ +53 diff --git a/root/etc/e-smith/db/configuration/defaults/tinydns/access b/root/etc/e-smith/db/configuration/defaults/tinydns/access new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/tinydns/access @@ -0,0 +1 @@ +localhost diff --git a/root/etc/e-smith/db/configuration/defaults/tinydns/status b/root/etc/e-smith/db/configuration/defaults/tinydns/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/tinydns/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/tinydns/type b/root/etc/e-smith/db/configuration/defaults/tinydns/type new file mode 100644 index 0000000..24e1098 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/tinydns/type @@ -0,0 +1 @@ +service diff --git a/root/etc/e-smith/db/configuration/migrate/tinydns_ListenIP b/root/etc/e-smith/db/configuration/migrate/tinydns_ListenIP new file mode 100644 index 0000000..35933c3 --- /dev/null +++ b/root/etc/e-smith/db/configuration/migrate/tinydns_ListenIP @@ -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"); + } +} diff --git a/root/etc/e-smith/db/hosts/migrate/20tinydns b/root/etc/e-smith/db/hosts/migrate/20tinydns new file mode 100644 index 0000000..0f0032a --- /dev/null +++ b/root/etc/e-smith/db/hosts/migrate/20tinydns @@ -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; +} diff --git a/root/etc/e-smith/events/bootstrap-console-save/.gitignore b/root/etc/e-smith/events/bootstrap-console-save/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/e-smith/events/post-install/.gitignore b/root/etc/e-smith/events/post-install/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/e-smith/events/post-upgrade/.gitignore b/root/etc/e-smith/events/post-upgrade/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/e-smith/templates/var/service/tinydns/env/DATALIMIT b/root/etc/e-smith/templates/var/service/tinydns/env/DATALIMIT new file mode 100644 index 0000000..832919b --- /dev/null +++ b/root/etc/e-smith/templates/var/service/tinydns/env/DATALIMIT @@ -0,0 +1,4 @@ +{ + my $datalimit = $tinydns{'DataLimit'} || "300000"; + "$datalimit"; +} diff --git a/root/etc/e-smith/templates/var/service/tinydns/env/IP b/root/etc/e-smith/templates/var/service/tinydns/env/IP new file mode 100644 index 0000000..a96eea0 --- /dev/null +++ b/root/etc/e-smith/templates/var/service/tinydns/env/IP @@ -0,0 +1,3 @@ +{ + $OUT = $tinydns{'ListenIP'} || "127.0.0.1"; +} diff --git a/root/etc/e-smith/templates/var/service/tinydns/root/data/00functions b/root/etc/e-smith/templates/var/service/tinydns/root/data/00functions new file mode 100644 index 0000000..f465c5d --- /dev/null +++ b/root/etc/e-smith/templates/var/service/tinydns/root/data/00functions @@ -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 = ''; +} diff --git a/root/etc/e-smith/templates/var/service/tinydns/root/data/30nameServers b/root/etc/e-smith/templates/var/service/tinydns/root/data/30nameServers new file mode 100644 index 0000000..d04fcff --- /dev/null +++ b/root/etc/e-smith/templates/var/service/tinydns/root/data/30nameServers @@ -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"; +} diff --git a/root/etc/e-smith/templates/var/service/tinydns/root/data/40mxRecords b/root/etc/e-smith/templates/var/service/tinydns/root/data/40mxRecords new file mode 100644 index 0000000..b4c15d2 --- /dev/null +++ b/root/etc/e-smith/templates/var/service/tinydns/root/data/40mxRecords @@ -0,0 +1,8 @@ +{ + $OUT .= "# MX Records\n"; + foreach my $domain (get_domains()) + { + $OUT .= "\@$domain:\:$SystemName." . get_local_domainname(). "\n"; + } + $OUT .= "\n"; +} diff --git a/root/etc/e-smith/templates/var/service/tinydns/root/data/50domainARecords b/root/etc/e-smith/templates/var/service/tinydns/root/data/50domainARecords new file mode 100644 index 0000000..4acfa16 --- /dev/null +++ b/root/etc/e-smith/templates/var/service/tinydns/root/data/50domainARecords @@ -0,0 +1,8 @@ +{ + $OUT .= "# A Records for domains\n"; + foreach my $domain (get_domains()) + { + $OUT .= "+$domain:$LocalIP\n"; + } + $OUT .= "\n"; +} diff --git a/root/etc/e-smith/templates/var/service/tinydns/root/data/60hostARecords b/root/etc/e-smith/templates/var/service/tinydns/root/data/60hostARecords new file mode 100644 index 0000000..8a4e8cd --- /dev/null +++ b/root/etc/e-smith/templates/var/service/tinydns/root/data/60hostARecords @@ -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"; + } +} diff --git a/root/etc/e-smith/templates/var/service/tinydns/root/data/70genericHostARecords b/root/etc/e-smith/templates/var/service/tinydns/root/data/70genericHostARecords new file mode 100644 index 0000000..f0e5930 --- /dev/null +++ b/root/etc/e-smith/templates/var/service/tinydns/root/data/70genericHostARecords @@ -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"; + } +} diff --git a/root/service/tinydns b/root/service/tinydns new file mode 120000 index 0000000..76d9f31 --- /dev/null +++ b/root/service/tinydns @@ -0,0 +1 @@ +/var/service/tinydns \ No newline at end of file diff --git a/root/usr/lib/systemd/system/tinydns.service b/root/usr/lib/systemd/system/tinydns.service new file mode 100644 index 0000000..c80b486 --- /dev/null +++ b/root/usr/lib/systemd/system/tinydns.service @@ -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 diff --git a/root/var/log/tinydns/.gitignore b/root/var/log/tinydns/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/root/var/service/tinydns/control/1 b/root/var/service/tinydns/control/1 new file mode 100644 index 0000000..8eaaf47 --- /dev/null +++ b/root/var/service/tinydns/control/1 @@ -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 diff --git a/root/var/service/tinydns/control/2 b/root/var/service/tinydns/control/2 new file mode 100644 index 0000000..6b56f93 --- /dev/null +++ b/root/var/service/tinydns/control/2 @@ -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: $!"; diff --git a/root/var/service/tinydns/down b/root/var/service/tinydns/down new file mode 100644 index 0000000..e69de29 diff --git a/root/var/service/tinydns/env/ROOT b/root/var/service/tinydns/env/ROOT new file mode 100644 index 0000000..0393eeb --- /dev/null +++ b/root/var/service/tinydns/env/ROOT @@ -0,0 +1 @@ +/var/service/tinydns/root diff --git a/root/var/service/tinydns/log/run b/root/var/service/tinydns/log/run new file mode 100644 index 0000000..9e8f266 --- /dev/null +++ b/root/var/service/tinydns/log/run @@ -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 diff --git a/root/var/service/tinydns/root/.gitignore b/root/var/service/tinydns/root/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/root/var/service/tinydns/run b/root/var/service/tinydns/run new file mode 100644 index 0000000..0a8c41d --- /dev/null +++ b/root/var/service/tinydns/run @@ -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 +' diff --git a/root/var/service/tinydns/tinydns-log.pl b/root/var/service/tinydns/tinydns-log.pl new file mode 100644 index 0000000..96d9418 --- /dev/null +++ b/root/var/service/tinydns/tinydns-log.pl @@ -0,0 +1,59 @@ +#!/usr/bin/perl -p + +# tinydns log formatting utility +# based on Faried Nawaz's logfile formatter for dnscache +# by Kenji Rikitake 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; +} + diff --git a/root/var/service/tinydns/tinydns-readstats b/root/var/service/tinydns/tinydns-readstats new file mode 100644 index 0000000..91800bd --- /dev/null +++ b/root/var/service/tinydns/tinydns-readstats @@ -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 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 +################################################################## +# +# 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 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 () { + + $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 () { + 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__ + + +