netbox-security 1.0.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 (123) hide show
  1. netbox_security-1.0.0/LICENSE +21 -0
  2. netbox_security-1.0.0/PKG-INFO +148 -0
  3. netbox_security-1.0.0/README.md +132 -0
  4. netbox_security-1.0.0/netbox_security/__init__.py +25 -0
  5. netbox_security-1.0.0/netbox_security/api/__init__.py +0 -0
  6. netbox_security-1.0.0/netbox_security/api/serializers.py +11 -0
  7. netbox_security-1.0.0/netbox_security/api/serializers_/__init__.py +0 -0
  8. netbox_security-1.0.0/netbox_security/api/serializers_/address.py +82 -0
  9. netbox_security-1.0.0/netbox_security/api/serializers_/address_list.py +86 -0
  10. netbox_security-1.0.0/netbox_security/api/serializers_/address_set.py +83 -0
  11. netbox_security-1.0.0/netbox_security/api/serializers_/firewall_filter.py +83 -0
  12. netbox_security-1.0.0/netbox_security/api/serializers_/firewall_filter_rule.py +126 -0
  13. netbox_security-1.0.0/netbox_security/api/serializers_/nat_pool.py +91 -0
  14. netbox_security-1.0.0/netbox_security/api/serializers_/nat_pool_member.py +44 -0
  15. netbox_security-1.0.0/netbox_security/api/serializers_/nat_rule.py +197 -0
  16. netbox_security-1.0.0/netbox_security/api/serializers_/nat_rule_set.py +140 -0
  17. netbox_security-1.0.0/netbox_security/api/serializers_/security_zone_policy.py +123 -0
  18. netbox_security-1.0.0/netbox_security/api/serializers_/securityzone.py +79 -0
  19. netbox_security-1.0.0/netbox_security/api/urls.py +54 -0
  20. netbox_security-1.0.0/netbox_security/api/views.py +229 -0
  21. netbox_security-1.0.0/netbox_security/apps.py +5 -0
  22. netbox_security-1.0.0/netbox_security/choices/__init__.py +28 -0
  23. netbox_security-1.0.0/netbox_security/choices/firewall_filter_choices.py +106 -0
  24. netbox_security-1.0.0/netbox_security/choices/nat_pool_choices.py +13 -0
  25. netbox_security-1.0.0/netbox_security/choices/nat_rule_choices.py +73 -0
  26. netbox_security-1.0.0/netbox_security/choices/security_policy_choices.py +20 -0
  27. netbox_security-1.0.0/netbox_security/constants/__init__.py +22 -0
  28. netbox_security-1.0.0/netbox_security/constants/constants.py +43 -0
  29. netbox_security-1.0.0/netbox_security/filtersets/__init__.py +11 -0
  30. netbox_security-1.0.0/netbox_security/filtersets/address.py +136 -0
  31. netbox_security-1.0.0/netbox_security/filtersets/address_list.py +147 -0
  32. netbox_security-1.0.0/netbox_security/filtersets/address_set.py +126 -0
  33. netbox_security-1.0.0/netbox_security/filtersets/firewall_filter.py +95 -0
  34. netbox_security-1.0.0/netbox_security/filtersets/firewall_filter_rule.py +83 -0
  35. netbox_security-1.0.0/netbox_security/filtersets/nat_pool.py +94 -0
  36. netbox_security-1.0.0/netbox_security/filtersets/nat_pool_member.py +83 -0
  37. netbox_security-1.0.0/netbox_security/filtersets/nat_rule.py +246 -0
  38. netbox_security-1.0.0/netbox_security/filtersets/natruleset.py +110 -0
  39. netbox_security-1.0.0/netbox_security/filtersets/security_zone_policy.py +100 -0
  40. netbox_security-1.0.0/netbox_security/filtersets/securityzone.py +129 -0
  41. netbox_security-1.0.0/netbox_security/forms/__init__.py +11 -0
  42. netbox_security-1.0.0/netbox_security/forms/address.py +141 -0
  43. netbox_security-1.0.0/netbox_security/forms/address_list.py +63 -0
  44. netbox_security-1.0.0/netbox_security/forms/address_set.py +149 -0
  45. netbox_security-1.0.0/netbox_security/forms/firewall_filter.py +147 -0
  46. netbox_security-1.0.0/netbox_security/forms/firewall_filter_rule.py +72 -0
  47. netbox_security-1.0.0/netbox_security/forms/nat_pool.py +125 -0
  48. netbox_security-1.0.0/netbox_security/forms/nat_pool_member.py +259 -0
  49. netbox_security-1.0.0/netbox_security/forms/nat_rule.py +373 -0
  50. netbox_security-1.0.0/netbox_security/forms/nat_rule_set.py +205 -0
  51. netbox_security-1.0.0/netbox_security/forms/security_zone_policy.py +237 -0
  52. netbox_security-1.0.0/netbox_security/forms/securityzone.py +135 -0
  53. netbox_security-1.0.0/netbox_security/graphql/__init__.py +25 -0
  54. netbox_security-1.0.0/netbox_security/graphql/filters.py +89 -0
  55. netbox_security-1.0.0/netbox_security/graphql/schema.py +107 -0
  56. netbox_security-1.0.0/netbox_security/graphql/types.py +221 -0
  57. netbox_security-1.0.0/netbox_security/migrations/0001_initial.py +1432 -0
  58. netbox_security-1.0.0/netbox_security/migrations/__init__.py +0 -0
  59. netbox_security-1.0.0/netbox_security/mixins/__init__.py +1 -0
  60. netbox_security-1.0.0/netbox_security/mixins/firewall_filter_rule.py +193 -0
  61. netbox_security-1.0.0/netbox_security/models/__init__.py +11 -0
  62. netbox_security-1.0.0/netbox_security/models/address.py +113 -0
  63. netbox_security-1.0.0/netbox_security/models/address_list.py +141 -0
  64. netbox_security-1.0.0/netbox_security/models/address_set.py +115 -0
  65. netbox_security-1.0.0/netbox_security/models/firewall_filter.py +122 -0
  66. netbox_security-1.0.0/netbox_security/models/firewall_filter_rule.py +119 -0
  67. netbox_security-1.0.0/netbox_security/models/nat_pool.py +117 -0
  68. netbox_security-1.0.0/netbox_security/models/nat_pool_member.py +140 -0
  69. netbox_security-1.0.0/netbox_security/models/nat_rule.py +214 -0
  70. netbox_security-1.0.0/netbox_security/models/natruleset.py +129 -0
  71. netbox_security-1.0.0/netbox_security/models/security_zone_policy.py +86 -0
  72. netbox_security-1.0.0/netbox_security/models/securityzone.py +116 -0
  73. netbox_security-1.0.0/netbox_security/navigation.py +223 -0
  74. netbox_security-1.0.0/netbox_security/tables/__init__.py +11 -0
  75. netbox_security-1.0.0/netbox_security/tables/address.py +84 -0
  76. netbox_security-1.0.0/netbox_security/tables/address_list.py +113 -0
  77. netbox_security-1.0.0/netbox_security/tables/address_set.py +87 -0
  78. netbox_security-1.0.0/netbox_security/tables/firewall_filter.py +69 -0
  79. netbox_security-1.0.0/netbox_security/tables/firewall_filter_rule.py +38 -0
  80. netbox_security-1.0.0/netbox_security/tables/nat_pool.py +66 -0
  81. netbox_security-1.0.0/netbox_security/tables/nat_pool_member.py +53 -0
  82. netbox_security-1.0.0/netbox_security/tables/nat_rule.py +99 -0
  83. netbox_security-1.0.0/netbox_security/tables/nat_rule_set.py +92 -0
  84. netbox_security-1.0.0/netbox_security/tables/security_zone_policy.py +67 -0
  85. netbox_security-1.0.0/netbox_security/tables/securityzone.py +89 -0
  86. netbox_security-1.0.0/netbox_security/template_content.py +252 -0
  87. netbox_security-1.0.0/netbox_security/templates/netbox_security/address/extend.html +19 -0
  88. netbox_security-1.0.0/netbox_security/templates/netbox_security/address.html +48 -0
  89. netbox_security-1.0.0/netbox_security/templates/netbox_security/addressset.html +51 -0
  90. netbox_security-1.0.0/netbox_security/templates/netbox_security/device/device_extend.html +134 -0
  91. netbox_security-1.0.0/netbox_security/templates/netbox_security/firewallfilter.html +61 -0
  92. netbox_security-1.0.0/netbox_security/templates/netbox_security/firewallfilterrule.html +43 -0
  93. netbox_security-1.0.0/netbox_security/templates/netbox_security/inc/settings.html +26 -0
  94. netbox_security-1.0.0/netbox_security/templates/netbox_security/interface/addresslist.html +38 -0
  95. netbox_security-1.0.0/netbox_security/templates/netbox_security/interface/interface_extend.html +42 -0
  96. netbox_security-1.0.0/netbox_security/templates/netbox_security/natpool.html +64 -0
  97. netbox_security-1.0.0/netbox_security/templates/netbox_security/natpool_members.html +23 -0
  98. netbox_security-1.0.0/netbox_security/templates/netbox_security/natpoolmember.html +73 -0
  99. netbox_security-1.0.0/netbox_security/templates/netbox_security/natrule.html +148 -0
  100. netbox_security-1.0.0/netbox_security/templates/netbox_security/natruleset.html +69 -0
  101. netbox_security-1.0.0/netbox_security/templates/netbox_security/natruleset_rules.html +24 -0
  102. netbox_security-1.0.0/netbox_security/templates/netbox_security/securityzone.html +65 -0
  103. netbox_security-1.0.0/netbox_security/templates/netbox_security/securityzonepolicy.html +85 -0
  104. netbox_security-1.0.0/netbox_security/urls.py +212 -0
  105. netbox_security-1.0.0/netbox_security/version.py +1 -0
  106. netbox_security-1.0.0/netbox_security/views/__init__.py +11 -0
  107. netbox_security-1.0.0/netbox_security/views/address.py +113 -0
  108. netbox_security-1.0.0/netbox_security/views/address_list.py +75 -0
  109. netbox_security-1.0.0/netbox_security/views/address_set.py +119 -0
  110. netbox_security-1.0.0/netbox_security/views/firewall_filter.py +126 -0
  111. netbox_security-1.0.0/netbox_security/views/firewall_filter_rule.py +112 -0
  112. netbox_security-1.0.0/netbox_security/views/nat_pool.py +140 -0
  113. netbox_security-1.0.0/netbox_security/views/nat_pool_member.py +70 -0
  114. netbox_security-1.0.0/netbox_security/views/nat_rule.py +142 -0
  115. netbox_security-1.0.0/netbox_security/views/nat_rule_set.py +143 -0
  116. netbox_security-1.0.0/netbox_security/views/security_zone_policy.py +93 -0
  117. netbox_security-1.0.0/netbox_security/views/securityzone.py +127 -0
  118. netbox_security-1.0.0/netbox_security.egg-info/PKG-INFO +148 -0
  119. netbox_security-1.0.0/netbox_security.egg-info/SOURCES.txt +121 -0
  120. netbox_security-1.0.0/netbox_security.egg-info/dependency_links.txt +1 -0
  121. netbox_security-1.0.0/netbox_security.egg-info/top_level.txt +3 -0
  122. netbox_security-1.0.0/pyproject.toml +32 -0
  123. netbox_security-1.0.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Andy Wilson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: netbox-security
3
+ Version: 1.0.0
4
+ Summary: NetBox Security is a NetBox plugin that enhances device and interface models with security specific data
5
+ Author-email: Andy Wilson <andy@shady.org>
6
+ Project-URL: Homepage, https://github.com/andy-shady-org/netbox-security
7
+ Project-URL: Documentation, https://github.com/andy-shady-org/netbox-security/blob/main/README.md
8
+ Project-URL: Repository, https://github.com/andy-shady-org/netbox-security
9
+ Project-URL: Issues, https://github.com/andy-shady-org/netbox-security/issues
10
+ Keywords: netbox,netbox-plugin,security
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Dynamic: license-file
16
+
17
+ # NetBox Security Plugin
18
+ [Netbox](https://github.com/netbox-community/netbox) plugin for Security and NAT related objects documentation.
19
+
20
+ <div align="center">
21
+ <a href="https://pypi.org/project/netbox-security/"><img src="https://img.shields.io/pypi/v/netbox-security" alt="PyPi"/></a>
22
+ <a href="https://github.com/andy-shady-org/netbox-security/network/members"><img src="https://img.shields.io/github/forks/andy-shady-org/netbox-security?style=flat" alt="Forks Badge"/></a>
23
+ <a href="https://github.com/andy-shady-org/netbox-security/issues"><img src="https://img.shields.io/github/issues/andy-shady-org/netbox-security" alt="Issues Badge"/></a>
24
+ <a href="https://github.com/andy-shady-org/netbox-security/pulls"><img src="https://img.shields.io/github/issues-pr/andy-shady-org/netbox-security" alt="Pull Requests Badge"/></a>
25
+ <a href="https://github.com/andy-shady-org/netbox-security/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/andy-shady-org/netbox-security?color=2b9348"></a>
26
+ <a href="https://github.com/andy-shady-org/netbox-security/blob/master/LICENSE"><img src="https://img.shields.io/github/license/andy-shady-org/netbox-security?color=2b9348" alt="License Badge"/></a>
27
+ <a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code Style Black"/></a>
28
+ </div>
29
+
30
+
31
+ ## Features
32
+ This plugin provides following Models:
33
+ * Addresses
34
+ * Address Sets
35
+ * Address Lists
36
+ * Security Zones
37
+ * Security Zone Policies
38
+ * NAT Pools
39
+ * NAT Pool Members
40
+ * NAT Rule-sets
41
+ * NAT Rules
42
+ * Firewall Filters
43
+ * Firewall Filter Rules
44
+
45
+ ## Compatibility
46
+
47
+ | | |
48
+ |------------|-----------|
49
+ | NetBox 4.2 | \>= 1.0.0 |
50
+
51
+ ## Installation
52
+
53
+ The plugin is available as a Python package in pypi and can be installed with pip
54
+
55
+ ```
56
+ pip install netbox-security
57
+ ```
58
+ Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:
59
+ ```
60
+ PLUGINS = ['netbox_security']
61
+ ```
62
+ Restart NetBox and add `netbox-security` to your local_requirements.txt
63
+
64
+ Perform database migrations:
65
+ ```bash
66
+ cd /opt/netbox
67
+ source venv/bin/activate
68
+ python ./netbox/manage.py migrate netbox_security
69
+ python ./netbox/manage.py reindex netbox_security
70
+ ```
71
+
72
+ Full documentation on using plugins with NetBox: [Using Plugins - NetBox Documentation](https://netbox.readthedocs.io/en/stable/plugins/)
73
+
74
+
75
+ ## Configuration
76
+
77
+ The following options are available:
78
+ * `device_ext_page`: String (default left) Device related objects table position. The following values are available:
79
+ left, right, full_width. Set empty value for disable.
80
+ * `virtual_ext_page`: String (default left) Virtual Context related objects table position. The following values are available:
81
+ left, right, full_width. Set empty value for disable.
82
+ * `interface_ext_page`: String (default left) Interface related objects table position. The following values are available:
83
+ left, right, full_width. Set empty value for disable.
84
+ * `address_ext_page`: String (default right) Address/Address Set related objects table position. The following values are available:
85
+ left, right, full_width. Set empty value for disable.
86
+ * `top_level_menu`: Boolean (default True) Display plugin menu at the top level. The following values are available: True, False.
87
+
88
+
89
+ ## Contribute
90
+
91
+ Contributions are always welcome! Please see the [Contribution Guidelines](CONTRIBUTING.md)
92
+
93
+
94
+ ## Documentation
95
+
96
+ For further information, please refer to the full documentation: [Using NetBox Security](docs/using_netbox_security.md)
97
+
98
+
99
+ ## Credits
100
+
101
+ - Thanks to Peter Eckel for providing some lovely examples which I've happily borrowed, and for providing excellent guidance.
102
+ - Thanks to Dan Sheppard for the abstracted field generation stuff which I also used.
103
+ - Thanks to Kris Beevers and Mark Coleman at Netbox Labs for encouragement and engagement.
104
+
105
+
106
+ ## Screenshots
107
+ Addresses
108
+ ![List Addresses](docs/img/address_list.png)
109
+ ![View Address](docs/img/address.png)
110
+
111
+ Address Sets
112
+ ![List Address Sets](docs/img/address_set_list.png)
113
+ ![View Address](docs/img/address_set.png)
114
+
115
+ Security Zones
116
+ ![List Security Zones](docs/img/security_zone_list.png)
117
+ ![View Security Zone](docs/img/security_zone.png)
118
+
119
+ Security Zone Policies
120
+ ![List Security Zone Policies](docs/img/policies_list.png)
121
+ ![View Security Zone Policy](docs/img/policy.png)
122
+
123
+ NAT Pools
124
+ ![List NAT Pools](docs/img/nat-pool-list.png)
125
+ ![View NAT Pool](docs/img/nat-pool.png)
126
+
127
+ NAT Pool Members
128
+ ![List NAT Pool Members](docs/img/members.png)
129
+ ![View NAT Pool Member](docs/img/nat-pool-member.png)
130
+
131
+ NAT Rule Sets
132
+ ![List NAT Rule Sets](docs/img/nat-rule-set-list.png)
133
+ ![View NAT Rule Set](docs/img/nat-rule-set.png)
134
+
135
+ NAT Rules
136
+ ![List NAT Rules](docs/img/nat-rule-list.png)
137
+ ![View NAT Rule](docs/img/nat-rule.png)
138
+
139
+ Firewall Filters
140
+ ![List Firewall Filters](docs/img/firewall-filter-list.png)
141
+ ![View Firewall Filter](docs/img/firewall-filter.png)
142
+
143
+ Firewall Filter Rules
144
+ ![List Firewall Filter Rules](docs/img/firewall-rule-list.png)
145
+ ![View Firewall Filter Rule](docs/img/firewall-rule.png)
146
+
147
+ Device
148
+ ![View Device](docs/img/device.png)
@@ -0,0 +1,132 @@
1
+ # NetBox Security Plugin
2
+ [Netbox](https://github.com/netbox-community/netbox) plugin for Security and NAT related objects documentation.
3
+
4
+ <div align="center">
5
+ <a href="https://pypi.org/project/netbox-security/"><img src="https://img.shields.io/pypi/v/netbox-security" alt="PyPi"/></a>
6
+ <a href="https://github.com/andy-shady-org/netbox-security/network/members"><img src="https://img.shields.io/github/forks/andy-shady-org/netbox-security?style=flat" alt="Forks Badge"/></a>
7
+ <a href="https://github.com/andy-shady-org/netbox-security/issues"><img src="https://img.shields.io/github/issues/andy-shady-org/netbox-security" alt="Issues Badge"/></a>
8
+ <a href="https://github.com/andy-shady-org/netbox-security/pulls"><img src="https://img.shields.io/github/issues-pr/andy-shady-org/netbox-security" alt="Pull Requests Badge"/></a>
9
+ <a href="https://github.com/andy-shady-org/netbox-security/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/andy-shady-org/netbox-security?color=2b9348"></a>
10
+ <a href="https://github.com/andy-shady-org/netbox-security/blob/master/LICENSE"><img src="https://img.shields.io/github/license/andy-shady-org/netbox-security?color=2b9348" alt="License Badge"/></a>
11
+ <a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code Style Black"/></a>
12
+ </div>
13
+
14
+
15
+ ## Features
16
+ This plugin provides following Models:
17
+ * Addresses
18
+ * Address Sets
19
+ * Address Lists
20
+ * Security Zones
21
+ * Security Zone Policies
22
+ * NAT Pools
23
+ * NAT Pool Members
24
+ * NAT Rule-sets
25
+ * NAT Rules
26
+ * Firewall Filters
27
+ * Firewall Filter Rules
28
+
29
+ ## Compatibility
30
+
31
+ | | |
32
+ |------------|-----------|
33
+ | NetBox 4.2 | \>= 1.0.0 |
34
+
35
+ ## Installation
36
+
37
+ The plugin is available as a Python package in pypi and can be installed with pip
38
+
39
+ ```
40
+ pip install netbox-security
41
+ ```
42
+ Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:
43
+ ```
44
+ PLUGINS = ['netbox_security']
45
+ ```
46
+ Restart NetBox and add `netbox-security` to your local_requirements.txt
47
+
48
+ Perform database migrations:
49
+ ```bash
50
+ cd /opt/netbox
51
+ source venv/bin/activate
52
+ python ./netbox/manage.py migrate netbox_security
53
+ python ./netbox/manage.py reindex netbox_security
54
+ ```
55
+
56
+ Full documentation on using plugins with NetBox: [Using Plugins - NetBox Documentation](https://netbox.readthedocs.io/en/stable/plugins/)
57
+
58
+
59
+ ## Configuration
60
+
61
+ The following options are available:
62
+ * `device_ext_page`: String (default left) Device related objects table position. The following values are available:
63
+ left, right, full_width. Set empty value for disable.
64
+ * `virtual_ext_page`: String (default left) Virtual Context related objects table position. The following values are available:
65
+ left, right, full_width. Set empty value for disable.
66
+ * `interface_ext_page`: String (default left) Interface related objects table position. The following values are available:
67
+ left, right, full_width. Set empty value for disable.
68
+ * `address_ext_page`: String (default right) Address/Address Set related objects table position. The following values are available:
69
+ left, right, full_width. Set empty value for disable.
70
+ * `top_level_menu`: Boolean (default True) Display plugin menu at the top level. The following values are available: True, False.
71
+
72
+
73
+ ## Contribute
74
+
75
+ Contributions are always welcome! Please see the [Contribution Guidelines](CONTRIBUTING.md)
76
+
77
+
78
+ ## Documentation
79
+
80
+ For further information, please refer to the full documentation: [Using NetBox Security](docs/using_netbox_security.md)
81
+
82
+
83
+ ## Credits
84
+
85
+ - Thanks to Peter Eckel for providing some lovely examples which I've happily borrowed, and for providing excellent guidance.
86
+ - Thanks to Dan Sheppard for the abstracted field generation stuff which I also used.
87
+ - Thanks to Kris Beevers and Mark Coleman at Netbox Labs for encouragement and engagement.
88
+
89
+
90
+ ## Screenshots
91
+ Addresses
92
+ ![List Addresses](docs/img/address_list.png)
93
+ ![View Address](docs/img/address.png)
94
+
95
+ Address Sets
96
+ ![List Address Sets](docs/img/address_set_list.png)
97
+ ![View Address](docs/img/address_set.png)
98
+
99
+ Security Zones
100
+ ![List Security Zones](docs/img/security_zone_list.png)
101
+ ![View Security Zone](docs/img/security_zone.png)
102
+
103
+ Security Zone Policies
104
+ ![List Security Zone Policies](docs/img/policies_list.png)
105
+ ![View Security Zone Policy](docs/img/policy.png)
106
+
107
+ NAT Pools
108
+ ![List NAT Pools](docs/img/nat-pool-list.png)
109
+ ![View NAT Pool](docs/img/nat-pool.png)
110
+
111
+ NAT Pool Members
112
+ ![List NAT Pool Members](docs/img/members.png)
113
+ ![View NAT Pool Member](docs/img/nat-pool-member.png)
114
+
115
+ NAT Rule Sets
116
+ ![List NAT Rule Sets](docs/img/nat-rule-set-list.png)
117
+ ![View NAT Rule Set](docs/img/nat-rule-set.png)
118
+
119
+ NAT Rules
120
+ ![List NAT Rules](docs/img/nat-rule-list.png)
121
+ ![View NAT Rule](docs/img/nat-rule.png)
122
+
123
+ Firewall Filters
124
+ ![List Firewall Filters](docs/img/firewall-filter-list.png)
125
+ ![View Firewall Filter](docs/img/firewall-filter.png)
126
+
127
+ Firewall Filter Rules
128
+ ![List Firewall Filter Rules](docs/img/firewall-rule-list.png)
129
+ ![View Firewall Filter Rule](docs/img/firewall-rule.png)
130
+
131
+ Device
132
+ ![View Device](docs/img/device.png)
@@ -0,0 +1,25 @@
1
+ from django.utils.translation import gettext_lazy as _
2
+ from netbox.plugins import PluginConfig
3
+ from .version import __version__
4
+
5
+
6
+ class SecurityConfig(PluginConfig):
7
+ name = "netbox_security"
8
+ verbose_name = _("Netbox Security")
9
+ description = _("Subsystem for tracking Security and NAT related objects")
10
+ version = __version__
11
+ author = "Andy Wilson"
12
+ author_email = "andy@shady.org"
13
+ base_url = "netbox-security"
14
+ required_settings = []
15
+ min_version = "4.2.0"
16
+ default_settings = {
17
+ "top_level_menu": True,
18
+ "virtual_ext_page": "left",
19
+ "device_ext_page": "left",
20
+ "interface_ext_page": "left",
21
+ "address_ext_page": "right",
22
+ }
23
+
24
+
25
+ config = SecurityConfig # noqa
File without changes
@@ -0,0 +1,11 @@
1
+ from .serializers_.address import *
2
+ from .serializers_.address_set import *
3
+ from .serializers_.address_list import *
4
+ from .serializers_.securityzone import *
5
+ from .serializers_.security_zone_policy import *
6
+ from .serializers_.nat_pool import *
7
+ from .serializers_.nat_pool_member import *
8
+ from .serializers_.nat_rule_set import *
9
+ from .serializers_.nat_rule import *
10
+ from .serializers_.firewall_filter import *
11
+ from .serializers_.firewall_filter_rule import *
@@ -0,0 +1,82 @@
1
+ from django.contrib.contenttypes.models import ContentType
2
+ from rest_framework.serializers import (
3
+ HyperlinkedIdentityField,
4
+ SerializerMethodField,
5
+ JSONField,
6
+ )
7
+ from drf_spectacular.utils import extend_schema_field
8
+ from netbox.api.fields import ContentTypeField
9
+ from netbox.api.serializers import NetBoxModelSerializer
10
+ from utilities.api import get_serializer_for_model
11
+ from tenancy.api.serializers import TenantSerializer
12
+ from ipam.api.field_serializers import IPNetworkField
13
+ from netbox_security.models import Address, AddressAssignment
14
+
15
+
16
+ class AddressSerializer(NetBoxModelSerializer):
17
+ url = HyperlinkedIdentityField(
18
+ view_name="plugins-api:netbox_security-api:address-detail"
19
+ )
20
+ tenant = TenantSerializer(nested=True, required=False, allow_null=True)
21
+ value = IPNetworkField()
22
+
23
+ class Meta:
24
+ model = Address
25
+ fields = (
26
+ "id",
27
+ "url",
28
+ "display",
29
+ "name",
30
+ "value",
31
+ "description",
32
+ "tenant",
33
+ "comments",
34
+ "tags",
35
+ "custom_fields",
36
+ "created",
37
+ "last_updated",
38
+ )
39
+ brief_fields = (
40
+ "id",
41
+ "url",
42
+ "display",
43
+ "name",
44
+ "value",
45
+ "description",
46
+ )
47
+
48
+
49
+ class AddressAssignmentSerializer(NetBoxModelSerializer):
50
+ address = AddressSerializer(nested=True, required=True, allow_null=False)
51
+ assigned_object_type = ContentTypeField(queryset=ContentType.objects.all())
52
+ assigned_object = SerializerMethodField(read_only=True)
53
+
54
+ class Meta:
55
+ model = AddressAssignment
56
+ fields = [
57
+ "id",
58
+ "url",
59
+ "display",
60
+ "address",
61
+ "assigned_object_type",
62
+ "assigned_object_id",
63
+ "assigned_object",
64
+ "created",
65
+ "last_updated",
66
+ ]
67
+ brief_fields = (
68
+ "id",
69
+ "url",
70
+ "display",
71
+ "address",
72
+ "assigned_object_type",
73
+ "assigned_object_id",
74
+ )
75
+
76
+ @extend_schema_field(JSONField(allow_null=True))
77
+ def get_assigned_object(self, obj):
78
+ if obj.assigned_object is None:
79
+ return None
80
+ serializer = get_serializer_for_model(obj.assigned_object)
81
+ context = {"request": self.context["request"]}
82
+ return serializer(obj.assigned_object, nested=True, context=context).data
@@ -0,0 +1,86 @@
1
+ from django.contrib.contenttypes.models import ContentType
2
+ from rest_framework.serializers import (
3
+ HyperlinkedIdentityField,
4
+ SerializerMethodField,
5
+ JSONField,
6
+ )
7
+ from drf_spectacular.utils import extend_schema_field
8
+ from netbox.api.fields import ContentTypeField
9
+ from netbox.api.serializers import NetBoxModelSerializer
10
+ from utilities.api import get_serializer_for_model
11
+
12
+ from netbox_security.models import AddressList, AddressListAssignment
13
+
14
+
15
+ class AddressListSerializer(NetBoxModelSerializer):
16
+ url = HyperlinkedIdentityField(
17
+ view_name="plugins-api:netbox_security-api:addresslist-detail"
18
+ )
19
+ assigned_object_type = ContentTypeField(queryset=ContentType.objects.all())
20
+ assigned_object = SerializerMethodField(read_only=True)
21
+
22
+ class Meta:
23
+ model = AddressList
24
+ fields = (
25
+ "id",
26
+ "url",
27
+ "display",
28
+ "name",
29
+ "assigned_object_type",
30
+ "assigned_object_id",
31
+ "assigned_object",
32
+ "created",
33
+ "last_updated",
34
+ )
35
+ brief_fields = (
36
+ "id",
37
+ "url",
38
+ "display",
39
+ "name",
40
+ "assigned_object_type",
41
+ "assigned_object_id",
42
+ )
43
+
44
+ @extend_schema_field(JSONField(allow_null=True))
45
+ def get_assigned_object(self, obj):
46
+ if obj.assigned_object is None:
47
+ return None
48
+ serializer = get_serializer_for_model(obj.assigned_object)
49
+ context = {"request": self.context["request"]}
50
+ return serializer(obj.assigned_object, nested=True, context=context).data
51
+
52
+
53
+ class AddressListAssignmentSerializer(NetBoxModelSerializer):
54
+ address_list = AddressListSerializer(nested=True, required=True, allow_null=False)
55
+ assigned_object_type = ContentTypeField(queryset=ContentType.objects.all())
56
+ assigned_object = SerializerMethodField(read_only=True)
57
+
58
+ class Meta:
59
+ model = AddressListAssignment
60
+ fields = [
61
+ "id",
62
+ "url",
63
+ "display",
64
+ "address_list",
65
+ "assigned_object_type",
66
+ "assigned_object_id",
67
+ "assigned_object",
68
+ "created",
69
+ "last_updated",
70
+ ]
71
+ brief_fields = (
72
+ "id",
73
+ "url",
74
+ "display",
75
+ "address_list",
76
+ "assigned_object_type",
77
+ "assigned_object_id",
78
+ )
79
+
80
+ @extend_schema_field(JSONField(allow_null=True))
81
+ def get_assigned_object(self, obj):
82
+ if obj.assigned_object is None:
83
+ return None
84
+ serializer = get_serializer_for_model(obj.assigned_object)
85
+ context = {"request": self.context["request"]}
86
+ return serializer(obj.assigned_object, nested=True, context=context).data
@@ -0,0 +1,83 @@
1
+ from django.contrib.contenttypes.models import ContentType
2
+ from rest_framework.serializers import (
3
+ HyperlinkedIdentityField,
4
+ SerializerMethodField,
5
+ JSONField,
6
+ )
7
+ from drf_spectacular.utils import extend_schema_field
8
+ from netbox.api.fields import ContentTypeField
9
+ from netbox.api.serializers import NetBoxModelSerializer
10
+ from utilities.api import get_serializer_for_model
11
+ from tenancy.api.serializers import TenantSerializer
12
+
13
+ from netbox_security.models import AddressSet, AddressSetAssignment
14
+ from netbox_security.api.serializers import AddressSerializer
15
+
16
+
17
+ class AddressSetSerializer(NetBoxModelSerializer):
18
+ url = HyperlinkedIdentityField(
19
+ view_name="plugins-api:netbox_security-api:address-detail"
20
+ )
21
+ addresses = AddressSerializer(nested=True, many=True, read_only=True)
22
+ tenant = TenantSerializer(nested=True, required=False, allow_null=True)
23
+
24
+ class Meta:
25
+ model = AddressSet
26
+ fields = (
27
+ "id",
28
+ "url",
29
+ "display",
30
+ "name",
31
+ "addresses",
32
+ "description",
33
+ "tenant",
34
+ "comments",
35
+ "tags",
36
+ "custom_fields",
37
+ "created",
38
+ "last_updated",
39
+ )
40
+ brief_fields = (
41
+ "id",
42
+ "url",
43
+ "display",
44
+ "name",
45
+ "addresses",
46
+ "description",
47
+ )
48
+
49
+
50
+ class AddressSetAssignmentSerializer(NetBoxModelSerializer):
51
+ address_set = AddressSetSerializer(nested=True, required=True, allow_null=False)
52
+ assigned_object_type = ContentTypeField(queryset=ContentType.objects.all())
53
+ assigned_object = SerializerMethodField(read_only=True)
54
+
55
+ class Meta:
56
+ model = AddressSetAssignment
57
+ fields = [
58
+ "id",
59
+ "url",
60
+ "display",
61
+ "address_set",
62
+ "assigned_object_type",
63
+ "assigned_object_id",
64
+ "assigned_object",
65
+ "created",
66
+ "last_updated",
67
+ ]
68
+ brief_fields = (
69
+ "id",
70
+ "url",
71
+ "display",
72
+ "address_set",
73
+ "assigned_object_type",
74
+ "assigned_object_id",
75
+ )
76
+
77
+ @extend_schema_field(JSONField(allow_null=True))
78
+ def get_assigned_object(self, obj):
79
+ if obj.assigned_object is None:
80
+ return None
81
+ serializer = get_serializer_for_model(obj.assigned_object)
82
+ context = {"request": self.context["request"]}
83
+ return serializer(obj.assigned_object, nested=True, context=context).data
@@ -0,0 +1,83 @@
1
+ from django.contrib.contenttypes.models import ContentType
2
+ from rest_framework.serializers import (
3
+ HyperlinkedIdentityField,
4
+ SerializerMethodField,
5
+ JSONField,
6
+ )
7
+ from drf_spectacular.utils import extend_schema_field
8
+ from netbox.api.fields import ContentTypeField
9
+ from netbox.api.serializers import NetBoxModelSerializer
10
+ from utilities.api import get_serializer_for_model
11
+ from tenancy.api.serializers import TenantSerializer
12
+
13
+ from netbox_security.models import FirewallFilter, FirewallFilterAssignment
14
+
15
+
16
+ class FirewallFilterSerializer(NetBoxModelSerializer):
17
+ url = HyperlinkedIdentityField(
18
+ view_name="plugins-api:netbox_security-api:firewallfilter-detail"
19
+ )
20
+ tenant = TenantSerializer(nested=True, required=False, allow_null=True)
21
+
22
+ class Meta:
23
+ model = FirewallFilter
24
+ fields = (
25
+ "id",
26
+ "url",
27
+ "display",
28
+ "name",
29
+ "family",
30
+ "description",
31
+ "tenant",
32
+ "comments",
33
+ "tags",
34
+ "custom_fields",
35
+ "created",
36
+ "last_updated",
37
+ )
38
+ brief_fields = (
39
+ "id",
40
+ "url",
41
+ "display",
42
+ "name",
43
+ "family",
44
+ "description",
45
+ )
46
+
47
+
48
+ class FirewallFilterAssignmentSerializer(NetBoxModelSerializer):
49
+ firewall_filter = FirewallFilterSerializer(
50
+ nested=True, required=True, allow_null=False
51
+ )
52
+ assigned_object_type = ContentTypeField(queryset=ContentType.objects.all())
53
+ assigned_object = SerializerMethodField(read_only=True)
54
+
55
+ class Meta:
56
+ model = FirewallFilterAssignment
57
+ fields = [
58
+ "id",
59
+ "url",
60
+ "display",
61
+ "firewall_filter",
62
+ "assigned_object_type",
63
+ "assigned_object_id",
64
+ "assigned_object",
65
+ "created",
66
+ "last_updated",
67
+ ]
68
+ brief_fields = (
69
+ "id",
70
+ "url",
71
+ "display",
72
+ "firewall_filter",
73
+ "assigned_object_type",
74
+ "assigned_object_id",
75
+ )
76
+
77
+ @extend_schema_field(JSONField(allow_null=True))
78
+ def get_assigned_object(self, obj):
79
+ if obj.assigned_object is None:
80
+ return None
81
+ serializer = get_serializer_for_model(obj.assigned_object)
82
+ context = {"request": self.context["request"]}
83
+ return serializer(obj.assigned_object, nested=True, context=context).data