netbox-windows-dhcp-plugin 0.1.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. netbox_windows_dhcp_plugin-0.1.0rc1/.gitignore +20 -0
  2. netbox_windows_dhcp_plugin-0.1.0rc1/CHANGELOG.md +93 -0
  3. netbox_windows_dhcp_plugin-0.1.0rc1/LICENSE +202 -0
  4. netbox_windows_dhcp_plugin-0.1.0rc1/PKG-INFO +137 -0
  5. netbox_windows_dhcp_plugin-0.1.0rc1/README.md +104 -0
  6. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/__init__.py +44 -0
  7. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/api/__init__.py +0 -0
  8. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/api/serializers.py +358 -0
  9. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/api/urls.py +25 -0
  10. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/api/views.py +174 -0
  11. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/choices.py +200 -0
  12. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/conf.py +151 -0
  13. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/connection.py +103 -0
  14. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/filtersets.py +343 -0
  15. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/forms.py +873 -0
  16. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/graphql/__init__.py +3 -0
  17. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/graphql/filters.py +132 -0
  18. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/graphql/schema.py +60 -0
  19. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/graphql/types.py +179 -0
  20. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/integrations/__init__.py +0 -0
  21. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/integrations/branching.py +357 -0
  22. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/jobs.py +496 -0
  23. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/leases.py +57 -0
  24. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/migrations/0001_initial.py +837 -0
  25. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/migrations/0002_import_fields.py +31 -0
  26. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/migrations/0003_remaining_objects.py +193 -0
  27. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/migrations/0004_reservation_iaid.py +18 -0
  28. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/migrations/__init__.py +0 -0
  29. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/models/__init__.py +36 -0
  30. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/models/dhcp.py +821 -0
  31. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/models/servers.py +202 -0
  32. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/models/sync.py +212 -0
  33. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/navigation.py +64 -0
  34. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/object_actions.py +112 -0
  35. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/review.py +58 -0
  36. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/search.py +56 -0
  37. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/signals.py +270 -0
  38. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/sync/__init__.py +7 -0
  39. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/sync/diff.py +133 -0
  40. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/sync/importer.py +426 -0
  41. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/sync/mapping.py +800 -0
  42. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/sync/netbox_state.py +556 -0
  43. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/sync/push.py +612 -0
  44. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/sync/pusher.py +157 -0
  45. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/sync/windows_state.py +744 -0
  46. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/sync/windows_writer.py +441 -0
  47. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/tables.py +391 -0
  48. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/templates/netbox_windows_dhcp_plugin/buttons/bulk_post.html +3 -0
  49. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/templates/netbox_windows_dhcp_plugin/buttons/post.html +6 -0
  50. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/templates/netbox_windows_dhcp_plugin/buttons/test_connection.html +6 -0
  51. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/templates/netbox_windows_dhcp_plugin/inc/lease_panel.html +78 -0
  52. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/templates/netbox_windows_dhcp_plugin/subnet_leases.html +9 -0
  53. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/ui/__init__.py +0 -0
  54. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/ui/panels.py +170 -0
  55. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/urls.py +32 -0
  56. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/version.py +1 -0
  57. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/views.py +602 -0
  58. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/windows/__init__.py +18 -0
  59. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/windows/client.py +1953 -0
  60. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/windows/fake.py +1169 -0
  61. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/windows/normalize.py +213 -0
  62. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/windows/psscript.py +307 -0
  63. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/windows/runner.py +130 -0
  64. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/windows/ssh.py +306 -0
  65. netbox_windows_dhcp_plugin-0.1.0rc1/netbox_windows_dhcp_plugin/windows/winrm.py +137 -0
  66. netbox_windows_dhcp_plugin-0.1.0rc1/pyproject.toml +80 -0
@@ -0,0 +1,20 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .venv/
5
+ build/
6
+ dist/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .coverage
10
+ htmlcov/
11
+ site/
12
+ dev/data/
13
+ .env
14
+
15
+ # Local Claude Code notes, kept out of the repo
16
+ CLAUDE.md
17
+ .claude/
18
+
19
+ # Lab test output (raw envelopes and property dumps): may identify the lab, never commit
20
+ .lab/
@@ -0,0 +1,93 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).
5
+
6
+ ## [Unreleased]
7
+
8
+ Pre-release 0.1.0rc1 (2026-10-21) is on PyPI for testing ahead of the lab run; 0.1.0 follows once the lab tests
9
+ pass. First release. Every v1 feature is in place and tested against the fake server and PowerShell stubs; the lab tests
10
+ against a real Windows server are written (`make test-lab`, `make lab-e2e`) but not run yet.
11
+
12
+ ### Added
13
+
14
+ Connections and security
15
+
16
+ - Windows server connection settings linked to netbox-plugin-dhcp servers: WinRM (NTLM, Basic or Kerberos, HTTPS by
17
+ default) or SSH, with an optional `computer_name` for a management host.
18
+ - Credential profiles in `PLUGINS_CONFIG`, each secret inline, from an environment variable or a file. Nothing secret
19
+ is stored in the database, the change log or job logs.
20
+ - `allowed_hosts` on credential profiles limits which hosts their credentials can be sent to, checked when a Windows
21
+ server is saved and before every connection. Basic authentication requires HTTPS with certificate checks. SSH
22
+ always verifies the host key (pinned key or the worker's known_hosts).
23
+ - "Test connection" button and REST action, run as a background job.
24
+
25
+ Models and API
26
+
27
+ - Models for what netbox-plugin-dhcp does not hold: Windows scope and reservation settings (including the DHCPv6
28
+ IAID), exclusion ranges, user and vendor classes, option definitions (Windows data type and default value),
29
+ option qualifiers, vendor class option definitions and values, policies, failover relationships, MAC filters and
30
+ the allow and deny list switches.
31
+ - Sync bookkeeping: sync state, sync runs and import proposals.
32
+ - REST API and GraphQL for every model. Names of classes, policies, superscopes and failover relationships compare
33
+ without case, as on Windows.
34
+
35
+ Import (Windows to NetBox)
36
+
37
+ - IPv4 scopes, superscopes, exclusion ranges, reservations, user and vendor classes, option definitions, vendor class
38
+ options, policies (conditions, IP ranges, processing order, lease time), failover relationships, MAC filters and
39
+ option values at server, scope, reservation, user class and policy level. They become netbox-plugin-dhcp objects
40
+ plus the prefixes, IP ranges, IP addresses and MAC addresses they need, in the server's import VRF. Objects missing
41
+ on Windows are proposed for deletion.
42
+ - DHCPv6 scopes (lifetimes, T1 and T2, state, preference), reservations (DUID, IAID), user classes and option values
43
+ against netbox-plugin-dhcp's standard DHCPv6 definitions. DHCPv6 vendor classes and values, other option codes and
44
+ exclusion ranges are noted and left alone.
45
+ - Option values containing a comma, stored as `\,` (Kea's escape).
46
+ - With netbox-branching, each import writes into a branch `dhcp-import/<server>/<timestamp>` (reused while open) and,
47
+ with netbox-change-control, opens a change request submitted for review.
48
+ - Without branching, each import fills an import proposal whose items are applied or dismissed one by one, in bulk
49
+ or for the whole proposal, from the UI or the REST API. Applying writes as the reviewing user, checks their
50
+ permissions, and refuses items whose NetBox object changed since the import.
51
+ - "Import now" button and REST action, and scheduled imports every `import_interval` minutes (`import_user` for
52
+ scheduled imports with branching).
53
+
54
+ Push (NetBox to Windows)
55
+
56
+ - A reconcile per server that creates, updates and deletes every kind above, in dependency order, so Windows matches
57
+ NetBox.
58
+ - Only objects recorded in sync state are deleted. Objects created by hand on Windows are left alone, and so are
59
+ managed objects changed on Windows since the last push and objects whose removal would take unmanaged ones with
60
+ them. Identical objects are adopted as managed; applying an import item adopts it straight away.
61
+ - NetBox data Windows cannot hold (a scope without a pool, a reservation without a MAC address, options 1 and 51,
62
+ values of codes Windows does not define) is reported in the sync run instead of pushed. A scope subnet mask or an
63
+ option definition type is never changed in place, and a scope with leases is never force-removed.
64
+ - With netbox-branching, merging or reverting a branch queues a push for each Windows server it touched. Other saves
65
+ (all of them without branching, direct edits of main with it) queue one push per server after commit,
66
+ `push_debounce` seconds later. `sync_enabled = False` stops pushes.
67
+ - "Sync now" and "Dry run" buttons and REST actions. A dry run records the planned changes in its sync run.
68
+ - Failover: relationships are written on the primary, with the shared secret read from the credential profile named
69
+ in `shared_secret_profile`; the changed scopes are then replicated to the partner. A scope leaving a relationship
70
+ leaves it before it is deleted, and a scope with leases is refused before anything changes.
71
+ - One import or push per server at a time across all workers (a PostgreSQL advisory lock); a busy push retries a
72
+ minute later.
73
+
74
+ Leases
75
+
76
+ - A Leases tab on the subnet page of Windows scopes (IPv4 and DHCPv6) reads the live leases in a background job.
77
+ Viewing needs the subnet and its Windows server, loading needs permission to change the server, and is refused
78
+ inside a branch. Leases are not stored.
79
+
80
+ Documentation
81
+
82
+ - A documentation site (https://thomaschristory.github.io/netbox-windows-dhcp-plugin/): installation, preparing
83
+ Windows, configuration, a first-sync walkthrough, how objects map, import, push, DHCPv6, failover, leases,
84
+ permissions, REST API and GraphQL, security, workers and jobs, troubleshooting and limitations.
85
+ - `SECURITY.md`: report vulnerabilities through GitHub's private vulnerability reporting.
86
+
87
+ Development
88
+
89
+ - `dev/scripts/lab-server-setup.ps1` prepares a Windows Server VM as the lab server (DHCP role, a least-privilege
90
+ account, WinRM over HTTPS).
91
+ - Opt-in lab tests against a real Windows DHCP server: `make test-lab` (the client over WinRM, one round trip per
92
+ unverified cmdlet) and `make lab-e2e` (import, push and leases on the dev stack). They only touch `nbwd-test-`
93
+ objects in `198.18.0.0/15` and `2001:db8:4e42::/64`.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.5
2
+ Name: netbox-windows-dhcp-plugin
3
+ Version: 0.1.0rc1
4
+ Summary: Sync netbox-plugin-dhcp data with Microsoft Windows DHCP servers over WinRM or SSH.
5
+ Project-URL: Homepage, https://github.com/thomaschristory/netbox-windows-dhcp-plugin
6
+ Project-URL: Documentation, https://thomaschristory.github.io/netbox-windows-dhcp-plugin/
7
+ Project-URL: Repository, https://github.com/thomaschristory/netbox-windows-dhcp-plugin
8
+ Project-URL: Changelog, https://github.com/thomaschristory/netbox-windows-dhcp-plugin/blob/main/CHANGELOG.md
9
+ Project-URL: Issues, https://github.com/thomaschristory/netbox-windows-dhcp-plugin/issues
10
+ Author: Thomas Christory
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ Keywords: ddi,dhcp,netbox,netbox-plugin,windows,winrm
14
+ Classifier: Development Status :: 2 - Pre-Alpha
15
+ Classifier: Framework :: Django
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: System :: Networking
23
+ Requires-Python: >=3.12
24
+ Requires-Dist: netbox-plugin-dhcp<0.3,>=0.2
25
+ Requires-Dist: paramiko>=3.5
26
+ Requires-Dist: pypsrp>=0.8
27
+ Provides-Extra: branching
28
+ Requires-Dist: netbox-change-control>=0.6; extra == 'branching'
29
+ Requires-Dist: netboxlabs-netbox-branching>=1.2.2; extra == 'branching'
30
+ Provides-Extra: kerberos
31
+ Requires-Dist: pypsrp[kerberos]>=0.8; extra == 'kerberos'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # netbox-windows-dhcp-plugin
35
+
36
+ A NetBox plugin that keeps Microsoft Windows DHCP servers in step with the data modelled by
37
+ [netbox-plugin-dhcp](https://github.com/sys4/netbox-plugin-dhcp), in both directions, over WinRM or SSH.
38
+
39
+ **Documentation: https://thomaschristory.github.io/netbox-windows-dhcp-plugin/**
40
+
41
+ > **Status: pre-release.** Every v1 feature is built and tested against an in-memory fake server and PowerShell
42
+ > stubs. Some cmdlets the plugin uses have not been checked against a real Windows server yet; they are marked
43
+ > `# unverified:` in the code, and the lab tests that settle them are waiting for a lab server (see the
44
+ > [roadmap](https://github.com/thomaschristory/netbox-windows-dhcp-plugin/blob/main/docs/ROADMAP.md) and
45
+ > [limitations](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/limitations/)). Try it on a lab server
46
+ > first.
47
+
48
+ ## Features
49
+
50
+ - **Import** from Windows, on demand or every `import_interval` minutes. With
51
+ [netbox-branching](https://github.com/netboxlabs/netbox-branching) each import lands in a branch (plus a change
52
+ request with [netbox-change-control](https://github.com/antoinekh/netbox-change-control)); without it, in an import
53
+ proposal whose items you apply or dismiss.
54
+ - **Push** to Windows: a reconcile per server when a branch is merged, or a few seconds after a save without
55
+ branching, plus "Sync now" and "Dry run". A push only deletes Windows objects NetBox manages; objects made by hand
56
+ on Windows are left alone until imported.
57
+ - IPv4 scopes, superscopes, exclusion ranges, reservations, option definitions and values, user and vendor classes,
58
+ vendor class options, policies, failover relationships (with replication to the partner) and MAC filters.
59
+ - DHCPv6 scopes, reservations (DUID and IAID), user classes and option values.
60
+ - A **Leases** tab on the subnet page, read live from Windows in a background job.
61
+ - WinRM (NTLM, Kerberos, Basic; HTTPS by default) or SSH, as in
62
+ [terraform-provider-windowsddi](https://github.com/thomaschristory/terraform-provider-windowsddi). Credentials
63
+ live in named profiles in the plugin configuration, limited to `allowed_hosts`, never in the database.
64
+ - REST API and GraphQL for every model; all Windows I/O in background jobs.
65
+
66
+ ## Compatibility
67
+
68
+ | Plugin | NetBox | netbox-plugin-dhcp | netbox-branching | Python |
69
+ |---|---|---|---|---|
70
+ | 0.1.x | 4.7 | 0.2.x | 1.2.2+ (optional) | 3.12 to 3.14 |
71
+
72
+ Windows Server 2016 or later with the DHCP Server role.
73
+
74
+ ## Quick start
75
+
76
+ ```bash
77
+ pip install --pre netbox-windows-dhcp-plugin # or ==0.1.0rc1; --pre is needed until 0.1.0 is out
78
+ # extras: [kerberos] for Kerberos (needs system GSSAPI libraries), [branching] for branching and change control
79
+ ```
80
+
81
+ ```python
82
+ PLUGINS = ["netbox_dhcp", "netbox_windows_dhcp_plugin"]
83
+
84
+ PLUGINS_CONFIG = {
85
+ "netbox_windows_dhcp_plugin": {
86
+ "credentials": {
87
+ "dhcp-admin": {
88
+ "username": "CORP\\svc-netbox-dhcp",
89
+ "password_env": "DHCP_ADMIN_PASSWORD",
90
+ "allowed_hosts": ["dhcp*.corp.example"],
91
+ },
92
+ },
93
+ },
94
+ }
95
+ ```
96
+
97
+ Run `python manage.py migrate`, restart NetBox and its worker, then add a Windows server under **Windows DHCP >
98
+ Windows servers**, click **Test connection** and **Import now**. The
99
+ [first sync](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/quickstart/) walkthrough covers the rest.
100
+
101
+ ## Documentation
102
+
103
+ - [Installation](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/installation/) and
104
+ [preparing Windows](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/windows-setup/)
105
+ - [Configuration](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/configuration/) and
106
+ [security](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/security/)
107
+ - [How objects map](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/mapping/),
108
+ [import](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/import/) and
109
+ [push](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/push/)
110
+ - [Permissions](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/permissions/),
111
+ [REST API and GraphQL](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/api/),
112
+ [troubleshooting](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/troubleshooting/)
113
+ - [Design](https://github.com/thomaschristory/netbox-windows-dhcp-plugin/blob/main/docs/DESIGN.md) and
114
+ [changelog](https://github.com/thomaschristory/netbox-windows-dhcp-plugin/blob/main/CHANGELOG.md)
115
+
116
+ The same pages are in the [`docs/`](https://github.com/thomaschristory/netbox-windows-dhcp-plugin/tree/main/docs)
117
+ folder of the repository.
118
+
119
+ ## Development
120
+
121
+ Requires [uv](https://docs.astral.sh/uv/) and Docker.
122
+
123
+ ```bash
124
+ make lint # ruff check and format check
125
+ make test # unit tests, no NetBox needed
126
+ make dev # NetBox, netbox-plugin-dhcp, branching and change control in docker
127
+ make test-netbox # NetBox integration tests inside the dev stack
128
+ make docs # build the documentation site
129
+ make dist # build and check the wheel and sdist
130
+ ```
131
+
132
+ See [Development](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/development/) for the lab tests
133
+ against a real Windows server.
134
+
135
+ ## License
136
+
137
+ Apache-2.0, see [LICENSE](https://github.com/thomaschristory/netbox-windows-dhcp-plugin/blob/main/LICENSE).
@@ -0,0 +1,104 @@
1
+ # netbox-windows-dhcp-plugin
2
+
3
+ A NetBox plugin that keeps Microsoft Windows DHCP servers in step with the data modelled by
4
+ [netbox-plugin-dhcp](https://github.com/sys4/netbox-plugin-dhcp), in both directions, over WinRM or SSH.
5
+
6
+ **Documentation: https://thomaschristory.github.io/netbox-windows-dhcp-plugin/**
7
+
8
+ > **Status: pre-release.** Every v1 feature is built and tested against an in-memory fake server and PowerShell
9
+ > stubs. Some cmdlets the plugin uses have not been checked against a real Windows server yet; they are marked
10
+ > `# unverified:` in the code, and the lab tests that settle them are waiting for a lab server (see the
11
+ > [roadmap](https://github.com/thomaschristory/netbox-windows-dhcp-plugin/blob/main/docs/ROADMAP.md) and
12
+ > [limitations](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/limitations/)). Try it on a lab server
13
+ > first.
14
+
15
+ ## Features
16
+
17
+ - **Import** from Windows, on demand or every `import_interval` minutes. With
18
+ [netbox-branching](https://github.com/netboxlabs/netbox-branching) each import lands in a branch (plus a change
19
+ request with [netbox-change-control](https://github.com/antoinekh/netbox-change-control)); without it, in an import
20
+ proposal whose items you apply or dismiss.
21
+ - **Push** to Windows: a reconcile per server when a branch is merged, or a few seconds after a save without
22
+ branching, plus "Sync now" and "Dry run". A push only deletes Windows objects NetBox manages; objects made by hand
23
+ on Windows are left alone until imported.
24
+ - IPv4 scopes, superscopes, exclusion ranges, reservations, option definitions and values, user and vendor classes,
25
+ vendor class options, policies, failover relationships (with replication to the partner) and MAC filters.
26
+ - DHCPv6 scopes, reservations (DUID and IAID), user classes and option values.
27
+ - A **Leases** tab on the subnet page, read live from Windows in a background job.
28
+ - WinRM (NTLM, Kerberos, Basic; HTTPS by default) or SSH, as in
29
+ [terraform-provider-windowsddi](https://github.com/thomaschristory/terraform-provider-windowsddi). Credentials
30
+ live in named profiles in the plugin configuration, limited to `allowed_hosts`, never in the database.
31
+ - REST API and GraphQL for every model; all Windows I/O in background jobs.
32
+
33
+ ## Compatibility
34
+
35
+ | Plugin | NetBox | netbox-plugin-dhcp | netbox-branching | Python |
36
+ |---|---|---|---|---|
37
+ | 0.1.x | 4.7 | 0.2.x | 1.2.2+ (optional) | 3.12 to 3.14 |
38
+
39
+ Windows Server 2016 or later with the DHCP Server role.
40
+
41
+ ## Quick start
42
+
43
+ ```bash
44
+ pip install --pre netbox-windows-dhcp-plugin # or ==0.1.0rc1; --pre is needed until 0.1.0 is out
45
+ # extras: [kerberos] for Kerberos (needs system GSSAPI libraries), [branching] for branching and change control
46
+ ```
47
+
48
+ ```python
49
+ PLUGINS = ["netbox_dhcp", "netbox_windows_dhcp_plugin"]
50
+
51
+ PLUGINS_CONFIG = {
52
+ "netbox_windows_dhcp_plugin": {
53
+ "credentials": {
54
+ "dhcp-admin": {
55
+ "username": "CORP\\svc-netbox-dhcp",
56
+ "password_env": "DHCP_ADMIN_PASSWORD",
57
+ "allowed_hosts": ["dhcp*.corp.example"],
58
+ },
59
+ },
60
+ },
61
+ }
62
+ ```
63
+
64
+ Run `python manage.py migrate`, restart NetBox and its worker, then add a Windows server under **Windows DHCP >
65
+ Windows servers**, click **Test connection** and **Import now**. The
66
+ [first sync](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/quickstart/) walkthrough covers the rest.
67
+
68
+ ## Documentation
69
+
70
+ - [Installation](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/installation/) and
71
+ [preparing Windows](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/windows-setup/)
72
+ - [Configuration](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/configuration/) and
73
+ [security](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/security/)
74
+ - [How objects map](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/mapping/),
75
+ [import](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/import/) and
76
+ [push](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/push/)
77
+ - [Permissions](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/permissions/),
78
+ [REST API and GraphQL](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/api/),
79
+ [troubleshooting](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/troubleshooting/)
80
+ - [Design](https://github.com/thomaschristory/netbox-windows-dhcp-plugin/blob/main/docs/DESIGN.md) and
81
+ [changelog](https://github.com/thomaschristory/netbox-windows-dhcp-plugin/blob/main/CHANGELOG.md)
82
+
83
+ The same pages are in the [`docs/`](https://github.com/thomaschristory/netbox-windows-dhcp-plugin/tree/main/docs)
84
+ folder of the repository.
85
+
86
+ ## Development
87
+
88
+ Requires [uv](https://docs.astral.sh/uv/) and Docker.
89
+
90
+ ```bash
91
+ make lint # ruff check and format check
92
+ make test # unit tests, no NetBox needed
93
+ make dev # NetBox, netbox-plugin-dhcp, branching and change control in docker
94
+ make test-netbox # NetBox integration tests inside the dev stack
95
+ make docs # build the documentation site
96
+ make dist # build and check the wheel and sdist
97
+ ```
98
+
99
+ See [Development](https://thomaschristory.github.io/netbox-windows-dhcp-plugin/development/) for the lab tests
100
+ against a real Windows server.
101
+
102
+ ## License
103
+
104
+ Apache-2.0, see [LICENSE](https://github.com/thomaschristory/netbox-windows-dhcp-plugin/blob/main/LICENSE).
@@ -0,0 +1,44 @@
1
+ from .version import __version__
2
+
3
+ try:
4
+ from netbox.plugins import PluginConfig
5
+ except ImportError: # imported outside NetBox (pure unit tests, build tools)
6
+ PluginConfig = None
7
+
8
+ if PluginConfig is not None:
9
+ from .conf import DEFAULTS
10
+
11
+ class WindowsDHCPConfig(PluginConfig):
12
+ name = "netbox_windows_dhcp_plugin"
13
+ verbose_name = "Windows DHCP"
14
+ description = "Sync netbox-plugin-dhcp data with Microsoft Windows DHCP servers"
15
+ version = __version__
16
+ author = "Thomas Christory"
17
+ author_email = "9317624+thomaschristory@users.noreply.github.com"
18
+ base_url = "windows-dhcp"
19
+ min_version = "4.7.0"
20
+ max_version = "4.7.99"
21
+ required_settings = []
22
+ default_settings = DEFAULTS
23
+
24
+ def ready(self):
25
+ super().ready()
26
+ import logging
27
+
28
+ from . import (
29
+ jobs, # noqa: F401 - registers the import scheduler system job
30
+ signals,
31
+ views, # noqa: F401 - the Leases tab on subnets, registered before netbox-plugin-dhcp builds its URLs
32
+ )
33
+ from .conf import profiles_without_allowed_hosts
34
+ from .integrations import branching
35
+
36
+ branching.register()
37
+ signals.connect()
38
+ unrestricted = profiles_without_allowed_hosts()
39
+ if unrestricted:
40
+ logging.getLogger(__name__).warning(
41
+ "credential profiles without allowed_hosts can be sent to any host: %s", ", ".join(unrestricted)
42
+ )
43
+
44
+ config = WindowsDHCPConfig