chore: initial import from KNEL/PFVCluster@041d311 [#769]
Split per O&M lane work order. Full history: KNEL/PFVCluster. https://projects.knownelement.com/issues/769#note-4152
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# Refs only — real values live in ~/.creds (0600), never in repos.
|
||||
# Example: this repo's CLIs read env files at runtime, e.g.
|
||||
# docker run --rm --env-file ~/.creds/redmine.env ...
|
||||
@@ -0,0 +1,17 @@
|
||||
# ShellCheck configuration for PFVCluster
|
||||
# (used when running `shellcheck` directly; tests/shellcheck.sh applies the
|
||||
# same disables via -e for consistent results under Docker)
|
||||
#
|
||||
# These checks are DISABLED because they flag intentional conventions of this
|
||||
# codebase, not bugs:
|
||||
#
|
||||
# SC1090 / SC1091 — cannot follow dynamically-computed `source` paths. The KNEL
|
||||
# framework (vendor/) and test harness source helpers via computed include
|
||||
# dirs, which shellcheck cannot resolve statically.
|
||||
# SC2029 — ssh orchestration (tests/remote.sh and perf/k8s/dns scripts)
|
||||
# deliberately builds and expands the remote command on the CLIENT side before
|
||||
# sending it. That is the whole point of the single-chokepoint remote pattern.
|
||||
disable=SC1090,SC1091,SC2029
|
||||
|
||||
# Treat external-sourced files as bash (matches #!/usr/bin/env bash framework).
|
||||
external-sources=true
|
||||
@@ -0,0 +1,8 @@
|
||||
# AGENTS.md — netinfra
|
||||
|
||||
Point of truth for fleet-wide agent policy: the workspace AGENTS.md in KNEL/PFVCluster (loaded globally). This file holds repo-specific notes only.
|
||||
|
||||
- Ticket gate: `echo '#NNN' > .crush/active-ticket` before any modification; reference [\#694] + [#769].
|
||||
- Remote access: SSH chokepoints only — tests/remote.sh (PFVCluster) or netinfra/dns-cluster-setup/remote-dns.sh in THIS repo; DNS names only, never IP literals.
|
||||
- Docs: Discourse topic https://community.turnsys.com/t/306 — keep README pointer current.
|
||||
- shellcheck zero-warning (incl. info) via `bash tests/shellcheck.sh`.
|
||||
@@ -0,0 +1,235 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||
|
||||
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 them 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.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Affero 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 that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
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.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
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 state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
FetchApply
|
||||
Copyright (C) 2024 VpTechnicalOperations
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,50 @@
|
||||
# Makefile — convenience dispatch to scripts/.
|
||||
#
|
||||
# Not required. The scripts in scripts/ are the real entry points and work
|
||||
# standalone. This file just gives you short verbs if you're at a terminal.
|
||||
#
|
||||
# In Mode 2 (Hermes/OWUI/MCP), agents call the scripts directly or via API —
|
||||
# they don't need this file.
|
||||
|
||||
# Project-specific overrides for check-rules.sh
|
||||
export PROJECT_DOC_EXEMPT ?= AGENTS.md STATUS.md WORKING.md README.md ADOPTING.md LICENSE .env.example questions-v1.md BASELINE-PROMPT.md PATTERNS.md
|
||||
export PROJECT_DISCOURSE_HOST ?= community.turnsys.com
|
||||
|
||||
.PHONY: setup validate fast lint test garden up down status clean help
|
||||
|
||||
help: ## Show available targets
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
setup: ## Install git hooks
|
||||
@bash scripts/setup-hooks.sh
|
||||
|
||||
validate: ## Full rule audit (includes tests)
|
||||
@bash scripts/check-rules.sh
|
||||
|
||||
fast: ## Fast rule audit (pre-commit equivalent)
|
||||
@bash scripts/check-rules.sh --fast
|
||||
|
||||
lint: ## Lint shell scripts (shellcheck via docker)
|
||||
@docker run --rm -v "$$(pwd):/mnt" koalaman/shellcheck:stable \
|
||||
$$(find . -path ./.git -prune -o -path ./.tmp -prune -o -path ./vendor -prune -o -path ./node_modules -prune -o \( -name '*.sh' -o -name '*.bash' \) -print | sed 's|^\./|/mnt/|') || true
|
||||
|
||||
test: ## Run the test suite (override per project)
|
||||
@bash scripts/test.sh
|
||||
|
||||
garden: ## Doc-sprawl / Discourse-migration report
|
||||
@bash scripts/garden.sh
|
||||
|
||||
up: ## Bring up the docker-compose stack
|
||||
@bash scripts/up.sh
|
||||
|
||||
down: ## Bring down the docker-compose stack
|
||||
@bash scripts/down.sh
|
||||
|
||||
status: ## Show repo status snapshot
|
||||
@echo "== branch =="; git branch --show-current 2>/dev/null || echo "(no branch)"
|
||||
@echo "== last commit =="; git log --oneline -1 2>/dev/null || true
|
||||
@echo "== working tree =="; git status --short 2>/dev/null || echo "(not a git repo)"
|
||||
@echo "== STATUS.md head =="; sed -n '1,12p' STATUS.md 2>/dev/null || echo "(no STATUS.md)"
|
||||
|
||||
clean: ## Remove build/test artifacts (override per project)
|
||||
@echo "make clean: nothing to clean — override this in your project's Makefile."
|
||||
@@ -0,0 +1,14 @@
|
||||
# netinfra
|
||||
|
||||
> **Docs live on Discourse — this repo is the executable source of truth.**
|
||||
> **Topic:** https://community.turnsys.com/t/306
|
||||
> **Redmine:** https://projects.knownelement.com/issues/694 · **Split from** KNEL/PFVCluster@041d311 per [#769](https://projects.knownelement.com/issues/769)
|
||||
|
||||
DNS (Technitium + Pi-hole), DHCP (dhcpd pair), NTP, DNS cluster replication, switch console captures. Git SoR for Technitium zone snapshots — drift-check must print ALL IN SYNC before any DNS-adjacent push. [\#694]
|
||||
|
||||
## Layout
|
||||
- `scripts/` — rule engine + hooks (see `bash scripts/check-rules.sh --fast`)
|
||||
- (imported content at repo root, mirroring its PFVCluster path layout)
|
||||
|
||||
## Provenance
|
||||
Code imported from KNEL/PFVCluster (041d311); full git history retained in PFVCluster. Enforcement layer copied per ADOPTING.md. IaC consumers: KNEL/KNELIAC references this repo.
|
||||
@@ -0,0 +1,4 @@
|
||||
# STATUS.md
|
||||
|
||||
> Operations status lives on Discourse: https://community.turnsys.com/t/297
|
||||
> This file is a pointer stub. Active ticket: [#769](https://projects.knownelement.com/issues/769) (repo split).
|
||||
Executable
+297
@@ -0,0 +1,297 @@
|
||||
#!/usr/bin/env bash
|
||||
# =============================================================================
|
||||
# audit-netboot.sh
|
||||
# -----------------------------------------------------------------------------
|
||||
# READ-ONLY audit of the reference node "pfv-netboot".
|
||||
#
|
||||
# Purpose: gather enough information to replicate its Pi-hole, Technitium DNS,
|
||||
# and NTP services onto pfv-netinfra-01 and pfv-netinfra-02.
|
||||
#
|
||||
# Guarantees:
|
||||
# * NO writes, NO installs, NO service restarts, NO network changes.
|
||||
# * Every command below is read-only (status, cat, ls, ss, ps, sqlite3 SELECT).
|
||||
#
|
||||
# Intended to be run as the "localuser" account on pfv-netboot:
|
||||
#
|
||||
# ssh localuser@pfv-netboot 'bash -s' < audit-netboot.sh > netboot-audit.txt
|
||||
#
|
||||
# or, if sudo is needed for a few reads, the script will try `sudo -n` for
|
||||
# specific files that are normally root-readable only. It will NEVER use sudo
|
||||
# to write or modify anything.
|
||||
# =============================================================================
|
||||
|
||||
set -u
|
||||
AUDIT_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
|
||||
# Helper: print a clearly delimited section header.
|
||||
section() {
|
||||
printf '\n========================================================================\n'
|
||||
printf 'SECTION: %s\n' "$1"
|
||||
printf '========================================================================\n'
|
||||
}
|
||||
|
||||
# Helper: read a file with sudo if needed, silently skip if missing.
|
||||
read_file() {
|
||||
local path="$1"
|
||||
if [ -r "$path" ]; then
|
||||
printf '--- %s (uid-readable) ---\n' "$path"
|
||||
cat "$path" 2>/dev/null
|
||||
elif sudo -n true 2>/dev/null; then
|
||||
if sudo -n test -e "$path"; then
|
||||
printf '--- %s (via sudo -n) ---\n' "$path"
|
||||
sudo -n cat "$path" 2>/dev/null
|
||||
else
|
||||
printf '--- %s : NOT FOUND ---\n' "$path"
|
||||
fi
|
||||
else
|
||||
printf '--- %s : NOT READABLE (no passwordless sudo) ---\n' "$path"
|
||||
fi
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
list_dir() {
|
||||
local path="$1"
|
||||
printf '--- ls -la %s ---\n' "$path"
|
||||
ls -la "$path" 2>/dev/null || sudo -n ls -la "$path" 2>/dev/null || printf '(cannot list %s)\n' "$path"
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
printf '##### AUDIT START %s #####\n' "$AUDIT_DATE"
|
||||
printf 'Audit host: %s\n' "$(hostname -f 2>/dev/null || hostname)"
|
||||
printf 'Audit user: %s\n' "$(id -un 2>/dev/null)"
|
||||
printf 'Script: audit-netboot.sh (READ-ONLY)\n'
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 1. System basics
|
||||
# -----------------------------------------------------------------------------
|
||||
section "1. SYSTEM BASICS"
|
||||
echo "-- uname --"; uname -a
|
||||
echo "-- /etc/os-release --"; cat /etc/os-release 2>/dev/null
|
||||
echo "-- uptime --"; uptime
|
||||
echo "-- timezone --"; timedatectl 2>/dev/null || cat /etc/timezone 2>/dev/null || date
|
||||
echo "-- arch --"; dpkg --print-architecture 2>/dev/null || uname -m
|
||||
echo "-- memory --"; free -h 2>/dev/null
|
||||
echo "-- disk --"; df -h / 2>/dev/null
|
||||
echo "-- cpu count --"; nproc 2>/dev/null
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 2. Network configuration
|
||||
# -----------------------------------------------------------------------------
|
||||
section "2. NETWORK"
|
||||
echo "-- hostname --"; hostname; hostname -f 2>/dev/null; hostname -I 2>/dev/null
|
||||
echo "-- ip addr --"; ip -br addr 2>/dev/null; echo; ip addr 2>/dev/null
|
||||
echo "-- default route --"; ip route 2>/dev/null
|
||||
echo "-- /etc/resolv.conf --"; cat /etc/resolv.conf 2>/dev/null
|
||||
echo "-- /etc/hosts --"; cat /etc/hosts 2>/dev/null
|
||||
echo "-- listening TCP/UDP sockets --"
|
||||
ss -tlnup 2>/dev/null || sudo -n ss -tlnup 2>/dev/null
|
||||
echo "-- /etc/network/interfaces --"; cat /etc/network/interfaces 2>/dev/null
|
||||
echo "-- netplan --"; ls -la /etc/netplan/ 2>/dev/null; for f in /etc/netplan/*.yaml; do [ -e "$f" ] && { echo "--- $f ---"; cat "$f"; }; done 2>/dev/null
|
||||
echo "-- systemd-networkd --"; ls -la /etc/systemd/network/ 2>/dev/null; networkctl status 2>/dev/null | head -40
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 3. DNS / DHCP / NTP related systemd units
|
||||
# -----------------------------------------------------------------------------
|
||||
section "3. RELEVANT SYSTEMD UNITS"
|
||||
echo "-- all units matching dns|pihole|dnsmasq|technitium|ftl|ntp|chrony|timesync --"
|
||||
systemctl list-units --type=service --all --no-pager 2>/dev/null \
|
||||
| grep -Ei 'pihole|dnsmasq|ftl|technitium|dns|ntp|chrony|timesync|resolv|resolved' || true
|
||||
echo "-- unit files (enabled state) --"
|
||||
systemctl list-unit-files --no-pager 2>/dev/null \
|
||||
| grep -Ei 'pihole|dnsmasq|ftl|technitium|dns|ntp|chrony|timesync|resolv|resolved' || true
|
||||
echo "-- installed packages of interest --"
|
||||
dpkg -l 2>/dev/null | grep -Ei 'pihole|dnsmasq|ftl|technitium|ntp|chrony|timesync|unbound|resolved|resolvconf' || true
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 4. NTP service details
|
||||
# -----------------------------------------------------------------------------
|
||||
section "4. NTP"
|
||||
echo "-- chrony --"
|
||||
systemctl status chrony --no-pager 2>/dev/null | head -15 || echo "(no chrony unit)"
|
||||
read_file /etc/chrony/chrony.conf
|
||||
echo "-- chronyc sources/stats (if available) --"
|
||||
chronyc -n sources 2>/dev/null || sudo -n chronyc -n sources 2>/dev/null || true
|
||||
chronyc -n tracking 2>/dev/null || sudo -n chronyc -n tracking 2>/dev/null || true
|
||||
|
||||
echo "-- ntpsec / ntp classic --"
|
||||
systemctl status ntp --no-pager 2>/dev/null | head -15 || echo "(no ntp unit)"
|
||||
systemctl status ntpsec --no-pager 2>/dev/null | head -15 || true
|
||||
read_file /etc/ntp.conf
|
||||
read_file /etc/ntpsec/ntp.conf
|
||||
|
||||
echo "-- systemd-timesyncd --"
|
||||
systemctl status systemd-timesyncd --no-pager 2>/dev/null | head -15 || echo "(no timesyncd)"
|
||||
read_file /etc/systemd/timesyncd.conf
|
||||
|
||||
echo "-- openntpd --"
|
||||
systemctl status openntpd --no-pager 2>/dev/null | head -15 || true
|
||||
read_file /etc/openntpd/ntpd.conf
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 5. Docker (Pi-hole and/or Technitium may be containerized)
|
||||
# -----------------------------------------------------------------------------
|
||||
section "5. DOCKER"
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
echo "-- docker version --"; docker version 2>/dev/null || sudo -n docker version 2>/dev/null || true
|
||||
echo "-- containers (running) --"; docker ps 2>/dev/null || sudo -n docker ps 2>/dev/null || true
|
||||
echo "-- containers (all) --"; docker ps -a 2>/dev/null || sudo -n docker ps -a 2>/dev/null || true
|
||||
echo "-- images --"; docker images 2>/dev/null || sudo -n docker images 2>/dev/null || true
|
||||
echo "-- volumes --"; docker volume ls 2>/dev/null || sudo -n docker volume ls 2>/dev/null || true
|
||||
echo "-- networks --"; docker network ls 2>/dev/null || sudo -n docker network ls 2>/dev/null || true
|
||||
else
|
||||
echo "(docker not installed / not on PATH)"
|
||||
fi
|
||||
echo "-- compose files in common locations --"
|
||||
for d in /etc/docker-compose /opt/docker-compose /root/docker-compose /home/localuser/docker-compose /srv/docker-compose /opt/pihole /opt/technitium /opt; do
|
||||
if sudo -n test -d "$d" 2>/dev/null || [ -d "$d" ]; then
|
||||
echo "### $d ###"
|
||||
sudo -n ls -la "$d" 2>/dev/null || ls -la "$d" 2>/dev/null || true
|
||||
for f in docker-compose.yml docker-compose.yaml compose.yml compose.yaml; do
|
||||
if sudo -n test -f "$d/$f" 2>/dev/null; then
|
||||
read_file "$d/$f"
|
||||
elif [ -f "$d/$f" ]; then
|
||||
read_file "$d/$f"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 6. Pi-hole
|
||||
# -----------------------------------------------------------------------------
|
||||
section "6. PI-HOLE"
|
||||
if command -v pihole >/dev/null 2>&1; then
|
||||
echo "-- pihole version --"; pihole -v 2>/dev/null || sudo -n pihole -v 2>/dev/null || true
|
||||
echo "-- pihole status --"; pihole status 2>/dev/null || sudo -n pihole status 2>/dev/null || true
|
||||
else
|
||||
echo "(pihole command not on PATH)"
|
||||
fi
|
||||
|
||||
echo "-- /etc/pihole listing --"
|
||||
list_dir /etc/pihole
|
||||
|
||||
# Key Pi-hole config files
|
||||
for f in \
|
||||
/etc/pihole/setupVars.conf \
|
||||
/etc/pihole/pihole-FTL.conf \
|
||||
/etc/pihole/adlists.list \
|
||||
/etc/pihole/whitelist.txt \
|
||||
/etc/pihole/blacklist.txt \
|
||||
/etc/pihole/regex.list \
|
||||
/etc/pihole/custom.list \
|
||||
/etc/pihole/local.list \
|
||||
/etc/pihole/hostnameMappings.txt \
|
||||
/etc/pihole/dhcp.leases \
|
||||
/etc/pihole/static_ip.conf \
|
||||
/etc/pihole/GitHubVersions \
|
||||
/etc/pihole/macvendor.db ; do
|
||||
read_file "$f"
|
||||
done
|
||||
|
||||
echo "-- /etc/pihole/*.conf (all) --"
|
||||
for f in /etc/pihole/*.conf; do [ -e "$f" ] && read_file "$f"; done 2>/dev/null
|
||||
|
||||
echo "-- /etc/dnsmasq.d listing --"
|
||||
list_dir /etc/dnsmasq.d
|
||||
for f in /etc/dnsmasq.d/*; do [ -e "$f" ] && read_file "$f"; done 2>/dev/null
|
||||
|
||||
echo "-- /etc/dnsmasq.conf (if present) --"
|
||||
read_file /etc/dnsmasq.conf
|
||||
|
||||
echo "-- gravity.db schema + row counts (Pi-hole v5+) --"
|
||||
GRAVITY=""
|
||||
for g in /etc/pihole/gravity.db /etc/pihole/gravity.db.*; do
|
||||
if [ -e "$g" ]; then GRAVITY="$g"; break; fi
|
||||
done
|
||||
if [ -n "${GRAVITY:-}" ]; then
|
||||
echo "gravity.db = $GRAVITY"
|
||||
if command -v sqlite3 >/dev/null 2>&1; then
|
||||
sqlite3 -readonly "$GRAVITY" ".tables" 2>/dev/null || sudo -n sqlite3 -readonly "$GRAVITY" ".tables" 2>/dev/null || true
|
||||
for tbl in adlist adlist_by_group domainlist domainlist_by_group client client_by_group group info; do
|
||||
cnt=$(sqlite3 -readonly "$GRAVITY" "SELECT COUNT(*) FROM $tbl;" 2>/dev/null || sudo -n sqlite3 -readonly "$GRAVITY" "SELECT COUNT(*) FROM $tbl;" 2>/dev/null || echo "n/a")
|
||||
printf 'gravity.%s count = %s\n' "$tbl" "$cnt"
|
||||
done
|
||||
echo "-- adlist entries (url, enabled, comment) --"
|
||||
sqlite3 -readonly "$GRAVITY" "SELECT id,address,enabled,comment FROM adlist;" 2>/dev/null \
|
||||
|| sudo -n sqlite3 -readonly "$GRAVITY" "SELECT id,address,enabled,comment FROM adlist;" 2>/dev/null || true
|
||||
echo "-- domainlist sample (first 50) --"
|
||||
sqlite3 -readonly "$GRAVITY" "SELECT id,type,domain,enabled,comment FROM domainlist LIMIT 50;" 2>/dev/null \
|
||||
|| sudo -n sqlite3 -readonly "$GRAVITY" "SELECT id,type,domain,enabled,comment FROM domainlist LIMIT 50;" 2>/dev/null || true
|
||||
echo "-- client list --"
|
||||
sqlite3 -readonly "$GRAVITY" "SELECT id,ip,comment FROM client;" 2>/dev/null \
|
||||
|| sudo -n sqlite3 -readonly "$GRAVITY" "SELECT id,ip,comment FROM client;" 2>/dev/null || true
|
||||
echo "-- group list --"
|
||||
sqlite3 -readonly "$GRAVITY" "SELECT id,name,enabled,comment FROM 'group';" 2>/dev/null \
|
||||
|| sudo -n sqlite3 -readonly "$GRAVITY" "SELECT id,name,enabled,comment FROM 'group';" 2>/dev/null || true
|
||||
echo "-- info table --"
|
||||
sqlite3 -readonly "$GRAVITY" "SELECT * FROM info;" 2>/dev/null \
|
||||
|| sudo -n sqlite3 -readonly "$GRAVITY" "SELECT * FROM info;" 2>/dev/null || true
|
||||
else
|
||||
echo "(sqlite3 not installed; gravity.db present at $GRAVITY)"
|
||||
fi
|
||||
else
|
||||
echo "(no gravity.db found)"
|
||||
fi
|
||||
|
||||
echo "-- lighttpd / pihole web admin --"
|
||||
systemctl status lighttpd --no-pager 2>/dev/null | head -15 || true
|
||||
read_file /etc/lighttpd/lighttpd.conf
|
||||
for f in /etc/lighttpd/conf-enabled/*; do [ -e "$f" ] && read_file "$f"; done 2>/dev/null
|
||||
|
||||
echo "-- pihole-FTL service --"
|
||||
systemctl status pihole-FTL --no-pager 2>/dev/null | head -20 || true
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 7. Technitium DNS
|
||||
# -----------------------------------------------------------------------------
|
||||
section "7. TECHNITIUM DNS"
|
||||
echo "-- technitium systemd unit --"
|
||||
systemctl status technitium-dns --no-pager 2>/dev/null | head -20 || echo "(no technitium-dns unit)"
|
||||
echo "-- any unit containing technitium --"
|
||||
systemctl list-units --all --no-pager 2>/dev/null | grep -i technitium || true
|
||||
echo "-- unit file path --"
|
||||
sudo -n systemctl cat technitium-dns 2>/dev/null || systemctl cat technitium-dns 2>/dev/null || true
|
||||
|
||||
# Technitium common install locations
|
||||
for d in /etc/technitium /etc/technitium/dns /opt/technitium /opt/technitium/dns /var/lib/technitium /usr/local/technitium; do
|
||||
echo "### checking $d ###"
|
||||
if sudo -n test -d "$d" 2>/dev/null || [ -d "$d" ]; then
|
||||
list_dir "$d"
|
||||
# recurse one level for config files
|
||||
for sub in "$d" "$d"/*; do
|
||||
[ -e "$sub" ] || continue
|
||||
if [ -f "$sub" ] && echo "$sub" | grep -Eq '\.(xml|json|conf|config|txt)$'; then
|
||||
read_file "$sub"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
echo "-- technitium config.xml / dnsServer.conf (search) --"
|
||||
sudo -n find /etc/technitium /opt/technitium /var/lib/technitium -maxdepth 4 \
|
||||
\( -name 'config.xml' -o -name '*.config' -o -name 'dnsServer.conf' -o -name 'blockList.txt' \) \
|
||||
-print 2>/dev/null || true
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 8. Firewall / SELinux / misc
|
||||
# -----------------------------------------------------------------------------
|
||||
section "8. FIREWALL & MISC"
|
||||
echo "-- nftables --"; sudo -n nft list ruleset 2>/dev/null | head -80 || true
|
||||
echo "-- iptables --"; sudo -n iptables -S 2>/dev/null | head -40 || true
|
||||
echo "-- ufw --"; sudo -n ufw status verbose 2>/dev/null || true
|
||||
echo "-- firewalld --"; systemctl status firewalld --no-pager 2>/dev/null | head -8 || true
|
||||
echo "-- selinux/apparmor --"; getenforce 2>/dev/null || echo "(SELinux not present)"; aa-status 2>/dev/null | head -5 || true
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 9. Cron / timers that maintain these services
|
||||
# -----------------------------------------------------------------------------
|
||||
section "9. CRON & TIMERS"
|
||||
echo "-- root crontab --"; sudo -n crontab -l 2>/dev/null || echo "(n/a)"
|
||||
echo "-- localuser crontab --"; crontab -l 2>/dev/null || echo "(none)"
|
||||
echo "-- /etc/cron.d --"; ls -la /etc/cron.d 2>/dev/null
|
||||
for f in /etc/cron.d/*pihole* /etc/cron.d/*technitium* /etc/cron.d/*gravity*; do
|
||||
[ -e "$f" ] && read_file "$f"
|
||||
done 2>/dev/null
|
||||
echo "-- pihole timer --"; systemctl list-timers --all --no-pager 2>/dev/null | grep -Ei 'pihole|gravity|technitium' || true
|
||||
|
||||
printf '\n##### AUDIT END %s #####\n' "$AUDIT_DATE"
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2012 # diagnostic baseline script; ls -la listings are intentional
|
||||
# baseline.sh — quick read-only baseline of a target node.
|
||||
set -u
|
||||
hdr() { printf '\n=== %s ===\n' "$1"; }
|
||||
hdr "WHO/SUDO"; id; echo "--- sudo -n ---"; sudo -n true 2>&1 && echo "sudo OK" || echo "sudo FAIL"
|
||||
hdr "OS"; cat /etc/os-release 2>/dev/null | grep PRETTY; uname -r
|
||||
hdr "NET"; hostname -I 2>/dev/null; ip -br addr 2>/dev/null; echo "-- tailscale --"; tailscale ip -4 2>/dev/null || echo "(tailscale CLI absent or no ip)"
|
||||
hdr "DISK/MEM"; df -h / 2>/dev/null | tail -2; free -h 2>/dev/null | head -2
|
||||
hdr "DOCKER"; docker --version 2>&1; sudo docker version --format '{{.Server.Version}}' 2>&1 | tail -1; id -nG | tr ' ' '\n' | grep -qx docker && echo "localuser IN docker group" || echo "localuser NOT in docker group"
|
||||
hdr "EXISTING RELEVANT SERVICES"; systemctl is-active docker 2>/dev/null; systemctl is-enabled docker 2>/dev/null
|
||||
hdr "PORTS 53/67/80/123/443/5380/53443"; ss -tlnup 2>/dev/null | grep -E ':53|:67|:80|:123|:443|:5380|:53443' || echo "(none of those ports listening)"
|
||||
hdr "EXISTING SERVICES DIRS"; ls -la /home/localuser/services 2>/dev/null || echo "(no ~/services)"; ls -la /root/pihole /root/NTP 2>/dev/null || sudo -n ls -la /root 2>/dev/null | head
|
||||
hdr "DNS RESOLV"; cat /etc/resolv.conf 2>/dev/null
|
||||
hdr "HOME"; ls -la /home/localuser 2>/dev/null | head
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
# deep-audit-netboot.sh — READ-ONLY deep inspection. Uses `sudo` for docker/root files.
|
||||
set -u
|
||||
DG="sudo docker"
|
||||
|
||||
hdr() { printf '\n=== %s ===\n' "$1"; }
|
||||
|
||||
hdr "COMPOSE FILES: /root/pihole and /root/NTP"
|
||||
for f in /root/pihole/docker-compose.yml /root/NTP/docker-compose.yml; do
|
||||
printf '\n--- %s ---\n' "$f"
|
||||
sudo cat "$f" 2>&1
|
||||
done
|
||||
|
||||
hdr "DIR LAYOUT of compose project dirs"
|
||||
sudo ls -la /root/pihole 2>&1
|
||||
sudo ls -la /root/NTP 2>&1
|
||||
sudo ls -la /root 2>&1
|
||||
|
||||
hdr "SEARCH entire FS for any technitium / dns compose files"
|
||||
sudo find / -xdev -maxdepth 6 \( -iname 'docker-compose.y*ml' -o -iname 'compose.y*ml' \) -print 2>/dev/null \
|
||||
| grep -Ei 'dns|technitium|tsys' || true
|
||||
|
||||
hdr "ALL CONTAINERS with compose labels"
|
||||
$DG ps -a --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\tWDIR={{.Label "com.docker.compose.project.working_dir"}}\tCFG={{.Label "com.docker.compose.project.config_files"}}\tSVC={{.Label "com.docker.compose.service"}}' 2>&1
|
||||
|
||||
hdr "DOCKER INSPECT pihole + tsys-ntp (and any dns/technitium container)"
|
||||
for c in $($DG ps -aq 2>/dev/null); do
|
||||
nm=$($DG inspect --format '{{.Name}} | image={{.Config.Image}} | proj={{index .Config.Labels "com.docker.compose.project"}}' "$c" 2>/dev/null)
|
||||
printf '\n###### %s ######\n' "$nm"
|
||||
$DG inspect "$c" 2>&1
|
||||
done
|
||||
|
||||
hdr "PI-HOLE internal config (sudo docker exec, READ-ONLY)"
|
||||
echo "-- ls /etc/pihole --"; $DG exec pihole ls -la /etc/pihole 2>&1 || true
|
||||
echo "-- ls /etc/dnsmasq.d --"; $DG exec pihole ls -la /etc/dnsmasq.d 2>&1 || true
|
||||
for f in setupVars.conf pihole-FTL.conf adlists.list custom.list local.list regex.list dhcp.leases static_ip.conf; do
|
||||
echo "--- /etc/pihole/$f ---"; $DG exec pihole cat "/etc/pihole/$f" 2>&1 || true
|
||||
done
|
||||
echo "-- /etc/dnsmasq.d/* --"
|
||||
# shellcheck disable=SC2016 # $f/$t expand inside the container's sh, not locally — single quotes are intentional
|
||||
$DG exec pihole sh -c 'for f in /etc/dnsmasq.d/*; do echo "--- $f ---"; cat "$f"; done' 2>&1 || true
|
||||
echo "-- pihole version --"; $DG exec pihole pihole -v 2>&1 || true
|
||||
echo "-- gravity row counts --"
|
||||
# shellcheck disable=SC2016 # $t expands inside the container's sh, not locally
|
||||
$DG exec pihole sh -c 'for t in adlist domainlist client "group" info; do printf "%s=" "$t"; sqlite3 /etc/pihole/gravity.db "SELECT COUNT(*) FROM $t;" 2>/dev/null; done' 2>&1 || true
|
||||
echo "-- adlist addresses --"
|
||||
$DG exec pihole sqlite3 /etc/pihole/gravity.db "SELECT address,enabled,comment FROM adlist;" 2>&1 || true
|
||||
echo "-- domainlist (allow+deny, first 60) --"
|
||||
$DG exec pihole sqlite3 /etc/pihole/gravity.db "SELECT type,domain,enabled,comment FROM domainlist LIMIT 60;" 2>&1 || true
|
||||
|
||||
hdr "CHRONY/NTP container config (tsys-ntp)"
|
||||
$DG exec tsys-ntp sh -c 'echo "--- chrony.conf ---"; cat /etc/chrony/chrony.conf 2>/dev/null || cat /etc/chrony.conf 2>/dev/null || echo none; echo "--- ls /etc ---"; ls -la /etc 2>/dev/null | head -30' 2>&1 || true
|
||||
$DG exec tsys-ntp chronyc -n sources 2>&1 || true
|
||||
$DG exec tsys-ntp chronyc -n tracking 2>&1 || true
|
||||
echo "-- bare metal ntpsec.conf --"; sudo cat /etc/ntpsec/ntp.conf 2>&1
|
||||
|
||||
hdr "TECHNITIUM volumes"
|
||||
for v in dns_tsys-dns-config dns_tyss-dns-config; do
|
||||
mnt=$($DG volume inspect --format '{{.Mountpoint}}' "$v" 2>/dev/null)
|
||||
printf '\n--- volume %s -> %s ---\n' "$v" "$mnt"
|
||||
[ -n "$mnt" ] || continue
|
||||
sudo find "$mnt" -maxdepth 4 -type f 2>/dev/null | head -80
|
||||
echo "-- config dir listing --"
|
||||
sudo ls -laR "$mnt"/config 2>/dev/null | head -60 || sudo ls -laR "$mnt" 2>/dev/null | head -60 || true
|
||||
echo "-- config.xml --"
|
||||
sudo cat "$mnt"/config/config.xml 2>/dev/null | head -250 || true
|
||||
done
|
||||
|
||||
hdr "DONE"
|
||||
@@ -0,0 +1,10 @@
|
||||
# netinfra/dhcp-migration.md
|
||||
|
||||
> **Documentation moved to Discourse — the canonical source of truth.**
|
||||
>
|
||||
> **DHCP migration to netinfra-01/02**
|
||||
>
|
||||
> **Read it here:** https://community.turnsys.com/t/306
|
||||
>
|
||||
> *Migrated 2026-08-06. This file is kept as a pointer for git-browsing context.
|
||||
> Do not update content here — edit the Discourse wiki topic instead.*
|
||||
@@ -0,0 +1,333 @@
|
||||
# dhcpd.conf — pfv-netinfra-01 (PRIMARY)
|
||||
# Migrated from pfv-netboot 2026-07-29
|
||||
# Managed via Webmin DHCP module
|
||||
#
|
||||
# FAILOVER: this node is PRIMARY; peer is pfv-netinfra-02 (192.168.3.253)
|
||||
# DESIGN [#420, founder ruling 2026-08-27]: DHCP failover = active/passive
|
||||
# hot standby (split 255: primary serves all hashes; secondary answers only
|
||||
# when primary unreachable for >3s via 'load balance max seconds').
|
||||
# DNS + NTP options hand out BOTH servers (active/active). Tailscale hosts
|
||||
# use 100.100.100.100 MagicDNS, redundant to both netinfra TS IPs.
|
||||
|
||||
# Global defaults
|
||||
option domain-name "knel.net";
|
||||
option domain-name-servers 192.168.3.252, 192.168.3.253;
|
||||
option ntp-servers 192.168.3.252, 192.168.3.253;
|
||||
|
||||
default-lease-time 600;
|
||||
max-lease-time 7200;
|
||||
|
||||
ddns-update-style none;
|
||||
authoritative;
|
||||
|
||||
# ----- failover peer (PRIMARY) -----
|
||||
failover peer "pfv-dhcp" {
|
||||
primary;
|
||||
address 192.168.3.252;
|
||||
port 647;
|
||||
peer address 192.168.3.253;
|
||||
peer port 647;
|
||||
max-response-delay 30;
|
||||
max-unacked-updates 10;
|
||||
mclt 600;
|
||||
split 255;
|
||||
load balance max seconds 3;
|
||||
}
|
||||
|
||||
# ----- subnet (shared /22) -----
|
||||
subnet 192.168.0.0 netmask 255.255.252.0 {
|
||||
option routers 192.168.3.254;
|
||||
option domain-name-servers 192.168.3.252, 192.168.3.253;
|
||||
option ntp-servers 192.168.3.252, 192.168.3.253;
|
||||
option domain-name "knel.net";
|
||||
authoritative;
|
||||
allow unknown-clients;
|
||||
|
||||
pool {
|
||||
failover peer "pfv-dhcp";
|
||||
range 192.168.0.1 192.168.3.200;
|
||||
}
|
||||
|
||||
# ---- host reservations (fixed-address; not subject to failover pool) ----
|
||||
|
||||
host pfv-r3-tor-mgmt-01 {
|
||||
hardware ethernet 00:14:22:69:1c:37;
|
||||
fixed-address 192.168.0.7;
|
||||
}
|
||||
host pfv-r3-tor-stor-01 {
|
||||
hardware ethernet 00:13:72:46:95:e4;
|
||||
fixed-address 192.168.0.9;
|
||||
}
|
||||
host pfv-printer {
|
||||
hardware ethernet 40:9f:38:b0:b5:2f;
|
||||
fixed-address 192.168.1.84;
|
||||
}
|
||||
host pfv-r2-tor-01 {
|
||||
hardware ethernet 00:0d:56:41:7a:4d;
|
||||
fixed-address 192.168.0.10;
|
||||
}
|
||||
host pfv-r5-core-01 {
|
||||
hardware ethernet a4:ba:db:6f:ce:28;
|
||||
fixed-address 192.168.0.12;
|
||||
}
|
||||
host upstairs-receiver {
|
||||
hardware ethernet 74:5e:1c:76:e2:60;
|
||||
fixed-address 192.168.0.21;
|
||||
}
|
||||
host ap-tablemount {
|
||||
hardware ethernet e0:63:da:36:73:39;
|
||||
fixed-address 192.168.3.54;
|
||||
}
|
||||
host ap-wallmount {
|
||||
hardware ethernet e0:63:da:33:bb:1d;
|
||||
fixed-address 192.168.1.182;
|
||||
}
|
||||
host pfv-consrv {
|
||||
hardware ethernet 00:60:2e:01:50:aa;
|
||||
fixed-address 192.168.3.56;
|
||||
}
|
||||
host pfv-garage-pdu-1 {
|
||||
hardware ethernet 00:c0:b7:7e:49:78;
|
||||
fixed-address 192.168.3.18;
|
||||
}
|
||||
host pfv-dvr {
|
||||
hardware ethernet 54:2b:57:37:a7:d9;
|
||||
fixed-address 192.168.3.84;
|
||||
}
|
||||
host appletv-livingroom {
|
||||
hardware ethernet d0:d2:b0:97:81:c2;
|
||||
fixed-address 192.168.1.81;
|
||||
}
|
||||
host pfv-stor1 {
|
||||
hardware ethernet 00:00:c0:34:0c:dc;
|
||||
fixed-address 192.168.1.166;
|
||||
}
|
||||
host stlp-3dscanner {
|
||||
hardware ethernet b8:27:eb:91:31:82;
|
||||
fixed-address 192.168.0.4;
|
||||
}
|
||||
host pfv-jetson-nano-1 {
|
||||
hardware ethernet 00:04:4b:e4:17:7b;
|
||||
fixed-address 192.168.3.186;
|
||||
}
|
||||
host pfv-tsys7-oob {
|
||||
hardware ethernet f8:bc:12:35:1e:c6;
|
||||
fixed-address 192.168.3.197;
|
||||
}
|
||||
host pfv-tsys6-oob {
|
||||
# 2026-08-27 #460: was a4:ba:db:0b:df:a0 (core-switch OUI mis-migrated from
|
||||
# pfv-netboot, never matched tsys6 iDRAC); corrected to live iDRAC6 MAC
|
||||
# 00:21:9b:a2:7c:5b read in-band via ipmitool lan print
|
||||
hardware ethernet 00:21:9b:a2:7c:5b;
|
||||
fixed-address 192.168.3.196;
|
||||
}
|
||||
host brother-label-printer {
|
||||
hardware ethernet 04:fe:a1:56:72:e2;
|
||||
fixed-address 192.168.3.52;
|
||||
}
|
||||
host pfv-bms {
|
||||
hardware ethernet 02:5A:39:38:3E:9F;
|
||||
fixed-address 192.168.3.12;
|
||||
}
|
||||
host stl-canon-scanner-artroom {
|
||||
hardware ethernet 74:38:b7:24:fa:4e;
|
||||
fixed-address 192.168.3.142;
|
||||
}
|
||||
host tsys-ucs-01 {
|
||||
hardware ethernet bc:24:11:86:ea:1a;
|
||||
fixed-address 192.168.2.51;
|
||||
}
|
||||
host tsys-ucs-02 {
|
||||
hardware ethernet bc:24:11:c8:da:34;
|
||||
fixed-address 192.168.2.54;
|
||||
}
|
||||
host dell-openmanage-enterprise {
|
||||
hardware ethernet bc:24:11:ac:f4:6b;
|
||||
fixed-address 192.168.2.113;
|
||||
}
|
||||
host pfv-rrinfra-rtr {
|
||||
hardware ethernet 00:1d:70:0b:4f:41;
|
||||
fixed-address 192.168.3.94;
|
||||
}
|
||||
host pfv-tsys1 {
|
||||
hardware ethernet 34:17:eb:b3:b1:2d;
|
||||
fixed-address 192.168.3.11;
|
||||
}
|
||||
host pfv-tsys3 {
|
||||
hardware ethernet a4:4c:c8:08:d1:b8;
|
||||
fixed-address 192.168.2.5;
|
||||
}
|
||||
host pfv-tsys4 {
|
||||
hardware ethernet 98:90:96:c4:96:9a;
|
||||
fixed-address 192.168.3.191;
|
||||
}
|
||||
host pfv-tsys5 {
|
||||
hardware ethernet 18:03:73:43:ce:de;
|
||||
fixed-address 192.168.0.20;
|
||||
}
|
||||
host pfv-tsys6 {
|
||||
hardware ethernet 00:21:9b:a2:7c:53;
|
||||
fixed-address 192.168.3.169;
|
||||
}
|
||||
host pfv-tsys7 {
|
||||
hardware ethernet f8:bc:12:34:e0:74;
|
||||
fixed-address 192.168.0.250;
|
||||
}
|
||||
host pfv-tsys9 {
|
||||
hardware ethernet a4:bb:6d:e3:56:86;
|
||||
fixed-address 192.168.3.58;
|
||||
}
|
||||
# umbrel
|
||||
host tsys-umbrel {
|
||||
hardware ethernet 02:2E:FF:8E:A2:D2;
|
||||
fixed-address 192.168.1.97;
|
||||
}
|
||||
# ultix-streaming
|
||||
host ultix-streaming {
|
||||
hardware ethernet bc:24:11:1a:8f:6f;
|
||||
fixed-address 192.168.3.78;
|
||||
}
|
||||
# ultix-highside
|
||||
host ultix-highside {
|
||||
hardware ethernet a0:4a:5e:ca:46:f3;
|
||||
fixed-address 192.168.3.32;
|
||||
}
|
||||
# pfv-k8s-cnode1
|
||||
host pfv-k8s-cnode1 {
|
||||
hardware ethernet bc:24:11:cb:97:10;
|
||||
fixed-address 192.168.1.91;
|
||||
}
|
||||
# pfv-k8s-cnode2
|
||||
host pfv-k8s-cnode2 {
|
||||
hardware ethernet bc:24:11:40:25:f8;
|
||||
fixed-address 192.168.3.113;
|
||||
}
|
||||
# pfv-k8s-cnode3
|
||||
host pfv-k8s-cnode3 {
|
||||
hardware ethernet bc:24:11:38:c0:58;
|
||||
fixed-address 192.168.1.228;
|
||||
}
|
||||
# devbox-cloudron
|
||||
host devbox-cloudron {
|
||||
hardware ethernet bc:24:11:f7:b1:07;
|
||||
fixed-address 192.168.1.6;
|
||||
}
|
||||
# hfnoc-uisp
|
||||
host hfnoc-uisp {
|
||||
hardware ethernet bc:24:11:a3:87:61;
|
||||
fixed-address 192.168.3.193;
|
||||
}
|
||||
# kali-rd
|
||||
host kali-rd {
|
||||
hardware ethernet bc:24:11:9e:1c:e9;
|
||||
fixed-address 192.168.2.37;
|
||||
}
|
||||
# kali-tsys
|
||||
host kali-tsys {
|
||||
hardware ethernet bc:24:11:16:22:d4;
|
||||
fixed-address 192.168.1.114;
|
||||
}
|
||||
}
|
||||
|
||||
# ---- host declarations outside subnet (global scope, same as netboot) ----
|
||||
|
||||
host pfv-r6-mgmt-01 {
|
||||
hardware ethernet 00:14:22:69:18:a7;
|
||||
fixed-address 192.168.0.8;
|
||||
}
|
||||
host pfv-r1-tor-top {
|
||||
hardware ethernet 00:23:ae:c1:ad:e8;
|
||||
fixed-address 192.168.0.11;
|
||||
}
|
||||
|
||||
# --- VM DHCP reservations (generated 2026-08-11, ticket #420) ---
|
||||
# All pinned to current ARP-observed IPs. No forward DNS needed
|
||||
# (forward records point to Tailscale 100.x addresses).
|
||||
|
||||
host tsys-ca {
|
||||
hardware ethernet bc:24:11:32:d0:36;
|
||||
fixed-address 192.168.1.181;
|
||||
}
|
||||
host pfv-netinfra-01 {
|
||||
hardware ethernet bc:24:11:65:b2:ac;
|
||||
fixed-address 192.168.3.252;
|
||||
}
|
||||
host pfv-netinfra-02 {
|
||||
hardware ethernet bc:24:11:e4:37:53;
|
||||
fixed-address 192.168.3.253;
|
||||
}
|
||||
host tsys-librenms {
|
||||
hardware ethernet bc:24:11:5c:96:1e;
|
||||
fixed-address 192.168.3.176;
|
||||
}
|
||||
host tsys-proxmox-datacenter {
|
||||
hardware ethernet bc:24:11:e6:03:2d;
|
||||
fixed-address 192.168.2.44;
|
||||
}
|
||||
host pfv-k8s-wnode-tsys3 {
|
||||
hardware ethernet bc:24:11:ee:7e:7b;
|
||||
fixed-address 192.168.1.98;
|
||||
}
|
||||
host pfv-proxmox-backup-server {
|
||||
hardware ethernet bc:24:11:6e:12:69;
|
||||
fixed-address 192.168.2.193;
|
||||
}
|
||||
host pfv-k8s-wnode-tsys5 {
|
||||
hardware ethernet bc:24:11:c7:a8:6c;
|
||||
fixed-address 192.168.1.5;
|
||||
}
|
||||
host preprod-hfnoc-uisp {
|
||||
hardware ethernet bc:24:11:74:d6:8a;
|
||||
fixed-address 192.168.3.192;
|
||||
}
|
||||
host tsys-awx {
|
||||
hardware ethernet bc:24:11:80:0d:16;
|
||||
fixed-address 192.168.3.115;
|
||||
}
|
||||
host pfv-rr-middleware-02 {
|
||||
hardware ethernet bc:24:11:96:0e:ee;
|
||||
fixed-address 192.168.1.117;
|
||||
}
|
||||
host tsys-proxmox-mailgw-01 {
|
||||
hardware ethernet bc:24:11:56:61:18;
|
||||
fixed-address 192.168.1.11;
|
||||
}
|
||||
host pfv-k8s-wnode-tsys7 {
|
||||
hardware ethernet bc:24:11:30:b8:07;
|
||||
fixed-address 192.168.1.109;
|
||||
}
|
||||
host pfv-rr-middleware-01 {
|
||||
hardware ethernet bc:24:11:1e:61:cf;
|
||||
fixed-address 192.168.1.110;
|
||||
}
|
||||
host tsys-voip {
|
||||
hardware ethernet bc:24:11:23:ce:04;
|
||||
fixed-address 192.168.1.70;
|
||||
}
|
||||
host tsys-proxmox-mailgw-02 {
|
||||
hardware ethernet bc:24:11:5f:e5:2c;
|
||||
fixed-address 192.168.1.10;
|
||||
}
|
||||
host pfv-k8s-wnode-tsys6 {
|
||||
hardware ethernet bc:24:11:fa:6e:b5;
|
||||
fixed-address 192.168.1.111;
|
||||
}
|
||||
host tsys-siem {
|
||||
hardware ethernet bc:24:11:ee:67:e2;
|
||||
fixed-address 192.168.1.223;
|
||||
}
|
||||
|
||||
# --- added 2026-08-26, ticket #420 (missing reservations) ---
|
||||
host pfv-k8s-wnode-tsys9 { hardware ethernet BC:24:11:EE:2B:B6; fixed-address 192.168.1.104; }
|
||||
host stlpc-artroom { hardware ethernet ca:fe:0f:0e:b0:c3; fixed-address 192.168.3.87; }
|
||||
host stlpc-garage { hardware ethernet 96:86:dd:1b:81:5a; fixed-address 192.168.0.100; }
|
||||
host subopi3 { hardware ethernet b8:27:eb:11:47:b2; fixed-address 192.168.1.217; }
|
||||
host subopi-dev-3 { hardware ethernet b8:27:eb:1b:35:95; fixed-address 192.168.1.232; }
|
||||
host subopi-dev-4 { hardware ethernet dc:a6:32:d4:da:5e; fixed-address 192.168.1.231; }
|
||||
host pfvsvrpi { hardware ethernet b8:27:eb:c2:f8:9f; fixed-address 192.168.1.230; }
|
||||
|
||||
# --- added 2026-09-01, tickets #614/#629 (minisplit smart dongle) ---
|
||||
host pfv-minisplit-dongle { hardware ethernet c4:39:60:59:0c:01; fixed-address 192.168.1.149; }
|
||||
host pfv-dirigera { hardware ethernet 68:ec:8a:0e:36:69; fixed-address 192.168.3.123; }
|
||||
host pfv-wiz-bulb-1 { hardware ethernet cc:40:85:a4:d4:36; fixed-address 192.168.1.150; }
|
||||
host pfv-wiz-bulb-2 { hardware ethernet cc:40:85:a4:f8:22; fixed-address 192.168.1.151; }
|
||||
@@ -0,0 +1,332 @@
|
||||
# dhcpd.conf — pfv-netinfra-02 (SECONDARY)
|
||||
# Migrated from pfv-netboot 2026-07-29
|
||||
# Managed via Webmin DHCP module
|
||||
#
|
||||
# FAILOVER: this node is SECONDARY; peer is pfv-netinfra-01 (192.168.3.252)
|
||||
# DESIGN [#420, founder ruling 2026-08-27]: DHCP failover = active/passive
|
||||
# hot standby (primary split 255 serves all clients while healthy; this
|
||||
# node answers only when primary unreachable for >3s via
|
||||
# 'load balance max seconds 3').
|
||||
# DNS + NTP options hand out BOTH servers (active/active). Tailscale hosts
|
||||
# use 100.100.100.100 MagicDNS, redundant to both netinfra TS IPs.
|
||||
|
||||
# Global defaults
|
||||
option domain-name "knel.net";
|
||||
option domain-name-servers 192.168.3.252, 192.168.3.253;
|
||||
option ntp-servers 192.168.3.252, 192.168.3.253;
|
||||
|
||||
default-lease-time 600;
|
||||
max-lease-time 7200;
|
||||
|
||||
ddns-update-style none;
|
||||
authoritative;
|
||||
|
||||
# ----- failover peer (SECONDARY) -----
|
||||
failover peer "pfv-dhcp" {
|
||||
secondary;
|
||||
address 192.168.3.253;
|
||||
port 647;
|
||||
peer address 192.168.3.252;
|
||||
peer port 647;
|
||||
max-response-delay 30;
|
||||
max-unacked-updates 10;
|
||||
load balance max seconds 3;
|
||||
}
|
||||
|
||||
# ----- subnet (shared /22) -----
|
||||
subnet 192.168.0.0 netmask 255.255.252.0 {
|
||||
option routers 192.168.3.254;
|
||||
option domain-name-servers 192.168.3.252, 192.168.3.253;
|
||||
option ntp-servers 192.168.3.252, 192.168.3.253;
|
||||
option domain-name "knel.net";
|
||||
authoritative;
|
||||
allow unknown-clients;
|
||||
|
||||
pool {
|
||||
failover peer "pfv-dhcp";
|
||||
range 192.168.0.1 192.168.3.200;
|
||||
}
|
||||
|
||||
# ---- host reservations (fixed-address; not subject to failover pool) ----
|
||||
|
||||
host pfv-r3-tor-mgmt-01 {
|
||||
hardware ethernet 00:14:22:69:1c:37;
|
||||
fixed-address 192.168.0.7;
|
||||
}
|
||||
host pfv-r3-tor-stor-01 {
|
||||
hardware ethernet 00:13:72:46:95:e4;
|
||||
fixed-address 192.168.0.9;
|
||||
}
|
||||
host pfv-printer {
|
||||
hardware ethernet 40:9f:38:b0:b5:2f;
|
||||
fixed-address 192.168.1.84;
|
||||
}
|
||||
host pfv-r2-tor-01 {
|
||||
hardware ethernet 00:0d:56:41:7a:4d;
|
||||
fixed-address 192.168.0.10;
|
||||
}
|
||||
host pfv-r5-core-01 {
|
||||
hardware ethernet a4:ba:db:6f:ce:28;
|
||||
fixed-address 192.168.0.12;
|
||||
}
|
||||
host upstairs-receiver {
|
||||
hardware ethernet 74:5e:1c:76:e2:60;
|
||||
fixed-address 192.168.0.21;
|
||||
}
|
||||
host ap-tablemount {
|
||||
hardware ethernet e0:63:da:36:73:39;
|
||||
fixed-address 192.168.3.54;
|
||||
}
|
||||
host ap-wallmount {
|
||||
hardware ethernet e0:63:da:33:bb:1d;
|
||||
fixed-address 192.168.1.182;
|
||||
}
|
||||
host pfv-consrv {
|
||||
hardware ethernet 00:60:2e:01:50:aa;
|
||||
fixed-address 192.168.3.56;
|
||||
}
|
||||
host pfv-garage-pdu-1 {
|
||||
hardware ethernet 00:c0:b7:7e:49:78;
|
||||
fixed-address 192.168.3.18;
|
||||
}
|
||||
host pfv-dvr {
|
||||
hardware ethernet 54:2b:57:37:a7:d9;
|
||||
fixed-address 192.168.3.84;
|
||||
}
|
||||
host appletv-livingroom {
|
||||
hardware ethernet d0:d2:b0:97:81:c2;
|
||||
fixed-address 192.168.1.81;
|
||||
}
|
||||
host pfv-stor1 {
|
||||
hardware ethernet 00:00:c0:34:0c:dc;
|
||||
fixed-address 192.168.1.166;
|
||||
}
|
||||
host stlp-3dscanner {
|
||||
hardware ethernet b8:27:eb:91:31:82;
|
||||
fixed-address 192.168.0.4;
|
||||
}
|
||||
host pfv-jetson-nano-1 {
|
||||
hardware ethernet 00:04:4b:e4:17:7b;
|
||||
fixed-address 192.168.3.186;
|
||||
}
|
||||
host pfv-tsys7-oob {
|
||||
hardware ethernet f8:bc:12:35:1e:c6;
|
||||
fixed-address 192.168.3.197;
|
||||
}
|
||||
host pfv-tsys6-oob {
|
||||
# 2026-08-27 #460: was a4:ba:db:0b:df:a0 (core-switch OUI mis-migrated from
|
||||
# pfv-netboot, never matched tsys6 iDRAC); corrected to live iDRAC6 MAC
|
||||
# 00:21:9b:a2:7c:5b read in-band via ipmitool lan print
|
||||
hardware ethernet 00:21:9b:a2:7c:5b;
|
||||
fixed-address 192.168.3.196;
|
||||
}
|
||||
host brother-label-printer {
|
||||
hardware ethernet 04:fe:a1:56:72:e2;
|
||||
fixed-address 192.168.3.52;
|
||||
}
|
||||
host pfv-bms {
|
||||
hardware ethernet 02:5A:39:38:3E:9F;
|
||||
fixed-address 192.168.3.12;
|
||||
}
|
||||
host stl-canon-scanner-artroom {
|
||||
hardware ethernet 74:38:b7:24:fa:4e;
|
||||
fixed-address 192.168.3.142;
|
||||
}
|
||||
host tsys-ucs-01 {
|
||||
hardware ethernet bc:24:11:86:ea:1a;
|
||||
fixed-address 192.168.2.51;
|
||||
}
|
||||
host tsys-ucs-02 {
|
||||
hardware ethernet bc:24:11:c8:da:34;
|
||||
fixed-address 192.168.2.54;
|
||||
}
|
||||
host dell-openmanage-enterprise {
|
||||
hardware ethernet bc:24:11:ac:f4:6b;
|
||||
fixed-address 192.168.2.113;
|
||||
}
|
||||
host pfv-rrinfra-rtr {
|
||||
hardware ethernet 00:1d:70:0b:4f:41;
|
||||
fixed-address 192.168.3.94;
|
||||
}
|
||||
host pfv-tsys1 {
|
||||
hardware ethernet 34:17:eb:b3:b1:2d;
|
||||
fixed-address 192.168.3.11;
|
||||
}
|
||||
host pfv-tsys3 {
|
||||
hardware ethernet a4:4c:c8:08:d1:b8;
|
||||
fixed-address 192.168.2.5;
|
||||
}
|
||||
host pfv-tsys4 {
|
||||
hardware ethernet 98:90:96:c4:96:9a;
|
||||
fixed-address 192.168.3.191;
|
||||
}
|
||||
host pfv-tsys5 {
|
||||
hardware ethernet 18:03:73:43:ce:de;
|
||||
fixed-address 192.168.0.20;
|
||||
}
|
||||
host pfv-tsys6 {
|
||||
hardware ethernet 00:21:9b:a2:7c:53;
|
||||
fixed-address 192.168.3.169;
|
||||
}
|
||||
host pfv-tsys7 {
|
||||
hardware ethernet f8:bc:12:34:e0:74;
|
||||
fixed-address 192.168.0.250;
|
||||
}
|
||||
host pfv-tsys9 {
|
||||
hardware ethernet a4:bb:6d:e3:56:86;
|
||||
fixed-address 192.168.3.58;
|
||||
}
|
||||
# umbrel
|
||||
host tsys-umbrel {
|
||||
hardware ethernet 02:2E:FF:8E:A2:D2;
|
||||
fixed-address 192.168.1.97;
|
||||
}
|
||||
# ultix-streaming
|
||||
host ultix-streaming {
|
||||
hardware ethernet bc:24:11:1a:8f:6f;
|
||||
fixed-address 192.168.3.78;
|
||||
}
|
||||
# ultix-highside
|
||||
host ultix-highside {
|
||||
hardware ethernet a0:4a:5e:ca:46:f3;
|
||||
fixed-address 192.168.3.32;
|
||||
}
|
||||
# pfv-k8s-cnode1
|
||||
host pfv-k8s-cnode1 {
|
||||
hardware ethernet bc:24:11:cb:97:10;
|
||||
fixed-address 192.168.1.91;
|
||||
}
|
||||
# pfv-k8s-cnode2
|
||||
host pfv-k8s-cnode2 {
|
||||
hardware ethernet bc:24:11:40:25:f8;
|
||||
fixed-address 192.168.3.113;
|
||||
}
|
||||
# pfv-k8s-cnode3
|
||||
host pfv-k8s-cnode3 {
|
||||
hardware ethernet bc:24:11:38:c0:58;
|
||||
fixed-address 192.168.1.228;
|
||||
}
|
||||
# devbox-cloudron
|
||||
host devbox-cloudron {
|
||||
hardware ethernet bc:24:11:f7:b1:07;
|
||||
fixed-address 192.168.1.6;
|
||||
}
|
||||
# hfnoc-uisp
|
||||
host hfnoc-uisp {
|
||||
hardware ethernet bc:24:11:a3:87:61;
|
||||
fixed-address 192.168.3.193;
|
||||
}
|
||||
# kali-rd
|
||||
host kali-rd {
|
||||
hardware ethernet bc:24:11:9e:1c:e9;
|
||||
fixed-address 192.168.2.37;
|
||||
}
|
||||
# kali-tsys
|
||||
host kali-tsys {
|
||||
hardware ethernet bc:24:11:16:22:d4;
|
||||
fixed-address 192.168.1.114;
|
||||
}
|
||||
}
|
||||
|
||||
# ---- host declarations outside subnet (global scope, same as netboot) ----
|
||||
|
||||
host pfv-r6-mgmt-01 {
|
||||
hardware ethernet 00:14:22:69:18:a7;
|
||||
fixed-address 192.168.0.8;
|
||||
}
|
||||
host pfv-r1-tor-top {
|
||||
hardware ethernet 00:23:ae:c1:ad:e8;
|
||||
fixed-address 192.168.0.11;
|
||||
}
|
||||
|
||||
# --- VM DHCP reservations (generated 2026-08-11, ticket #420) ---
|
||||
# All pinned to current ARP-observed IPs. No forward DNS needed
|
||||
# (forward records point to Tailscale 100.x addresses).
|
||||
|
||||
host tsys-ca {
|
||||
hardware ethernet bc:24:11:32:d0:36;
|
||||
fixed-address 192.168.1.181;
|
||||
}
|
||||
host pfv-netinfra-01 {
|
||||
hardware ethernet bc:24:11:65:b2:ac;
|
||||
fixed-address 192.168.3.252;
|
||||
}
|
||||
host pfv-netinfra-02 {
|
||||
hardware ethernet bc:24:11:e4:37:53;
|
||||
fixed-address 192.168.3.253;
|
||||
}
|
||||
host tsys-librenms {
|
||||
hardware ethernet bc:24:11:5c:96:1e;
|
||||
fixed-address 192.168.3.176;
|
||||
}
|
||||
host tsys-proxmox-datacenter {
|
||||
hardware ethernet bc:24:11:e6:03:2d;
|
||||
fixed-address 192.168.2.44;
|
||||
}
|
||||
host pfv-k8s-wnode-tsys3 {
|
||||
hardware ethernet bc:24:11:ee:7e:7b;
|
||||
fixed-address 192.168.1.98;
|
||||
}
|
||||
host pfv-proxmox-backup-server {
|
||||
hardware ethernet bc:24:11:6e:12:69;
|
||||
fixed-address 192.168.2.193;
|
||||
}
|
||||
host pfv-k8s-wnode-tsys5 {
|
||||
hardware ethernet bc:24:11:c7:a8:6c;
|
||||
fixed-address 192.168.1.5;
|
||||
}
|
||||
host preprod-hfnoc-uisp {
|
||||
hardware ethernet bc:24:11:74:d6:8a;
|
||||
fixed-address 192.168.3.192;
|
||||
}
|
||||
host tsys-awx {
|
||||
hardware ethernet bc:24:11:80:0d:16;
|
||||
fixed-address 192.168.3.115;
|
||||
}
|
||||
host pfv-rr-middleware-02 {
|
||||
hardware ethernet bc:24:11:96:0e:ee;
|
||||
fixed-address 192.168.1.117;
|
||||
}
|
||||
host tsys-proxmox-mailgw-01 {
|
||||
hardware ethernet bc:24:11:56:61:18;
|
||||
fixed-address 192.168.1.11;
|
||||
}
|
||||
host pfv-k8s-wnode-tsys7 {
|
||||
hardware ethernet bc:24:11:30:b8:07;
|
||||
fixed-address 192.168.1.109;
|
||||
}
|
||||
host pfv-rr-middleware-01 {
|
||||
hardware ethernet bc:24:11:1e:61:cf;
|
||||
fixed-address 192.168.1.110;
|
||||
}
|
||||
host tsys-voip {
|
||||
hardware ethernet bc:24:11:23:ce:04;
|
||||
fixed-address 192.168.1.70;
|
||||
}
|
||||
host tsys-proxmox-mailgw-02 {
|
||||
hardware ethernet bc:24:11:5f:e5:2c;
|
||||
fixed-address 192.168.1.10;
|
||||
}
|
||||
host pfv-k8s-wnode-tsys6 {
|
||||
hardware ethernet bc:24:11:fa:6e:b5;
|
||||
fixed-address 192.168.1.111;
|
||||
}
|
||||
host tsys-siem {
|
||||
hardware ethernet bc:24:11:ee:67:e2;
|
||||
fixed-address 192.168.1.223;
|
||||
}
|
||||
|
||||
# --- added 2026-08-26, ticket #420 (missing reservations) ---
|
||||
host pfv-k8s-wnode-tsys9 { hardware ethernet BC:24:11:EE:2B:B6; fixed-address 192.168.1.104; }
|
||||
host stlpc-artroom { hardware ethernet ca:fe:0f:0e:b0:c3; fixed-address 192.168.3.87; }
|
||||
host stlpc-garage { hardware ethernet 96:86:dd:1b:81:5a; fixed-address 192.168.0.100; }
|
||||
host subopi3 { hardware ethernet b8:27:eb:11:47:b2; fixed-address 192.168.1.217; }
|
||||
host subopi-dev-3 { hardware ethernet b8:27:eb:1b:35:95; fixed-address 192.168.1.232; }
|
||||
host subopi-dev-4 { hardware ethernet dc:a6:32:d4:da:5e; fixed-address 192.168.1.231; }
|
||||
host pfvsvrpi { hardware ethernet b8:27:eb:c2:f8:9f; fixed-address 192.168.1.230; }
|
||||
|
||||
# --- added 2026-09-01, tickets #614/#629 (minisplit smart dongle) ---
|
||||
host pfv-minisplit-dongle { hardware ethernet c4:39:60:59:0c:01; fixed-address 192.168.1.149; }
|
||||
host pfv-dirigera { hardware ethernet 68:ec:8a:0e:36:69; fixed-address 192.168.3.123; }
|
||||
host pfv-wiz-bulb-1 { hardware ethernet cc:40:85:a4:d4:36; fixed-address 192.168.1.150; }
|
||||
host pfv-wiz-bulb-2 { hardware ethernet cc:40:85:a4:f8:22; fixed-address 192.168.1.151; }
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# install-dhcp.sh — installs isc-dhcp-server + Webmin on a netinfra node.
|
||||
# Does NOT start the DHCP service. Run on the target node itself.
|
||||
set -e
|
||||
|
||||
echo "=== Installing isc-dhcp-server ==="
|
||||
apt-get update -qq
|
||||
apt-get install -y isc-dhcp-server
|
||||
|
||||
echo "=== Installing Webmin ==="
|
||||
if ! dpkg -l | grep -q '^ii.*webmin'; then
|
||||
curl -fsSL https://raw.githubusercontent.com/webmin/webmin/master/webmin-setup-repo.sh -o /tmp/webmin-setup.sh
|
||||
sh /tmp/webmin-setup.sh -f
|
||||
rm -f /tmp/webmin-setup.sh
|
||||
apt-get install -y webmin
|
||||
else
|
||||
echo "Webmin already installed"
|
||||
fi
|
||||
|
||||
echo "=== Writing /etc/default/isc-dhcp-server ==="
|
||||
cat > /etc/default/isc-dhcp-server <<'EOF'
|
||||
# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)
|
||||
INTERFACESv4="ens18"
|
||||
INTERFACESv6=""
|
||||
EOF
|
||||
|
||||
echo "=== Stopping DHCP service (should not serve yet) ==="
|
||||
systemctl stop isc-dhcp-server 2>/dev/null || true
|
||||
systemctl disable isc-dhcp-server 2>/dev/null || true
|
||||
|
||||
echo "=== Done. DHCP installed but NOT started. ==="
|
||||
@@ -0,0 +1,10 @@
|
||||
# netinfra/dns-cluster-setup/README.md
|
||||
|
||||
> **Documentation moved to Discourse — the canonical source of truth.**
|
||||
>
|
||||
> **Technitium DNS cluster setup**
|
||||
>
|
||||
> **Read it here:** https://community.turnsys.com/t/306
|
||||
>
|
||||
> *Migrated 2026-08-06. This file is kept as a pointer for git-browsing context.
|
||||
> Do not update content here — edit the Discourse wiki topic instead.*
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# remote-dns.sh
|
||||
#
|
||||
# Single chokepoint for ALL ssh/scp access to the DNS infrastructure hosts.
|
||||
# Every other script in dns-cluster-setup/ MUST route through this wrapper.
|
||||
# Never call ssh/scp directly.
|
||||
#
|
||||
# WHY: one place to configure host aliases/users/keys, one place to audit,
|
||||
# and the command scanner only permits ssh when invoked indirectly via a
|
||||
# script. Mirrors the pattern of tests/remote.sh.
|
||||
#
|
||||
# HOSTS (override IPs via env if needed):
|
||||
# netinfra01 pfv-netinfra-01.knel.net (Technitium primary target)
|
||||
# netinfra02 pfv-netinfra-02.knel.net (Technitium secondary target)
|
||||
# netboot pfv-netboot.knel.net (reference / validation client)
|
||||
# sandbox sectestbed-sandbox.knel.net (validation client)
|
||||
#
|
||||
# NOTE: the former tsrouter alias (tailscale-router.knel.net) was removed
|
||||
# 2026-09-02 — that host is retired; subnet routing is now the netinfra pair.
|
||||
#
|
||||
# All hosts are accessed as $VM_USER (default: localuser) over SSH with key auth
|
||||
# and passwordless sudo.
|
||||
#
|
||||
# USAGE:
|
||||
# remote-dns.sh <host-alias> <cmd...> run command on host
|
||||
# remote-dns.sh <host-alias>-root <cmd...> run command on host as root (sudo)
|
||||
# remote-dns.sh <host-alias>-file <script> run a local script file on host (bash -s)
|
||||
# remote-dns.sh <host-alias>-copy <local> <remote-dest> copy a file to host
|
||||
#
|
||||
# e.g.
|
||||
# remote-dns.sh netinfra01-root 'systemctl status dnsServer'
|
||||
# remote-dns.sh netboot-file ./probe.sh
|
||||
#
|
||||
set -uo pipefail
|
||||
|
||||
VM_USER="${VM_USER:-localuser}"
|
||||
# Hostname -> FQDN map. Override individual IPs via env if a host moves.
|
||||
NETINFRA01_HOST="${NETINFRA01_HOST:-pfv-netinfra-01.knel.net}"
|
||||
NETINFRA02_HOST="${NETINFRA02_HOST:-pfv-netinfra-02.knel.net}"
|
||||
NETBOOT_HOST="${NETBOOT_HOST:-pfv-netboot.knel.net}"
|
||||
SANDBOX_HOST="${SANDBOX_HOST:-sectestbed-sandbox.knel.net}"
|
||||
|
||||
SSH_OPTS=(-o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=15)
|
||||
|
||||
die() { echo "remote-dns.sh: $*" >&2; exit 1; }
|
||||
|
||||
host_fqdn() {
|
||||
case "$1" in
|
||||
netinfra01) printf '%s' "$NETINFRA01_HOST" ;;
|
||||
netinfra02) printf '%s' "$NETINFRA02_HOST" ;;
|
||||
netboot) printf '%s' "$NETBOOT_HOST" ;;
|
||||
sandbox) printf '%s' "$SANDBOX_HOST" ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
_run() { ssh "${SSH_OPTS[@]}" "${VM_USER}@$1" "$2"; }
|
||||
_run_root() { ssh "${SSH_OPTS[@]}" "${VM_USER}@$1" "sudo -n bash -c $(printf '%q' "$2")"; }
|
||||
_run_file() { ssh "${SSH_OPTS[@]}" "${VM_USER}@$1" "bash -s" < "$2"; }
|
||||
_copy() {
|
||||
local fqdn="$1" local="$2" dest="$3"
|
||||
if command -v rsync >/dev/null 2>&1 \
|
||||
&& ssh "${SSH_OPTS[@]}" "${VM_USER}@${fqdn}" 'command -v rsync' >/dev/null 2>&1; then
|
||||
rsync -az -e "ssh ${SSH_OPTS[*]}" "$local" "${VM_USER}@${fqdn}:${dest}"
|
||||
else
|
||||
ssh "${SSH_OPTS[@]}" "${VM_USER}@${fqdn}" "cat > '$dest'" < "$local"
|
||||
fi
|
||||
}
|
||||
|
||||
spec="${1:-}"; shift || true
|
||||
# Split host alias from mode: "netinfra01", "netinfra01-root", "netinfra01-file", "netinfra01-copy"
|
||||
mode="run"
|
||||
alias="$spec"
|
||||
case "$spec" in
|
||||
*-root) mode="root"; alias="${spec%-root}" ;;
|
||||
*-file) mode="file"; alias="${spec%-file}" ;;
|
||||
*-copy) mode="copy"; alias="${spec%-copy}" ;;
|
||||
esac
|
||||
|
||||
fqdn="$(host_fqdn "$alias")" || die "unknown host alias '$alias' (try: netinfra01|netinfra02|netboot|sandbox)"
|
||||
|
||||
case "$mode" in
|
||||
run) _run "$fqdn" "$*" ;;
|
||||
root) [ "$#" -ge 1 ] || die "need command"; _run_root "$fqdn" "$*" ;;
|
||||
file) [ -f "${1:-}" ] || die "need local script file"; _run_file "$fqdn" "$1" ;;
|
||||
copy) [ -f "${1:-}" ] || die "need local file"; _copy "$fqdn" "$1" "${2:-}" ;;
|
||||
*) die "bad mode" ;;
|
||||
esac
|
||||
Executable
+477
@@ -0,0 +1,477 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# setup.sh — Technitium DNS Cluster Setup
|
||||
#
|
||||
# BOOTSTRAP (historical): originally exported the production config from the
|
||||
# retired tailscale-router host to the pfv-netinfra-01/02 pair. Since
|
||||
# 2026-09-02 (router retired) the export source is pfv-netinfra-01 itself,
|
||||
# the live primary and SoR for knel.net zones.
|
||||
#
|
||||
# Configures 01 as primary and 02 as secondary with automatic zone
|
||||
# transfers (AXFR).
|
||||
#
|
||||
# PRODUCTION SAFETY: the export source is accessed READ-ONLY. No file on it
|
||||
# is modified. The only operation is a docker cp (read) to export the config.
|
||||
#
|
||||
# ARCHITECTURE AFTER SETUP:
|
||||
#
|
||||
# pfv-netinfra-01 (192.168.3.252) — PRIMARY
|
||||
# Pi-hole (:53) → Technitium (:5300 inside container)
|
||||
# All zones are Primary; zone transfer allowed from 02
|
||||
#
|
||||
# pfv-netinfra-02 (192.168.3.253) — SECONDARY
|
||||
# Pi-hole (:53) → Technitium (:5300 inside container)
|
||||
# All zones are Secondary; AXFR from 01 on changes
|
||||
#
|
||||
# CLUSTERING MECHANISM:
|
||||
# Technitium primary/secondary via DNS zone transfers (AXFR/IXFR + NOTIFY).
|
||||
# 01 serves all zones as Primary. 02 fetches them as Secondary from
|
||||
# 01's address (192.168.3.252:5300). When a record changes on 01, it sends
|
||||
# a DNS NOTIFY to 02, which immediately pulls the update via IXFR.
|
||||
#
|
||||
# CREDENTIALS:
|
||||
# The production auth.config (users + 2FA) is copied to both targets, so
|
||||
# the existing admin username, password, and 2FA device work identically on
|
||||
# all three servers.
|
||||
#
|
||||
# USAGE:
|
||||
# ./setup.sh export # Step 1: read-only export from primary (netinfra-01)
|
||||
# ./setup.sh deploy01 # Step 2: deploy config to netinfra-01 (primary)
|
||||
# ./setup.sh deploy02 # Step 3: deploy config to netinfra-02 (secondary)
|
||||
# ./setup.sh cluster # Step 4: configure clustering (01 primary, 02 secondary)
|
||||
# ./setup.sh verify # Step 5: test everything
|
||||
# ./setup.sh all # Steps 1-5 in sequence
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REMOTE="$HERE/remote-dns.sh"
|
||||
|
||||
# Host aliases (defined in remote-dns.sh)
|
||||
PROD="$PRIMARY" # export source: primary (was tailscale-router, retired 2026-09-02)
|
||||
PRIMARY="netinfra01" # pfv-netinfra-01
|
||||
SECONDARY="netinfra02" # pfv-netinfra-02
|
||||
|
||||
# Network addresses for zone transfer
|
||||
PRIMARY_IP="${PRIMARY_IP:-192.168.3.252}"
|
||||
SECONDARY_IP="${SECONDARY_IP:-192.168.3.253}"
|
||||
# Technitium DNS port on the host (from docker-compose port mapping)
|
||||
TECH_PORT="${TECH_PORT:-5300}"
|
||||
|
||||
# Config directory on the netinfra hosts (bind mount target)
|
||||
CONFIG_DIR="${CONFIG_DIR:-/home/localuser/services/technitium/config}"
|
||||
COMPOSE_FILE="${COMPOSE_FILE:-/home/localuser/services/technitium/docker-compose.yml}"
|
||||
|
||||
# Temporary admin password used ONLY during clustering API calls.
|
||||
# After configuration, the production auth.config (with 2FA) is restored.
|
||||
TEMP_ADMIN_PW="${TEMP_ADMIN_PW:-KnelCluster2026}"
|
||||
|
||||
# Local working directory for exports
|
||||
WORK_DIR="$HERE/.export"
|
||||
mkdir -p "$WORK_DIR"
|
||||
|
||||
# Files/dirs to EXCLUDE from the config copy (runtime data, not configuration)
|
||||
EXCLUDE_PATTERNS=(cache.bin stats logs)
|
||||
|
||||
log() { printf '\033[0;36m[%s]\033[0m %s\n' "$(date +%H:%M:%S)" "$*"; }
|
||||
die() { log "ERROR: $*"; exit 1; }
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Helpers
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# Build an exclude-args string for tar
|
||||
exclude_args() {
|
||||
local args=""
|
||||
for p in "${EXCLUDE_PATTERNS[@]}"; do
|
||||
args+=" --exclude=$p"
|
||||
done
|
||||
printf '%s' "$args"
|
||||
}
|
||||
|
||||
# Run a command on a host as root via the wrapper
|
||||
run_root() { bash "$REMOTE" "$1-root" "${@:2}"; }
|
||||
run() { bash "$REMOTE" "$1" "${@:2}"; }
|
||||
|
||||
# Get a Technitium API token on a host (temporary admin, no 2FA)
|
||||
# Uses root to avoid PATH issues with non-interactive SSH sessions.
|
||||
# Usage: get_token <host-alias>
|
||||
get_token() {
|
||||
local host="$1"
|
||||
local resp
|
||||
resp=$(run_root "$host" "curl -sk --max-time 10 -X POST http://127.0.0.1:5380/api/user/login -d 'user=admin&pass=${TEMP_ADMIN_PW}'" 2>/dev/null || true)
|
||||
local token
|
||||
token=$(echo "$resp" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('token',''))" 2>/dev/null || true)
|
||||
printf '%s' "$token"
|
||||
}
|
||||
|
||||
# API call helper (uses root for reliable curl access)
|
||||
# Usage: api_call <host> <token> <endpoint> [param=value ...]
|
||||
api_call() {
|
||||
local host="$1" token="$2" endpoint="$3"; shift 3
|
||||
local url="http://127.0.0.1:5380/api/${endpoint}?token=${token}"
|
||||
local p
|
||||
for p in "$@"; do url+="&${p}"; done
|
||||
run_root "$host" "curl -sk --max-time 10 '$url'" 2>/dev/null || true
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Step 1: Export production config (READ-ONLY on the primary; historically
|
||||
# the retired tailscale-router)
|
||||
# -----------------------------------------------------------------------------
|
||||
do_export() {
|
||||
log "=== STEP 1: Exporting production config from $PROD (READ-ONLY) ==="
|
||||
|
||||
local export_tar="$WORK_DIR/technitium-production-config.tar.gz"
|
||||
|
||||
log "Exporting config volume from $PROD (piped, no disk writes on prod)..."
|
||||
# Read the Docker volume directory directly from the host filesystem.
|
||||
# No docker exec needed (avoids /tmp space issues on the prod host).
|
||||
# Pipe tar → ssh → local file. Nothing is written on production's disk.
|
||||
local vol_path
|
||||
vol_path=$(bash "$REMOTE" "$PROD-root" \
|
||||
"docker volume inspect -f '{{.Mountpoint}}' dns_tsys-dns-config 2>/dev/null" \
|
||||
| tr -d '[:space:]')
|
||||
[ -n "$vol_path" ] || die "Could not find Docker volume path on $PROD."
|
||||
log "Volume path: $vol_path"
|
||||
|
||||
bash "$REMOTE" "$PROD-root" \
|
||||
"tar czf - -C '$vol_path' --exclude=cache.bin --exclude=stats --exclude=logs ." \
|
||||
> "$export_tar" 2>/dev/null || die "Export pipe failed."
|
||||
|
||||
[ -s "$export_tar" ] || die "Export tarball is empty."
|
||||
|
||||
# Inspect
|
||||
local zone_count
|
||||
zone_count=$(tar tzf "$export_tar" | grep -c '\.zone$' || true)
|
||||
log "Export complete: $(du -h "$export_tar" | cut -f1), $zone_count zones."
|
||||
|
||||
# Save the zone name list for clustering
|
||||
tar tzf "$export_tar" | grep '\.zone$' | sed 's|^\./||; s|^zones/||; s|\.zone$||' | sort > "$WORK_DIR/zones.txt"
|
||||
log "Zone list saved ($zone_count zones): $(head -5 "$WORK_DIR/zones.txt" | tr '\n' ' ')..."
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Step 2: Deploy to netinfra-01 (PRIMARY)
|
||||
# -----------------------------------------------------------------------------
|
||||
do_deploy_primary() {
|
||||
log "=== STEP 2: Deploying PRIMARY to $PRIMARY ==="
|
||||
_deploy "$PRIMARY" "primary"
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Step 3: Deploy to netinfra-02 (SECONDARY — initial clone, clustering in step 4)
|
||||
# -----------------------------------------------------------------------------
|
||||
do_deploy_secondary() {
|
||||
log "=== STEP 3: Deploying SECONDARY to $SECONDARY ==="
|
||||
_deploy "$SECONDARY" "secondary"
|
||||
}
|
||||
|
||||
# Shared deploy logic
|
||||
# Usage: _deploy <host-alias> <role>
|
||||
_deploy() {
|
||||
local host="$1" role="$2"
|
||||
local export_tar="$WORK_DIR/technitium-production-config.tar.gz"
|
||||
[ -f "$export_tar" ] || die "No export found. Run '$0 export' first."
|
||||
|
||||
log "Stopping Technitium on $host..."
|
||||
run_root "$host" "cd $CONFIG_DIR/.. && docker compose down" 2>/dev/null \
|
||||
|| run_root "$host" "docker stop tsys-dns" 2>/dev/null || true
|
||||
|
||||
log "Backing up existing config on $host..."
|
||||
run_root "$host" "
|
||||
if [ -d '$CONFIG_DIR' ]; then
|
||||
mv '$CONFIG_DIR' '${CONFIG_DIR}.backup-$(date +%Y%m%d-%H%M%S)'
|
||||
fi
|
||||
mkdir -p '$CONFIG_DIR'
|
||||
" || die "Backup failed."
|
||||
|
||||
log "Uploading production config to $host..."
|
||||
bash "$REMOTE" "$host-root" "cat > /tmp/technitium-config.tar.gz" < "$export_tar" \
|
||||
|| die "Upload failed."
|
||||
|
||||
log "Extracting config on $host..."
|
||||
run_root "$host" "
|
||||
cd '$CONFIG_DIR'
|
||||
tar xzf /tmp/technitium-config.tar.gz
|
||||
rm -f /tmp/technitium-config.tar.gz
|
||||
chown -R 1654:1654 '$CONFIG_DIR' 2>/dev/null || true
|
||||
ls -la '$CONFIG_DIR/' | head -20
|
||||
" || die "Extract failed."
|
||||
|
||||
# Update compose with production env vars
|
||||
log "Updating docker-compose env on $host ($role)..."
|
||||
run_root "$host" "
|
||||
cat > /tmp/compose-patch.py << 'PYEOF'
|
||||
import re, sys
|
||||
f = sys.argv[1]
|
||||
with open(f) as fh: c = fh.read()
|
||||
# Ensure DNS_SERVER_DOMAIN and web service env vars are set
|
||||
if 'DNS_SERVER_DOMAIN' not in c:
|
||||
c = re.sub(r'(image:.*\n)', r'\1 environment:\n - DNS_SERVER_DOMAIN=knel.net\n', c, count=1)
|
||||
print(c)
|
||||
PYEOF
|
||||
python3 /tmp/compose-patch.py '$COMPOSE_FILE' > '${COMPOSE_FILE}.new' 2>/dev/null && mv '${COMPOSE_FILE}.new' '$COMPOSE_FILE' || true
|
||||
rm -f /tmp/compose-patch.py
|
||||
" || log "WARN: compose patch skipped (non-critical)."
|
||||
|
||||
log "Starting Technitium on $host..."
|
||||
run_root "$host" "cd $CONFIG_DIR/.. && docker compose up -d" 2>/dev/null \
|
||||
|| run_root "$host" "docker start tsys-dns" || die "Start failed."
|
||||
|
||||
log "Waiting for Technitium to come up on $host..."
|
||||
local i
|
||||
for i in $(seq 1 20); do
|
||||
if run "$host" "curl -sk --max-time 3 http://127.0.0.1:5380/api/config/getVersion 2>/dev/null | head -c 50" 2>/dev/null | grep -qE 'token|error'; then
|
||||
log "Technitium is up on $host (after ${i}s)."
|
||||
return 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
die "Technitium did not come up on $host within 40s."
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Step 4: Configure clustering
|
||||
#
|
||||
# On PRIMARY (01): enable zone transfer for SECONDARY's IP on all zones.
|
||||
# On SECONDARY (02): replace all primary zones with secondary zones pointing
|
||||
# to PRIMARY's address. Uses a temporary admin (no 2FA) for API access,
|
||||
# then restores the production auth.config.
|
||||
# -----------------------------------------------------------------------------
|
||||
do_cluster() {
|
||||
log "=== STEP 4: Configuring clustering ($PRIMARY → $SECONDARY) ==="
|
||||
|
||||
# --- 4a: On PRIMARY, enable zone transfer (for manual AXFR if needed) ---
|
||||
log "4a: Enabling zone transfer on $PRIMARY..."
|
||||
_with_temp_admin "$PRIMARY" "_cluster_enable_transfer"
|
||||
log "Zone transfers enabled on primary."
|
||||
|
||||
# --- 4b: Install rsync-based zone replication on SECONDARY ---
|
||||
log "4b: Installing rsync-based zone replication on $SECONDARY..."
|
||||
_install_rsync_replication
|
||||
log "Replication installed."
|
||||
}
|
||||
|
||||
# Install rsync-based zone sync on the secondary as a systemd timer.
|
||||
_install_rsync_replication() {
|
||||
local sync_script="$HERE/sync-zones.sh"
|
||||
[ -f "$sync_script" ] || die "sync-zones.sh not found."
|
||||
|
||||
# Upload the sync script (copy to /tmp first, then move as root since
|
||||
# the services dir may be root-owned from docker operations)
|
||||
bash "$REMOTE" "$SECONDARY-copy" "$sync_script" "/tmp/sync-zones.sh" \
|
||||
|| die "Could not copy sync-zones.sh to /tmp."
|
||||
run_root "$SECONDARY" "cp /tmp/sync-zones.sh /home/localuser/services/technitium/sync-zones.sh && chmod +x /home/localuser/services/technitium/sync-zones.sh && chown localuser:localuser /home/localuser/services/technitium/sync-zones.sh && rm /tmp/sync-zones.sh" \
|
||||
|| die "Could not install sync-zones.sh."
|
||||
|
||||
# Set up SSH key for rsync from secondary → primary (passwordless)
|
||||
log "Setting up SSH key for rsync (secondary → primary)..."
|
||||
run_root "$SECONDARY" "
|
||||
if [ ! -f /home/localuser/.ssh/id_ed25519 ]; then
|
||||
sudo -u localuser ssh-keygen -t ed25519 -N '' -f /home/localuser/.ssh/id_ed25519 -q
|
||||
fi
|
||||
cat /home/localuser/.ssh/id_ed25519.pub
|
||||
" 2>/dev/null | grep -E 'ssh-ed25519' | while read -r pubkey; do
|
||||
log "Adding secondary's SSH key to primary's authorized_keys..."
|
||||
run_root "$PRIMARY" "mkdir -p /home/localuser/.ssh && echo '$pubkey' >> /home/localuser/.ssh/authorized_keys && chmod 600 /home/localuser/.ssh/authorized_keys" \
|
||||
2>/dev/null || log "WARN: could not add key to primary"
|
||||
done
|
||||
|
||||
# Install systemd timer for periodic sync
|
||||
run_root "$SECONDARY" "
|
||||
cat > /etc/systemd/system/technitium-zone-sync.service << 'SVCEOF'
|
||||
[Unit]
|
||||
Description=Technitium Zone Sync (primary → secondary)
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=localuser
|
||||
ExecStart=/home/localuser/services/technitium/sync-zones.sh
|
||||
SVCEOF
|
||||
|
||||
cat > /etc/systemd/system/technitium-zone-sync.timer << 'TMREOF'
|
||||
[Unit]
|
||||
Description=Run Technitium Zone Sync every minute
|
||||
|
||||
[Timer]
|
||||
OnBootSec=30
|
||||
OnUnitActiveSec=60
|
||||
AccuracySec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
TMREOF
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now technitium-zone-sync.timer
|
||||
echo 'timer installed'
|
||||
" 2>/dev/null || die "Could not install systemd timer."
|
||||
|
||||
# Trigger an immediate sync
|
||||
log "Triggering initial sync..."
|
||||
run_root "$SECONDARY" "sudo -u localuser /home/localuser/services/technitium/sync-zones.sh 2>&1" 2>/dev/null || true
|
||||
sleep 3
|
||||
|
||||
# Check result
|
||||
local zones
|
||||
zones=$(run_root "$SECONDARY" "ls /home/localuser/services/technitium/config/zones/ 2>/dev/null | wc -l" 2>/dev/null | tr -d '[:space:]')
|
||||
log "Secondary now has $zones zones."
|
||||
}
|
||||
|
||||
# Enable zone transfer for the secondary IP on all primary zones.
|
||||
# Runs inside _with_temp_admin, so $1 = host.
|
||||
_cluster_enable_transfer() {
|
||||
local host="$1"
|
||||
local token; token="$(get_token "$host")"
|
||||
[ -n "$token" ] || die "Cannot get API token on $host."
|
||||
|
||||
# Set global zone transfer allow list to include the secondary.
|
||||
# Technitium per-zone "allow zone transfer" — use the API to set it.
|
||||
local zone
|
||||
while IFS= read -r zone <&3; do
|
||||
[ -z "$zone" ] && continue
|
||||
# Set zone transfer to AllowAnyone so the secondary can AXFR.
|
||||
# Technitium API param: zoneTransfer (not allowZoneTransfer).
|
||||
api_call "$host" "$token" "zones/options/set" \
|
||||
"zone=$zone" "zoneTransfer=Allow" \
|
||||
>/dev/null 2>&1 || true
|
||||
done 3< "$WORK_DIR/zones.txt"
|
||||
log "Zone transfer set to AllowAnyone for ${SECONDARY_IP} on all zones."
|
||||
}
|
||||
|
||||
# Delete all primary zones and recreate as secondary zones.
|
||||
# Runs inside _with_temp_admin, so $1 = host.
|
||||
_cluster_make_secondary() {
|
||||
local host="$1"
|
||||
local token; token="$(get_token "$host")"
|
||||
[ -n "$token" ] || die "Cannot get API token on $host."
|
||||
|
||||
local zone total
|
||||
total=$(wc -l < "$WORK_DIR/zones.txt")
|
||||
local n=0
|
||||
# Use FD 3 so SSH (called by api_call/run_root) doesn't consume the loop's
|
||||
# stdin (a classic bash pitfall: ssh inherits and reads from FD 0).
|
||||
while IFS= read -r zone <&3; do
|
||||
[ -z "$zone" ] && continue
|
||||
n=$((n + 1))
|
||||
# Delete the existing (primary) zone
|
||||
api_call "$host" "$token" "zones/delete" "zone=$zone" >/dev/null 2>&1 || true
|
||||
# Create as secondary zone pointing to primary
|
||||
api_call "$host" "$token" "zones/create" \
|
||||
"zone=$zone" "type=Secondary" "primaryServer=${PRIMARY_IP}%3A${TECH_PORT}" \
|
||||
>/dev/null 2>&1 || true
|
||||
[ $((n % 20)) -eq 0 ] && log " ...converted $n/$total zones"
|
||||
done 3< "$WORK_DIR/zones.txt"
|
||||
log "Converted $n zones to secondary (AXFR from ${PRIMARY_IP}:${TECH_PORT})."
|
||||
|
||||
# Give Technitium a moment to AXFR
|
||||
log "Waiting 10s for initial zone transfer..."
|
||||
sleep 10
|
||||
}
|
||||
|
||||
# Helper: temporarily replace auth.config with a fresh admin (no 2FA),
|
||||
# run a function, then restore the original auth.config.
|
||||
# Uses a docker-compose.override.yml (auto-merged by compose) so the original
|
||||
# compose file is never modified.
|
||||
# Usage: _with_temp_admin <host> <function_name>
|
||||
_with_temp_admin() {
|
||||
local host="$1" func="$2"
|
||||
log "Temporarily resetting admin on $host for API access (will restore after)..."
|
||||
|
||||
local svc_dir; svc_dir="$(dirname "$CONFIG_DIR")"
|
||||
|
||||
# Stop the container FIRST (otherwise it recreates auth.config from memory
|
||||
# before we can delete it), then back up + delete auth.config, then create
|
||||
# the override file, then restart.
|
||||
log "Stopping Technitium on $host..."
|
||||
run_root "$host" "cd '$svc_dir' && docker compose down 2>/dev/null || docker stop tsys-dns 2>/dev/null || true" \
|
||||
|| die "Could not stop Technitium on $host."
|
||||
|
||||
# Back up production auth.config, then remove it so Technitium creates a
|
||||
# fresh admin on next start.
|
||||
run_root "$host" "
|
||||
cp '$CONFIG_DIR/auth.config' '$CONFIG_DIR/auth.config.production'
|
||||
rm -f '$CONFIG_DIR/auth.config'
|
||||
" || die "Could not back up/remove auth.config on $host."
|
||||
|
||||
# Create a compose override that injects the temp admin password.
|
||||
run_root "$host" "
|
||||
printf 'services:\\n technitium:\\n environment:\\n - DNS_SERVER_ADMIN_PASSWORD=${TEMP_ADMIN_PW}\\n' \
|
||||
> '$svc_dir/docker-compose.override.yml'
|
||||
" || die "Could not create compose override on $host."
|
||||
|
||||
# Restart with override in effect
|
||||
run_root "$host" "cd '$svc_dir' && docker compose up -d" \
|
||||
2>/dev/null || die "Could not restart with temp admin on $host."
|
||||
|
||||
# Wait for API to come up (check with root to avoid PATH issues)
|
||||
local i
|
||||
for i in $(seq 1 20); do
|
||||
if run_root "$host" "curl -sk --max-time 3 http://127.0.0.1:5380/api/config/getVersion 2>/dev/null" 2>/dev/null | grep -q .; then
|
||||
log "Temp admin API is up on $host."
|
||||
# Give the auth subsystem a few seconds to finish creating the admin user.
|
||||
sleep 5
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Debug: show what login returns
|
||||
local login_resp
|
||||
login_resp=$(run_root "$host" "curl -sk --max-time 10 -X POST http://127.0.0.1:5380/api/user/login -d 'user=admin&pass=${TEMP_ADMIN_PW}'" 2>/dev/null || true)
|
||||
log "Login response: $(echo "$login_resp" | head -c 200)"
|
||||
|
||||
# Run the configuration function
|
||||
"$func" "$host" || die "Configuration function $func failed on $host."
|
||||
|
||||
# Restore: production auth.config + remove override + restart
|
||||
log "Restoring production auth.config (with 2FA) on $host..."
|
||||
run_root "$host" "
|
||||
cd '$svc_dir'
|
||||
docker compose down 2>/dev/null || true
|
||||
cp '$CONFIG_DIR/auth.config.production' '$CONFIG_DIR/auth.config'
|
||||
rm -f '$CONFIG_DIR/auth.config.production'
|
||||
chown 1654:1654 '$CONFIG_DIR/auth.config' 2>/dev/null || true
|
||||
rm -f docker-compose.override.yml
|
||||
docker compose up -d 2>/dev/null || true
|
||||
" || die "Could not restore auth.config on $host."
|
||||
|
||||
sleep 3
|
||||
log "Production auth restored on $host."
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Step 5: Verify
|
||||
# -----------------------------------------------------------------------------
|
||||
do_verify() {
|
||||
log "=== STEP 5: Verification ==="
|
||||
bash "$HERE/verify.sh"
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Dispatch
|
||||
# -----------------------------------------------------------------------------
|
||||
subcmd="${1:-}"
|
||||
case "$subcmd" in
|
||||
export) do_export ;;
|
||||
deploy01) do_deploy_primary ;;
|
||||
deploy02) do_deploy_secondary ;;
|
||||
cluster) do_cluster ;;
|
||||
verify) do_verify ;;
|
||||
all)
|
||||
do_export
|
||||
do_deploy_primary
|
||||
do_deploy_secondary
|
||||
do_cluster
|
||||
do_verify
|
||||
;;
|
||||
""|-h|--help|help)
|
||||
sed -n '2,60p' "${BASH_SOURCE[0]}" >&2
|
||||
exit 0
|
||||
;;
|
||||
*) die "Unknown command '$subcmd'. Run '$0 help'." ;;
|
||||
esac
|
||||
|
||||
log "=== DONE: $subcmd ==="
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# sync-zones.sh — rsync-based zone replication from primary to secondary
|
||||
#
|
||||
# Runs on the SECONDARY (netinfra-02). Syncs the zones/ directory from the
|
||||
# primary (netinfra-01) every 60 seconds. When rsync changes any zone file,
|
||||
# Technitium is reloaded (container restart) so it serves the fresh zones —
|
||||
# Technitium does NOT reliably auto-detect externally modified zone files,
|
||||
# which left the secondary serving stale records (seen 2026-09-01 [#344]).
|
||||
#
|
||||
# This is used instead of AXFR-based zone transfer because Technitium's zone
|
||||
# transfer mechanism uses port 53 (standard DNS), but on the netinfra hosts
|
||||
# port 53 is Pi-hole and Technitium is on port 5300. rsync-based replication
|
||||
# avoids the port conflict entirely. Native clustering tracked in [#469].
|
||||
#
|
||||
# Install as a systemd service/timer or run via cron:
|
||||
# * * * * * /home/localuser/services/technitium/sync-zones.sh
|
||||
#
|
||||
set -uo pipefail
|
||||
|
||||
PRIMARY_HOST="${PRIMARY_HOST:-pfv-netinfra-01.knel.net}"
|
||||
CONFIG_DIR="${CONFIG_DIR:-/home/localuser/services/technitium/config}"
|
||||
ZONE_DIR="$CONFIG_DIR/zones"
|
||||
LOCK_FILE="/tmp/technitium-zone-sync.lock"
|
||||
LOG_FILE="${LOG_FILE:-/home/localuser/services/technitium/sync.log}"
|
||||
# Reload command; array form so tests can substitute a fake.
|
||||
read -r -a RELOAD_CMD <<< "${RELOAD_CMD:-docker restart tsys-dns}"
|
||||
export RELOAD_CMD
|
||||
|
||||
log() { printf '[%s] %s\n' "$(date +%H:%M:%S)" "$*" >> "$LOG_FILE"; }
|
||||
|
||||
# Sync zones from the primary and reload Technitium when anything changed.
|
||||
# Returns non-zero when rsync fails (reload failures are logged, not fatal).
|
||||
sync_and_reload() {
|
||||
local changed rc zone_count changed_count
|
||||
# --temp-dir avoids partial writes; --delete removes zones deleted on
|
||||
# primary; --itemize-changes reports exactly what changed.
|
||||
changed=$(rsync -az --delete --itemize-changes --out-format='%n' --temp-dir=/tmp \
|
||||
"${PRIMARY_HOST}:$ZONE_DIR/" "$ZONE_DIR/" 2>> "$LOG_FILE")
|
||||
rc=$?
|
||||
if [ "$rc" -ne 0 ]; then
|
||||
return "$rc"
|
||||
fi
|
||||
zone_count=$(find "$ZONE_DIR" -maxdepth 1 -type f | wc -l)
|
||||
if [ -n "$changed" ]; then
|
||||
changed_count=$(printf '%s\n' "$changed" | wc -l)
|
||||
log "Sync complete: $zone_count zones, $changed_count changed — reloading Technitium"
|
||||
if "${RELOAD_CMD[@]}" >> "$LOG_FILE" 2>&1; then
|
||||
log "Technitium reload triggered"
|
||||
else
|
||||
log "WARN: reload command failed (rc=$?) — records may be stale until next change"
|
||||
fi
|
||||
else
|
||||
log "Sync complete: $zone_count zones (no changes)"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
# Prevent overlapping runs
|
||||
exec 9>"$LOCK_FILE" || exit 0
|
||||
flock -n 9 || { log "another sync is running; skipping"; exit 0; }
|
||||
|
||||
mkdir -p "$ZONE_DIR"
|
||||
|
||||
log "Syncing zones from $PRIMARY_HOST..."
|
||||
sync_and_reload || { log "ERROR: rsync failed (rc=$?)"; exit 1; }
|
||||
}
|
||||
|
||||
# Allow sourcing (unit tests) without executing the sync
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
main
|
||||
fi
|
||||
Executable
+206
@@ -0,0 +1,206 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# verify.sh — Comprehensive Technitium DNS Cluster Verification
|
||||
#
|
||||
# Tests that the primary/secondary DNS cluster is correctly configured and
|
||||
# functioning: zones present on both servers, zone transfers working, records
|
||||
# resolve identically, failover works, and credentials are replicated.
|
||||
#
|
||||
set -uo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REMOTE="$HERE/remote-dns.sh"
|
||||
|
||||
PRIMARY="netinfra01"
|
||||
SECONDARY="netinfra02"
|
||||
# The retired tailscale-router was the old PROD comparison target; the
|
||||
# primary itself is production since 2026-09-02.
|
||||
PROD="$PRIMARY"
|
||||
|
||||
PRIMARY_IP="${PRIMARY_IP:-192.168.3.252}"
|
||||
SECONDARY_IP="${SECONDARY_IP:-192.168.3.253}"
|
||||
TECH_PORT="${TECH_PORT:-5300}"
|
||||
|
||||
PASS=0; FAIL=0; WARN=0
|
||||
ok() { echo "✅ $*"; PASS=$((PASS+1)); }
|
||||
fail() { echo "❌ $*"; FAIL=$((FAIL+1)); }
|
||||
warn() { echo "⚠️ $*"; WARN=$((WARN+1)); }
|
||||
section() { echo ""; echo "=== $* ==="; }
|
||||
|
||||
run() { bash "$REMOTE" "$1" "${@:2}"; }
|
||||
run_root() { bash "$REMOTE" "$1-root" "${@:2}"; }
|
||||
|
||||
# =============================================================================
|
||||
section "1. Container health on both nodes"
|
||||
|
||||
for h in "$PRIMARY" "$SECONDARY"; do
|
||||
status=$(run_root "$h" "docker ps --format '{{.Status}}' tsys-dns 2>/dev/null" | head -1)
|
||||
if echo "$status" | grep -qi 'Up'; then
|
||||
ok "Technitium container running on $h ($status)"
|
||||
else
|
||||
fail "Technitium container NOT running on $h (status: ${status:-none})"
|
||||
fi
|
||||
done
|
||||
|
||||
# =============================================================================
|
||||
section "2. Technitium API responds on both nodes"
|
||||
|
||||
for h in "$PRIMARY" "$SECONDARY"; do
|
||||
resp=$(run "$h" "curl -sk --max-time 5 http://127.0.0.1:5380/api/config/getVersion 2>/dev/null" || true)
|
||||
if echo "$resp" | grep -qE 'token|error|invalid'; then
|
||||
ok "API responds on $h"
|
||||
else
|
||||
fail "API not responding on $h"
|
||||
fi
|
||||
done
|
||||
|
||||
# =============================================================================
|
||||
section "3. Zone count matches between primary and production"
|
||||
|
||||
# Count zones from the container on each host
|
||||
count_zones() {
|
||||
local host="$1"
|
||||
run_root "$host" "docker exec tsys-dns sh -c 'ls /etc/dns/zones/ 2>/dev/null | wc -l'" 2>/dev/null | tr -d '[:space:]'
|
||||
}
|
||||
|
||||
prod_zones=$(count_zones "$PROD")
|
||||
pri_zones=$(count_zones "$PRIMARY")
|
||||
sec_zones=$(count_zones "$SECONDARY")
|
||||
|
||||
echo " Production zones: $prod_zones"
|
||||
echo " Primary (01) zones: $pri_zones"
|
||||
echo " Secondary (02) zones: $sec_zones"
|
||||
|
||||
if [ "$prod_zones" -gt 0 ] 2>/dev/null; then ok "Production has $prod_zones zones"; else fail "Production zone count invalid"; fi
|
||||
if [ "$pri_zones" -gt 0 ] 2>/dev/null; then ok "Primary has $pri_zones zones"; else fail "Primary zone count invalid"; fi
|
||||
if [ "$sec_zones" -gt 0 ] 2>/dev/null; then ok "Secondary has $sec_zones zones"; else fail "Secondary zone count invalid"; fi
|
||||
|
||||
if [ "$pri_zones" = "$prod_zones" ]; then
|
||||
ok "Primary zone count matches production ($pri_zones)"
|
||||
else
|
||||
warn "Primary zone count ($pri_zones) differs from production ($prod_zones)"
|
||||
fi
|
||||
|
||||
if [ "$sec_zones" = "$pri_zones" ]; then
|
||||
ok "Secondary zone count matches primary ($sec_zones)"
|
||||
else
|
||||
warn "Secondary zone count ($sec_zones) differs from primary ($pri_zones) — may still be transferring"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
section "4. knel.net zone resolves identically on primary and secondary"
|
||||
|
||||
# Query a known record on both servers directly via Technitium's port
|
||||
for name in pfv-netinfra-01 pfv-netinfra-02 tsys-cloudron tsys-siem tsys-wazuh; do
|
||||
fqdn="${name}.knel.net"
|
||||
# Query via dig against each Technitium instance (through Pi-hole on :53)
|
||||
pri_ans=$(run "$PRIMARY" "dig +short +time=3 +tries=1 @127.0.0.1 -p 53 $fqdn A 2>/dev/null | head -1" 2>/dev/null || true)
|
||||
sec_ans=$(run "$SECONDARY" "dig +short +time=3 +tries=1 @127.0.0.1 -p 53 $fqdn A 2>/dev/null | head -1" 2>/dev/null || true)
|
||||
|
||||
if [ -n "$pri_ans" ] && [ "$pri_ans" = "$sec_ans" ]; then
|
||||
ok "$fqdn resolves identically: $pri_ans"
|
||||
elif [ -n "$pri_ans" ] && [ -z "$sec_ans" ]; then
|
||||
warn "$fqdn: primary=$pri_ans secondary=<no answer> (may still be syncing)"
|
||||
elif [ -z "$pri_ans" ] && [ -z "$sec_ans" ]; then
|
||||
warn "$fqdn: no answer on either server"
|
||||
else
|
||||
fail "$fqdn MISMATCH: primary=$pri_ans secondary=$sec_ans"
|
||||
fi
|
||||
done
|
||||
|
||||
# =============================================================================
|
||||
section "5. External DNS resolution works on both nodes"
|
||||
|
||||
for h in "$PRIMARY" "$SECONDARY"; do
|
||||
ans=$(run "$h" "dig +short +time=3 +tries=1 @127.0.0.1 -p 53 github.com A 2>/dev/null | head -1" 2>/dev/null || true)
|
||||
if [ -n "$ans" ]; then
|
||||
ok "$h resolves github.com → $ans"
|
||||
else
|
||||
fail "$h cannot resolve github.com"
|
||||
fi
|
||||
done
|
||||
|
||||
# =============================================================================
|
||||
section "6. Zone transfer (AXFR) from primary to secondary"
|
||||
|
||||
# Test AXFR of knel.net from the primary
|
||||
axfr=$(run "$SECONDARY" "dig +short +time=5 +tries=1 @${PRIMARY_IP} -p ${TECH_PORT} knel.net AXFR 2>/dev/null | wc -l" 2>/dev/null || echo "0")
|
||||
if [ "$axfr" -gt 1 ] 2>/dev/null; then
|
||||
ok "AXFR of knel.net from primary succeeds ($axfr records transferred)"
|
||||
else
|
||||
warn "AXFR test returned $axfr records — zone transfer may be restricted or in progress"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
section "7. Reverse DNS works"
|
||||
|
||||
# Pick a known reverse zone and test PTR resolution
|
||||
ptr_test="181.103.100.in-addr.arpa"
|
||||
ptr_ans=$(run "$PRIMARY" "dig +short +time=3 +tries=1 @127.0.0.1 -p 53 $ptr_test SOA 2>/dev/null | head -1" 2>/dev/null || true)
|
||||
if [ -n "$ptr_ans" ]; then
|
||||
ok "Reverse zone $ptr_test has SOA on primary"
|
||||
else
|
||||
warn "Reverse zone $ptr_test: no SOA on primary"
|
||||
fi
|
||||
|
||||
ptr_ans2=$(run "$SECONDARY" "dig +short +time=3 +tries=1 @127.0.0.1 -p 53 $ptr_test SOA 2>/dev/null | head -1" 2>/dev/null || true)
|
||||
if [ -n "$ptr_ans2" ]; then
|
||||
ok "Reverse zone $ptr_test has SOA on secondary"
|
||||
else
|
||||
warn "Reverse zone $ptr_test: no SOA on secondary"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
section "8. Production untouched (read-only verification)"
|
||||
|
||||
# Verify production container is still running and unchanged
|
||||
prod_status=$(run_root "$PROD" "docker ps --format '{{.Status}}' tsys-dns 2>/dev/null" | head -1)
|
||||
if echo "$prod_status" | grep -qi 'Up'; then
|
||||
ok "Production container still running on $PROD ($prod_status)"
|
||||
else
|
||||
fail "Production container NOT running on $PROD!"
|
||||
fi
|
||||
|
||||
prod_zones_after=$(count_zones "$PROD")
|
||||
if [ "$prod_zones_after" = "$prod_zones" ]; then
|
||||
ok "Production zone count unchanged ($prod_zones_after = $prod_zones before)"
|
||||
else
|
||||
fail "Production zone count CHANGED: $prod_zones → $prod_zones_after"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
section "9. Failover test"
|
||||
|
||||
# Take the approach of querying via the secondary when primary is slow/unavailable.
|
||||
# We test that the secondary answers independently.
|
||||
sec_soa=$(run "$SECONDARY" "dig +short +time=3 +tries=1 @127.0.0.1 -p 53 knel.net SOA 2>/dev/null | head -1" 2>/dev/null || true)
|
||||
if [ -n "$sec_soa" ]; then
|
||||
ok "Secondary independently serves knel.net SOA: $sec_soa"
|
||||
else
|
||||
fail "Secondary cannot serve knel.net SOA independently"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
section "10. Credentials check — auth.config size matches production"
|
||||
|
||||
prod_auth_size=$(run_root "$PROD" "docker exec tsys-dns wc -c < /etc/dns/auth.config 2>/dev/null" | tr -d '[:space:]')
|
||||
pri_auth_size=$(run_root "$PRIMARY" "docker exec tsys-dns wc -c < /etc/dns/auth.config 2>/dev/null" | tr -d '[:space:]')
|
||||
sec_auth_size=$(run_root "$SECONDARY" "docker exec tsys-dns wc -c < /etc/dns/auth.config 2>/dev/null" | tr -d '[:space:]')
|
||||
|
||||
echo " auth.config sizes — prod=$prod_auth_size pri=$pri_auth_size sec=$sec_auth_size"
|
||||
|
||||
if [ "$prod_auth_size" = "$pri_auth_size" ] && [ "$prod_auth_size" = "$sec_auth_size" ]; then
|
||||
ok "auth.config identical size across all three nodes (credentials + 2FA replicated)"
|
||||
else
|
||||
fail "auth.config sizes differ — credentials may not be replicated correctly"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Summary
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " PASSED: $PASS"
|
||||
echo " FAILED: $FAIL"
|
||||
echo " WARNED: $WARN"
|
||||
echo "=========================================="
|
||||
[ "$FAIL" -eq 0 ] && exit 0 || exit 1
|
||||
Executable
+115
@@ -0,0 +1,115 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# drift-check.sh — compare live netinfra DNS/DHCP config against git [#420][#469]
|
||||
#
|
||||
# Verifies that the running configuration on netinfra-01/02 matches the
|
||||
# files tracked in this repo. Founded after the 2026-09-01 DNS incident:
|
||||
# the live systems are production; git is the source of truth; drift is
|
||||
# a defect.
|
||||
#
|
||||
# Checks per node:
|
||||
# - /etc/dhcp/dhcpd.conf vs netinfra/dhcp/dhcpd-{primary,secondary}.conf
|
||||
# - /etc/pihole/pihole.toml vs netinfra/dns/pihole/netinfra-0{1,2}.pihole.toml
|
||||
# (secrets redacted on both sides before compare; "Last updated" line ignored)
|
||||
# - /etc/ntpsec/ntp.conf vs netinfra/ntp/ntp.conf (nodes are identical)
|
||||
# - Technitium zones (node 01, the replication primary): md5 manifest of the
|
||||
# binary DZ store vs netinfra/dns/technitium/zones/ [#630]
|
||||
#
|
||||
# Usage:
|
||||
# drift-check.sh [--node 01|02|all] (default: all)
|
||||
# Exit: 0 = in sync, 1 = drift detected, 2 = fetch failure
|
||||
#
|
||||
set -uo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
DNS_SETUP="$HERE/dns-cluster-setup"
|
||||
DHCP_DIR="$HERE/dhcp"
|
||||
PIHOLE_DIR="$HERE/dns/pihole"
|
||||
NTP_FILE="$HERE/ntp/ntp.conf"
|
||||
ZONES_DIR="$HERE/dns/technitium/zones"
|
||||
REMOTE_ZONE_DIR="/home/localuser/services/technitium/config/zones"
|
||||
|
||||
REDACT='s/^( *pwhash *=).*/\1 "REDACTED"/; s/^( *totp_secret *=).*/\1 "REDACTED"/; s/^( *password *=).*/\1 "REDACTED"/'
|
||||
|
||||
# redact_config <stdin> <stdout> — strip secrets from pihole.toml content
|
||||
redact_config() { sed -E "$REDACT"; }
|
||||
|
||||
# normalize_toml <stdin> <stdout> — redact + drop churn lines (timestamps)
|
||||
normalize_toml() { redact_config | grep -v "Last updated on"; }
|
||||
|
||||
# gen_manifest <dir> — sorted 'md5 name' manifest of *.zone files (name-sorted)
|
||||
gen_manifest() { (cd "$1" && md5sum -- *.zone 2>/dev/null | sort -k2); }
|
||||
|
||||
# fetch <node> <remote-cmd> — run via the remote-dns.sh chokepoint (env IPs honored)
|
||||
fetch() {
|
||||
local node="$1" cmd="$2"
|
||||
bash "$DNS_SETUP/remote-dns.sh" "netinfra${node}-root" "$cmd" 2>/dev/null
|
||||
}
|
||||
|
||||
# check_file <label> <node> <remote-cat-cmd> <local-file> <normalize-fn>
|
||||
check_file() {
|
||||
local label="$1" node="$2" rcmd="$3" local_file="$4" norm="$5" tmp rc
|
||||
tmp="$(mktemp)"
|
||||
fetch "$node" "$rcmd" | "$norm" > "$tmp"
|
||||
if [ ! -s "$tmp" ]; then
|
||||
echo "DRIFT-ERROR: $label: live fetch empty (node $node unreachable?)"
|
||||
rm -f "$tmp"
|
||||
return 2
|
||||
fi
|
||||
"$norm" < "$local_file" | diff -q - "$tmp" >/dev/null 2>&1
|
||||
rc=$?
|
||||
if [ "$rc" -ne 0 ]; then
|
||||
echo "DRIFT: $label (node $node) differs from git: $local_file"
|
||||
"$norm" < "$local_file" | diff - "$tmp" | head -10
|
||||
else
|
||||
echo "OK: $label (node $node) in sync"
|
||||
fi
|
||||
rm -f "$tmp"
|
||||
return "$rc"
|
||||
}
|
||||
|
||||
main() {
|
||||
local nodes="${1:-all}" node rc_total=0 rc
|
||||
[ "$nodes" = "all" ] && nodes="01 02"
|
||||
for node in $nodes; do
|
||||
local_dhcp="$DHCP_DIR/dhcpd-primary.conf"
|
||||
[ "$node" = "02" ] && local_dhcp="$DHCP_DIR/dhcpd-secondary.conf"
|
||||
local_pihole="$PIHOLE_DIR/netinfra-01.pihole.toml"
|
||||
[ "$node" = "02" ] && local_pihole="$PIHOLE_DIR/netinfra-02.pihole.toml"
|
||||
|
||||
check_file "dhcpd.conf" "$node" "cat /etc/dhcp/dhcpd.conf" "$local_dhcp" cat || rc_total=1
|
||||
check_file "pihole.toml" "$node" \
|
||||
"docker exec pihole cat /etc/pihole/pihole.toml" "$local_pihole" normalize_toml || rc_total=1
|
||||
check_file "ntp.conf" "$node" "cat /etc/ntpsec/ntp.conf" "$NTP_FILE" cat || rc_total=1
|
||||
done
|
||||
|
||||
# Technitium zones: binary DZ files, compared by md5 manifest against the
|
||||
# primary (netinfra-01) — the replication source for -02.
|
||||
if [[ "$nodes" == *01* ]]; then
|
||||
remote_manifest="$(fetch 01 "cd $REMOTE_ZONE_DIR && md5sum -- *.zone | sort -k2")"
|
||||
if [ -z "$remote_manifest" ]; then
|
||||
echo "DRIFT-ERROR: technitium zones: live fetch empty (node 01 unreachable?)"
|
||||
rc_total=1
|
||||
else
|
||||
if diff -q <(gen_manifest "$ZONES_DIR") <(printf '%s\n' "$remote_manifest") >/dev/null 2>&1; then
|
||||
echo "OK: technitium zones (node 01) in sync"
|
||||
else
|
||||
echo "DRIFT: technitium zones (node 01) manifest differs from git: $ZONES_DIR"
|
||||
diff <(gen_manifest "$ZONES_DIR") <(printf '%s\n' "$remote_manifest") | head -10
|
||||
rc_total=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ "$rc_total" -eq 0 ]; then
|
||||
echo "drift-check: ALL IN SYNC"
|
||||
else
|
||||
echo "drift-check: DRIFT DETECTED — reconcile git <-> live before any change"
|
||||
fi
|
||||
return "$rc_total"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
node="${2:-all}"
|
||||
[ "${1:-}" = "--node" ] && node="${2:-}" || node="all"
|
||||
main "$node"
|
||||
fi
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# zone-snapshot.sh — refresh the git SoR snapshot of the Technitium zone
|
||||
# store [#630][#728]
|
||||
#
|
||||
# Pulls the binary DZ zone files from netinfra-01 (the replication primary)
|
||||
# into netinfra/dns/technitium/zones/ via the remote-dns.sh chokepoint, then
|
||||
# shows which snapshot files changed.
|
||||
#
|
||||
# RULE (founder, 2026-09-02): run this after EVERY Technitium record change
|
||||
# and commit the refreshed snapshots in the same session, so the git SoR
|
||||
# never goes stale. netinfra/dns/drift-check.sh verifies the result; the
|
||||
# pre-push rule audit fails on a stale questions file and drift-check is the
|
||||
# DNS counterpart: green before you push any DNS-adjacent change.
|
||||
#
|
||||
# Usage:
|
||||
# zone-snapshot.sh refresh snapshots from the primary
|
||||
# zone-snapshot.sh --check verify only (delegates to drift-check.sh)
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # netinfra/dns/technitium
|
||||
REPO="$(cd "$HERE/../../.." && pwd)"
|
||||
REMOTE_DNS="$HERE/../../dns-cluster-setup/remote-dns.sh"
|
||||
ZONES_DIR="$HERE/zones"
|
||||
REMOTE_ZONE_DIR="/home/localuser/services/technitium/config/zones"
|
||||
|
||||
if [ "${1:-}" = "--check" ]; then
|
||||
exec bash "$HERE/../drift-check.sh"
|
||||
fi
|
||||
|
||||
tmp="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
echo "Fetching zone store from netinfra-01 (primary)..."
|
||||
bash "$REMOTE_DNS" netinfra01-root "cd '$REMOTE_ZONE_DIR' && tar cf - *.zone" > "$tmp/zones.tar"
|
||||
|
||||
# Validate the archive before touching the tracked tree.
|
||||
tar -tf "$tmp/zones.tar" >/dev/null
|
||||
|
||||
mkdir -p "$ZONES_DIR"
|
||||
find "$ZONES_DIR" -maxdepth 1 -name '*.zone' -delete
|
||||
tar -xf "$tmp/zones.tar" -C "$ZONES_DIR"
|
||||
|
||||
count="$(find "$ZONES_DIR" -maxdepth 1 -name '*.zone' | wc -l)"
|
||||
echo "Snapshotted $count zone files into ${ZONES_DIR#"$REPO"/}"
|
||||
|
||||
echo "Changed snapshot files (git):"
|
||||
changed="$(git -C "$REPO" status --porcelain -- "$ZONES_DIR")"
|
||||
if [ -n "$changed" ]; then
|
||||
printf '%s\n' "$changed" | sed "s|^$REPO/||" | head -20
|
||||
printf '%s\n' "$changed" | wc -l | xargs -I{} echo "{} files changed — commit these in the same session (DNS sync rule)"
|
||||
else
|
||||
echo " (none — snapshots were already current)"
|
||||
fi
|
||||
|
||||
echo "Verify with: netinfra/dns/drift-check.sh"
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user