netbox-plugin-dns-bridge 1.5.0__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 (36) hide show
  1. netbox_plugin_dns_bridge-1.5.0/LICENSE.md +18 -0
  2. netbox_plugin_dns_bridge-1.5.0/MANIFEST.in +1 -0
  3. netbox_plugin_dns_bridge-1.5.0/PKG-INFO +286 -0
  4. netbox_plugin_dns_bridge-1.5.0/README.md +253 -0
  5. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/__init__.py +36 -0
  6. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/catalog_zone_manager.py +234 -0
  7. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/dns_server.py +46 -0
  8. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/management/commands/dns-export-zone.py +60 -0
  9. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/management/commands/dns-export-zones.py +52 -0
  10. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/management/commands/dns-settings.py +51 -0
  11. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/management/commands/dns-transfer-endpoint.py +117 -0
  12. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/migrations/0001_initial.py +58 -0
  13. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/models.py +33 -0
  14. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/request_handler.py +412 -0
  15. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/signals.py +37 -0
  16. netbox_plugin_dns_bridge-1.5.0/build/lib/netbox_dns_bridge/utils.py +35 -0
  17. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/__init__.py +36 -0
  18. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/catalog_zone_manager.py +234 -0
  19. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/dns_server.py +46 -0
  20. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/management/commands/dns-export-zone.py +60 -0
  21. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/management/commands/dns-export-zones.py +52 -0
  22. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/management/commands/dns-settings.py +51 -0
  23. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/management/commands/dns-transfer-endpoint.py +117 -0
  24. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/migrations/0001_initial.py +58 -0
  25. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/models.py +33 -0
  26. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/request_handler.py +412 -0
  27. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/signals.py +37 -0
  28. netbox_plugin_dns_bridge-1.5.0/netbox_dns_bridge/utils.py +35 -0
  29. netbox_plugin_dns_bridge-1.5.0/netbox_plugin_dns_bridge.egg-info/PKG-INFO +286 -0
  30. netbox_plugin_dns_bridge-1.5.0/netbox_plugin_dns_bridge.egg-info/SOURCES.txt +46 -0
  31. netbox_plugin_dns_bridge-1.5.0/netbox_plugin_dns_bridge.egg-info/dependency_links.txt +1 -0
  32. netbox_plugin_dns_bridge-1.5.0/netbox_plugin_dns_bridge.egg-info/not-zip-safe +1 -0
  33. netbox_plugin_dns_bridge-1.5.0/netbox_plugin_dns_bridge.egg-info/requires.txt +2 -0
  34. netbox_plugin_dns_bridge-1.5.0/netbox_plugin_dns_bridge.egg-info/top_level.txt +4 -0
  35. netbox_plugin_dns_bridge-1.5.0/pyproject.toml +33 -0
  36. netbox_plugin_dns_bridge-1.5.0/setup.cfg +4 -0
@@ -0,0 +1,18 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Sven Luethi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6
+ associated documentation files (the “Software”), to deal in the Software without restriction,
7
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
8
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial
12
+ portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
15
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
17
+ OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ recursive-include netbox_bind_provisioner *.py
@@ -0,0 +1,286 @@
1
+ Metadata-Version: 2.4
2
+ Name: netbox-plugin-dns-bridge
3
+ Version: 1.5.0
4
+ Summary: A bridge between netbox-plugin-dns and your DNS infrastructure.
5
+ Author: Sven Luethi
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025-2026 Sven Luethi
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
11
+ associated documentation files (the “Software”), to deal in the Software without restriction,
12
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
13
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all copies or substantial
17
+ portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
20
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
22
+ OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ Project-URL: Homepage, https://github.com/Suraxius/netbox-plugin-bind-provisioner
26
+ Project-URL: Issues, https://github.com/Suraxius/netbox-plugin-bind-provisioner/issues
27
+ Requires-Python: >=3.7
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE.md
30
+ Requires-Dist: netbox-plugin-dns>=1.5.0
31
+ Requires-Dist: dnspython>=2.8.0
32
+ Dynamic: license-file
33
+
34
+ # Netbox DNS Bridge
35
+ (Formerly Netbox Bind Provisioner)
36
+
37
+ The Netbox DNS Bridge plugin implements a lightweight DNS server inside Netbox and builds a bridge
38
+ for BIND and other DNS Servers implementing RFC9432 to retrieve DNS Zones directly from Netbox
39
+ using DNS native mechanisms.
40
+
41
+ <a href="https://pypi.org/project/netbox-plugin-bind-provisioner/"><img src="https://img.shields.io/pypi/v/netbox-plugin-bind-provisioner" alt="PyPi"></a>
42
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/stargazers"><img src="https://img.shields.io/github/stars/suraxius/netbox-plugin-bind-provisioner?style=flat" alt="Stars Badge"></a>
43
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/network/members"><img src="https://img.shields.io/github/forks/suraxius/netbox-plugin-bind-provisioner?style=flat" alt="Forks Badge"></a>
44
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/issues"><img src="https://img.shields.io/github/issues/suraxius/netbox-plugin-bind-provisioner" alt="Issues Badge"></a>
45
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/pulls"><img src="https://img.shields.io/github/issues-pr/suraxius/netbox-plugin-bind-provisioner" alt="Pull Requests Badge"></a>
46
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/graphs/contributors"><img src="https://img.shields.io/github/contributors/suraxius/netbox-plugin-bind-provisioner?color=2b9348" alt="GitHub contributors"></a>
47
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/blob/master/LICENSE"><img src="https://img.shields.io/github/license/suraxius/netbox-plugin-bind-provisioner?color=2b9348" alt="License Badge"></a>
48
+ <a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code Style Black"></a>
49
+ <a href="https://pepy.tech/project/netbox-plugin-bind-provisioner"><img src="https://static.pepy.tech/personalized-badge/netbox-plugin-bind-provisioner?period=total&left_color=BLACK&right_color=BLUE&left_text=Downloads" alt="Downloads"></a>
50
+ <a href="https://pepy.tech/project/netbox-plugin-bind-provisioner"><img src="https://static.pepy.tech/personalized-badge/netbox-plugin-bind-provisioner?period=monthly&left_color=BLACK&right_color=BLUE&left_text=Downloads%2fMonth" alt="Downloads/Week"></a>
51
+ <a href="https://pepy.tech/project/netbox-plugin-bind-provisioner"><img src="https://static.pepy.tech/personalized-badge/netbox-plugin-bind-provisioner?period=weekly&left_color=BLACK&right_color=BLUE&left_text=Downloads%2fWeek" alt="Downloads/Month"></a>
52
+
53
+
54
+
55
+ ![Architecture Overview](docs/architecture-overview.svg)
56
+
57
+ DISCLAIMER: The dynamic update endpoint isn't here yet. Its planned - without a deadline.
58
+
59
+ ## Plugin configuration
60
+ While providing Zone transfers via AXFR, the Server also exposes specialized catalog zones that BIND
61
+ and other RFC9432 compliant DNS Servers use to automatically discover newly created zones and remove
62
+ deleted ones. The plugin supports views and basic DNS security via TSIG.
63
+
64
+ The plugin exposes one catalog zone per view. Each catalog zone is made available under the special
65
+ zone name **"catz"** and addtionally under **"[viewname].catz"** and may be queried through the
66
+ built-in DNS server just like any other dns zone.
67
+
68
+ For proper operation, each view requires an installed TSIG key, and the `dns-transfer-endpoint` must
69
+ be running as a separate background service using the `manage.py` command. Note that DNSSEC support
70
+ will be added once BIND9 provides a mechanism to configure it through the Catalog Zones system.
71
+
72
+ To start the transfer endpoint service in the foreground:
73
+ ```
74
+ manage.py dns-transfer-endpoint --port 5354
75
+ ```
76
+ This process needs to be scheduled as a background service for the built-in DNS Server to work
77
+ correctly. For Linux users with Systemd (Ubuntu, etc), Matt Kollross provides a startup unit and
78
+ instructions [here](docs/install-systemd-service.md).
79
+
80
+ ### Service parameters
81
+ Parameter | Description
82
+ --------- | -------------------------------------------------------------------
83
+ --port | Port to listen on for requests (defaults to 5354)
84
+ --address | IP of interface to bind to (defaults to 0.0.0.0)
85
+
86
+ ### Plugin settings
87
+ Setting | Description
88
+ --------------------| ---------------------------------------------------------
89
+ tsig_keys | Maps a TSIG Key to be used for each view.
90
+
91
+ ## Plugin compatibility
92
+ This plugin is an extension to the netbox-plugin-dns plugin. As such the versioning of this plugin
93
+ was changed to match the one of the netbox-plugin-dns plugin closely. To guarantee compatability,
94
+ ensure that the major and minor version match between both plugins.
95
+ For example, when using netbox-plugin-dns `v1.5.5` install netbox-plugin-dns-bridge `v1.5.x`
96
+
97
+ ## Post 1.0.7 Upgrade Guide
98
+ After version 1.0.7, the project was restructured and renamed. Until that point version updates happened more or less
99
+ automatically. However, this shift is more of a move from one plugin to another as the package name has changed.
100
+
101
+ This should not be an issue since the slave DNS Servers connected to Netbox can operate independently while this plugin
102
+ is being upgraded.
103
+
104
+ Make sure to note down the catalog zone serial number before switching.
105
+
106
+ 1. Remove Netbox Bind Provisioner package
107
+ - Remove `netbox-plugin-bind-provisioner` from **local_dependencies.txt**
108
+ - Uninstall the package: `pip uninstall netbox-plugin-bind-provisioner`
109
+ 2. Install Netbox DNS Bridge package
110
+ - Install the package `pip install netbox-plugin-dns-bridge`
111
+ - Put `netbox-plugin-dns-bridge` in your **local_dependencies.txt** so it will be installed on next upgrade.
112
+ 3. Follow the Installation Guide below.
113
+ 4. Ensure the `dns-transfer-endpoint` service is not running before the next step.
114
+ 5. Restore the catalog zone serial you noted down previously so that your slave dns servers continue
115
+ to pull the changes: `manage.py dns-settings set catalog-zone-soa-serial yourserialnumber`
116
+ 6. Start the `dns-transfer-endpoint` service. This should be it.
117
+
118
+ ## Installation guide
119
+ This setup provisions a BIND9 server directly with DNS data from NetBox. BIND9 can optionally run on
120
+ a separate server. If so, any reference to 127.0.0.1 in step 6 must be replaced with the IP address
121
+ of the NetBox host. TCP and UDP traffic from the BIND9 server to the NetBox host must be allowed on
122
+ port 5354 (or the port you have configured).
123
+
124
+ This guide assumes:
125
+ - Netbox has been installed under /opt/netbox
126
+ - Bind9 is installed on the same host as Netbox
127
+ - The Netbox DNS Plugin netbox-plugin-dns is installed
128
+ - The following dns views exist in Netbox DNS:
129
+ - `public` (the default)
130
+ - `private`
131
+
132
+ 1. Preliminaries
133
+ - Install Bind9 on the same host that netbox is on.
134
+ - Generate a TSIG Key for the `public` and `private` dns views respectively.
135
+
136
+ 2. Adding required package
137
+ ```
138
+ cd netbox
139
+ echo netbox-plugin-bind-provisioner >> local_requirements.txt
140
+ . venv/bin/activate
141
+ pip install -r local_requirements.txt
142
+ ```
143
+
144
+ 3. Updating netbox plugin configuration (configuration.py)
145
+ Change following line from
146
+ ```
147
+ PLUGINS = ['netbox_dns']
148
+ ```
149
+ to
150
+ ```
151
+ PLUGINS = ['netbox_dns', 'netbox_dns_bridge']
152
+ ```
153
+
154
+ Configure the DNS Bridge Plugin using the PLUGINS_CONFIG dictionary.
155
+ Change
156
+ ```
157
+ PLUGINS_CONFIG = {}
158
+ ```
159
+ to
160
+ ```
161
+ PLUGINS_CONFIG = {
162
+ "netbox_dns_bridge": {
163
+ "tsig_keys": {
164
+ "public": {
165
+ "keyname": "public_view_key",
166
+ "algorithm": "hmac-sha256",
167
+ "secret": "base64-encoded-secret"
168
+ },
169
+ "private": {
170
+ "keyname": "private_view_key",
171
+ "algorithm": "hmac-sha256",
172
+ "secret": "base64-encoded-secret"
173
+ }
174
+ }
175
+ }
176
+ }
177
+ ```
178
+ Note that the tsig-key attributes keyname, algorithm and secret form a
179
+ dictionary in following python structure path:
180
+ ```
181
+ PLUGINS_CONFIG.netbox_dns_bridge.tsig_keys.<dns_view_name>
182
+ ```
183
+ This allows the plugin to map requests to the right dns view using the tsig
184
+ signature from each request.
185
+
186
+ 4. Run migrations
187
+ ```
188
+ python3 netbox/manage.py migrate
189
+ ```
190
+
191
+ 5. Start listener
192
+
193
+ This step runs the DNS endpoint used by bind to configure itself. You may want to write a
194
+ service wrapper that runs this in the background. A guide for setting up a systemd service on
195
+ Ubuntu is provided by Matt Kollross [here](docs/install-systemd-service.md). Dont forget to
196
+ activate the venv if you do decide to run this service in the background.
197
+
198
+ Note that `--port 5354` is optional. The listener will bind this port by default.
199
+ ```
200
+ python3 netbox/manage.py dns-transfer-endpoint --port 5354
201
+ ```
202
+
203
+ 6. Configuring a Bind9 to interact with Netbox via the dns-transfer-endpoint endpoint. Note that its
204
+ not possible to give all the correct details of the `options` block as it is heavily dependent
205
+ on the Operating System used. Please dont forget to adjust as required.
206
+
207
+ ```
208
+ ########## OPTIONS ##########
209
+
210
+ options {
211
+ allow-update { none; };
212
+ allow-query { any; };
213
+ allow-recursion { none; };
214
+ notify yes;
215
+ min-refresh-time 60;
216
+ };
217
+
218
+ ########## ACLs ##########
219
+
220
+ acl public {
221
+ !10.0.0.0/8;
222
+ !172.16.0.0/12;
223
+ !192.168.0.0/16;
224
+ any;
225
+ };
226
+
227
+ acl private {
228
+ 10.0.0.0/8;
229
+ 172.16.0.0/12;
230
+ 192.168.0.0/16;
231
+ };
232
+
233
+ ######## TSIG Keys ########
234
+ key "public_view_key" {
235
+ algorithm hmac-sha256;
236
+ secret "base64-encoded-secret";
237
+ };
238
+
239
+ key "private_view_key" {
240
+ algorithm hmac-sha256;
241
+ secret "base64-encoded-secret";
242
+ };
243
+ ###########################
244
+
245
+
246
+ ########## ZONES ##########
247
+ view "public" {
248
+ match-clients { public; };
249
+
250
+ catalog-zones {
251
+ zone "catz"
252
+ default-masters { 127.0.0.1 port 5354 key "public_view_key"; }
253
+ zone-directory "/var/lib/bind/zones"
254
+ min-update-interval 1;
255
+ };
256
+
257
+ zone "catz" {
258
+ type slave;
259
+ file "/var/lib/bind/zones/catz_public";
260
+ masters { 127.0.0.1 port 5354 key "public_view_key"; };
261
+ notify no;
262
+ };
263
+ };
264
+
265
+ view "private" {
266
+ match-clients { private; };
267
+
268
+ catalog-zones {
269
+ zone "catz"
270
+ default-masters { 127.0.0.1 port 5354 key "private_view_key"; }
271
+ zone-directory "/var/lib/bind/zones"
272
+ min-update-interval 1;
273
+ };
274
+
275
+ zone "catz" {
276
+ type slave;
277
+ file "/var/lib/bind/zones/catz_private";
278
+ masters { 127.0.0.1 port 5354 key "private_view_key"; };
279
+ notify no;
280
+ };
281
+ };
282
+ ```
283
+
284
+ 7. Restart bind - Done
285
+
286
+
@@ -0,0 +1,253 @@
1
+ # Netbox DNS Bridge
2
+ (Formerly Netbox Bind Provisioner)
3
+
4
+ The Netbox DNS Bridge plugin implements a lightweight DNS server inside Netbox and builds a bridge
5
+ for BIND and other DNS Servers implementing RFC9432 to retrieve DNS Zones directly from Netbox
6
+ using DNS native mechanisms.
7
+
8
+ <a href="https://pypi.org/project/netbox-plugin-bind-provisioner/"><img src="https://img.shields.io/pypi/v/netbox-plugin-bind-provisioner" alt="PyPi"></a>
9
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/stargazers"><img src="https://img.shields.io/github/stars/suraxius/netbox-plugin-bind-provisioner?style=flat" alt="Stars Badge"></a>
10
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/network/members"><img src="https://img.shields.io/github/forks/suraxius/netbox-plugin-bind-provisioner?style=flat" alt="Forks Badge"></a>
11
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/issues"><img src="https://img.shields.io/github/issues/suraxius/netbox-plugin-bind-provisioner" alt="Issues Badge"></a>
12
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/pulls"><img src="https://img.shields.io/github/issues-pr/suraxius/netbox-plugin-bind-provisioner" alt="Pull Requests Badge"></a>
13
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/graphs/contributors"><img src="https://img.shields.io/github/contributors/suraxius/netbox-plugin-bind-provisioner?color=2b9348" alt="GitHub contributors"></a>
14
+ <a href="https://github.com/suraxius/netbox-plugin-bind-provisioner/blob/master/LICENSE"><img src="https://img.shields.io/github/license/suraxius/netbox-plugin-bind-provisioner?color=2b9348" alt="License Badge"></a>
15
+ <a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code Style Black"></a>
16
+ <a href="https://pepy.tech/project/netbox-plugin-bind-provisioner"><img src="https://static.pepy.tech/personalized-badge/netbox-plugin-bind-provisioner?period=total&left_color=BLACK&right_color=BLUE&left_text=Downloads" alt="Downloads"></a>
17
+ <a href="https://pepy.tech/project/netbox-plugin-bind-provisioner"><img src="https://static.pepy.tech/personalized-badge/netbox-plugin-bind-provisioner?period=monthly&left_color=BLACK&right_color=BLUE&left_text=Downloads%2fMonth" alt="Downloads/Week"></a>
18
+ <a href="https://pepy.tech/project/netbox-plugin-bind-provisioner"><img src="https://static.pepy.tech/personalized-badge/netbox-plugin-bind-provisioner?period=weekly&left_color=BLACK&right_color=BLUE&left_text=Downloads%2fWeek" alt="Downloads/Month"></a>
19
+
20
+
21
+
22
+ ![Architecture Overview](docs/architecture-overview.svg)
23
+
24
+ DISCLAIMER: The dynamic update endpoint isn't here yet. Its planned - without a deadline.
25
+
26
+ ## Plugin configuration
27
+ While providing Zone transfers via AXFR, the Server also exposes specialized catalog zones that BIND
28
+ and other RFC9432 compliant DNS Servers use to automatically discover newly created zones and remove
29
+ deleted ones. The plugin supports views and basic DNS security via TSIG.
30
+
31
+ The plugin exposes one catalog zone per view. Each catalog zone is made available under the special
32
+ zone name **"catz"** and addtionally under **"[viewname].catz"** and may be queried through the
33
+ built-in DNS server just like any other dns zone.
34
+
35
+ For proper operation, each view requires an installed TSIG key, and the `dns-transfer-endpoint` must
36
+ be running as a separate background service using the `manage.py` command. Note that DNSSEC support
37
+ will be added once BIND9 provides a mechanism to configure it through the Catalog Zones system.
38
+
39
+ To start the transfer endpoint service in the foreground:
40
+ ```
41
+ manage.py dns-transfer-endpoint --port 5354
42
+ ```
43
+ This process needs to be scheduled as a background service for the built-in DNS Server to work
44
+ correctly. For Linux users with Systemd (Ubuntu, etc), Matt Kollross provides a startup unit and
45
+ instructions [here](docs/install-systemd-service.md).
46
+
47
+ ### Service parameters
48
+ Parameter | Description
49
+ --------- | -------------------------------------------------------------------
50
+ --port | Port to listen on for requests (defaults to 5354)
51
+ --address | IP of interface to bind to (defaults to 0.0.0.0)
52
+
53
+ ### Plugin settings
54
+ Setting | Description
55
+ --------------------| ---------------------------------------------------------
56
+ tsig_keys | Maps a TSIG Key to be used for each view.
57
+
58
+ ## Plugin compatibility
59
+ This plugin is an extension to the netbox-plugin-dns plugin. As such the versioning of this plugin
60
+ was changed to match the one of the netbox-plugin-dns plugin closely. To guarantee compatability,
61
+ ensure that the major and minor version match between both plugins.
62
+ For example, when using netbox-plugin-dns `v1.5.5` install netbox-plugin-dns-bridge `v1.5.x`
63
+
64
+ ## Post 1.0.7 Upgrade Guide
65
+ After version 1.0.7, the project was restructured and renamed. Until that point version updates happened more or less
66
+ automatically. However, this shift is more of a move from one plugin to another as the package name has changed.
67
+
68
+ This should not be an issue since the slave DNS Servers connected to Netbox can operate independently while this plugin
69
+ is being upgraded.
70
+
71
+ Make sure to note down the catalog zone serial number before switching.
72
+
73
+ 1. Remove Netbox Bind Provisioner package
74
+ - Remove `netbox-plugin-bind-provisioner` from **local_dependencies.txt**
75
+ - Uninstall the package: `pip uninstall netbox-plugin-bind-provisioner`
76
+ 2. Install Netbox DNS Bridge package
77
+ - Install the package `pip install netbox-plugin-dns-bridge`
78
+ - Put `netbox-plugin-dns-bridge` in your **local_dependencies.txt** so it will be installed on next upgrade.
79
+ 3. Follow the Installation Guide below.
80
+ 4. Ensure the `dns-transfer-endpoint` service is not running before the next step.
81
+ 5. Restore the catalog zone serial you noted down previously so that your slave dns servers continue
82
+ to pull the changes: `manage.py dns-settings set catalog-zone-soa-serial yourserialnumber`
83
+ 6. Start the `dns-transfer-endpoint` service. This should be it.
84
+
85
+ ## Installation guide
86
+ This setup provisions a BIND9 server directly with DNS data from NetBox. BIND9 can optionally run on
87
+ a separate server. If so, any reference to 127.0.0.1 in step 6 must be replaced with the IP address
88
+ of the NetBox host. TCP and UDP traffic from the BIND9 server to the NetBox host must be allowed on
89
+ port 5354 (or the port you have configured).
90
+
91
+ This guide assumes:
92
+ - Netbox has been installed under /opt/netbox
93
+ - Bind9 is installed on the same host as Netbox
94
+ - The Netbox DNS Plugin netbox-plugin-dns is installed
95
+ - The following dns views exist in Netbox DNS:
96
+ - `public` (the default)
97
+ - `private`
98
+
99
+ 1. Preliminaries
100
+ - Install Bind9 on the same host that netbox is on.
101
+ - Generate a TSIG Key for the `public` and `private` dns views respectively.
102
+
103
+ 2. Adding required package
104
+ ```
105
+ cd netbox
106
+ echo netbox-plugin-bind-provisioner >> local_requirements.txt
107
+ . venv/bin/activate
108
+ pip install -r local_requirements.txt
109
+ ```
110
+
111
+ 3. Updating netbox plugin configuration (configuration.py)
112
+ Change following line from
113
+ ```
114
+ PLUGINS = ['netbox_dns']
115
+ ```
116
+ to
117
+ ```
118
+ PLUGINS = ['netbox_dns', 'netbox_dns_bridge']
119
+ ```
120
+
121
+ Configure the DNS Bridge Plugin using the PLUGINS_CONFIG dictionary.
122
+ Change
123
+ ```
124
+ PLUGINS_CONFIG = {}
125
+ ```
126
+ to
127
+ ```
128
+ PLUGINS_CONFIG = {
129
+ "netbox_dns_bridge": {
130
+ "tsig_keys": {
131
+ "public": {
132
+ "keyname": "public_view_key",
133
+ "algorithm": "hmac-sha256",
134
+ "secret": "base64-encoded-secret"
135
+ },
136
+ "private": {
137
+ "keyname": "private_view_key",
138
+ "algorithm": "hmac-sha256",
139
+ "secret": "base64-encoded-secret"
140
+ }
141
+ }
142
+ }
143
+ }
144
+ ```
145
+ Note that the tsig-key attributes keyname, algorithm and secret form a
146
+ dictionary in following python structure path:
147
+ ```
148
+ PLUGINS_CONFIG.netbox_dns_bridge.tsig_keys.<dns_view_name>
149
+ ```
150
+ This allows the plugin to map requests to the right dns view using the tsig
151
+ signature from each request.
152
+
153
+ 4. Run migrations
154
+ ```
155
+ python3 netbox/manage.py migrate
156
+ ```
157
+
158
+ 5. Start listener
159
+
160
+ This step runs the DNS endpoint used by bind to configure itself. You may want to write a
161
+ service wrapper that runs this in the background. A guide for setting up a systemd service on
162
+ Ubuntu is provided by Matt Kollross [here](docs/install-systemd-service.md). Dont forget to
163
+ activate the venv if you do decide to run this service in the background.
164
+
165
+ Note that `--port 5354` is optional. The listener will bind this port by default.
166
+ ```
167
+ python3 netbox/manage.py dns-transfer-endpoint --port 5354
168
+ ```
169
+
170
+ 6. Configuring a Bind9 to interact with Netbox via the dns-transfer-endpoint endpoint. Note that its
171
+ not possible to give all the correct details of the `options` block as it is heavily dependent
172
+ on the Operating System used. Please dont forget to adjust as required.
173
+
174
+ ```
175
+ ########## OPTIONS ##########
176
+
177
+ options {
178
+ allow-update { none; };
179
+ allow-query { any; };
180
+ allow-recursion { none; };
181
+ notify yes;
182
+ min-refresh-time 60;
183
+ };
184
+
185
+ ########## ACLs ##########
186
+
187
+ acl public {
188
+ !10.0.0.0/8;
189
+ !172.16.0.0/12;
190
+ !192.168.0.0/16;
191
+ any;
192
+ };
193
+
194
+ acl private {
195
+ 10.0.0.0/8;
196
+ 172.16.0.0/12;
197
+ 192.168.0.0/16;
198
+ };
199
+
200
+ ######## TSIG Keys ########
201
+ key "public_view_key" {
202
+ algorithm hmac-sha256;
203
+ secret "base64-encoded-secret";
204
+ };
205
+
206
+ key "private_view_key" {
207
+ algorithm hmac-sha256;
208
+ secret "base64-encoded-secret";
209
+ };
210
+ ###########################
211
+
212
+
213
+ ########## ZONES ##########
214
+ view "public" {
215
+ match-clients { public; };
216
+
217
+ catalog-zones {
218
+ zone "catz"
219
+ default-masters { 127.0.0.1 port 5354 key "public_view_key"; }
220
+ zone-directory "/var/lib/bind/zones"
221
+ min-update-interval 1;
222
+ };
223
+
224
+ zone "catz" {
225
+ type slave;
226
+ file "/var/lib/bind/zones/catz_public";
227
+ masters { 127.0.0.1 port 5354 key "public_view_key"; };
228
+ notify no;
229
+ };
230
+ };
231
+
232
+ view "private" {
233
+ match-clients { private; };
234
+
235
+ catalog-zones {
236
+ zone "catz"
237
+ default-masters { 127.0.0.1 port 5354 key "private_view_key"; }
238
+ zone-directory "/var/lib/bind/zones"
239
+ min-update-interval 1;
240
+ };
241
+
242
+ zone "catz" {
243
+ type slave;
244
+ file "/var/lib/bind/zones/catz_private";
245
+ masters { 127.0.0.1 port 5354 key "private_view_key"; };
246
+ notify no;
247
+ };
248
+ };
249
+ ```
250
+
251
+ 7. Restart bind - Done
252
+
253
+
@@ -0,0 +1,36 @@
1
+ import logging
2
+ from netbox.plugins import PluginConfig
3
+ from django.conf import settings
4
+
5
+ __version__ = "1.5.0"
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+ logging.basicConfig(
10
+ level=logging.DEBUG, # Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
11
+ format="%(asctime)s [%(levelname)s] %(name)s: %(message)s", # Log format
12
+ datefmt="%Y-%m-%d %H:%M:%S", # Date format for timestamps
13
+ )
14
+
15
+
16
+ class DNSBridgeConfig(PluginConfig):
17
+ name = "netbox_dns_bridge"
18
+ verbose_name = "Netbox DNS Bridge"
19
+ description = ""
20
+ version = __version__
21
+ author = "Sven Luethi"
22
+ author_email = "dev@sven.luethi.co"
23
+ base_url = "dns-bridge"
24
+
25
+ def ready(self):
26
+ self.settings = settings.PLUGINS_CONFIG.get(self.name, None)
27
+ if not self.settings:
28
+ raise RuntimeError(
29
+ f"{self.name}: Plugin {self.verbose_name} failed to initialize due to missing settings. Terminating Netbox."
30
+ )
31
+
32
+ from . import signals as signals
33
+
34
+
35
+ config = DNSBridgeConfig
36
+ default_app_config = ".apps.NetboxDNSBridgeConfig"