From b45f3382c736201e461e046715035fa56160f1e5 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Wed, 12 Jul 2023 08:56:08 +0100 Subject: [PATCH] initial commit of file from CVS for e-smith-hosts on Wed 12 Jul 08:56:08 BST 2023 --- .gitignore | 4 + Makefile | 21 + README.md | 18 +- additional/COPYING | 340 +++++ contriborbase | 1 + createlinks | 69 ++ e-smith-hosts.spec | 1099 +++++++++++++++++ root/etc/e-smith/db/hosts/migrate/10reformat | 38 + .../e-smith/db/hosts/migrate/10sanitise-db | 22 + .../etc/e-smith/db/hosts/migrate/20eachdomain | 20 + .../db/hosts/migrate/30sanitise_host_comment | 10 + root/etc/e-smith/events/actions/conf-hostsdb | 28 + .../e-smith/events/actions/conf-migrate-hosts | 272 ++++ .../events/actions/create-default-hosts | 69 ++ root/etc/e-smith/events/actions/purge-domain | 67 + .../etc/e-smith/web/functions/hostentries | 288 +++++ .../templates/etc/dhcpd.conf/60StaticEntries | 27 + root/etc/e-smith/tests/50-hosts/.dummy | 0 .../e-smith/tests/50-hosts/configuration.conf | 104 ++ root/etc/e-smith/tests/50-hosts/hosts.conf | 10 + root/etc/e-smith/web/functions/hostentries | 137 ++ .../web/panels/manager/cgi-bin/.gitignore | 0 .../esmith/FormMagick/Panel/hostentries.pm | 736 +++++++++++ 23 files changed, 3378 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 additional/COPYING create mode 100644 contriborbase create mode 100644 createlinks create mode 100644 e-smith-hosts.spec create mode 100644 root/etc/e-smith/db/hosts/migrate/10reformat create mode 100644 root/etc/e-smith/db/hosts/migrate/10sanitise-db create mode 100644 root/etc/e-smith/db/hosts/migrate/20eachdomain create mode 100644 root/etc/e-smith/db/hosts/migrate/30sanitise_host_comment create mode 100644 root/etc/e-smith/events/actions/conf-hostsdb create mode 100644 root/etc/e-smith/events/actions/conf-migrate-hosts create mode 100644 root/etc/e-smith/events/actions/create-default-hosts create mode 100644 root/etc/e-smith/events/actions/purge-domain create mode 100755 root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/hostentries create mode 100644 root/etc/e-smith/templates/etc/dhcpd.conf/60StaticEntries create mode 100644 root/etc/e-smith/tests/50-hosts/.dummy create mode 100644 root/etc/e-smith/tests/50-hosts/configuration.conf create mode 100644 root/etc/e-smith/tests/50-hosts/hosts.conf create mode 100755 root/etc/e-smith/web/functions/hostentries create mode 100644 root/etc/e-smith/web/panels/manager/cgi-bin/.gitignore create mode 100644 root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/hostentries.pm 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..c5cdbe3 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +# Makefile for source rpm: e-smith-hosts +# $Id: Makefile,v 1.1 2016/02/05 22:56:04 stephdl Exp $ +NAME := e-smith-hosts +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 68c07eb..a584c92 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ -# e-smith-hosts +# e-smith-hosts -SMEServer Koozali developed git repo for e-smith-hosts smeserver \ No newline at end of file +SMEServer Koozali developed git repo for e-smith-hosts smeserver + +## Wiki +
https://wiki.koozali.org/ + +## Bugzilla +Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=e-smith-hosts&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-hosts is a software used to manage the local and remote addresses of a network. It is a powerful tool for network administrators that allows them to maintain secure and efficient networks. It can be used to add and remove IP addresses and hostnames of local and remote computers, and it also allows users to define DNS records for each host. It also lets administrators maintain an efficient firewall configuration, which is essential in preventing malicious attacks and data breaches. e-smith-hosts is a powerful and versatile tool that can help administrators maintain a secure and efficient network. 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..29fc5aa --- /dev/null +++ b/createlinks @@ -0,0 +1,69 @@ +#!/usr/bin/perl -w +# This script creates the symlinks needed by this RPM +# Specific support exists to create symlinks within e-smith web "panels" +# and for links from named "events" directories into the "actions" directory + +use strict; +use esmith::Build::CreateLinks qw(:all); + +#-------------------------------------------------- +# functions for manager panel +#-------------------------------------------------- +my $panel = "manager"; + +panel_link("hostentries", $panel); + +#-------------------------------------------------- +# link in the appropriate actions +#-------------------------------------------------- +my $event; + +foreach $event ( qw(host-create host-delete host-modify) ) +{ + safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/dhcpd"); + safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/tinydns"); + safe_symlink("sigterm", "root/etc/e-smith/events/$event/services2adjust/dnscache"); +} + +#-------------------------------------------------- +# actions for bootstrap-console-save event +#-------------------------------------------------- +$event = "bootstrap-console-save"; + +event_link("conf-hostsdb", $event , "03"); +event_link("purge-domain", $event, "04"); + +#-------------------------------------------------- +# actions for console-save event +#-------------------------------------------------- +$event = "console-save"; + +event_link("conf-hostsdb", $event , "04"); + +#-------------------------------------------------- +# actions for domain-create event +#-------------------------------------------------- +$event = "domain-create"; + +event_link("create-default-hosts", $event, "04"); + +#-------------------------------------------------- +# actions for domain-delete event +#-------------------------------------------------- +$event = "domain-delete"; + +event_link("purge-domain", $event, "04"); + +#-------------------------------------------------- +# e-smith-hosts-update event +#-------------------------------------------------- +$event="e-smith-hosts-update"; + +safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/dhcpd"); +safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/tinydns"); +safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/dnscache"); +event_link("conf-hostsdb", $event , "03"); +event_link("purge-domain", $event, "04"); +# systemd-specific action mandatory for this package-update event +event_link("systemd-reload", $event, "89"); +event_link("systemd-default", $event, "88"); diff --git a/e-smith-hosts.spec b/e-smith-hosts.spec new file mode 100644 index 0000000..426e207 --- /dev/null +++ b/e-smith-hosts.spec @@ -0,0 +1,1099 @@ +# $Id: e-smith-hosts.spec,v 1.7 2021/01/06 19:54:15 jpp Exp $ + +Summary: e-smith module for managing hosts entries +Name: e-smith-hosts +%define version 2.6.0 +%define release 7 +Version: %{version} +Release: %{release}%{?dist} +License: GPL +Group: Networking/Daemons +Source: %{name}-%{version}.tar.xz + +BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot +Requires: e-smith-base +Requires: e-smith-lib >= 1.15.1-19 +Requires: e-smith-test >= 0.1.14 +Requires: e-smith-formmagick >= 1.4.0-12 +Requires: e-smith-tinydns >= 2.2.0-2 +Requires: dhcp +BuildRequires: e-smith-devtools +BuildArchitectures: noarch +AutoReqProv: no + +%description +e-smith module to allow the configuration of the hosts database, which is +used to build the DNS and DHCP configuration. + +%changelog +* Wed Jul 12 2023 cvs2git.sh aka Brian Read 2.6.0-7.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. + +* Wed Jan 06 2021 Jean-Philipe Pialasse 2.6.0-6.sme +- add update event [SME: 11138] + +* Wed Apr 12 2017 Jean-Philipe Pialasse 2.6.0-5.sme +- remove reference to smtpd [SME: 9478] + +* Sat Jul 23 2016 Jean-Philipe Pialasse 2.6.0-4.sme +- fix servicename syslog to rsylog [SME: 9691] +- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday, + by assuming the date is correct and changing the weekday. + +* Mon Jul 18 2016 Jean-Philipe Pialasse 2.6.0-3.sme +- fix mysqld to mariadb [SME: 9438] + +* Thu May 12 2016 Daniel Berteaud 2.6.0-2.sme +- Rebuild for [SME: 9393] + +* Fri Feb 05 2016 stephane de Labrusse 2.6.0-1.sme +- Initial release to sme10 + +* Wed Jan 6 2016 Daniel Berteaud 2.4.0-12.sme +- Allow empty comment when creating/modifying a hostname [SME: 9177] + +* Fri Feb 6 2015 stephane de Labrusse 2.4.0-11.sme +- Add a migrate fragment to sanitize the host comment [SME: 8723] +- Code done by Charlie Brady +- and Huib + +* Sat Jan 18 2014 stephane de Labrusse 2.4.0-4.sme + Sun Jan 18 2014 --> Sun Jan 12 2014 or Sat Jan 18 2014 or Sun Jan 19 2014 or .... +- Add a validator for the comment and the hostname field [SME: 8723] + +* Sat Nov 30 2013 Daniel Berteaud 2.4.0-3.sme +- Remove the "swap interface" feature [SME: 7993] + +* Wed Feb 13 2013 Daniel Berteaud 2.4.0-2.sme +- Add missing dependency on dhcp [SME: 7297] + +* Wed Feb 13 2013 Shad L. Lords 2.4.0-1.sme +- Roll new stream for sme9 +- Perl modules moved to /usr/share/perl5/vendor_perl [SME: 7223] + +* Mon Nov 29 2010 Shad L. Lords 2.2.0-8.sme +- Sanitize comment field in tables and edit form [SME: 6408] + +* Mon Nov 29 2010 Jonathan Martens 2.2.0-7.sme +- Fix double speechmarks in comment field in hostname panel [SME: 6408] + +* Wed Oct 20 2010 Jonathan Martens 2.2.0-6.sme +- Update some more occurrences to also reflect the option of a FQDN [SME: 6296] + +* Tue Oct 19 2010 Jonathan Martens 2.2.0-5.sme +- Update textbox description to also reflect the option of a FQDN [SME: 6296] + +* Sat Sep 25 2010 Shad L. Lords 2.2.0-4.sme + Sun Sep 25 2010 --> Sun Sep 19 2010 or Sat Sep 25 2010 or Sun Sep 26 2010 or .... +- Trap croak inside Net::IPv4Addr::ipv4_in_network [SME: 6288] + +* Sat Sep 25 2010 Shad L. Lords 2.2.0-3.sme + Sun Sep 25 2010 --> Sun Sep 19 2010 or Sat Sep 25 2010 or Sun Sep 26 2010 or .... +- Add validator back for ip or cname entry [SME: 3132] + +* 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] + +* Tue Jul 8 2008 Jonathan Martens 1.14.0-14 +- Move single occurence HOSTTYPE back to e-smith-hosts + +* Sun Apr 27 2008 Jonathan Martens 1.14.0-13 +- Add common tags to e-smith-formmagick's general [SME: 4280] + +* Sun Feb 10 2008 Stephen Noble 1.14.0-12 +- Remove duplicate entries [SME: 3895] + +* Sat Feb 09 2008 Stephen Noble 1.14.0-11 +- Remove empty lexicon entry [SME: 3880] + +* Thu Jul 12 2007 Charlie Brady 1.14.0-10 +- Remove implicit use of GLOBAL_IP lexicon entries. [SME: 3135] + +* Fri Jul 06 2007 Charlie Brady 1.14.0-9 +- Remove more remnant lexicon entries. [SME: 3135] + +* Fri Jul 06 2007 Charlie Brady 1.14.0-8 +- Remove remnant DNS publication code and lexicon entries. [SME: 3135] + +* Sun Apr 29 2007 Shad L. Lords +- Clean up spec so package can be built by koji/plague + +* Mon Feb 19 2007 Stephen Noble 1.14.0-7 +- Fix text with a space [SME: 2246] + +* Sat Jan 13 2007 Shad L. Lords 1.14.0-6 +- Make success/failure messages standard [SME: 2290] + +* Wed Jan 10 2007 Shad L. Lords 1.14.0-5 +- Add comment to host entries. [SME: 878] + +* Thu Dec 07 2006 Shad L. Lords +- Update to new release naming. No functional changes. +- Make Packager generic + +* Thu Jun 22 2006 Charlie Brady 1.14.0-03 +- Fix display of hosts table for additional domains. [SME: 1630, 1374] + +* Wed Jun 14 2006 Gavin Weight 1.14.0-02 +- Improved layout applied to Hostnames and addresses. [SME: 1374] + +* Wed Mar 15 2006 Charlie Brady 1.14.0-01 +- Roll stable stream version. [SME: 1016] + +* Tue Jan 24 2006 Gordon Rowell 1.13.3-04 +- Fix purge-domain code relating to pseudonym cleanup [SME: 515] + +* Wed Nov 30 2005 Gordon Rowell 1.13.3-03 +- Bump release number only + +* Fri Nov 4 2005 Charlie Brady +- [1.13.3-02] +- s/local_ip/global_ip/ when setting host to type Remote. + Ensure that Remote hosts don't have local_ip set. + [SF: 1293449] +- Add missing "IP_ADDRESS" localisation. +- Remove vestigial print_global_ip_field() function. +- Deal gracefully with missing Nameservers property of domains. + +* Fri Oct 14 2005 Gordon Rowell +- [1.13.3-01] +- Remove L10Ns from base packages [SF: 1309520] + +* Fri Oct 14 2005 Gordon Rowell +- [1.13.2-01] +- New dev stream before relocating L10Ns + +* Fri Sep 30 2005 Gordon Rowell +- [1.13.1-15] +- Added Italian L10N - Thanks Filippo Carletti [SF: 1309266] + +* Mon Sep 26 2005 Gordon Rowell +- [1.13.1-14] +- Only display the DNS Forwarder message if there are no domains + set with Nameservers==localhost [SF: 1303422] + +* Mon Sep 26 2005 Gordon Rowell +- [1.13.1-13] +- Allow dnscache{Forwarder} to be configured, but empty [SF: 1303422] + +* Mon Sep 26 2005 Gordon Rowell +- [1.13.1-12] +- Added German L10N - Thanks Dietmar Berteld [SF: 1293325] + +* Mon Aug 29 2005 Charlie Brady +- [1.13.1-11] +- Avoid double reformatting of old host records, which breaks HostType == self + records. [SF: 1275450] + +* Mon Aug 15 2005 Charlie Brady +- [1.13.1-10] +- Remove some remnant ServiceLink code +- Replace conf-migrate-hosts with some migrate fragments for the host db +- Restart dnscache during host-{create,delete,modify} events, so that + cached information on hostnames is purged. [SF: 1243418,1243423] + +* Tue Jul 19 2005 Charlie Brady +- [1.13.1-09] +- Hostnames panel updates from Shad Lords. + +* Tue Jul 19 2005 Charlie Brady +- [1.13.1-08] +- Complete the update to current db access APIs - a few esmith::db and + esmith::config calls were found hiding. Rewrite conf-hostsdb as simple + shell script. [SF: 1216546] + +* Mon Jul 18 2005 Charlie Brady +- [1.13.1-07] +- Greatly simplify delete-hosts, and rename to purge-domain. Purge user@domain + pseudonyms for deleted domains. [SF: 1193570 (Gordon)] + +* Mon Jul 18 2005 Charlie Brady +- [1.13.1-06] +- Update to current db access APIs, in readiness for move of dbs to private + directory. [SF: 1216546 (Shad)] + +* Mon Jul 18 2005 Charlie Brady +- [1.13.1-05] +- Fix to ensure panel returns status if delete fails [SF: 1200284 (Shad)] + +* Thu Jul 7 2005 Charlie Brady +- [1.13.1-04] +- Include Shad's panel changes (publishglobal and formmagick patches) + from e-smith-hosts-1.13.0-02sme04. [SF: 1234280] +- Avoid multiple re-openings of config db in panel code. + +* Thu Jul 7 2005 Charlie Brady +- [1.13.1-03] +- Move all host db manipulation actions to before template + expansions (in all events, not just bootstrap-console-save). + [SF: 1234255] + +* Thu Apr 14 2005 Charlie Brady +- [1.13.1-02] +- Use services2adjust symlink to reconfigure tinydns (tinydns-conf + is obsolete). +- Move all host db manipulation actions to before template + expansions in bootstrap-console-save. + +* Fri Apr 1 2005 Charlie Brady +- [1.13.1-01] +- Roll new dev stream - 1.13.1 + +* Tue Mar 8 2005 Charlie Brady +- [1.13.0-06] +- Use generic_template_expand action in place of restart-dhcpd. + Update e-smith-lib dependency. [MN00064130] + +* Mon Mar 7 2005 Charlie Brady +- [1.13.0-05] +- Fix RE used in untainting of hostname. [charlieb MN00050161] + +* Tue Jan 25 2005 Charlie Brady +- [1.13.0-04] +- Only check if host exists on create not modify. [MN00065708] +- Remove stray ServiceLink action symlink. [MN00064757] + +* Wed Nov 10 2004 Charlie Brady +- [1.13.0-03] +- Untaint hostname before using in system(). [charlieb MN00050161] + +* Tue May 25 2004 Michael Soulier +- [1.13.0-02] +- Fixing typo that prevented H&A panel from being disabled if a DNS forwarder + was in use. [msoulier MN00034840] + +* Tue May 25 2004 Michael Soulier +- [1.13.0-01] +- rolling to dev stream - 1.13.0 + +* Thu Feb 19 2004 Michael Soulier +- [1.12.0-04] +- Added a check in more_options() to reject the hostname if it's a dup. + [msoulier dpar-20864] + +* Thu Feb 19 2004 Michael Soulier +- [1.12.0-03] +- Added further validation of the local IP address, to prevent the user using + the external or internal interface IP, the gateway IP, or the loopback + interface. [msoulier 8887] +- Added further validation of a host being added as local, to prevent users + adding "local" hosts with are not local. [msoulier dpar-20865] + +* Tue Aug 19 2003 Michael Soulier +- [1.12.0-02] +- Fixed persistence problem with publish_globally field. [msoulier 9427] + +* Thu Jun 26 2003 Charlie Brady +- [1.12.0-01] +- Changing version to stable stream number - 1.12.0 + +* Thu Jun 12 2003 Gordon Rowell +- [1.11.1-01] +- Added order to migrate fragments [gordonr 9015] + +* Fri Jun 6 2003 Gordon Rowell +- [1.11.0-32] +- Move force to lowercase to the correct place so we don't just bark + if upper case hostnames are entered - we squash them to lower case + before confirming [gordonr 8939] +- Correct the migrate fragment [gordonr 8939] + +* Fri Jun 6 2003 Gordon Rowell +- [1.11.0-31] +- Force hostnames to lowercase on h&a panel [gordonr 8939] +- Sanitise hostsdb for old non-lowercase names (WIP) [gordonr 8939] + +* Fri May 30 2003 Michael Soulier +- [1.11.0-30] +- Updated delete-hosts to use esmith::HostsDB, and removed redundant bind db + handling. [msoulier 8809] +- Updated delete-hosts to scan the entire hostsdb, cross-referencing with the + domainsdb, and remove any host for a domain that we do not manage. + [msoulier 8809] +- Added links to delete-hosts from bootstrap-console-save and + registration-clear. [msoulier 8809] + +* Tue May 20 2003 Michael Soulier +- [1.11.0-29] +- Fixed indentation in lexicon files, and changed "Create/modify" to "Create + or modify" in all lexicon files. [msoulier 8543] + +* Tue May 6 2003 Lijie Deng +- [1.11.0-28] +- Add Spanish lexicon for hostentries [lijied 3793] + +* Tue Apr 29 2003 Gordon Rowell +- [1.11.0-27] +- Removed duplicate tag [gordonr 8613] + +* Thu Apr 24 2003 Lijie Deng +- [1.11.0-26] +- Deleted FIRSTPAGE_DESC text [lijied 8493] + +* Tue Apr 22 2003 Lijie Deng +- [1.11.0-25] +- Removed inline in text [lijied 7949] + +* Mon Apr 21 2003 Lijie Deng +- [1.11.0-24] +- Standardize Add/Save button name [lijied 7921] + +* Tue Apr 15 2003 Gordon Rowell +- [1.11.0-23] +- Added fr entry for previous change [gordonr 3722] + +* Mon Apr 14 2003 Gordon Rowell +- [1.11.0-22] +- Don't display H&A panel if DNS forwarder configured [gordonr 3722] + +* Wed Apr 9 2003 Gordon Rowell +- [1.11.0-21] +- Panel cleanup now all domains are in domains db [gordonr 8097] + +* Tue Apr 8 2003 Lijie Deng +- [1.11.0-20] +- Standardized the button name [lijied 7921] + +* Fri Apr 4 2003 Lijie Deng +- [1.11.0-19] +- Change $q->table to $q->start_table where necessary [lijied 8034] + +* Fri Apr 4 2003 Charlie Brady +- [1.11.0-18] +- Add tinydns-conf links in place of previous named-conf ones. + [charlieb 8071] + +* Thu Apr 3 2003 Lijie Deng +- [1.11.0-17] +- Removed 'Mitel Networks SME Server' branding [lijied 8016] + +* Tue Apr 1 2003 Gordon Rowell +- [1.11.0-16] +- Removed named links [gordonr 7659] + +* Tue Apr 1 2003 Gordon Rowell +- [1.11.0-15] +- Removed conf-dhcpd symlinks - now done in run script [gordonr 7771] + +* Mon Mar 31 2003 Mike Dickson +- [1.11.0-14] +- fixed the "Action" column to be several comns instead of one [miked 7761] + +* Thu Mar 27 2003 Lijie Deng +- [1.11.0-13] +- Modified French lexicon to use lang="fr", rename the lexicon + directory to fr [lijied 6787] + +* Thu Mar 6 2003 Lijie Deng +- [1.11.0-12] +- Modified hostentries panel order [lijied 7356] + +* Tue Mar 4 2003 Lijie Deng +- [1.11.0-11] +- Split en-us lexicon from hostentries panel [lijied 4030] + +* Fri Feb 28 2003 Lijie Deng +- [1.11.0-10] +- Added French lexicon for hostsentries. [lijied 5003] + +* Mon Feb 24 2003 Michael Soulier +- [1.11.0-09] +- Remove use of LocalDomainPrefix. [msoulier 4812] + +* Fri Feb 21 2003 Charlie Brady +- [1.11.0-08] +- Remove deprecated WebServerName setting from canned test data. [charlieb 6861] + +* Sat Jan 25 2003 Mike Dickson +- [1.11.0-07] +- added Action to the lexicon [miked 6363] + +* Fri Dec 27 2002 Mike Dickson +- [1.11.0-06] +- minor UI updates [miked 5494] + +* Mon Dec 16 2002 Charlie Brady +- [1.11.0-05] +- Fix problem with globally visible (published) external IPs [charlieb 5816] + +* Mon Dec 9 2002 Mike Dickson +- [1.11.0-04] +- ui update [miked 5494] + +* Mon Dec 2 2002 Mike Dickson +- [1.11.0-03] +- ui update [miked 5494 + +* Fri Nov 15 2002 Charlie Brady +- [1.11.0-02] +- Removing explicit dependency on e-smith-named. [charlieb 4058] + +* Fri Nov 15 2002 Charlie Brady +- [1.11.0-01] +- Rolling development stream to 1.11.0 + +* Fri Oct 11 2002 Charlie Brady +- [1.10.0-01] +- Roll to maintained version number to 1.10.0 + +* Fri Oct 11 2002 Charlie Brady +- [1.9.0-11] +- Back out the check for duplicate hosts added at 1.9.0-04 - it prevents + any modification of existing hostnames. [charlieb 3813] + +* Fri Sep 6 2002 Gordon Rowell +- [1.9.0-10] +- Check return value of open on NetworkServicesDB [gordonr 4760] + +* Fri Sep 6 2002 Gordon Rowell +- [1.9.0-09] +- Make use of NetworkServicesDB.pm in conf-migrate-hosts [gordonr 4773] + +* Fri Sep 6 2002 Gordon Rowell +- [1.9.0-08] +- Remove auto-creation of LocalDomainPrefix on upgrades. An existing + value will be retained, but the implicit creation of e-smith. + or mitel-networks. for the local prefix no longer happens. [gordonr 4811] + +* Thu Sep 5 2002 Mark Knox +- [1.9.0-07] +- Added 3 missing lexicon entries [markk 3812] + +* Wed Sep 4 2002 Mark Knox +- [1.9.0-06] +- Fixed some problems with dhcp range validator [markk 4513] + +* Mon Aug 26 2002 Mark Knox +- [1.9.0-05] +- Improved logic for when to clear global IP [markk 3816] + +* Mon Aug 26 2002 Mark Knox +- [1.9.0-04] +- Check for duplicate host names [markk 3813] + +* Fri Aug 23 2002 Charlie Brady +- [1.9.0-03] +- Fix validator function from previous change [charlieb 4513] + +* Fri Aug 23 2002 Charlie Brady +- [1.9.0-02] +- Include validator to ensure that host IP is not in DHCP range [charlieb 4513] + +* Wed Jun 5 2002 Charlie Brady +- [1.9.0-01] +- Changing version to development stream number to 1.9.0 + +* Mon Jun 3 2002 Gordon Rowell +- [1.8.6-01] +- Default for HostType is 'Self' [gordonr 3811] + +* Mon Jun 3 2002 Gordon Rowell +- [1.8.5-01] +- Relaxed regexp to match text: [a-z0-9][a-z0-9-]* [gordonr 3684] + +* Mon Jun 3 2002 Gordon Rowell +- [1.8.4-01] +- Validate that the (root of the) hostname matches [a-z][a-z0-9-]* + Remove unused open of the ConfigDB [gordonr 3684] + +* Mon Jun 3 2002 Gordon Rowell +- [1.8.3-01] +- Delete MACAddress when type is Remote + Delete RemoteIP when type is Local [gordonr 3684] + +* Mon Jun 3 2002 Mark Knox +- [1.8.2-01] +- Resolved more confusion with addresses not displaying, naming conventions, + delete non-essential fields in modification, and stop allowing change of + domain during modification. [markk 3684] + +* Sat Jun 1 2002 Gordon Rowell +- [1.8.1-01] +- Resolved a lot of confusion about HostType, Visbility, local and + remote hosts and global publishing. These were all mixed up. + TODO: Need to ensure that InternalIP and ExternalIP are deleted when + changing host types from Remote->Local->Self [gordonr 3684] + +* Fri May 31 2002 Charlie Brady +- [1.8.0-01] +- Changing version to maintained stream number to 1.8.0 + +* Fri May 31 2002 Kirrily Robert +- [1.7.20-01] +- removed SL-specific service domain stuff, now just calls a routine + elsewhere [skud 3731] + +* Fri May 31 2002 Kirrily Robert +- [1.7.19-01] +- Now checking for SL service domain in panel [skud 3684] + +* Fri May 31 2002 Kirrily Robert +- [1.7.18-01] +- Made hosttyle (Local/Remote/Self) have first letter uppercase. + [skud 3684] + +* Thu May 30 2002 Kirrily Robert +- [1.7.17-01] +- Default all hostentries props to empty string to avoid "odd number of + elements in hash" warning and mixed up hosts config file. [skud 3684] + +* Wed May 29 2002 Kirrily Robert +- [1.7.16-01] +- Added hostname l10n for previous hostname/name fix [skud 3684] + +* Wed May 29 2002 Kirrily Robert +- [1.7.15-01] +- Fixed hostname/name CGI parameter mixup in hostentries.pm [skud 3684] +- Fixed ethernet address validation (should be allowed to be blank) + +* Thu May 23 2002 Gordon Rowell +- [1.7.14-01] +- RPM rebuild forced by cvsroot2rpm + +* Fri May 17 2002 Mark Knox +- [1.7.13-01] +- Added missing tag [markk 3430] + +* Fri May 17 2002 Mark Knox +- [1.7.12-01] +- Removed extra lexicon data after the tag. [markk 3430] + +* Thu May 16 2002 Kirrily Robert +- [1.7.11-01] +- Added english localisation for NO_HOSTS_FOR_THIS_DOMAIN [skud #3429] + +* Wed May 15 2002 Kirrily Robert +- [1.7.10-01] +- Fixed broken links to hostentries.skud [skud #3430] + +* Mon May 13 2002 Gordon Rowell +- [1.7.9-01] +- Catch up with changes in action names in e-smith-named [gordonr 2733] + +* Wed May 8 2002 Gordon Rowell +- [1.7.8-01] +- Removed whitespace from nav bar entries. For some reason it resulted + in another Configuration group. Probably funkiness in the navigation + routine, but that's for ron. [gordonr 3155] + +* Wed May 8 2002 Gordon Rowell +- [1.7.7-01] +- removed dependency on esmith::NetworkServicesDB/ServiceLink-lib + [skud 3353] + +* Tue May 7 2002 Gordon Rowell +- [1.7.6-01] +- And fixed tests to pick up en-us [gordonr 3155] + +* Tue May 7 2002 Gordon Rowell +- [1.7.5-01] +- Lexicon en->en-us [gordonr 3155] + +* Wed May 1 2002 Gordon Rowell +- [1.7.4-01] +- esmith::AccountDB -> esmith::AccountsDB [schwern 3287] + +* Tue Apr 30 2002 Gordon Rowell +- [1.7.3-01] +- I18N'd version of hostentries [skud 3027] +- Nav bar entries for same [gordonr 3155] + +* Fri Apr 19 2002 Gordon Rowell +- [1.7.2-01] +- InternalIP & ExternalIPs now translated correctly from 4.1.2 style + hosts databases by conf-migrate-hosts (2495) +- Added 'wpad' alias for Windows proxy autodetection - thanks Damien Curtain + [gordonr 3073] + +* Wed Feb 27 2002 Jason Miller +- [1.7.1-01] +- Rolling to new version 1.7.1-01, includes all patches up to 1.7.0-01, + as part of testing that rpm2cvs was successfull + +* Wed Feb 27 2002 Jason Miller +- [1.7.0-01] +- rollRPM: Rolled version number to 1.7.0-01. Includes patches up to 1.6.0-02. + +* Fri Jan 4 2002 Adrian Chung +- [1.6.0-02] +- Adding 'proxy' to the list of hostnames added to hosts database. +- Use passed in visibility argument for systemName.FQDN rather than always + using 'Global'. + +* Tue Dec 11 2001 Adrian Chung +- [1.6.0-01] +- rollRPM: Rolled version number to 1.6.0-01. Includes patches up to 1.5.0-01. + +* Fri Nov 23 2001 Tony Clayton +- [1.5.0-01] +- rollRPM: Rolled version number to 1.5.0-01. Includes patches up to 1.4.0-05. +- s/march-networks/mitel-networks/ in conf-migrate-hosts + +* Wed Nov 07 2001 Tony Clayton +- [1.4.0-05] +- rebranding to Mitel Networks + +* Wed Aug 22 2001 Gordon Rowell +- [1.4.0-04] +- Well, one more branding change + +* Tue Aug 21 2001 Gordon Rowell +- [1.4.0-03] +- Final branding cleanup + +* Fri Aug 17 2001 gordonr +- [1.4.0-02] +- Autorebuild by rebuildRPM + +* Wed Aug 8 2001 Charlie Brady +- [1.4.0-01] +- Rolled version number to 1.4.0-01. Includes patches upto 1.3.0-58. + +* Tue Jul 31 2001 Jason Miller +- [1.3.0-58] +- Update to hostentries panel to change url + +* Tue Jul 31 2001 Jason Miller +- [1.3.0-57] +- Update conf-migrate-hosts to change default LocalDomainPrefix value from + e-smith. to march-networks. + +* Sun Jul 29 2001 Jason Miller +- [1.3.0-56] +- Branding text changes to the hostentries web panel + +* Wed Jul 18 2001 Jason Miller +- [1.3.0-55] +- Updates to error message displays + +* Wed Jul 18 2001 Jason Miller +- [1.3.0-54] +- Split actions + +* Fri Jul 6 2001 Peter Samuel +- [1.3.0-53] +- Changed license to GPL + +* Tue Jun 12 2001 Jason Miller +- [1.3.0-52] +- Update to conf-migrate-hosts script to ignore hosts already in the new + format + +* Thu Jun 07 2001 Jason Miller +- [1.3.0-51] +- Fixed bug in create-default-hosts action + +* Thu Jun 07 2001 Jason Miller +- [1.3.0-50] +- Update to hostentries panel to include a message about static + host entries and why they are non-modifiable + +* Thu Jun 07 2001 Jason Miller +- [1.3.0-49] +- Update to create-default-hosts to create a new host for SystemName + with property static=yes +- Update to hostentries panel to not allow modifications for hosts + that have the property static=yes + +* Fri Jun 01 2001 Jason Miller +- [1.3.0-48] +- Updates to several of the panels to reflect better documentation habits + +* Thu May 31 2001 Gordon Rowell +- [1.3.0-47] +- Re-did showInitial() text to be more in line with the text in -46 changes + +* Thu May 31 2001 Jason Miller +- [1.3.0-46] +- Similar updates for createSelf(), createLocal(), createRemote(), modifyHost() + as were done in 1.3.0-45. + +* Thu May 31 2001 Jason Miller +- [1.3.0-45] +- Updates to the showInitial() subroutine in the hostentries panel to have + better formatted warnings + +* Wed May 30 2001 Jason Miller +- [1.3.0-44] +- Updates to createSelfHost, createLocalHost, createRemoteHost, modifyHost + subroutines inside the hostentries panel to show marketing information + +* Wed May 30 2001 Jason Miller +- [1.3.0-43] +- Updates to the showInitial panel to display marketing information + +* Wed May 16 2001 Jason Miller +- [1.3.0-42] +- Fixed subroutine genDomainMenu() in hostentries panel + +* Thu May 10 2001 Jason Miller +- [1.3.0-41] +- Changed order of actions + +* Wed May 09 2001 Jason Miller +- [1.3.0-40] +- Error handling fixes to 'hostentries' panel, and 'conf-migrate-hosts' + +* Wed May 09 2001 Jason Miller +- [1.3.0-39] +- Forgot to change conf-service-name to look for correct event + +* Wed May 09 2001 Jason Miller +- [1.3.0-38] +- Moved the conf-service-name action + +* Wed May 09 2001 Jason Miller +- [1.3.0-37] +- Changes various templates and web panels to check for publishDomain + - hostentries web panel + - conf-migrate-hosts action + - conf-service-name action + +* Tue May 01 2001 Jason Miller +- [1.3.0-36] +- Added an optional parameter to create-default-hosts to allow one to make + all the default hosts Globally published [i.e. service domain name] + +* Wed Apr 25 2001 Jason Miller +- [1.3.0-35] +- Reorganization of createlinks +- Added action delete-hosts which is symlinked into domain-delete + to automatically delete the host values for a particular domain + +* Wed Apr 25 2001 Jason Miller +- [1.3.0-34] +- Re-added symlink for console-save -> conf-hostsdb as it would + be required in the event that a domain is changed in the console + configuration + +* Wed Apr 25 2001 Jason Miller +- [1.3.0-33] +- Typo fix in genDomainMenu() + +* Wed Apr 25 2001 Jason Miller +- [1.3.0-32] +- Changed showInitial() subroutine in hostentries panel to use the + LocalDomainPrefix if one is set instead of DomainName +- Changed the ordering of genDomainMenu() subroutine in hostentries so that + the list of domains in the system appears as: + - Primary domain (with LocalDomainPrefix if applicable) + - Service domain + - Sorted i-bays + +* Tue Apr 24 2001 Jason Miller +- [1.3.0-31] +- Added actions for service domain + +* Tue Apr 24 2001 Jason Miller +- [1.3.0-30] +- Removed conf-hostsdb from console-save and host-delete events as it is not + necessary +- Added new action create-default-hosts (linked to domain-create event) which + takes the passed $domainName value and generates default hosts for that domain +- Changed conf-hostsdb to call create-default-hosts action passing it the + primary domain + +* Tue Apr 24 2001 Jason Miller +- [1.3.0-29] +- Cleaned up the Cgi code that displays the table of hosts (hostentries panel) + so that it would properly display in lynx + +* Mon Apr 16 2001 Jason Miller +- [1.3.0-28] +- Fixed up /etc/dhcpd.conf/60StaticEntries so that it also checks that + MACAddress and LocalIP are defined AND not equal to '' + +* Thu Apr 12 2001 Jason Miller +- [1.3.0-27] +- More panel text corrections +- Removed the autogeneration of hostname e-smith-manager.$DomainName as it + won't work as expected anyways (needs an apache configuration to pass it + on to the port 980) + +* Thu Apr 12 2001 Jason Miller +- [1.3.0-26] +- More panel updates for textual content as well as some more cleanup of + deprecated modules + +* Thu Apr 12 2001 Jason Miller +- [1.3.0-25] +- Panel updates for textual content for deleteHostEntry() and modifyHostEntry() + +* Wed Apr 11 2001 Jason Miller +- [1.3.0-24] +- Panel updates for textual content for showInitial(), createSelfHost(), + createLocalHost(), createRemoteHost() +- Cleanup of several deprecated modules + +* Wed Apr 11 2001 Jason Miller +- [1.3.0-23] +- changes to the layout of the manager text for the various panels + of createSelfHost(), createLocalHost(), createRemoteHost() and modifyHost() +- changes to the display of some of the panels + +* Thu Apr 05 2001 Jason Miller +- [1.3.0-22] +- Removed link to removed panel + +* Thu Apr 05 2001 Jason Miller +- [1.3.0-21] +- Made a generic modifyHostEntry() function that is meant for all three host + types and includes a drop-down to choose that type. +- Added 'FIXME' comments to locations that need to be removed + +* Thu Apr 05 2001 Jason Miller +- [1.3.0-20] +- Removed conf-hostsdb and conf-migrate-hosts out of post-install/post-upgrade + as this is a duplicated action set (bootstrap-console-save) which shouldn't + need to occur + +* Thu Apr 05 2001 Jason Miller +- [1.3.0-19] +- Changed conf-hostsdb and conf-migrate-hosts to not generate serviceDomain + entries if configuration value for ServiceDomain = '' (default on install) + +* Thu Apr 05 2001 Jason Miller +- [1.3.0-18] +- Added in the host-create and host-modify events to each of the performCreate() + and performModify() sections so that named is updated with the new information + +* Thu Apr 05 2001 Jason Miller +- [1.3.0-17] +- Merged the working prototype webpanel into the normal hostentries panel + (still keeping the old create/modify/delete scripts for reference) +- Made stipulation to show hostname/addresses for the serviceDomainName + if defined and not equal to '' (default on an installation) + +* Thu Apr 05 2001 Jason Miller +- [1.3.0-16] +- Changed conf-migrate-hosts to be operation 06 in post-install/post-upgrade + as it caused a failed dependency for 05init-accounts which MUST come first + +* Wed Apr 04 2001 Jason Miller +- [1.3.0-15] +- Added $ServiceDomainName to the list of domains for both + conf-hostsdb and conf-migrate-hosts scripts + +* Wed Apr 04 2001 Jason Miller +- [1.3.0-14] +- added a new conf-migrate-hosts script to be included in + post-install/post-upgrade (05) to migrate existing hosts to the new format + as well as to check for special hosts being defined for all domains + [note: this doesn't include service domain just yet] +- changed the meaning of conf-hostsdb for the default domains that it generates +- changed the panel to start using /home/e-smith/hosts instead of + /home/e-smith/service_hosts (test centre) + +* Mon Apr 02 2001 Jason Miller +- [1.3.0-13] +- added the functionality for modifiying all three host types + +* Mon Apr 02 2001 Jason Miller +- [1.3.0-12] +- created user interface for modifySelfHostEntry(), modifyLocalHostEntry(), + and modifyRemoteHostEntry() + +* Mon Apr 02 2001 Jason Miller +- [1.3.0-11] +- prepared modify{$HostType}HostEntry and performModify{$HostType}Modify + for actual content + +* Tue Mar 27 2001 Jason Miller +- [1.3.0-10] +- Implemented the performCreateRemoteHostEntry() functionality + +* Tue Mar 27 2001 Jason Miller +- [1.3.0-09] +- Updated performCreateSelfHostEntry() to do a check for a valid domain + name first, and rearranged order of variable declarations +- Completed the logic for performCreateLocalHostEntry() + +* Tue Mar 27 2001 Jason Miller +- [1.3.0-08] +- implemented deleteHostEntry() to work with the new schema + +* Fri Mar 23 2001 Jason Miller +- [1.3.0-07] +- Created the interfaces for create self/local/remote +- Implemented performCreateSelfHostEntry() and prepared + the logic for performCreateLocalHostEntry() and + performCreateRemoteHostEntry() to occur +- Changed REGEX for HostName to not allow periods at all +- Added genDomain() subroutine to generate a list of domains + to create host for. + +* Fri Mar 23 2001 Jason Miller +- [1.3.0-06] +- Further prepared the links for create/modify/remove to include the + relevant host information and the appropriate subroutines to handle + them [minus the handling portions] + +* Thu Mar 22 2001 Jason Miller +- [1.3.0-05] +- Prepared the links for create/modify/remove host entries + +* Thu Mar 22 2001 Jason Miller +- [1.3.0-04] +- Added ability to store each service_host db value into a two-tiered hash + which is then used to provide the host name values into the table structure + previously layed out in the panel. +- Added code to show a 'No hosts for this domain' message if no hosts exist + +* Thu Mar 22 2001 Jason Miller +- [1.3.0-03] +- Updated the new panel (service_hosts) to read from /home/e-smith/service_hosts + and changed to reflect the new layout of host entries per domain on the system + by providing menus only + +* Wed Mar 21 2001 Jason Miller +- [1.3.0-02] +- Created a new panel + +* Wed Mar 21 2001 Jason Miller +- [1.3.0-01] +- Rolled to version 1.3.0-01. Includes all patches up to 1.2.0-04 + +* Thu Feb 8 2001 Adrian Chung +- Rolling release number for GPG signing. + +* Thu Jan 25 2001 Tony Clayton +- [1.2.0-03] +- changed conf-hostdb action order from 01 to 07 for all events + +* Thu Jan 25 2001 Charlie Brady +- [1.2.0-02] +- Add code to set default string for LocalDomainPrefix. + +* Thu Jan 25 2001 Peter Samuel +- [1.2.0-01] +- Rolled version number to 1.2.0-01. Includes patches upto 1.1.0-15. + +* Tue Jan 23 2001 Gordon Rowell +- [1.1.0-15] +- Trim trailing periods from hostnames + +* Mon Jan 15 2001 Jason Miller +- [1.1.0-14] +- Changed descriptive text for hosts and addresses panel to emphasize + don't do anything unless you know what you're doing + +* Mon Jan 15 2001 Jason Miller +- [1.1.0-13] +- Changed descriptive text for hosts and addresses panel + +* Mon Jan 15 2001 Jason Miller +- [1.1.0-12] +- Changes to the navigation of the e-smith manager + +* Wed Jan 10 2001 Paul Nesbit +- [1.1.0-11] +- If $MACAddress isn't defined, set it to " " for display. This fixes + "Use of uninitialised..." warnings in admin_error_log. + +* Tue Jan 09 2001 Charlie Brady +- [1.1.0-10] +- Create new bootstrap-console-save event + +* Tue Jan 02 2001 Gordon Rowell +- [1.1.0-9] +- Redid panel + +* Thu Dec 21 2000 Charlie Brady +- [1.1.0-8] +- Removed unnecessary reconfig and restart of DHCPD from remoteaccess_update + event. + +* Thu Dec 21 2000 Peter Samuel +- [1.1.0-7] +- Fixed case where a null host was added during post-install + +* Tue Dec 19 2000 Jason Miller +- [1.1.0-6] +- updated createlinks to include conf-hostsdb in the post-install and + post-upgrade events + +* Sun Dec 17 2000 Gordon Rowell +- [1.1.0-5] +- Removed console-save from %post - not required, and bad during installs + +* Fri Dec 15 2000 Charlie Brady +- [1.1.0-4] +- Actions may well be named dhcpd, but they shouldn't be here - they're + duplicated in e-smith-base :-) + +* Wed Dec 13 2000 Gordon Rowell +- [1.1.0-3] +- Actions are named dhcpd, not dhcp + +* Wed Dec 13 2000 Gordon Rowell +- [1.1.0-2] +- Link actions into remoteaccess-update + +* Tue Nov 28 2000 Adrian Chung +- Branched to 1.1.0 for 4.1/7.0 release. +- Modified conf-dhcpd to look in /var/lib instead of /var/state + +* Fri Nov 03 2000 Gordon Rowell +- Clean up of web interface code + +* Wed Nov 01 2000 Gordon Rowell +- Put minor version numbers into patch file +- Changed test on web interface +- Modified conf-hostsdb to work for any event (including host-delete) + +* Wed Nov 01 2000 Brett Jensen +- Updates to the web interface + +* Mon Oct 30 2000 Gordon Rowell +- More functional web interface + +* Sun Oct 29 2000 Gordon Rowell +- Partially functional web interface + +* Sun Oct 29 2000 Gordon Rowell +- Added conf-hostsdb to prime hosts database with default entries + +* Sat Oct 28 2000 Gordon Rowell +- Renamed from e-smith-named-conf to e-smith-hosts +- Rewritten to use hosts database +- /var/named template changes moved to e-smith-named + +* Fri Sep 1 2000 Damien Curtain +- set -x added aswell as "accounts" replaced with "host name" +- on the web interface. + +* Thu Aug 31 2000 Damien Curtain +- Added some checking to ensure entered data is semi-valid + +* Wed Aug 30 2000 Damien Curtain +- Change of name. MAC Address no longer required. + +* Sun Aug 20 2000 Damien Curtain +- Initial Release + +%prep +%setup + +%build +perl createlinks + +%install +rm -rf $RPM_BUILD_ROOT +(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) +rm -f %{name}-%{version}-%{release}-filelist +/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ + > %{name}-%{version}-%{release}-filelist +echo "%doc COPYING" >> %{name}-%{version}-%{release}-filelist + +%clean +rm -rf $RPM_BUILD_ROOT + +%files -f %{name}-%{version}-%{release}-filelist +%defattr(-,root,root) diff --git a/root/etc/e-smith/db/hosts/migrate/10reformat b/root/etc/e-smith/db/hosts/migrate/10reformat new file mode 100644 index 0000000..c05c3f9 --- /dev/null +++ b/root/etc/e-smith/db/hosts/migrate/10reformat @@ -0,0 +1,38 @@ +{ + foreach my $host ($DB->get_all) + { + next if defined $host->prop('HostType'); + + my %properties; + $properties{'InternalIP'} = $host->prop('InternalIP') || ''; + $properties{'ExternalIP'} = $host->prop('ExternalIP') || ''; + $properties{'MACAddress'} = $host->prop('MACAddress') || ''; + + # If defined as host 'self', change to new format + if (($properties{'InternalIP'} eq 'self') && + ($properties{'ExternalIP'} eq 'self')) + { + $properties{'HostType'} = 'Self'; + $properties{'InternalIP'} = ''; + $properties{'ExternalIP'} = ''; + $properties{'MACAddress'} = ''; + } + # defined as 'local' entry in new format + elsif( $properties{InternalIP} ne 'self' ) + { + $properties{'HostType'} = 'Local'; + $properties{ExternalIP} = ''; + } + elsif( $properties{ExternalIP} ne 'self' ) + { + $properties{'HostType'} = 'Remote'; + $properties{InternalIP} = ''; + } + else { + warn "$host has no InternalIP or ExternalIP!\n"; + } + + $host->delete_prop('Visibility'); + $host->merge_props(%properties); + } +} diff --git a/root/etc/e-smith/db/hosts/migrate/10sanitise-db b/root/etc/e-smith/db/hosts/migrate/10sanitise-db new file mode 100644 index 0000000..72575c4 --- /dev/null +++ b/root/etc/e-smith/db/hosts/migrate/10sanitise-db @@ -0,0 +1,22 @@ +{ + foreach my $host ($DB->get_all) + { + my $lc_key = lc($host->key); + + next if ( $lc_key eq $host->key ); + + my $rec = $DB->get($lc_key); + + if ($rec) + { + warn "HostsDB: " . $host->key . + " NOT migrated as $lc_key exists\n"; + next; + } + + $rec = $DB->new_record($lc_key); + $rec->merge_props($host->props); + + $host->delete; + } +} diff --git a/root/etc/e-smith/db/hosts/migrate/20eachdomain b/root/etc/e-smith/db/hosts/migrate/20eachdomain new file mode 100644 index 0000000..5da9113 --- /dev/null +++ b/root/etc/e-smith/db/hosts/migrate/20eachdomain @@ -0,0 +1,20 @@ +{ + use esmith::DomainsDB; + my $ddb = esmith::DomainsDB->open_ro; + # If there's no domains db, there's nothing to do + return unless $ddb; + + # For any bare hostname, create a qualified host record + # for each domain, then delete the bare host record + foreach my $host (grep { $_->key !~ /\./ } $DB->get_all) + { + my $key = $host->key; + foreach my $d ($ddb->domains) + { + $d = $d->key; + next if $DB->get("$key.$d"); + $DB->new_record("$key.$d", { $host->props }); + } + $host->delete; + } +} diff --git a/root/etc/e-smith/db/hosts/migrate/30sanitise_host_comment b/root/etc/e-smith/db/hosts/migrate/30sanitise_host_comment new file mode 100644 index 0000000..37fdc8b --- /dev/null +++ b/root/etc/e-smith/db/hosts/migrate/30sanitise_host_comment @@ -0,0 +1,10 @@ +{ + # Purge quoting chars in comments to fix bug 8723 & bug 8806 + foreach my $host ($DB->get_all) + { + my $comment = $host->prop('Comment'); + next unless $comment; + $comment =~ s/[^a-zA-Z0-9\ \_\-\,\.]+//g; + $host->merge_props(Comment => $comment); + } +} diff --git a/root/etc/e-smith/events/actions/conf-hostsdb b/root/etc/e-smith/events/actions/conf-hostsdb new file mode 100644 index 0000000..2eb1df8 --- /dev/null +++ b/root/etc/e-smith/events/actions/conf-hostsdb @@ -0,0 +1,28 @@ +#!/bin/sh + +#---------------------------------------------------------------------- +# copyright (C) 1999-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 +# +#---------------------------------------------------------------------- + +#------------------------------------------------------------ +# Create the default hosts for the primary domain in +# bootstrap-console-save +#------------------------------------------------------------ + +exec /etc/e-smith/events/actions/create-default-hosts domain-create \ + $(/sbin/e-smith/config get DomainName) diff --git a/root/etc/e-smith/events/actions/conf-migrate-hosts b/root/etc/e-smith/events/actions/conf-migrate-hosts new file mode 100644 index 0000000..8aef3ed --- /dev/null +++ b/root/etc/e-smith/events/actions/conf-migrate-hosts @@ -0,0 +1,272 @@ +#!/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 +# +#---------------------------------------------------------------------- + +#-------------------------------------------------- +# Names in the hosts database can be: +# - Internal name only (name for host on local LAN) +# hp4500=host|InternalIP|192.168.16.201|MacAddress|aa:bb:cc:dd:ee:ff +# +# - Hosted by e-smith server (internal/external on e-smith server) +# mail=host|ExternalIP|self|InternalIP|self +# +# - Externally hosted +# www=host|ExternalIP|a.b.c.d +# +# - Internal machine behind port-forwarding firewall +# secure=host|ExternalIP|d.e.f.g|InternalIP|w.x.y.z +# +# Unqualified names in the key apply to all domains +# FQDNs apply to specific domains and override the wildcard shortnames +#-------------------------------------------------- +package esmith; + +use strict; +use Errno; +use esmith::HostsDB; +my $hdb = esmith::HostsDB->open(); + +=begin testing + +use esmith::TestUtils qw(scratch_copy); + +my $h_tmp = '50-hosts/hosts.conf.4.1.2'; +my $c_scratch = scratch_copy('50-hosts/configuration.conf'); +$ENV{ESMITH_HOSTS_DB} = $h_tmp; +$ENV{ESMITH_CONFIG_DB} = $c_scratch; + +# 4.1.2 Hosts DB which caused bug 2495 +open(TMP, ">$h_tmp") || die $!; +print TMP <<'OUT'; +archie=host|ExternalIP|209.28.139.23|InternalIP|self +e-smith=host|ExternalIP|self|InternalIP|self +e-smith-manager=host|ExternalIP|self|InternalIP|self +ftp=host|ExternalIP|self|InternalIP|self +mail=host|ExternalIP|self|InternalIP|self +proxy=host|ExternalIP|self|InternalIP|self +server=host|ExternalIP|self|InternalIP|self +www=host|ExternalIP|self|InternalIP|202.49.164.27 +OUT +close TMP; + +END { unlink $h_tmp } + +system($^X, $Original_File); + +use esmith::ConfigDB; +use esmith::HostsDB; +my $migrated = esmith::HostsDB->open; +my $config = esmith::ConfigDB->open; +my $domain = $config->get('DomainName')->value; + +my $www = $migrated->get("www.$domain"); +isa_ok( $www, 'esmith::DB::Record' ); +is( $www->prop('InternalIP'), '202.49.164.27' ); +is( $www->prop('ExternalIP'), '' ); +is( $www->prop('HostType'), 'Local' ); + +my $archie = $migrated->get("archie.$domain"); +isa_ok( $archie, 'esmith::DB::Record' ); +is( $archie->prop('InternalIP'), '', 'InternalIP'); +is( $archie->prop('ExternalIP'), '209.28.139.23', 'ExternalIP' ); +is( $archie->prop('HostType'), 'Remote', 'HostType' ); + + +my @migrated = grep { $_->key !~ /^(archie|www)/ } + $migrated->get_all_by_prop(type => 'host'); +is_deeply( [ sort map { $_->key } @migrated ], + [ sort map { "$_.$domain" } + qw( e-smith e-smith-manager ftp mail proxy server )], + 'domain names fully qualified' +); + +foreach my $host (@migrated) { + my $dn = $host->key; + is( $host->prop('HostType'), 'Self', "$dn - HostType"); + is( $host->prop('ExternalIP'), '' , " ExternalIP" ); + is( $host->prop('InternalIP'), '' , " InternalIP" ); +} + +=end testing + +=cut + +#------------------------------------------------------------ +# Populate the hosts database with default entries if they +# they don't already exist +#------------------------------------------------------------ +my $event = $ARGV [0]; + +#------------------------------------------------------------ +# Migrate existing hosts to new format for primary domain, and +# for any existing virtual domains +# +# eg. www=host|... -> www.{$DomainName}=host|... +#------------------------------------------------------------ + +my @FQDNHostList = (); +my @ShortHostList = (); + +foreach my $host ($hdb->hosts) +{ + if ($host->key =~ /\./) + { + # keep track of fully qualified domain name hosts + push @FQDNHostList, $host->key; + } + else + { + # keep track of single word hosts + push @ShortHostList, $host->key; + } +} + +# Get the list of local domain names +use esmith::DomainsDB; +my $ddb = esmith::DomainsDB->open_ro(); + +my @domainsList = map { $_-> key } $ddb->domains; + +eval "require esmith::NetworkServicesDB"; + +unless ($@) +{ + my $nsdb = esmith::NetworkServicesDB->open(); + + if ($nsdb) + { + my $service_domain = $nsdb->service_domain(); + + push @domainsList, $service_domain if $service_domain; + } +} + +#------------------------------------------------------- +# Iterate over each domain to propagate the single host +# entries for each virtual domain +#------------------------------------------------------- + +foreach my $domain ( @domainsList ) +{ + # default visibility property is 'Local' as this never existed before + + my %properties = ( + Visibility => 'Local' + ); + + foreach my $host ( @ShortHostList ) + { + $properties{'InternalIP'} = + $hdb->get_prop ($host, 'InternalIP') || ''; + + $properties{'ExternalIP'} = + $hdb->get_prop ($host, 'ExternalIP') || ''; + + $properties{'MACAddress'} = + $hdb->get_prop ($host, 'MACAddress') || ''; + + my $FQDN = "$host.$domain"; + + next if (defined $hdb->get ($FQDN)); + + # If defined as host 'self', change to new format + if (($properties{'InternalIP'} eq 'self') && + ($properties{'ExternalIP'} eq 'self')) + { + $properties{'HostType'} = 'Self'; + $properties{'InternalIP'} = ''; + $properties{'ExternalIP'} = ''; + $properties{'MACAddress'} = ''; + } + # defined as 'local' entry in new format + elsif( $properties{InternalIP} ne 'self' ) + { + $properties{'HostType'} = 'Local'; + $properties{ExternalIP} = ''; + } + elsif( $properties{ExternalIP} ne 'self' ) + { + $properties{'HostType'} = 'Remote'; + $properties{InternalIP} = ''; + } + else { + warn "$host has no InternalIP or ExternalIP!\n"; + } + + $properties{'type'} = 'host'; + $hdb->new_record($FQDN, \%properties); + } +} + +#------------------------------------------------------- +# Iterate over all of the fully qualified domain names, +# setting valid ones (from @domainsList) with appropriate +# values and flagging other non-expected ones with errors +#------------------------------------------------------- + +foreach my $key ( @FQDNHostList ) +{ + # Skip the hosts if already in the new format + next if (defined $hdb->get_prop ($key, 'HostType')); + + my %properties = ( + Visibility => 'Local' + ); + + my ($tempHost, $tempDomain) = split /\./, $key, 2; + + my @matches = grep(/$tempDomain/, @domainsList); + + unless (@matches) + { + # doesn't match an existing domain, set error flag + $properties{'error'} = 'Host has no matching domain in system'; + } + + $properties{'InternalIP'} = $hdb->get_prop ($key, 'InternalIP') || ''; + $properties{'ExternalIP'} = $hdb->get_prop ($key, 'ExternalIP') || ''; + $properties{'MACAddress'} = $hdb->get_prop ($key, 'MACAddress') || ''; + + # If defined as host 'self', change to new format + if ($properties{'InternalIP'} eq 'self') + { + $properties{'HostType'} = 'Self'; + $properties{'InternalIP'} = ''; + $properties{'ExternalIP'} = ''; + $properties{'MACAddress'} = ''; + } + else # defined as 'local' entry in new format + { + $properties{'HostType'} = 'Local'; + $properties{'ExternalIP'} = ''; + } + + $properties{'type'} = 'host'; + $hdb->new_record($key, \%properties); +} + + +# Remove the old single host entries +foreach my $host ( @ShortHostList ) +{ + $hdb->get($host)->delete; +} + +exit (0); diff --git a/root/etc/e-smith/events/actions/create-default-hosts b/root/etc/e-smith/events/actions/create-default-hosts new file mode 100644 index 0000000..31aabec --- /dev/null +++ b/root/etc/e-smith/events/actions/create-default-hosts @@ -0,0 +1,69 @@ +#!/usr/bin/perl -w + +#---------------------------------------------------------------------- +# copyright (C) 1999-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 +# +#---------------------------------------------------------------------- + +package esmith; + +use strict; +use Errno; +use esmith::ConfigDB; +use esmith::HostsDB; + +my $db = esmith::ConfigDB->open_ro(); + +my $hdb = esmith::HostsDB->open(); + +#------------------------------------------------------------ +# Populate the hosts database with default entries for a given +# domain if they don't already exist +#------------------------------------------------------------ +my $event = $ARGV [0] or die "Must provide event name arg"; +my $domain = $ARGV [1] or die "Must provide domain name arg"; + +#------------------------------------------------------------ +# Create a default host for the SystemName which includes +# a property static=yes (meaning not editable from the interface) +# +# Also create a set of default host records of type "Self". +#------------------------------------------------------------ + +my $systemName = $db->get('SystemName')->value; + +foreach my $host (qw(ftp mail www proxy wpad), $systemName) +{ + my $FQDN = join ".", $host, $domain; + next if (defined $hdb->get($FQDN)); + + my %properties = ( + type => 'host', + HostType => 'Self', + InternalIP => '', + ExternalIP => '', + MACAddress => '' + ); + if ($host eq $systemName) + { + $properties{static} = "yes"; + } + + $hdb->new_record($FQDN, \%properties); +} + +exit (0); diff --git a/root/etc/e-smith/events/actions/purge-domain b/root/etc/e-smith/events/actions/purge-domain new file mode 100644 index 0000000..09c0829 --- /dev/null +++ b/root/etc/e-smith/events/actions/purge-domain @@ -0,0 +1,67 @@ +#!/usr/bin/perl -w + +#---------------------------------------------------------------------- +# copyright (C) 1999-2005 Mitel Networks Corporation +# Copyright (C) 2005 Gordon Rowell +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#---------------------------------------------------------------------- + +package esmith; + +use strict; +use esmith::util; +use esmith::DomainsDB; +use esmith::HostsDB; +use esmith::AccountsDB; + +my $domainsdb = esmith::DomainsDB->open_ro; +my $hostsdb = esmith::HostsDB->open; +my $accountsdb = esmith::AccountsDB->open; + +#------------------------------------------------------------ +# Remove all hosts for the domain being deleted +#------------------------------------------------------------ + +my $event = $ARGV [0]; +# my $domain = $ARGV[1]; # Unused + +# Look for invalid hosts in the hostsdb. +my %domain_names = map { $_->{key} => 1 } $domainsdb->domains; + +# We want to check each host and see if it belongs to a domain that we are +# currently managing. If not, delete it. +foreach my $host ($hostsdb->hosts) +{ + my ($hostpart, $domainpart) = split (/\./, $host->{key}, 2); + + next if exists $domain_names{$domainpart}; + + $host->delete; +} + +# Ditto for pseudonyms +for my $nym ($accountsdb->pseudonyms) +{ + my ($host, $domain) = split (/\@/, $nym->{key}, 2); + + next unless $domain; + + next if exists $domain_names{$domain}; + + $nym->delete; +} + +exit 0; diff --git a/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/hostentries b/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/hostentries new file mode 100755 index 0000000..8bdb248 --- /dev/null +++ b/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/hostentries @@ -0,0 +1,288 @@ + + + + Hostnames and addresses + + Hostnames and addresses + + + + UNABLE_TO_OPEN_CONFIGDB + Unable to open configuration database + + + DNS_FORWARDER_ENABLED + + A DNS forwarder has been configured. This means that all DNS + lookups will be handled by the DNS forwarder. Hostnames + and addresses cannot be modified on this server while + a DNS forwarder is configured. + + + + ADD_HOSTNAME + + Add hostname + ]]> + + + + HOSTNAME + + Hostname + + + + HOSTTYPE + + Location + + + + LOCAL_IP + + Local IP + + + + ETHERNET_ADDRESS + + Ethernet address + + + + CURRENT_HOSTNAMES_FOR_DOMAIN + + Current list of hostnames for {$domain}. + + + + NO_HOSTNAMES_FOR_SERVICENAME + + There are no hostnames in the system for {$serviceName}. + + + + CURRENT_HOSTNAMES_FOR_LOCAL_DOMAIN + + Current list of hostnames for {$localDomainName} + + + + NO_HOSTNAMES_FOR_LOCAL_DOMAIN + + There are no hostnames in the system for {$localDomainName}. + + + + STATIC_HOST_MESSAGE + + - This host represents your system name and cannot be modified + or removed. + + + + CREATE_LOCAL_HOST_TITLE + + Create a new hostname for this server + + + HOSTNAME_VALIDATION_ERROR + + Error: unexpected characters in host name: + "{$HostName}". The host name should contain only + letters, numbers, and hyphens and must start + with a letter or a number. + + + + HOSTNAME_LENGTH_ERROR + + Error: account name {$HostName} is too long. The + maximum is 32 characters. + + + + DOMAIN_VALIDATION_ERROR + + Error: unexpected or missing characters in domain name + {$DomainName}. The domain name should contain one or more + letters, numbers, periods and minus signs. Did not create new + domain. + + + + HOSTNAME_EXISTS_ERROR + + Error: account {$fullHostName} is an existing {$type} hostname. + + + + SUCCESSFULLY_CREATED + + Successfully created hostname. + + + + HOSTNAME_DESCRIPTION + + The hostname must contain only letters, numbers, and hyphens, + and must start with a letter or number. + + + + LOCAL_IP_DESCRIPTION + + The Local IP address is the IP address of another machine on + the local network. Please enter a valid IP address in the + format "aaa.bbb.ccc.ddd". + + + + ETHERNET_ADDRESS_DESCRIPTION + + The ethernet address is optional and causes the DHCP server to + statically bind the local IP address to the computer with this + ethernet address. If specified, it must be of the form + "AA:BB:CC:DD:EE:FF" and must contain only the numbers 0-9 and + the letters A-F. + + + + CREATE_LOCAL_HOST_TITLE + + Create a new hostname referring to a local host. + + + + DIDNT_ENTER_LOCAL_IP + + Error: You did not specify a Local IP address. IP + addresses must contain only numbers and periods and + be in the form "aaa.bbb.ccc.ddd". Did not create hostname. + + + + IP_VALIDATION_ERROR + + Error: IP Address {$InternalIP} is + invalid. IP Addresses must contain only numbers and periods and be in the form "aaa.bbb.ccc.ddd". Did not create hostname. + + + + MAC_ADDRESS_VALIDATION_ERROR + + Error: Ethernet address {$MACAddress} + is invalid. Ethernet addresses must be in the + form "AA:BB:CC:DD:EE:FF" and only contain the + numbers 0-9 and the letters A-F. Did not create + hostname. + + + + CREATE_REMOTE_HOST_TITLE + + Create a new hostname referring to a remote host + + + + CREATE_TITLE + + Create or modify hostname + + + + LOCAL_PAGE_DESCRIPTION + + Please enter the following additional details for a local + host: + + + + REMOTE_PAGE_DESCRIPTION + + Please enter the following additional details for a remote + host: + + + + SUCCESSFULLY_DELETED + + Successfully deleted host. + + + + SUCCESSFULLY_MODIFIED + + Successfully modified host. + + + + REMOVE_PAGE_DESCRIPTION + + +

+ Are you sure you wish to remove this hostname? + ]]> + + + + CONFIRM_DESCRIPTION + + Please confirm the following details. + + + + NO_HOSTS_FOR_THIS_DOMAIN + + There are no hosts for this domain. + + + + ADDR_IN_DHCP_RANGE + Address is inside the DHCP assigned dynamic range + + + ERROR_WHILE_CREATING_HOST + Error occurred while creating hostname. + + + ERROR_WHILE_MODIFYING_HOST + Error occurred while modifying hostname. + + + ERROR_WHILE_DELETING_HOST + Error occurred while deleting hostname. + + + ERR_IP_IS_LOCAL_OR_GATEWAY + Error: IP cannot be server IP or Gateway IP. + + + ERR_IP_NOT_LOCAL + Error: This IP address is not on any of our local + networks. + + + MUST_BE_VALID_HOSTNAME_OR_IP + Must be a valid hostname or IP number + + + HOSTNAME_COMMENT_ERROR + + Error: unexpected characters in the comment of "{$hostname}.{$domain}". + The comment must contain only letters, spaces, numbers, dots, commas, undescores, hyphens and must start with a letter or number. + + + + HOSTNAME_VALIDATOR_ERROR + + Error: unexpected characters in host name: "{$hostname}.{$domain}". The host name should contain only + letters, numbers, and hyphens and must start with a letter or a number. + + + diff --git a/root/etc/e-smith/templates/etc/dhcpd.conf/60StaticEntries b/root/etc/e-smith/templates/etc/dhcpd.conf/60StaticEntries new file mode 100644 index 0000000..beaeb58 --- /dev/null +++ b/root/etc/e-smith/templates/etc/dhcpd.conf/60StaticEntries @@ -0,0 +1,27 @@ +{ + #------------------------------------------------------------ + # Static dhcp Entries + #------------------------------------------------------------ + use esmith::HostsDB; + my $hdb = esmith::HostsDB->open_ro(); + + foreach $host ($hdb->hosts) + { + my $InternalIP = $host->prop('InternalIP'); + next unless (defined($InternalIP) && ($InternalIP ne '')); + + my $MACAddress = $host->prop('MACAddress'); + next unless ( defined($MACAddress) && ($MACAddress ne '')); + + my $Filename = $host->prop('Filename'); + + $OUT .= "\n"; + $OUT .= "host " . $host->key . " \{\n"; + defined($Filename) and $OUT .= " filename \"$Filename\";\n"; + $OUT .= " hardware ethernet $MACAddress;\n"; + $OUT .= " fixed-address $InternalIP;\n"; + $OUT .= "\}"; + $OUT .= "\n"; + } + undef; # We need a return value +} diff --git a/root/etc/e-smith/tests/50-hosts/.dummy b/root/etc/e-smith/tests/50-hosts/.dummy new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/e-smith/tests/50-hosts/configuration.conf b/root/etc/e-smith/tests/50-hosts/configuration.conf new file mode 100644 index 0000000..f25177c --- /dev/null +++ b/root/etc/e-smith/tests/50-hosts/configuration.conf @@ -0,0 +1,104 @@ +# DO NOT MODIFY THIS FILE. +# This file is automatically maintained by the Mitel Networks SME Server +# configuration software. Manually editing this file may put your +# system in an unknown state. +# +# updated: Tue Apr 16 08:41:42 2002 +AccessType=dedicated +ActiveAccounts=0 +AdminEmail= +ConsoleMode=auto +ContactEmail= +ContactName= +ContactOrg= +DNSPrimaryIP= +DNSSecondaryIP= +DialupConnOffice=long +DialupConnOutside=long +DialupConnWeekend=long +DialupFreqOffice=every15min +DialupFreqOutside=everyhour +DialupFreqWeekend=everyhour +DialupModemDevice=/dev/ttyS1 +DialupPhoneNumber= +DialupUserAccount=useraccount +DialupUserPassword=userpassword +DomainName=nssg.mitel.com +EmailUnknownUser=return +EthernetDriver1=pcnet32 +EthernetDriver2=unknown +ExternalDHCP=off +ExternalNetmask=255.255.255.0 +GatewayIP=10.33.15.1 +LocalIP=10.33.15.127 +LocalNetmask=255.255.255.0 +MinUid=5000 +NOCType=undefined +PasswordSet=yes +PreviousConfiguration=/home/e-smith/db/configuration.previous +SMTPSmartHost= +SambaDomainMaster=no +SambaServerName=mitel-networks-server +SambaWorkgroup=mitel-networks +ServiceAccountId= +ServiceDomainName= +ServiceTargetIP= +SquidParent= +SquidParentPort= +StatusReports=off +SystemMode=serveronly +SystemName=chocky +TimeZone=US/Eastern +UnsavedChanges=no +atalk=service|InitscriptOrder|91|status|enabled +auth=service|access|public|status|enabled +blades=service|Host|service.e-smith.com|status|enabled +bootstrap-console=service|InitscriptOrder|35|Run|no|status|enabled +branding=service|modified|000000000000|status|enabled +broker=service|DbHost|localhost|DbPass|nocpassword|DbPort|3306|DbUser|nocuser +crond=service|InitscriptOrder|40|status|enabled +ctrlaltdel=service|status|enabled +dhcpd=service|InitscriptOrder|65|end|10.33.15.250|start|10.33.15.65|status|disabled +diald=service|InitscriptOrder|57|status|disabled +fetchmail=service|FreqOffice|every5min|FreqOutside|every30min|FreqWeekend|never|Method|standard|SecondaryMailAccount|popaccount|SecondaryMailPassword|poppassword|SecondaryMailServer|mail.myisp.xxx|status|disabled +flexbackup=backupservice|erase_rewind_only|true +ftp=service|access|private|accessLimits|off|status|enabled +hdparm=service|InitscriptOrder|40|status|disabled +horde=service|status|disabled +httpd-admin=service|InitscriptOrder|86|status|enabled +httpd-e-smith=service|InitscriptOrder|85|access|private|status|enabled +imap=service|access|private|status|enabled +imp=service|status|disabled +ippp=service|InitscriptOrder|55|status|enabled +ipsec=service|InitscriptOrder|90|PubKey|0sAQNRVkVir0fuYdTrXFJlWdQuBB3Z67JqdqjPJzIdxCec/ci4PgJ6nA6zsTe+VqVYzFwCz2MudYlEN0pzwMaNcXdFXhPXhb969klS90UhgB2OdImwqGtt++si/WJ9DT3NdGRFYIw1hPibd5NzjFi3fNVS4lW8oU4I4ic0q7vYVpXu2Q==|status|disabled +isdn=service|Protocol|2|UseSyncPPP|yes|status|disabled +keytable=service|InitscriptOrder|25|status|enabled +ldap=service|InitscriptOrder|80|access|private|defaultCity|Ottawa|defaultCompany|XYZ Corporation|defaultDepartment|Main|defaultPhoneNumber|555-5555|defaultStreet|123 Main Street|status|enabled +lilo=service|AddressMode|linear +local=service|InitscriptOrder|99|status|enabled +lpd=service|InitscriptOrder|60|status|enabled +mariadb=service|InitscriptOrder|90|status|enabled +masq=service|InitscriptOrder|06|Logging|none|Stealth|no|status|disabled +modSSL=service|status|enabled +mysql.init=service|InitscriptOrder|99|status|enabled +named=service|chroot|yes|status|enabled +network=service|InitscriptOrder|10|status|enabled +ntpd=service|InitscriptOrder|55|status|disabled +php=service|status|enabled +popd=service|access|private|status|enabled +pppoe=service|DemandIdleTime|no|InitscriptOrder|57|SynchronousPPP|no|status|disabled +pptpd=service|sessions|10|status|disabled +qmail=service|InitscriptOrder|80|status|enabled +random=service|InitscriptOrder|20|status|enabled +rsyslog=service|InitscriptOrder|05|status|enabled +scanner=service|ScannerFns|iscan|UpdateTime|24:17|scanMail|yes|status|enabled +smb=service|DomainMaster|no|InitscriptOrder|91|RoamingProfiles|no|ServerName|chocky|Workgroup|mitel-networks|status|enabled +smtpfwdd=service|InitscriptOrder|81|status|enabled +squid=service|InitscriptOrder|90|status|enabled +sshd=service|InitscriptOrder|85|PasswordAuthentication|yes|PermitRootLogin|yes|access|private|status|enabled +sync=service|Host|service.e-smith.com|LastId|0|SuccessId|0|SyncFrequency|1|SyncMinute|36|status|disabled +telnet=service|access|private|status|disabled +testing=service|destruction|0 +tinydns=service|InitscriptOrder|81|NOCServer|service.e-smith.com|Nameservers|ns1.e-smith.com,ns2.e-smith.com,ns3.e-smith.com,ns4.e-smith.com|PublishDomain|e-smith.net|SOA_Expiry|1048576|SOA_Minimum|2560|SOA_Refresh|16384|SOA_Retry|2048|status|enabled +twig=service|status|disabled +xinetd=service|InitscriptOrder|50|status|enabled diff --git a/root/etc/e-smith/tests/50-hosts/hosts.conf b/root/etc/e-smith/tests/50-hosts/hosts.conf new file mode 100644 index 0000000..3b95022 --- /dev/null +++ b/root/etc/e-smith/tests/50-hosts/hosts.conf @@ -0,0 +1,10 @@ +# DO NOT MODIFY THIS FILE. +# This file is automatically maintained by the Mitel Networks SME Server +# configuration software. Manually editing this file may put your +# system in an unknown state. +# +# updated: Wed May 8 09:45:28 2002 +bar.invalid.tld=host|ExternalIP||HostType|Self|InternalIP||MACAddress||Visibility|Local +baz.invalid.tld=host|ExternalIP||HostType|Self|InternalIP||MACAddress||Visibility|Local +foo.invalid.tld=host|ExternalIP||HostType|Self|InternalIP||MACAddress||Visibility|Local +wibble.invalid.tld=host|ExternalIP|InternalIP|MACAddress||Visibility|self diff --git a/root/etc/e-smith/web/functions/hostentries b/root/etc/e-smith/web/functions/hostentries new file mode 100755 index 0000000..00fa357 --- /dev/null +++ b/root/etc/e-smith/web/functions/hostentries @@ -0,0 +1,137 @@ +#!/usr/bin/perl -wT +# vim: set ft=xml: + +#---------------------------------------------------------------------- +# heading : Configuration +# description : Hostnames and addresses +# navigation : 6000 6500 +#---------------------------------------------------------------------- +#---------------------------------------------------------------------- +# copyright (C) 2002 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. +#---------------------------------------------------------------------- + +use strict; +use esmith::FormMagick::Panel::hostentries; +my $fm = esmith::FormMagick::Panel::hostentries->new(); +$fm->display(); + +=begin testing + +use esmith::FormMagick::Tester; +use esmith::TestUtils; +use esmith::TestUtils; +use esmith::ConfigDB; +use esmith::AccountsDB; + +my $panel = $Original_File; +my $ua = esmith::FormMagick::Tester->new(); + +my $c = esmith::ConfigDB->open(); +my $a = esmith::AccountsDB->open(); + +is (mode($panel), '4750', "Check permissions on script"); +ok ($ua->get_panel($panel), "ABOUT TO RUN L10N TESTS"); +is ($ua->{status}, 200, "200 OK"); +#like($ua->{content}, qr/FORM_TITLE/, "Saw untranslated form title"); +ok ($ua->set_language("en-us"), "Set language to U.S. English"); +ok ($ua->get_panel($panel), "Get panel"); +is ($ua->{status}, 200, "200 OK"); +like($ua->{content}, qr/Hostnames and addresses/, "Saw translated form title"); + +ok ($ua->get_panel($panel), "ABOUT TO TEST CREATING HOST"); +ok ($ua->follow("Click here"), "Follow 'create host' link"); +is ($ua->{status}, 200, "200 OK"); +like($ua->{content}, qr/Create\/modify host/, "Saw page +title"); +like($ua->{content}, qr/Publish globally/, "Saw fields"); +like($ua->{content}, qr/Next/, "Saw next button"); + +ok ($ua->get_panel($panel), "ABOUT TO TEST MODIFYING HOST"); +ok ($ua->follow("Modify"), "Follow 'modify' link"); +is ($ua->{status}, 200, "200 OK"); + +ok ($ua->get_panel($panel), "ABOUT TO TEST REMOVING HOST"); +ok ($ua->follow("Remove"), "Follow 'remove' link"); +is ($ua->{status}, 200, "200 OK"); + + +=end testing + +=cut + + +__DATA__ +

+ + + + + CREATE_TITLE + + + + + + + + + + + + REMOVE_PAGE_DESCRIPTION + + + + + LOCAL_PAGE_DESCRIPTION + + + LOCAL_IP_DESCRIPTION + + + + ETHERNET_ADDRESS_DESCRIPTION + + + + + REMOTE_PAGE_DESCRIPTION + + + + + + + + CONFIRM_DESCRIPTION + + + +
diff --git a/root/etc/e-smith/web/panels/manager/cgi-bin/.gitignore b/root/etc/e-smith/web/panels/manager/cgi-bin/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/hostentries.pm b/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/hostentries.pm new file mode 100644 index 0000000..5f6a74c --- /dev/null +++ b/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/hostentries.pm @@ -0,0 +1,736 @@ +#!/usr/bin/perl -w + +#---------------------------------------------------------------------- +# copyright (C) 1999-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 +#---------------------------------------------------------------------- + +package esmith::FormMagick::Panel::hostentries; + +use strict; + +use esmith::FormMagick; +use esmith::ConfigDB; +use esmith::DomainsDB; +use esmith::HostsDB; +use esmith::NetworksDB; +use esmith::cgi; +use esmith::util; +use File::Basename; +use Exporter; +use Carp; +use Net::IPv4Addr; +use HTML::Entities; + +our @ISA = qw(esmith::FormMagick Exporter); + +our @EXPORT = qw( + print_hosts_tables + print_hostname_field + print_domain_field + domains_list + more_options + goto_confirm + print_confirmation_details + create_or_modify + lexicon_params + remove + mac_address_or_blank + not_in_dhcp_range + print_save_or_add_button + not_taken + must_be_local + hostname_or_ip +); + +our $VERSION = sprintf '%d.%03d', q$Revision: 1.54 $ =~ /: (\d+).(\d+)/; + +our $db = esmith::ConfigDB->open(); + +=pod + +=head1 NAME + +esmith::FormMagick::Panels::hostentries - useful panel functions + +=head1 SYNOPSIS + +use esmith::FormMagick::Panels::hostentries; + +my $panel = esmith::FormMagick::Panel::hostentries->new(); +$panel->display(); + +=head1 DESCRIPTION + +=head2 new(); + +Exactly as for esmith::FormMagick + +=begin testing + +$ENV{ESMITH_ACCOUNT_DB} = "10e-smith-base/accounts.conf"; +$ENV{ESMITH_CONFIG_DB} = "10e-smith-base/configuration.conf"; + +use_ok('esmith::FormMagick::Panel::hostentries'); +use vars qw($panel); +ok($panel = esmith::FormMagick::Panel::hostentries->new(), +"Create panel object"); +isa_ok($panel, 'esmith::FormMagick::Panel::hostentries'); + +=end testing + +=cut + +sub new +{ + shift; + my $self = esmith::FormMagick->new(); + $self->{calling_package} = (caller)[0]; + bless $self; + # Uncomment the next line for debugging. + #$self->debug(1); + return $self; +} + +=head2 hostname_or_ip + +Validation routine for the remote address field for network printers. + +=for testing +my $fm = esmith::FormMagick::Panel::hostentries->new(); +can_ok('main', 'hostname_or_ip'); +can_ok('CGI::FormMagick::Validator', 'ip_number'); +isnt(CGI::FormMagick::Validator::ip_number($fm, '1.2.3'), "OK", "ip_number works OK"); +like(CGI::FormMagick::Validator::ip_number($fm, '1.2.3'), qr(enough octets), "ip_number works OK"); +foreach ("1.2.3.4", "255.255.255.255", "foo.com", "foo.bar.com", "123.foo.xxx"){ + is(hostname_or_ip($fm, $_), "OK", "$_ should be OK"); +} +foreach ("1.2.3", "foo bar", "foo;bar;com", " ", undef) { + isnt(hostname_or_ip($fm, $_), "OK", "$_ should not be OK"); +} + +=cut + +sub hostname_or_ip +{ + my ($fm, $data) = @_; + if ($data =~ /^[\d\.]+$/) { + if (CGI::FormMagick::Validator::ip_number($fm, $data) eq "OK") + { + return "OK"; + } + else + { + return "MUST_BE_VALID_HOSTNAME_OR_IP"; + } + } + elsif ($data =~ /^([a-zA-Z0-9\.\-]+)$/ ) + { + return "OK"; + } + else + { + return "MUST_BE_VALID_HOSTNAME_OR_IP"; + } +} + +=head1 HTML GENERATION ROUTINES + +Routines for generating chunks of HTML needed by the panel. + +=for testing +use_ok('esmith::DomainsDB'); +my $d = esmith::DomainsDB->create(); +isa_ok($d, 'esmith::DomainsDB'); +can_ok($d, 'domains'); +#can_ok($d, 'get_by_prop'); + +=cut + +sub print_hosts_tables +{ + my $self = shift; + my $q = $self->{cgi}; + unless ($db) + { + $self->error('UNABLE_TO_OPEN_CONFIGDB', 'First'); + $self->print_status_message(); + return undef; + } + + unless (scalar @{$self->domains_list()}) + { + $self->success('DNS_FORWARDER_ENABLED', 'First'); + $self->print_status_message(); + return undef; + } + + print $q->start_Tr,"",$q->start_table ({-CLASS => "sme-noborders"}),"\n"; + print $q->start_Tr,"",$self->localise('ADD_HOSTNAME'),"",$q->end_Tr,"\n"; + + my $hosts_db = esmith::HostsDB->open(); + + foreach my $d (@{$self->domains_list()}) + { + print $q->start_Tr,"","\n"; + print $q->h3($self->localise('CURRENT_HOSTNAMES_FOR_DOMAIN', {domain => $d})),"\n"; + print "",$q->end_Tr,"\n"; + + if (my @hosts = $hosts_db->get_hosts_by_domain($d)) + { + print $q->start_Tr,"\n",$q->start_table ({-CLASS => "sme-border"}),"\n"; + print $q->Tr (esmith::cgi::genSmallCell($q, $self->localise('HOSTNAME'),"header"), + esmith::cgi::genSmallCell($q, $self->localise('LOCATION'),"header"), + esmith::cgi::genSmallCell($q, $self->localise('IP_ADDRESS_OR_FQDN'),"header"), + esmith::cgi::genSmallCell($q, $self->localise('ETHERNET_ADDRESS'),"header"), + esmith::cgi::genSmallCell($q, $self->localise('COMMENT'),"header"), + esmith::cgi::genSmallCell($q, $self->localise('ACTION'),"header",2)); + $self->print_host_row($_) foreach @hosts; + print $q->end_table, "\n"; + print "",$q->end_Tr,"\n"; + } + else + { + print $q->start_Tr,"\n"; + print $self->localise('NO_HOSTS_FOR_THIS_DOMAIN'); + print "",$q->end_Tr,"\n"; + } + } + print $q->end_table,"\n"; + return undef; +} + +=head2 $panel->print_table_headers() + +Prints the table header row for the hosts tables. + +=for testing +can_ok($panel, 'print_table_headers'); +can_ok($panel, 'localise'); +$panel->print_table_headers; +like($_STDOUT_, qr(HOSTNAME), "Printed table headers"); + +=cut + +sub print_table_headers +{ + +} + +sub print_host_row +{ + my ($self,$host_record) = @_; + my $q = $self->{cgi}; + my $ht = $host_record->prop('HostType'); + my $ip = + ($ht eq 'Self') ? $db->get_value('LocalIP') : + ($ht eq 'Remote') ? $host_record->prop('ExternalIP') : + $host_record->prop('InternalIP'); + + print $q->start_Tr; + + $self->print_td($host_record->key()); + $self->print_td($self->localise($host_record->prop('HostType')) || " "); + $self->print_td($ip); + $self->print_td($host_record->prop('MACAddress') || " "); + $self->print_td(HTML::Entities::encode($host_record->prop('Comment')) || " "); + my $static = $host_record->prop('static') || "no"; + if ($static ne 'yes') { + my $propstring = $self->build_host_cgi_params($host_record->key(), $host_record->props()); + $self->print_td(qq() + . $self->localise('MODIFY') + . qq(\n)); + $self->print_td(qq() + . $self->localise('REMOVE') + . qq(\n)); + } else { + $self->print_td(" "); + $self->print_td(" "); + } + print "\n"; +} + +=for testing +$panel->print_td("foo"); +like($_STDOUT_, qr(foo), "print_td"); + +=cut + +sub print_td +{ + my ($self, $value) = @_; + print "$value\n"; +} + +sub build_host_cgi_params { + my ($self, $hostname, %oldprops) = @_; + + my ($host, $domain) = $self->split_hostname($hostname); + + my %props = ( + page => 0, + page_stack => "", + ".id" => $self->{cgi}->param('.id') || "", + name => $host, + domain => $domain, + local_ip => $oldprops{InternalIP}, + global_ip => $oldprops{ExternalIP}, + ethernet_address => $oldprops{MACAddress}, + hosttype => $oldprops{HostType}, + comment => HTML::Entities::encode($oldprops{Comment}), + ); + + return $self->props_to_query_string(\%props); +} + +=for testing +my @expect = qw(foo bar.com); +is_deeply(\@expect, [$panel->split_hostname("foo.bar.com")], "Split hostname"); + +=cut + +sub split_hostname { + my ($self, $hostname) = @_; + return ($hostname =~ /^([^\.]+)\.(.+)$/); +} + +sub print_hostname_field { + my $fm = shift; + + print qq() . $fm->localise('HOSTNAME_DESCRIPTION') . qq(); + print qq() . $fm->localise('HOSTNAME') . qq(\n); + + my $h = $fm->{cgi}->param('name'); + + if ($h) { + print qq( + $h + + + + ); + } else { + print qq( + + + + ); + } + + print qq(\n); + return undef; + +} + +sub print_domain_field +{ + my $fm = shift; + print qq( ) ."\n". qq( ) . $fm->localise('DOMAIN') . qq(\n); + + my $h = $fm->{cgi}->param('name'); + my $dom = $fm->{cgi}->param('domain'); + if ($h) { + print qq( + $dom + + + ); + } else { + print qq( + + + \n); + } + + print qq( \n); + return undef; +} + +=head2 mac_address_or_blank + +Validation routine for optional ethernet address + +=for testing +can_ok('main', 'mac_address_or_blank'); +is(mac_address_or_blank(undef, ""), "OK", "blank mac address is OK"); +is(mac_address_or_blank(undef, "aa:bb:cc:dd:ee:ff"), "OK", "OK mac address is OK"); +isnt(mac_address_or_blank(undef, "blah"), "OK", "wrong mac address is not OK"); + +=cut + +sub mac_address_or_blank { + my ($fm, $data) = @_; + return "OK" unless $data; + return CGI::FormMagick::Validator::mac_address($fm, $data); +} + +=for testing +can_ok('main', 'domains_list'); + +=cut + +sub domains_list +{ + my $self = shift; + + my $d = esmith::DomainsDB->open_ro() or die "Couldn't open DomainsDB"; + + my @domains; + + for ($d->domains) + { + my $ns = $_->prop("Nameservers") || 'localhost'; + push @domains, $_->key if ($ns eq 'localhost'); + } + + return \@domains; +} + +=for testing +can_ok('main', 'more_options'); + +=cut + + +sub more_options +{ + my $self = shift; + my $q = $self->{cgi}; + my $hostsdb = esmith::HostsDB->open_ro; + + my $hostname = lc $q->param('name'); + my $domain = lc $q->param('domain'); + my $fqdn = "$hostname.$domain"; + my $comment = $q->param('comment'); + $self->cgi->param(-name=>'name', -value=>$hostname); + + unless ( $hostname =~ /^[a-z0-9][a-z0-9-]*$/ ) + { + return $self->error('HOSTNAME_VALIDATOR_ERROR'); + } + + unless ( $comment =~ /^([a-zA-Z0-9][\_\.\-,A-Za-z0-9\s]*)$/ || $comment eq '' ) + { + return $self->error('HOSTNAME_COMMENT_ERROR'); + } + # Look for duplicate hosts. + my $hostrec = undef; + if ($self->cgi->param('action') eq 'create' and $hostrec = $hostsdb->get($fqdn)) + { + return $self->error( + $self->localise('HOSTNAME_EXISTS_ERROR', + {fullHostName => $fqdn, + type => $hostrec->prop('HostType')})); + } + + my $hosttype = $self->cgi->param('hosttype'); + if ($hosttype eq 'Self') { + $self->wherenext('Confirm'); + } elsif ($hosttype eq 'Local') { + $self->wherenext('Local'); + } elsif ($hosttype eq 'Remote') { + $self->wherenext('Remote'); + } else { + $self->wherenext('Confirm'); + } +} + +=for testing +can_ok('main', 'goto_confirm'); + +=cut + +sub goto_confirm +{ + my $self = shift; + $self->wherenext('Confirm'); +} + +=for testing +can_ok('main', 'print_confirmation_details'); + +=cut + +sub print_confirmation_details { + my ($self) = @_; + my $q = $self->{cgi}; + print $q->start_table ({-CLASS => "sme-border"}),"\n"; + + my $type = $self->{cgi}->param('hosttype') || ''; + if ($type eq "Self") + { + $self->{cgi}->delete('local_ip'); + $self->{cgi}->delete('global_ip'); + $self->{cgi}->delete('ethernet_address'); + } + + if ($type eq "Remote") + { + $self->{cgi}->delete('local_ip'); + $self->{cgi}->delete('ethernet_address'); + } + + if ($type eq "Local") + { + $self->{cgi}->delete('global_ip'); + } + + my %label_map = ( + global_ip => "IP_ADDRESS_OR_FQDN", + local_ip => "IP_ADDRESS", + ); + foreach my $f (qw( name domain hosttype local_ip global_ip + ethernet_address comment) ) { + my $val = $self->cgi->param($f) || ''; + $self->debug_msg("looping on param $f, val is $val"); + next unless $val; + my $label = $label_map{$f} || uc($f); + print $q->Tr (esmith::cgi::genSmallCell($q, $self->localise($label),"normal"), + esmith::cgi::genSmallCell($q, HTML::Entities::encode($val),"normal")); + } + + print qq(); + + return ""; +} + +=head2 create_or_modify() + +This is the subroutine that does the actual work when you create/modify +a host. + +=begin testing + +#$ENV{ESMITH_HOSTS_DB} = scratch_copy("50-hosts/hosts.conf"); +$ENV{ESMITH_HOSTS_DB} = "50-hosts/hosts.conf"; + +ok($panel = esmith::FormMagick::Panel::hostentries->new(), +"Create panel object"); +isa_ok($panel, 'esmith::FormMagick::Panel::hostentries'); + +$panel->{cgi} = CGI->new({ + name => 'wibble', + domain => 'invalid.tld', + hosttype => 'Self', + action => 'create', +}); + +$panel->create_or_modify(); +isnt($panel->cgi->param('status_message'), undef, "Set status message"); + +my $h = esmith::HostsDB->open(); +ok($h->get('wibble.invalid.tld'), "Host added to db"); + +=end testing + +=cut + +sub create_or_modify { + my ($self) = @_; + $self->wherenext('First'); + my $h = esmith::HostsDB->open() || esmith::HostsDB->create(); + my $hostname = $self->cgi->param('name') . "." . + $self->cgi->param('domain'); + + # Untaint and lowercase $hostname + $hostname =~ /([\w\.-]+)/; $hostname = lc($1); + + my %props = ( + type => 'host', + HostType => $self->cgi->param('hosttype') || "", + ExternalIP => $self->cgi->param('global_ip') || "", + InternalIP => $self->cgi->param('local_ip') || "", + MACAddress => $self->cgi->param('ethernet_address') || "", + Comment => $self->cgi->param('comment') || "", + ); + + if ($self->cgi->param('action') eq 'create') { + if ($h->new_record($hostname, \%props)) { + if (system("/sbin/e-smith/signal-event", "host-create", $hostname) == 0) { + return $self->success('SUCCESSFULLY_CREATED'); + } + } + return $self->error('ERROR_WHILE_CREATING_HOST'); + } else { + my $record = $h->get($hostname); + if ($record->merge_props(%props)) { + if (system("/sbin/e-smith/signal-event", "host-modify", $hostname) == 0) { + return $self->success('SUCCESSFULLY_MODIFIED'); + } + } + $self->error('ERROR_WHILE_MODIFYING_HOST'); + } +} + +=head2 print_save_or_add_button() + +=cut + +sub print_save_or_add_button { + my ($self) = @_; + + if ($self->cgi->param('action') eq 'modify') { + $self->print_button("SAVE"); + } else { + $self->print_button("ADD"); + } +} + +=head2 remove() + +=for testing +can_ok('main', 'remove'); + +=cut + +sub remove { + my ($self) = @_; + $self->wherenext('First'); + my $h = esmith::HostsDB->open(); + my $hostname = $self->cgi->param('name') . "." . + $self->cgi->param('domain'); + + # Untaint $hostname before use in system() + $hostname =~ /([\w\.-]+)/; $hostname = $1; + + my $record = $h->get($hostname); + if ($record->delete()) { + if (system("/sbin/e-smith/signal-event", "host-delete", $hostname) == 0) { + return $self->success('SUCCESSFULLY_DELETED'); + } + } + return $self->error('ERROR_WHILE_DELETING_HOST'); +} + +=head2 lexicon_params() + +Provides lexicon parameters for interpolation. + +=for testing +can_ok('main', 'lexicon_params'); +my $panel = esmith::FormMagick::Panel::hostentries->new(); +my %expect = ( + hostname => 'wibble', + domain => 'invalid.tld' +); +$panel->{cgi} = CGI->new({ + name => 'wibble', + domain => 'invalid.tld' +}); +is_deeply({lexicon_params($panel)}, \%expect, "Get lexicon params"); + +=cut + +sub lexicon_params { + my ($self) = @_; + return ( + hostname => $self->cgi->param('name') || "", + domain => $self->cgi->param('domain') || "", + ); +} + +sub not_in_dhcp_range +{ + my $self = shift; + my $address = shift; + my $status = $db->get('dhcpd')->prop('status') || "disabled"; + return "OK" unless $status eq "enabled"; + my $start = $db->get('dhcpd')->prop('start'); + my $end = $db->get('dhcpd')->prop('end'); + return (esmith::util::IPquadToAddr($start) + <= esmith::util::IPquadToAddr($address) + && + esmith::util::IPquadToAddr($address) + <= esmith::util::IPquadToAddr($end)) ? + "ADDR_IN_DHCP_RANGE" : + "OK"; +} + +=head2 not_taken + +This function checks the local ip address being set in the panel, and +ensures that it is not already taken as the gateway ip or the local ip +of the server. + +=cut + +sub not_taken +{ + my $self = shift; + my $q = $self->{cgi}; + my $localip = $q->param('local_ip'); + + my $server_localip = $db->get_value('LocalIP') || ''; + my $server_gateway = $db->get_value('GatewayIP') || ''; + my $server_extip = $db->get_value('ExternalIP') || ''; + + $self->debug_msg("\$localip is $localip"); + $self->debug_msg("\$server_localip is $server_localip"); + $self->debug_msg("\$server_gateway is $server_gateway"); + $self->debug_msg("\$server_extip is $server_extip"); + + if ($localip eq $server_localip) + { + return 'ERR_IP_IS_LOCAL_OR_GATEWAY'; + } + elsif ($localip eq $server_gateway) + { + return 'ERR_IP_IS_LOCAL_OR_GATEWAY'; + } + elsif (($db->get_value('SystemMode') ne 'serveronly') && + ($server_extip eq $localip)) + { + return 'ERR_IP_IS_LOCAL_OR_GATEWAY'; + } + elsif ($localip eq '127.0.0.1') + { + return 'ERR_IP_IS_LOCAL_OR_GATEWAY'; + } + else + { + return 'OK'; + } +} + +sub must_be_local +{ + my $self = shift; + my $q = $self->{cgi}; + my $localip = $q->param('local_ip'); + + # Make sure that the IP is indeed local. + my $ndb = esmith::NetworksDB->open_ro; + my @local_list = $ndb->local_access_spec; + + foreach my $spec (@local_list) + { + next if $spec eq '127.0.0.1'; + if (eval{Net::IPv4Addr::ipv4_in_network($spec, $localip)}) + { + return 'OK'; + } + } + # Not OK. The IP is not on any of our local networks. + return 'ERR_IP_NOT_LOCAL'; +} + +1;