netbox-ot 0.3.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 (74) hide show
  1. netbox_ot-0.3.0/LICENSE +178 -0
  2. netbox_ot-0.3.0/PKG-INFO +156 -0
  3. netbox_ot-0.3.0/README.md +128 -0
  4. netbox_ot-0.3.0/netbox_ot/__init__.py +47 -0
  5. netbox_ot-0.3.0/netbox_ot/accessmap.py +173 -0
  6. netbox_ot-0.3.0/netbox_ot/adopt.py +213 -0
  7. netbox_ot-0.3.0/netbox_ot/api/__init__.py +0 -0
  8. netbox_ot-0.3.0/netbox_ot/api/serializers.py +254 -0
  9. netbox_ot-0.3.0/netbox_ot/api/urls.py +21 -0
  10. netbox_ot-0.3.0/netbox_ot/api/views.py +194 -0
  11. netbox_ot-0.3.0/netbox_ot/checks.py +380 -0
  12. netbox_ot-0.3.0/netbox_ot/choices.py +331 -0
  13. netbox_ot-0.3.0/netbox_ot/customfields.py +121 -0
  14. netbox_ot-0.3.0/netbox_ot/filtersets.py +509 -0
  15. netbox_ot-0.3.0/netbox_ot/forms.py +927 -0
  16. netbox_ot-0.3.0/netbox_ot/graphql/__init__.py +3 -0
  17. netbox_ot-0.3.0/netbox_ot/graphql/filters.py +97 -0
  18. netbox_ot-0.3.0/netbox_ot/graphql/schema.py +39 -0
  19. netbox_ot-0.3.0/netbox_ot/graphql/types.py +104 -0
  20. netbox_ot-0.3.0/netbox_ot/importers/__init__.py +0 -0
  21. netbox_ot-0.3.0/netbox_ot/importers/functions.py +234 -0
  22. netbox_ot-0.3.0/netbox_ot/importers/netbox_zones.py +32 -0
  23. netbox_ot-0.3.0/netbox_ot/importers/observations.py +794 -0
  24. netbox_ot-0.3.0/netbox_ot/importers/zeek.py +302 -0
  25. netbox_ot-0.3.0/netbox_ot/lifecycle.py +89 -0
  26. netbox_ot-0.3.0/netbox_ot/management/__init__.py +0 -0
  27. netbox_ot-0.3.0/netbox_ot/management/commands/__init__.py +0 -0
  28. netbox_ot-0.3.0/netbox_ot/management/commands/ot_check.py +44 -0
  29. netbox_ot-0.3.0/netbox_ot/management/commands/ot_demo.py +244 -0
  30. netbox_ot-0.3.0/netbox_ot/management/commands/ot_import.py +167 -0
  31. netbox_ot-0.3.0/netbox_ot/management/commands/ot_rules.py +44 -0
  32. netbox_ot-0.3.0/netbox_ot/migrations/0001_initial.py +280 -0
  33. netbox_ot-0.3.0/netbox_ot/migrations/__init__.py +0 -0
  34. netbox_ot-0.3.0/netbox_ot/models.py +811 -0
  35. netbox_ot-0.3.0/netbox_ot/navigation.py +68 -0
  36. netbox_ot-0.3.0/netbox_ot/register.py +159 -0
  37. netbox_ot-0.3.0/netbox_ot/rules.py +137 -0
  38. netbox_ot-0.3.0/netbox_ot/search.py +73 -0
  39. netbox_ot-0.3.0/netbox_ot/sl.py +87 -0
  40. netbox_ot-0.3.0/netbox_ot/tables.py +196 -0
  41. netbox_ot-0.3.0/netbox_ot/template_content.py +71 -0
  42. netbox_ot-0.3.0/netbox_ot/templates/netbox_ot/accessmap.html +31 -0
  43. netbox_ot-0.3.0/netbox_ot/templates/netbox_ot/checks.html +31 -0
  44. netbox_ot-0.3.0/netbox_ot/templates/netbox_ot/inc/access_attr.html +1 -0
  45. netbox_ot-0.3.0/netbox_ot/templates/netbox_ot/inc/accessmap_table.html +81 -0
  46. netbox_ot-0.3.0/netbox_ot/templates/netbox_ot/inc/asset_panel.html +100 -0
  47. netbox_ot-0.3.0/netbox_ot/templates/netbox_ot/inc/checks_table.html +37 -0
  48. netbox_ot-0.3.0/netbox_ot/templates/netbox_ot/inc/sl_panel.html +24 -0
  49. netbox_ot-0.3.0/netbox_ot/templates/netbox_ot/inc/verdict_attr.html +3 -0
  50. netbox_ot-0.3.0/netbox_ot/templates/netbox_ot/site_accessmap.html +15 -0
  51. netbox_ot-0.3.0/netbox_ot/templates/netbox_ot/site_register.html +97 -0
  52. netbox_ot-0.3.0/netbox_ot/tests/__init__.py +0 -0
  53. netbox_ot-0.3.0/netbox_ot/tests/query_counts.json +16 -0
  54. netbox_ot-0.3.0/netbox_ot/tests/test_adopt.py +155 -0
  55. netbox_ot-0.3.0/netbox_ot/tests/test_api.py +282 -0
  56. netbox_ot-0.3.0/netbox_ot/tests/test_checks.py +151 -0
  57. netbox_ot-0.3.0/netbox_ot/tests/test_demo.py +44 -0
  58. netbox_ot-0.3.0/netbox_ot/tests/test_filtersets.py +214 -0
  59. netbox_ot-0.3.0/netbox_ot/tests/test_importer.py +453 -0
  60. netbox_ot-0.3.0/netbox_ot/tests/test_industrial.py +252 -0
  61. netbox_ot-0.3.0/netbox_ot/tests/test_lifecycle.py +119 -0
  62. netbox_ot-0.3.0/netbox_ot/tests/test_models.py +195 -0
  63. netbox_ot-0.3.0/netbox_ot/tests/test_rules.py +133 -0
  64. netbox_ot-0.3.0/netbox_ot/tests/test_views.py +393 -0
  65. netbox_ot-0.3.0/netbox_ot/tests/test_zeek.py +252 -0
  66. netbox_ot-0.3.0/netbox_ot/upgrade.py +31 -0
  67. netbox_ot-0.3.0/netbox_ot/urls.py +24 -0
  68. netbox_ot-0.3.0/netbox_ot/views.py +794 -0
  69. netbox_ot-0.3.0/netbox_ot.egg-info/PKG-INFO +156 -0
  70. netbox_ot-0.3.0/netbox_ot.egg-info/SOURCES.txt +72 -0
  71. netbox_ot-0.3.0/netbox_ot.egg-info/dependency_links.txt +1 -0
  72. netbox_ot-0.3.0/netbox_ot.egg-info/top_level.txt +1 -0
  73. netbox_ot-0.3.0/pyproject.toml +59 -0
  74. netbox_ot-0.3.0/setup.cfg +4 -0
@@ -0,0 +1,178 @@
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
+
@@ -0,0 +1,156 @@
1
+ Metadata-Version: 2.4
2
+ Name: netbox-ot
3
+ Version: 0.3.0
4
+ Summary: IEC 62443 zones, conduits and flows, Purdue levels, an access map and a zone register for NetBox
5
+ Author: Packetflow
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/Packetflow-be/netbox-ot
8
+ Project-URL: Documentation, https://github.com/Packetflow-be/netbox-ot/blob/main/docs/README.md
9
+ Project-URL: Discussions, https://github.com/Packetflow-be/netbox-ot/discussions
10
+ Project-URL: Issues, https://github.com/Packetflow-be/netbox-ot/issues
11
+ Project-URL: Changelog, https://github.com/Packetflow-be/netbox-ot/blob/main/CHANGELOG.md
12
+ Keywords: netbox,netbox-plugin,iec62443,ot,ics,scada,purdue,zeek,icsnpp
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Web Environment
15
+ Classifier: Framework :: Django
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: Intended Audience :: Information Technology
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Security
23
+ Classifier: Topic :: System :: Networking
24
+ Requires-Python: >=3.12
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Dynamic: license-file
28
+
29
+ <img src="https://raw.githubusercontent.com/Packetflow-be/netbox-ot/main/docs/icon.svg" alt="" width="96" align="right">
30
+
31
+ # netbox-ot
32
+
33
+ **An OT asset and security register in NetBox: IEC 62443 zones, conduits and flows, who can reach your PLCs and
34
+ who decided that is allowed.**
35
+
36
+ *Formerly **netbox-iec62443**: 0.3.0 takes an existing installation over in place, see
37
+ [Upgrading from netbox-iec62443](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/installation.md#from-netbox-iec62443).*
38
+
39
+ [![PyPI](https://img.shields.io/pypi/v/netbox-ot)](https://pypi.org/project/netbox-ot/)
40
+ [![CI](https://github.com/Packetflow-be/netbox-ot/actions/workflows/ci.yml/badge.svg)](https://github.com/Packetflow-be/netbox-ot/actions/workflows/ci.yml)
41
+ [![License](https://img.shields.io/pypi/l/netbox-ot)](https://github.com/Packetflow-be/netbox-ot/blob/main/LICENSE)
42
+
43
+ A NetBox plugin for OT networks. It models **IEC 62443 zones and conduits**, the **flows** that run through
44
+ them, and **Purdue levels** on devices and virtual machines. On top of that it builds an **access map**: every
45
+ known flow into the controller zones, each with an "allowed?" verdict and who decided it.
46
+
47
+ It is meant for the people who run production networks: plant and maintenance engineers, OT/IT teams and the
48
+ integrators who work for them. Keep zones, conduits and industrial protocols in the same NetBox as the rest of
49
+ your inventory. See at a glance who can reach the PLCs, including supplier remote access over 4G routers,
50
+ TeamViewer, VPN or an MSP's jump host, and decide per flow whether that is allowed. Then hand an auditor the
51
+ zone register.
52
+
53
+ ![The demo plant: the access map, a flow with its verdict and path, a zone with its security levels, and the zone register](https://raw.githubusercontent.com/Packetflow-be/netbox-ot/main/docs/demo.gif)
54
+
55
+ ## Features
56
+
57
+ - **Zones and conduits** per IEC 62443-3-2: zone types (OT, safety/SIS, DMZ, enterprise, supplier), Purdue
58
+ levels, SL-T and SL-A vectors over the seven foundational requirements, accountable people, sub-zones, the
59
+ devices that enforce a conduit, and risk assessments. [Data model](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/data-model.md)
60
+ - **Flows**: what actually runs from one zone into another (protocol, ports, read/write/control/program access,
61
+ remote access, the path of hops it takes) with a verdict: allowed yes/no/unknown, decided by whom, review
62
+ and expiry dates.
63
+ - **Access map** per site: the flows into the controller zones, worst first, with what needs attention and a
64
+ diagram. [Access map](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/access-map.md)
65
+ - **Consistency checks** and a printable **zone register** (CSV, JSON) for the audit, also as an API and a
66
+ command with an exit code for CI. [Checks and register](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/checks-and-register.md)
67
+ - **Industrial services and fieldbuses**: Modbus, S7comm, PROFINET, EtherNet/IP, OPC UA, DNP3, IEC 61850 and
68
+ more, linked to NetBox application services. [Industrial systems](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/industrial.md)
69
+ - **Importer** for passive captures: Zeek logs (with or without CISA ICSNPP) or a documented JSON format, with
70
+ a list of the hosts NetBox does not know yet. [Importer](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/importer.md)
71
+ - **Vendor-neutral firewall rules** from the allowed flows. [Firewall rules](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/firewall-rules.md)
72
+ - **Lifecycle**: end of support per device from netbox-lifecycle (device type and modules), checks for
73
+ unsupported devices in secure zones, and a firmware version field on devices and modules.
74
+ [Companion plugins](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/companions.md)
75
+ - REST API, GraphQL, filters, bulk import/edit, change log and permissions like any NetBox object.
76
+ [API](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/api.md)
77
+
78
+ ## Compatibility
79
+
80
+ | Plugin | NetBox | Python |
81
+ |---|---|---|
82
+ | 0.3.x (netbox-ot) | 4.7.0 and later 4.7 releases; 4.8 allowed | 3.12, 3.13 |
83
+ | 0.2.x, 0.1.x (as netbox-iec62443) | 4.7.0 and later 4.7 releases; 4.8 allowed | 3.12, 3.13 |
84
+
85
+ CI runs the full test suite on NetBox 4.7.0, on the newest 4.7 release, and every week on NetBox's
86
+ development branch for the next release, so a NetBox change that breaks the plugin shows up before it ships.
87
+ `max_version` admits 4.8 on the strength of that weekly run; it is lowered again if the next release breaks
88
+ the plugin.
89
+
90
+ ## Dependencies
91
+
92
+ None: no other NetBox plugins, Python packages, external software or services. The importer reads files that
93
+ other tools wrote; to import from network captures you need [Zeek](https://zeek.org/) (optionally with the
94
+ [CISA ICSNPP](https://github.com/cisagov/ICSNPP) parsers, or [Malcolm](https://github.com/cisagov/Malcolm),
95
+ which bundles both) somewhere, not on the NetBox server.
96
+
97
+ **Works with** [netbox-lifecycle](https://github.com/DanSheps/netbox-lifecycle) (end of support per device,
98
+ checks for unsupported devices in secure zones) and [netbox-inventory](https://github.com/ArnesSI/netbox-inventory)
99
+ (spares and purchases), tested together in CI; both optional. See
100
+ [Companion plugins](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/companions.md).
101
+
102
+ ## Installation
103
+
104
+ For a NetBox installed from source in `/opt/netbox`:
105
+
106
+ ```bash
107
+ cd /opt/netbox
108
+ echo "netbox-ot" | sudo tee -a local_requirements.txt
109
+ sudo venv/bin/pip install netbox-ot
110
+ ```
111
+
112
+ Add the plugin to `/opt/netbox/netbox/netbox/configuration.py` (if `PLUGINS` already exists, add it to the
113
+ list):
114
+
115
+ ```python
116
+ PLUGINS = ["netbox_ot"]
117
+ ```
118
+
119
+ Create its tables and restart:
120
+
121
+ ```bash
122
+ sudo venv/bin/python netbox/manage.py migrate
123
+ sudo venv/bin/python netbox/manage.py collectstatic --no-input
124
+ sudo systemctl restart netbox netbox-rq
125
+ ```
126
+
127
+ An *IEC 62443* menu appears. To see it populated within minutes, create the fictional demo plant and open the
128
+ site *IEC 62443 demo plant* (`--delete` removes it again):
129
+
130
+ ```bash
131
+ sudo venv/bin/python netbox/manage.py ot_demo
132
+ ```
133
+
134
+ [netbox-docker](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/installation.md#netbox-docker), the settings, permissions, upgrading and removing are in
135
+ [docs/installation.md](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/installation.md).
136
+
137
+ ## Documentation
138
+
139
+ The full documentation is in [docs/](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/README.md); release notes are in [CHANGELOG.md](https://github.com/Packetflow-be/netbox-ot/blob/main/CHANGELOG.md).
140
+
141
+ ## Getting help and contributing
142
+
143
+ - **Questions and how-to**: [GitHub Discussions](https://github.com/Packetflow-be/netbox-ot/discussions).
144
+ - **Bugs and feature requests**: [GitHub issues](https://github.com/Packetflow-be/netbox-ot/issues). Please
145
+ include the NetBox and plugin versions.
146
+ - **Security issues**: privately, as described in [SECURITY.md](https://github.com/Packetflow-be/netbox-ot/blob/main/SECURITY.md), not in a public issue.
147
+ - **Code, documentation and translations**: see [CONTRIBUTING.md](https://github.com/Packetflow-be/netbox-ot/blob/main/CONTRIBUTING.md).
148
+
149
+ The plugin is maintained by [Packetflow](https://packetflow.be), a small company in Belgium, and is in alpha:
150
+ the data model may still change, and every breaking change comes with a migration and a **Breaking Changes**
151
+ note in the changelog.
152
+
153
+ ## License
154
+
155
+ Code: Apache License 2.0, see [LICENSE](https://github.com/Packetflow-be/netbox-ot/blob/main/LICENSE). The icon (`docs/icon.svg`) is licensed under
156
+ [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
@@ -0,0 +1,128 @@
1
+ <img src="https://raw.githubusercontent.com/Packetflow-be/netbox-ot/main/docs/icon.svg" alt="" width="96" align="right">
2
+
3
+ # netbox-ot
4
+
5
+ **An OT asset and security register in NetBox: IEC 62443 zones, conduits and flows, who can reach your PLCs and
6
+ who decided that is allowed.**
7
+
8
+ *Formerly **netbox-iec62443**: 0.3.0 takes an existing installation over in place, see
9
+ [Upgrading from netbox-iec62443](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/installation.md#from-netbox-iec62443).*
10
+
11
+ [![PyPI](https://img.shields.io/pypi/v/netbox-ot)](https://pypi.org/project/netbox-ot/)
12
+ [![CI](https://github.com/Packetflow-be/netbox-ot/actions/workflows/ci.yml/badge.svg)](https://github.com/Packetflow-be/netbox-ot/actions/workflows/ci.yml)
13
+ [![License](https://img.shields.io/pypi/l/netbox-ot)](https://github.com/Packetflow-be/netbox-ot/blob/main/LICENSE)
14
+
15
+ A NetBox plugin for OT networks. It models **IEC 62443 zones and conduits**, the **flows** that run through
16
+ them, and **Purdue levels** on devices and virtual machines. On top of that it builds an **access map**: every
17
+ known flow into the controller zones, each with an "allowed?" verdict and who decided it.
18
+
19
+ It is meant for the people who run production networks: plant and maintenance engineers, OT/IT teams and the
20
+ integrators who work for them. Keep zones, conduits and industrial protocols in the same NetBox as the rest of
21
+ your inventory. See at a glance who can reach the PLCs, including supplier remote access over 4G routers,
22
+ TeamViewer, VPN or an MSP's jump host, and decide per flow whether that is allowed. Then hand an auditor the
23
+ zone register.
24
+
25
+ ![The demo plant: the access map, a flow with its verdict and path, a zone with its security levels, and the zone register](https://raw.githubusercontent.com/Packetflow-be/netbox-ot/main/docs/demo.gif)
26
+
27
+ ## Features
28
+
29
+ - **Zones and conduits** per IEC 62443-3-2: zone types (OT, safety/SIS, DMZ, enterprise, supplier), Purdue
30
+ levels, SL-T and SL-A vectors over the seven foundational requirements, accountable people, sub-zones, the
31
+ devices that enforce a conduit, and risk assessments. [Data model](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/data-model.md)
32
+ - **Flows**: what actually runs from one zone into another (protocol, ports, read/write/control/program access,
33
+ remote access, the path of hops it takes) with a verdict: allowed yes/no/unknown, decided by whom, review
34
+ and expiry dates.
35
+ - **Access map** per site: the flows into the controller zones, worst first, with what needs attention and a
36
+ diagram. [Access map](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/access-map.md)
37
+ - **Consistency checks** and a printable **zone register** (CSV, JSON) for the audit, also as an API and a
38
+ command with an exit code for CI. [Checks and register](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/checks-and-register.md)
39
+ - **Industrial services and fieldbuses**: Modbus, S7comm, PROFINET, EtherNet/IP, OPC UA, DNP3, IEC 61850 and
40
+ more, linked to NetBox application services. [Industrial systems](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/industrial.md)
41
+ - **Importer** for passive captures: Zeek logs (with or without CISA ICSNPP) or a documented JSON format, with
42
+ a list of the hosts NetBox does not know yet. [Importer](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/importer.md)
43
+ - **Vendor-neutral firewall rules** from the allowed flows. [Firewall rules](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/firewall-rules.md)
44
+ - **Lifecycle**: end of support per device from netbox-lifecycle (device type and modules), checks for
45
+ unsupported devices in secure zones, and a firmware version field on devices and modules.
46
+ [Companion plugins](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/companions.md)
47
+ - REST API, GraphQL, filters, bulk import/edit, change log and permissions like any NetBox object.
48
+ [API](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/api.md)
49
+
50
+ ## Compatibility
51
+
52
+ | Plugin | NetBox | Python |
53
+ |---|---|---|
54
+ | 0.3.x (netbox-ot) | 4.7.0 and later 4.7 releases; 4.8 allowed | 3.12, 3.13 |
55
+ | 0.2.x, 0.1.x (as netbox-iec62443) | 4.7.0 and later 4.7 releases; 4.8 allowed | 3.12, 3.13 |
56
+
57
+ CI runs the full test suite on NetBox 4.7.0, on the newest 4.7 release, and every week on NetBox's
58
+ development branch for the next release, so a NetBox change that breaks the plugin shows up before it ships.
59
+ `max_version` admits 4.8 on the strength of that weekly run; it is lowered again if the next release breaks
60
+ the plugin.
61
+
62
+ ## Dependencies
63
+
64
+ None: no other NetBox plugins, Python packages, external software or services. The importer reads files that
65
+ other tools wrote; to import from network captures you need [Zeek](https://zeek.org/) (optionally with the
66
+ [CISA ICSNPP](https://github.com/cisagov/ICSNPP) parsers, or [Malcolm](https://github.com/cisagov/Malcolm),
67
+ which bundles both) somewhere, not on the NetBox server.
68
+
69
+ **Works with** [netbox-lifecycle](https://github.com/DanSheps/netbox-lifecycle) (end of support per device,
70
+ checks for unsupported devices in secure zones) and [netbox-inventory](https://github.com/ArnesSI/netbox-inventory)
71
+ (spares and purchases), tested together in CI; both optional. See
72
+ [Companion plugins](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/companions.md).
73
+
74
+ ## Installation
75
+
76
+ For a NetBox installed from source in `/opt/netbox`:
77
+
78
+ ```bash
79
+ cd /opt/netbox
80
+ echo "netbox-ot" | sudo tee -a local_requirements.txt
81
+ sudo venv/bin/pip install netbox-ot
82
+ ```
83
+
84
+ Add the plugin to `/opt/netbox/netbox/netbox/configuration.py` (if `PLUGINS` already exists, add it to the
85
+ list):
86
+
87
+ ```python
88
+ PLUGINS = ["netbox_ot"]
89
+ ```
90
+
91
+ Create its tables and restart:
92
+
93
+ ```bash
94
+ sudo venv/bin/python netbox/manage.py migrate
95
+ sudo venv/bin/python netbox/manage.py collectstatic --no-input
96
+ sudo systemctl restart netbox netbox-rq
97
+ ```
98
+
99
+ An *IEC 62443* menu appears. To see it populated within minutes, create the fictional demo plant and open the
100
+ site *IEC 62443 demo plant* (`--delete` removes it again):
101
+
102
+ ```bash
103
+ sudo venv/bin/python netbox/manage.py ot_demo
104
+ ```
105
+
106
+ [netbox-docker](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/installation.md#netbox-docker), the settings, permissions, upgrading and removing are in
107
+ [docs/installation.md](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/installation.md).
108
+
109
+ ## Documentation
110
+
111
+ The full documentation is in [docs/](https://github.com/Packetflow-be/netbox-ot/blob/main/docs/README.md); release notes are in [CHANGELOG.md](https://github.com/Packetflow-be/netbox-ot/blob/main/CHANGELOG.md).
112
+
113
+ ## Getting help and contributing
114
+
115
+ - **Questions and how-to**: [GitHub Discussions](https://github.com/Packetflow-be/netbox-ot/discussions).
116
+ - **Bugs and feature requests**: [GitHub issues](https://github.com/Packetflow-be/netbox-ot/issues). Please
117
+ include the NetBox and plugin versions.
118
+ - **Security issues**: privately, as described in [SECURITY.md](https://github.com/Packetflow-be/netbox-ot/blob/main/SECURITY.md), not in a public issue.
119
+ - **Code, documentation and translations**: see [CONTRIBUTING.md](https://github.com/Packetflow-be/netbox-ot/blob/main/CONTRIBUTING.md).
120
+
121
+ The plugin is maintained by [Packetflow](https://packetflow.be), a small company in Belgium, and is in alpha:
122
+ the data model may still change, and every breaking change comes with a migration and a **Breaking Changes**
123
+ note in the changelog.
124
+
125
+ ## License
126
+
127
+ Code: Apache License 2.0, see [LICENSE](https://github.com/Packetflow-be/netbox-ot/blob/main/LICENSE). The icon (`docs/icon.svg`) is licensed under
128
+ [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
@@ -0,0 +1,47 @@
1
+ from netbox.plugins import PluginConfig
2
+
3
+ __version__ = '0.3.0'
4
+
5
+
6
+ class NetBoxOTConfig(PluginConfig):
7
+ name = 'netbox_ot'
8
+ verbose_name = 'OT'
9
+ description = (
10
+ 'OT asset and security register: IEC 62443 zones, conduits and flows, Purdue levels, an access map, '
11
+ 'a zone register and lifecycle checks'
12
+ )
13
+ version = __version__
14
+ author = 'Packetflow'
15
+ base_url = 'ot'
16
+ # Tested in CI on 4.7.0, the newest 4.7 release and NetBox's development branch for the next release (weekly)
17
+ min_version = '4.7.0'
18
+ max_version = '4.8.99'
19
+ default_settings = {
20
+ # Create the "Purdue level" custom field on devices and virtual machines after migrate.
21
+ 'create_custom_fields': True,
22
+ # The access map lists flows into zones at this Purdue level or below.
23
+ 'access_map_max_level': '2',
24
+ # A flow not seen for this many days needs attention.
25
+ 'stale_after_days': 90,
26
+ }
27
+
28
+ def ready(self):
29
+ from django.conf import settings
30
+ from django.core.exceptions import ImproperlyConfigured
31
+
32
+ if 'netbox_iec62443' in settings.PLUGINS:
33
+ # netbox-ot takes the old plugin's tables over on migrate (adopt.py); both at once would break both
34
+ raise ImproperlyConfigured(
35
+ 'netbox-ot replaces netbox-iec62443: remove netbox_iec62443 from PLUGINS (and its PLUGINS_CONFIG '
36
+ 'entry; move the settings to netbox_ot), then run migrate.'
37
+ )
38
+ super().ready()
39
+ from django.db.models.signals import post_migrate
40
+
41
+ from .customfields import ensure_custom_fields
42
+ from .upgrade import after_upgrade
43
+ post_migrate.connect(ensure_custom_fields, sender=self)
44
+ post_migrate.connect(after_upgrade, sender=self)
45
+
46
+
47
+ config = NetBoxOTConfig