From 7685f89bf42977ea3641c6aabe683f7fcf5a8208 Mon Sep 17 00:00:00 2001 From: Trevor Batley Date: Sat, 7 Sep 2024 20:16:46 +1000 Subject: [PATCH] initial commit of file from CVS for smeserver-dhcp-dns on Sat Sep 7 20:16:46 AEST 2024 --- .gitignore | 4 + Makefile | 21 ++ README.md | 16 +- additional/CHANGELOG.git | 309 ++++++++++++++++ additional/COPYING | 340 ++++++++++++++++++ additional/README.md | 4 + additional/smeserver-dhcp-dns.spec | 110 ++++++ contriborbase | 1 + createlinks | 25 ++ .../db/configuration/defaults/dhcp-dns/status | 1 + .../db/configuration/defaults/dhcp-dns/type | 1 + .../service/tinydns/root/data/65dhcpARecords | 138 +++++++ root/sbin/e-smith/systemd/dhcp-dns | 49 +++ root/usr/lib/systemd/system/dhcp-dns.service | 11 + root/var/service/dhcp-dns/run | 4 + smeserver-dhcp-dns.spec | 129 +++++++ 16 files changed, 1161 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 additional/CHANGELOG.git create mode 100644 additional/COPYING create mode 100644 additional/README.md create mode 100644 additional/smeserver-dhcp-dns.spec create mode 100644 contriborbase create mode 100644 createlinks create mode 100644 root/etc/e-smith/db/configuration/defaults/dhcp-dns/status create mode 100644 root/etc/e-smith/db/configuration/defaults/dhcp-dns/type create mode 100644 root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords create mode 100644 root/sbin/e-smith/systemd/dhcp-dns create mode 100644 root/usr/lib/systemd/system/dhcp-dns.service create mode 100755 root/var/service/dhcp-dns/run create mode 100644 smeserver-dhcp-dns.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cbb3a13 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.rpm +*.log +*spec-20* +*.tar.gz diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5a3c105 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +# Makefile for source rpm: smeserver-dhcp-dns +# $Id: Makefile,v 1.1 2020/10/12 15:24:42 brianr Exp $ +NAME := smeserver-dhcp-dns +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 3dbff9d..571341b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ -# smeserver-dhcp-dns +# smeserver-dhcp-dns -SMEServer Koozali developed git repo for smeserver-dhcp-dns smecontribs \ No newline at end of file +SMEServer Koozali developed git repo for smeserver-dhcp-dns smecontribs + +## Wiki +
https://wiki.koozali.org/Dhcp-dns + +## Bugzilla +Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-dhcp-dns&product=SME%20Contribs&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* +
diff --git a/additional/CHANGELOG.git b/additional/CHANGELOG.git new file mode 100644 index 0000000..6436c6c --- /dev/null +++ b/additional/CHANGELOG.git @@ -0,0 +1,309 @@ +commit 82f0b9fd354ec7b7ff71b5dc565a63e1613a2b30 +Author: Stephane de Labrusse +Date: Thu Jul 30 17:01:23 2015 +0200 + + * Thu Jul 30 2015 stephane de Labrusse 1.2.0-2 + - finished lease are now prohibited + +commit 4e0f26c5825671d4eaf8bfed4beb1fde2ea8b89d +Author: Stephane de Labrusse +Date: Sat Jul 25 10:03:36 2015 +0200 + + spec modified + +commit 5e73b0d385c331ca3845a7b0239706e7c8b6d54f +Author: Stephane de Labrusse +Date: Sat Jul 25 09:42:29 2015 +0200 + + * Sat Jul 25 2015 stephane de Labrusse 1.2.0-1 + - enhancement following the bug [SME: 2388] + - e-smith-tinydns-2.4.0_add_hostname_following_dhcpdleases_hostname.patch + - waiting a release to the core, it is now a contrib for sme9 + +commit baf82f24fdc314a451b377b28376671cfa7c5211 +Author: Stephane de Labrusse +Date: Wed Jun 18 14:37:43 2014 +0200 + + * Wed Jun 18 2014 stephane de Labrusse 1.1.2-1 + - correction of file 65dhcpARecords + +commit bd547907773bf12253576ac8133307d0000417ef +Author: Stephane de Labrusse +Date: Sun May 18 01:22:36 2014 +0200 + + spec update + +commit efb888048477eafc316fb5996c0854e5dd3e20c0 +Author: Stephane de Labrusse +Date: Sun May 18 01:20:50 2014 +0200 + + minor correction on event->action name + +commit f49df5d084a865c6b55eaf68b7b9f52e0d0a35c4 +Author: Stephane de Labrusse +Date: Sun May 18 01:13:06 2014 +0200 + + * Sun May 18 2014 stephane de Labrusse 1.1.0-11 + - add a tinydns expand-template on event dhcp-dns + - add a restart dhcp-dns to signal-event dhcp-dns + +commit c1ad095a162d228c2e676fbe9e210d0a7573d119 +Merge: becc191 8206ab1 +Author: Stephane de Labrusse +Date: Sun May 18 00:57:36 2014 +0200 + + wip + +commit becc191b3df00a88c64cf221ec3be699697336c9 +Author: Stephane de Labrusse +Date: Sun May 18 00:41:41 2014 +0200 + + comment of createlinks + +commit 8206ab14335357a614035347526d49473e04390f +Author: Stephane de Labrusse +Date: Sun May 18 00:46:33 2014 +0200 + + add a restart dhcp-dns to signal-event dhcp-dns + +commit a5f0d9e4e606d980aa1e5c4775a563d257c56346 +Author: Stephane de Labrusse +Date: Sun May 18 00:18:43 2014 +0200 + + merge from sme9_devel for sme8 contribs + +commit 7a32d5d4cf263a8b9815a20df44391fffe83b011 +Author: Stephane de Labrusse +Date: Sun May 18 00:14:47 2014 +0200 + + add a tinydns expand-template on event dhcp-dns + +commit b36880002902a29e86747943a3126cbbf98c2040 +Author: Stephane de Labrusse +Date: Sun May 18 00:12:30 2014 +0200 + + add a tinydns expand-template on event dhcp-dns + +commit dcd7e152c4d32b7be019b3802e4b7329ab7dcb74 +Author: Stephane de Labrusse +Date: Fri May 16 18:44:55 2014 +0200 + + version 1.1.1-8 + +commit 16acdb9c618498a764a1e06f83a45cbd03d3e4b2 +Author: Stephane de Labrusse +Date: Fri May 16 01:23:53 2014 +0200 + + * Tue May 13 2014 stephane de Labrusse 1.1.0-7 + - First release for SME Server 9.0 + - Thanks to John Crisp, Stefano Zamboni and Rick Jones + - This contribs is made from the solution of Stefano Zamboni [SME:2388] + - and the original idea of Rick Jones. + +commit 9632a55dcc00a357ce535ac7d6ce8708f2bfe5b9 +Author: Stephane de Labrusse +Date: Fri May 16 01:22:03 2014 +0200 + + add defined to $ip and $name + +commit b4c01981ea3c2a7555ae40e0b94602b0935937d6 +Author: Stephane de Labrusse +Date: Fri May 16 00:30:11 2014 +0200 + + add dhcpd restart + +commit 314241138f3943703620fa54bb4107e5cb408361 +Author: Stephane de Labrusse +Date: Fri May 16 00:12:03 2014 +0200 + + we are near :) + +commit 3698b69219c1328bb2bf97ff42fe7914c15c6d78 +Author: Stephane de Labrusse +Date: Fri May 16 00:00:47 2014 +0200 + + wip + +commit 611f66618aa820cd75862b269261d35b0ecc79d2 +Author: Stephane de Labrusse +Date: Thu May 15 23:54:20 2014 +0200 + + wip + +commit 2aab427eb5453d2a4264539cc849ed3b28149e2a +Author: Stephane de Labrusse +Date: Thu May 15 23:51:47 2014 +0200 + + wip + +commit 667ea32cf6bb820604d6035b5eaeb16b82894569 +Author: Stephane de Labrusse +Date: Thu May 15 23:34:45 2014 +0200 + + wip + +commit 0549b5b954c310d4f175b29219a9707d96d958f9 +Author: Stephane de Labrusse +Date: Thu May 15 23:30:29 2014 +0200 + + wip + +commit dc7fcf5b590b3e530149e6a70808346e31d5a115 +Author: Stephane de Labrusse +Date: Thu May 15 23:08:19 2014 +0200 + + wip + +commit 628a7b8d3947ec0fc68b2287ed0b6068fd54dd41 +Author: Stephane de Labrusse +Date: Thu May 15 23:07:57 2014 +0200 + + wip + +commit 6d34cf699e1acb084765a2a8e40903647fdb9fb5 +Author: Stephane de Labrusse +Date: Thu May 15 22:49:18 2014 +0200 + + spec file modified + +commit 11673f4aa9c1bdba65fadd9b30b049f0b4e99938 +Author: Stephane de Labrusse +Date: Thu May 15 22:47:53 2014 +0200 + + spec file modified + +commit 87f1f36ddcbc373bcc5d7f33049c01deddd0cd38 +Author: Stephane de Labrusse +Date: Thu May 15 22:45:38 2014 +0200 + + merge spec file modified + +commit d1178a4ebccb837d9f522064651b7cb71790b599 +Author: Stephane de Labrusse +Date: Thu May 15 21:26:03 2014 +0200 + + adding a real service in /etc/rc.d/init.d + +commit 8f87dc2b0925dd5967bea91aec29e419a094fa52 +Author: Stephane de Labrusse +Date: Thu May 15 18:26:08 2014 +0200 + + wip + +commit 56942bd905dc2f08d9f9bb7dc6935b3637246c00 +Author: Stephane de Labrusse +Date: Wed May 14 22:33:19 2014 +0200 + + added an initscript + +commit 76156f4ce15b594f628178432baa19b0a93da838 +Author: Stephane de Labrusse +Date: Wed May 14 22:18:04 2014 +0200 + + wip + +commit 07bf204da66bf32efb49e40b0b16ad9fa1f5dc02 +Author: Stephane de Labrusse +Date: Wed May 14 20:55:39 2014 +0200 + + wip + +commit 0672ad62c3cf4fc61b465f495ea8e3682e524bcf +Author: Stephane de Labrusse +Date: Wed May 14 20:48:47 2014 +0200 + + wip + +commit 0cbcf44e87426c5c489451b1e13f8e43651a5cef +Author: Stephane de Labrusse +Date: Wed May 14 19:55:38 2014 +0200 + + force the %post link creation + +commit a6c3f29b6da6eab0e1a4a8236541c38e0be86d24 +Author: Stephane de Labrusse +Date: Wed May 14 18:45:22 2014 +0200 + + * Tue May 13 2014 stephane de Labrusse 1.1.0-1 + - First release for SME Server 9.0 + - Thanks to John Crisp, Stefano Zamboni and Rick Jones + - This contribs is made from the solution of Stefano Zamboni [SME:2388] + - and the original idea of Rick Jones. + +commit af7a3ed19f2303d7ca61385e55f03d03c36ce7ff +Author: Stephane de Labrusse +Date: Wed May 14 16:57:36 2014 +0200 + + adaptation to bug 2388_following + +commit f7179f2edc732a4c147643fcf50bc7507ced629c +Author: Stephane de Labrusse +Date: Wed May 14 16:57:15 2014 +0200 + + adaptation to bug 2388 + +commit 08270bbdde619ecaa088fce9bf35fdd1c6cf0a48 +Author: Stephane de Labrusse +Date: Wed May 14 00:21:14 2014 +0200 + + ## + +commit fa51b4b245d35721721feef8fabe6fe09b0d7071 +Author: Stephane de Labrusse +Date: Wed May 14 00:18:09 2014 +0200 + + add spec file + +commit 40fb1475cdde7f172735203a6f34aeb3f34a716e +Author: Stephane de Labrusse +Date: Wed May 14 00:17:11 2014 +0200 + + link to daemontoolsv2 + +commit 930948165cff4fe8a20545272b197ed11bc6b92e +Author: Stephane de Labrusse +Date: Wed May 14 00:08:44 2014 +0200 + + link to daemontoolsv2 + +commit 44e6face146e4fd197ffc22b3b195531a8f6bedc +Author: Stephane de Labrusse +Date: Wed May 14 00:05:08 2014 +0200 + + link to daemontools + +commit 8c967bd7394d43f3ea7fa7e608d0e7888cd70fc6 +Author: Stephane de Labrusse +Date: Tue May 13 22:06:28 2014 +0200 + + modified spec file, removed wrong date + +commit 28d7ff3138cfc317b4c4470331841ad163bcc739 +Author: Stephane de Labrusse +Date: Tue May 13 22:03:15 2014 +0200 + + modified createlinks + +commit 3f502909676b8f1ccfdc31795cd26bd8ad72f10f +Author: Stephane de Labrusse +Date: Tue May 13 22:01:42 2014 +0200 + + modified spec file and cretaelinks + +commit 3a3d55764078c2f46b21214a4397fb330e61c44a +Author: Stephane de Labrusse +Date: Tue May 13 21:28:14 2014 +0200 + + modified spec file + +commit 31cb84af5547a3e1fcd424579d438d5bbafbf93b +Author: Stephane de Labrusse +Date: Tue May 13 20:42:51 2014 +0200 + + initial relase from sme-dhcp-dns-1.01 from Rick Jones rick@activeservice.co.uk, thank to him and john crisp + +commit f251152fb48014fdf5a2836ce29bd8d5a04c20b9 +Author: Stephane de Labrusse +Date: Tue May 13 11:32:44 2014 -0700 + + Initial commit 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/additional/README.md b/additional/README.md new file mode 100644 index 0000000..989e2cd --- /dev/null +++ b/additional/README.md @@ -0,0 +1,4 @@ +smeserver-dhcp-dns +================== + +a contrib to fill the name of computer to tinydns through the dhcp service diff --git a/additional/smeserver-dhcp-dns.spec b/additional/smeserver-dhcp-dns.spec new file mode 100644 index 0000000..144ef5c --- /dev/null +++ b/additional/smeserver-dhcp-dns.spec @@ -0,0 +1,110 @@ +%define name smeserver-dhcp-dns +%define version 1.2.0 +%define release 2 + +Summary: contrib to update dynamically the dns data +Name: %{name} +Version: %{version} +Release: %{release}%{?dist} +Source: %{name}-%{version}.tar.gz +License: GNU GPL version 2 +URL: http://www.contribs.org +Group: SMEserver/addon +BuildRoot: %{_tmppath}/%{name}-buildroot +BuildArchitectures: noarch +BuildRequires: e-smith-devtools +Requires: e-smith-release >= 9.0 +AutoReqProv: no + +%description +Implementation of some features arround dhcp to dynamically update dns data file whenever the dhcp file changes. +This eliminates the 'pc-0001' etc. default names. + +%changelog +* Thu Jul 30 2015 stephane de Labrusse 1.2.0-2 +- finished lease are now prohibited + +* Sat Jul 25 2015 stephane de Labrusse 1.2.0-1 +- enhancement following the bug [SME: 2388] +- e-smith-tinydns-2.4.0_add_hostname_following_dhcpdleases_hostname.patch +- waiting a release to the core, it is now a contrib for sme9 + +* Wed Jun 18 2014 stephane de Labrusse 1.1.2-1 +- correction of file 65dhcpARecords + +* Sun May 18 2014 stephane de Labrusse 1.1.0-12 +- add a tinydns expand-template on event dhcp-dns +- add a restart dhcp-dns to signal-event dhcp-dns +- minor correction on event->action name + +* Tue May 13 2014 stephane de Labrusse 1.1.0-8 +- First release for SME Server 9.0 +- Thanks to John Crisp, Stefano Zamboni and Rick Jones +- This contribs is made from the solution of Stefano Zamboni [SME:2388] +- and the original idea of Rick Jones. + +* Sun Mar 20 2005 Rick Jones +- [1.0-1] +- First complete release, includes resolution of client name clashes +- (thanks to Placido Sanchez for suggestions and load-testing) +- also ignores expired entries in the leases file + +* Fri Apr 30 2004 Rick Jones +- [0.9-rc1] +- First provisional release, added GPL & README + +* Fri Apr 30 2004 Rick Jones +- [0.2-2] +- Patch hostentries web-panel to allow non-IP entry of remote host, +- allows Cname support to be used (un-patch when RPM removed) + +* Fri Apr 23 2004 Rick Jones +- [0.2-1] +- Handle static IPs, replaces 50domainARecords with 60hostARecords + +* Thu Apr 22 2004 Rick Jones +- [0.1-3] +- Regenerate old DNS data after RPM removal +- Minor tidying + +* Thu Apr 22 2004 Rick Jones +- [0.1-2] +- Moved actual daemon code into dhcp-dnsd, run just execs (better for ps) +- Add missing "run" file for log directory, and create /var/log directory +- Add some logging output +- Remove rc files (service is up by default, no startup needed) +- Re-arrange initialisation & cleanup + +* Sun Apr 18 2004 Rick Jones +- [0.1-1] +- Initial beta release + + + +%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 \ + --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 +cd .. +rm -rf %{name}-%{version} + +%pre +%preun + +%post + +%postun + +%files -f %{name}-%{version}-%{release}-filelist +%defattr(-,root,root) diff --git a/contriborbase b/contriborbase new file mode 100644 index 0000000..9b7fd51 --- /dev/null +++ b/contriborbase @@ -0,0 +1 @@ +contribs10 diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..69ef60d --- /dev/null +++ b/createlinks @@ -0,0 +1,25 @@ +#! /usr/bin/perl -w + +use esmith::Build::CreateLinks qw(:all); + + +#link to services2adjust and templates2expand for dhcp-dns event +for my $event (qw( dhcp-dns smeserver-dhcp-dns-update)) + { + # services to launch on event + safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/dnscache"); + safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/tinydns"); + safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/dhcp-dns"); + } + +my $event = "smeserver-dhcp-dns-update"; +event_link("systemd-reload", $event, "89"); +event_link("systemd-default", $event, "88"); + +#creation of dhcp-dns service +# safe_symlink("daemontools", "root/etc/rc.d/init.d/dhcp-dns"); +# service_link_enhanced("dhcp-dns", "S85", "7"); +# service_link_enhanced("dhcp-dns", "K65", "6"); +# service_link_enhanced("dhcp-dns", "K65", "0"); +# service_link_enhanced("dhcp-dns", "K65", "1"); +# safe_symlink("/var/service/dhcp-dns/", "root/service/dhcp-dns"); diff --git a/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status b/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status new file mode 100644 index 0000000..86981e6 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dhcp-dns/status @@ -0,0 +1 @@ +enabled diff --git a/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type b/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type new file mode 100644 index 0000000..24e1098 --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/dhcp-dns/type @@ -0,0 +1 @@ +service diff --git a/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords b/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords new file mode 100644 index 0000000..3234321 --- /dev/null +++ b/root/etc/e-smith/templates/var/service/tinydns/root/data/65dhcpARecords @@ -0,0 +1,138 @@ +{ + use strict; + use warnings; + use esmith::Logger; + use esmith::ConfigDB; + use esmith::HostsDB; + use Time::TAI64 qw /unixtai64/; + use Date::Manip qw /UnixDate/; + use File::Copy; + + my $DB = esmith::ConfigDB->open_ro or die ("Unable to open configuration database"); + my $hosts = esmith::HostsDB->open_ro or die ("Unable to open Host database"); + + my $dhcpdns = $DB->get_prop('dhcp-dns','status') || 'disabled'; + return '' if $dhcpdns ne 'enabled'; + + #we start a hash for name & ip + my %allocated_name = (); + my %allocated_ip_dhcplease = (); + + #start a hash of all hosts in DB + my @hosts = $hosts->keys; + my %hostsdb; + @hostsdb{@hosts} = (); + + # copy dhcpd.leases to /tmp + copy("/var/lib/dhcpd/dhcpd.leases","/tmp/tmpdhcpd.leases") + or die ("Error dhcp-dns Service : Unable to copy the /var/lib/dhcpd/dhcpd.leases"); + + #we want to write in log + sub log2messages + { + my $message = shift; + tie *FH, 'esmith::Logger'; + print FH "$message"; + close FH; + } + + #Text::DHCPparse forked because it doesn't allow to retrieve the end of lease + #Only the start is found by the leaseparse of DHCPparse.pm s/starts/ends + sub leaseparse + { + my $logfile = shift; + my ( %list, $ip ); + open FILE, $logfile or die; + + while () + { + next if /^#|^$/; + if (/^lease (\d+\.\d+\.\d+\.\d+)/) + { + $ip = $1; + $list{$ip} = sprintf("%-17s", $ip); + } + /^\s*hardware ethernet (.*);/ && ($list{$ip} .= sprintf("%-19s", $1)); + /^\s*ends \d (.*);/ && ($list{$ip} .= sprintf("%-21s", $1)); + /^\s*(abandoned).*/ && ($list{$ip} .= sprintf("%-19s", $1)); + /^\s*client-hostname "(.*)";/ && ($list{$ip} .= sprintf("%-17s", $1)); + } + + close FILE; + + # make all entries 74 characters long to format properly + foreach (keys %list) + { + $list{$_} = sprintf("%-74s", $list{$_}) if (length$list{$_} < 76); + } + + return \%list; + } + + #hostname validator routine + sub namevalidator + { + my $local_domain = $DB->get_value('DomainName') or die ("Unable retrieve the DomainName property"); + my $server_name = $DB->get_value('SystemName') or die ("Unable retrieve the SystemName property"); + my $validator = shift; + + if ($validator eq $server_name) { + log2messages("The hostname of this server ($server_name) is already in use with a different IP address in /var/lib/dhcpd/dhcpd.leases"); + return 1; + } + elsif ($validator !~ /^[a-zA-Z0-9][a-zA-Z0-9-]*$/) { + log2messages("The hostname of the dhcp client ($validator) contains illegal characters in /var/lib/dhcpd/dhcpd.leases"); + return 1; + } + elsif (exists $hostsdb{lc "$validator\.$local_domain"}) { + log2messages("The hostname of the dhcp client ($validator) is already used in the hosts database"); + return 1; + } + elsif (exists $allocated_name{$validator}) { + log2messages("The hostname ($validator) has already been assigned an IP address in /var/lib/dhcpd/dhcpd.leases"); + return 1; + } + else { + return 0; + } + } + + # now we parse the leases + my $return = leaseparse('/tmp/tmpdhcpd.leases'); + my ($ip,$time,$mac,$name); + + # retrieve the local domain name + my $localdomain = $DB->get_value('DomainName') or die ("Unable retrieve the DomainName property"); + + $OUT .= "# A records for dhcp hosts in $localdomain\n"; + + foreach (keys %$return) + { + ($ip, $time, $mac, $name) = unpack("A17 A21 A19 A30", $return->{$_}); + + # we skip allocated ips & empty names + unless ((exists $allocated_ip_dhcplease{$ip}) || ( $name eq "" )) + { + # Convert lease end time to the format expected as + # see: http://cr.yp.to/djbdns/tinydns-data.html + my $ts = UnixDate($time, "%s"); + my $endtai = unixtai64($ts); + $endtai =~ s/@//; + + #we don't want finished lease + next if ($ts < time); + + # Determine TTL + my $ttl = 0; + + # display if the hostname is valid + $OUT .= "=$name.$localdomain:$ip:$ttl:$endtai\n" if (namevalidator("$name") ne '1'); + } + + $allocated_ip_dhcplease{$ip} = 1; + $allocated_name{$name} ++; + } + # remove the temp file + unlink "/tmp/tmpdhcpd.leases" + or log2messages("Error dhcp-dns Service : Unable to remove the /tmp/tmpdhcpd.leases"); +} diff --git a/root/sbin/e-smith/systemd/dhcp-dns b/root/sbin/e-smith/systemd/dhcp-dns new file mode 100644 index 0000000..e11d7b8 --- /dev/null +++ b/root/sbin/e-smith/systemd/dhcp-dns @@ -0,0 +1,49 @@ +#!/usr/bin/perl +use strict; +use warnings; +use esmith::ConfigDB; + +my $DB = esmith::ConfigDB->open_ro or die ("Unable to open configuration database"); +my $dhcpdns = $DB->get_prop('dhcp-dns','status') || 'disabled'; + +my $lease_file = "/var/lib/dhcpd/dhcpd.leases"; + +# last modified time +my $modtime = 0; + +# seconds to wait +my $update_freq = 30; + +#we want to write in log +sub log2messages + { + my $message = shift; + tie *FH, 'esmith::Logger'; + print FH "$message"; + close FH; + } + +########################################################################### +# Main Loop +while ($dhcpdns eq 'enabled') { + + # check the file's last updated time, if it's been changed, update + # the DNS and save the modified time. This will ALWAYS run once - on + # startup, since $modtime starts at zero. + + my @stats = stat ($lease_file); + if ($stats[9] > $modtime) { + + $modtime = $stats[9]; + system ("/usr/bin/sv 1 /service/tinydns") ==0 + or log2messages('Error service dhcp-dns : Unable to restart /service/tinydns'); + + system ("/usr/bin/sv 1 /service/dnscache") ==0 + or log2messages('Error service dhcp-dns : Unable to do restart /service/dnscache'); + } + + # wait till next check time + sleep $update_freq; + +} # end main +########################################################################### diff --git a/root/usr/lib/systemd/system/dhcp-dns.service b/root/usr/lib/systemd/system/dhcp-dns.service new file mode 100644 index 0000000..58141a0 --- /dev/null +++ b/root/usr/lib/systemd/system/dhcp-dns.service @@ -0,0 +1,11 @@ +[Unit] +Description=DHCP leases to DNS +After=tinydns.service dhcpd.service + +[Service] +ExecStartPre=/sbin/e-smith/service-status dhcp-dns +ExecStart=/usr/bin/perl /sbin/e-smith/systemd/dhcp-dns +RemainAfterExit=yes + +[Install] +WantedBy=sme-server.target diff --git a/root/var/service/dhcp-dns/run b/root/var/service/dhcp-dns/run new file mode 100755 index 0000000..d1a6d2c --- /dev/null +++ b/root/var/service/dhcp-dns/run @@ -0,0 +1,4 @@ +#!/bin/sh + +exec 2>&1 +exec /usr/bin/perl dhcp-dns diff --git a/smeserver-dhcp-dns.spec b/smeserver-dhcp-dns.spec new file mode 100644 index 0000000..fb7287f --- /dev/null +++ b/smeserver-dhcp-dns.spec @@ -0,0 +1,129 @@ +%define name smeserver-dhcp-dns +%define version 1.2.0 +%define release 6 + +Summary: contrib to update dynamically the dns data +Name: %{name} +Version: %{version} +Release: %{release}%{?dist} +Source: %{name}-%{version}.tar.xz + +License: GNU GPL version 2 +URL: http://www.contribs.org +Group: SMEserver/addon +BuildRoot: %{_tmppath}/%{name}-buildroot +BuildArchitectures: noarch +BuildRequires: e-smith-devtools +Requires: e-smith-release >= 8.0 +AutoReqProv: no + +%description +Implementation of some features arround dhcp to dynamically update dns data file whenever the dhcp file changes. +This eliminates the 'pc-0001' etc. default names. + +%changelog +* Sat Sep 07 2024 cvs2git.sh aka Brian Read 1.2.0-6.sme +- Roll up patches and move to git repo [SME: 12338] + +* Sat Sep 07 2024 BogusDateBot +- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday, + by assuming the date is correct and changing the weekday. + +* Tue Mar 30 2021 Jean-Philippe Pialasse 1.2.0-5.sme +- moving to systemd + update event [SME: 11031] + +* Mon Oct 12 2020 Brian Read 1.2.0-4.sme +- Initial import to SME10 tree [SME: 11031] + +* Wed Aug 19 2015 stephane de Labrusse 1.2.0-3 +- now released in smecontribs + +* Thu Jul 30 2015 stephane de Labrusse 1.2.0-2 +- finished lease are now prohibited + +* Sat Jul 25 2015 stephane de Labrusse 1.2.0-1 +- enhancement following the bug [SME: 2388] +- e-smith-tinydns-2.4.0_add_hostname_following_dhcpdleases_hostname.patch +- waiting a release to the core, it is now a contrib for sme9 + +* Wed Jun 18 2014 stephane de Labrusse 1.1.2-1 +- correction of file 65dhcpARecords + +* Sun May 18 2014 stephane de Labrusse 1.1.0-12 +- add a tinydns expand-template on event dhcp-dns +- add a restart dhcp-dns to signal-event dhcp-dns +- minor correction on event->action name + +* Tue May 13 2014 stephane de Labrusse 1.1.0-8 +- First release for SME Server 9.0 +- Thanks to John Crisp, Stefano Zamboni and Rick Jones +- This contribs is made from the solution of Stefano Zamboni [SME:2388] +- and the original idea of Rick Jones. + +* Sun Mar 20 2005 Rick Jones +- [1.0-1] +- First complete release, includes resolution of client name clashes +- (thanks to Placido Sanchez for suggestions and load-testing) +- also ignores expired entries in the leases file + +* Fri Apr 30 2004 Rick Jones +- [0.9-rc1] +- First provisional release, added GPL & README + +* Fri Apr 30 2004 Rick Jones +- [0.2-2] +- Patch hostentries web-panel to allow non-IP entry of remote host, +- allows Cname support to be used (un-patch when RPM removed) + +* Fri Apr 23 2004 Rick Jones +- [0.2-1] +- Handle static IPs, replaces 50domainARecords with 60hostARecords + +* Thu Apr 22 2004 Rick Jones +- [0.1-3] +- Regenerate old DNS data after RPM removal +- Minor tidying + +* Thu Apr 22 2004 Rick Jones +- [0.1-2] +- Moved actual daemon code into dhcp-dnsd, run just execs (better for ps) +- Add missing "run" file for log directory, and create /var/log directory +- Add some logging output +- Remove rc files (service is up by default, no startup needed) +- Re-arrange initialisation & cleanup + +* Sun Apr 18 2004 Rick Jones +- [0.1-1] +- Initial beta release + + + +%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 \ + --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 +cd .. +rm -rf %{name}-%{version} + +%pre +%preun + +%post + +%postun + +%files -f %{name}-%{version}-%{release}-filelist +%defattr(-,root,root)