netbox-proxy-plugin 0.1.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.
- netbox_proxy_plugin-0.1.0/.gitignore +44 -0
- netbox_proxy_plugin-0.1.0/CHANGELOG.md +24 -0
- netbox_proxy_plugin-0.1.0/LICENSE +190 -0
- netbox_proxy_plugin-0.1.0/PKG-INFO +163 -0
- netbox_proxy_plugin-0.1.0/README.md +141 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/__init__.py +16 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/api/__init__.py +0 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/api/serializers.py +24 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/api/urls.py +7 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/api/views.py +11 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/filtersets.py +17 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/forms.py +41 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/migrations/__init__.py +0 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/models.py +60 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/navigation.py +29 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/proxy_router.py +33 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/tables.py +29 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/templates/netbox_proxy_plugin/proxy.html +44 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/urls.py +7 -0
- netbox_proxy_plugin-0.1.0/netbox_proxy_plugin/views.py +49 -0
- netbox_proxy_plugin-0.1.0/pyproject.toml +50 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
|
|
7
|
+
# Distribution / packaging
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
*.egg-info/
|
|
11
|
+
*.egg
|
|
12
|
+
.eggs/
|
|
13
|
+
|
|
14
|
+
# Virtual environments
|
|
15
|
+
venv/
|
|
16
|
+
.venv/
|
|
17
|
+
env/
|
|
18
|
+
|
|
19
|
+
# IDE
|
|
20
|
+
.idea/
|
|
21
|
+
.vscode/
|
|
22
|
+
.fleet/
|
|
23
|
+
*.swp
|
|
24
|
+
*.swo
|
|
25
|
+
|
|
26
|
+
# OS
|
|
27
|
+
.DS_Store
|
|
28
|
+
Thumbs.db
|
|
29
|
+
|
|
30
|
+
# Environment / secrets
|
|
31
|
+
.env
|
|
32
|
+
|
|
33
|
+
# AI / MCP
|
|
34
|
+
.mcp.json
|
|
35
|
+
|
|
36
|
+
# uv
|
|
37
|
+
uv.lock
|
|
38
|
+
.python-version
|
|
39
|
+
|
|
40
|
+
# Testing
|
|
41
|
+
.tox/
|
|
42
|
+
.coverage
|
|
43
|
+
htmlcov/
|
|
44
|
+
.pytest_cache/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2025-03-12
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Proxy model with name, protocol (HTTP/HTTPS/SOCKS4/SOCKS5), server, port, and optional credentials
|
|
15
|
+
- Web UI for listing, creating, editing, and deleting proxies
|
|
16
|
+
- Bulk import, edit, and delete operations
|
|
17
|
+
- REST API at `/api/plugins/proxies/proxies/`
|
|
18
|
+
- Filtering by protocol, server, port, and name
|
|
19
|
+
- `PluginProxyRouter` for integration with NetBox's `PROXY_ROUTERS`
|
|
20
|
+
- Navigation menu under "Proxies > Proxy Management"
|
|
21
|
+
- Tags and custom fields support
|
|
22
|
+
|
|
23
|
+
[Unreleased]: https://github.com/thomaschristory/netbox-proxy-plugin/compare/v0.1.0...HEAD
|
|
24
|
+
[0.1.0]: https://github.com/thomaschristory/netbox-proxy-plugin/releases/tag/v0.1.0
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 thomaschristory
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netbox-proxy-plugin
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NetBox plugin for managing HTTP proxy configurations
|
|
5
|
+
Project-URL: Homepage, https://github.com/thomaschristory/netbox-proxy-plugin
|
|
6
|
+
Project-URL: Repository, https://github.com/thomaschristory/netbox-proxy-plugin
|
|
7
|
+
Project-URL: Issues, https://github.com/thomaschristory/netbox-proxy-plugin/issues
|
|
8
|
+
Project-URL: Documentation, https://github.com/thomaschristory/netbox-proxy-plugin#readme
|
|
9
|
+
Project-URL: Changelog, https://github.com/thomaschristory/netbox-proxy-plugin/blob/main/CHANGELOG.md
|
|
10
|
+
Author: thomaschristory
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: http-proxy,netbox,netbox-plugin,proxy,socks
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Framework :: Django
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# netbox-proxy-plugin
|
|
24
|
+
|
|
25
|
+
[](https://github.com/thomaschristory/netbox-proxy-plugin/actions/workflows/ci.yml)
|
|
26
|
+
[](https://github.com/thomaschristory/netbox-proxy-plugin/blob/main/LICENSE)
|
|
27
|
+
|
|
28
|
+
A [NetBox](https://github.com/netbox-community/netbox) plugin for managing HTTP proxy configurations through the NetBox web interface and REST API.
|
|
29
|
+
|
|
30
|
+
This plugin integrates with NetBox's [proxy routing system](https://github.com/netbox-community/netbox/pull/18681) (`PROXY_ROUTERS`), allowing you to define and manage proxy configurations from the database instead of static configuration files.
|
|
31
|
+
|
|
32
|
+
## Compatibility
|
|
33
|
+
|
|
34
|
+
| NetBox Version | Plugin Version |
|
|
35
|
+
|----------------|----------------|
|
|
36
|
+
| 4.2+ | 0.1.x |
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Create, edit, and delete proxy configurations via the NetBox UI
|
|
41
|
+
- Support for HTTP, HTTPS, SOCKS4, and SOCKS5 protocols
|
|
42
|
+
- REST API for programmatic proxy management
|
|
43
|
+
- Bulk import/edit/delete operations
|
|
44
|
+
- Filtering and search
|
|
45
|
+
- Optional proxy router that resolves proxies from the plugin database
|
|
46
|
+
- Tags and custom fields support
|
|
47
|
+
|
|
48
|
+
## Requirements
|
|
49
|
+
|
|
50
|
+
- NetBox 4.2 or later
|
|
51
|
+
- Python 3.10 or later
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
### 1. Install the package
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install netbox-proxy-plugin
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or for development:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
cd netbox-proxy-plugin
|
|
65
|
+
pip install -e .
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 2. Enable the plugin
|
|
69
|
+
|
|
70
|
+
Add to your NetBox `configuration.py`:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
PLUGINS = [
|
|
74
|
+
"netbox_proxy_plugin",
|
|
75
|
+
]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Run migrations
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
cd /opt/netbox/netbox
|
|
82
|
+
python manage.py migrate
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 4. Restart NetBox
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
sudo systemctl restart netbox netbox-rq
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
### Using the Plugin Proxy Router
|
|
94
|
+
|
|
95
|
+
To have NetBox resolve proxies from the plugin database, add the `PluginProxyRouter` to your `PROXY_ROUTERS` setting in `configuration.py`:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
PROXY_ROUTERS = [
|
|
99
|
+
"netbox_proxy_plugin.proxy_router.PluginProxyRouter",
|
|
100
|
+
"utilities.proxy.DefaultProxyRouter",
|
|
101
|
+
]
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The plugin router is listed first so it takes priority. If no matching proxy is found in the database, the default router falls back to the `HTTP_PROXIES` static configuration.
|
|
105
|
+
|
|
106
|
+
### How Proxy Routing Works
|
|
107
|
+
|
|
108
|
+
NetBox's proxy routing system (introduced in [PR #18681](https://github.com/netbox-community/netbox/pull/18681)) calls `resolve_proxies()` whenever an outbound HTTP request needs proxy configuration. Each router in `PROXY_ROUTERS` is tried in order. The first router to return a non-empty result wins.
|
|
109
|
+
|
|
110
|
+
The `PluginProxyRouter` queries the plugin's `Proxy` model and returns matching entries as a dictionary:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
{"http": "http://proxy.example.com:8080", "https": "https://proxy.example.com:8443"}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Usage
|
|
117
|
+
|
|
118
|
+
### Web Interface
|
|
119
|
+
|
|
120
|
+
After installation, a **Proxies** menu appears in the NetBox navigation. From there you can:
|
|
121
|
+
|
|
122
|
+
- **List** all configured proxies
|
|
123
|
+
- **Add** a new proxy with protocol, server, port, and optional credentials
|
|
124
|
+
- **Edit** or **delete** existing proxies
|
|
125
|
+
- **Bulk import** proxies from CSV
|
|
126
|
+
- **Filter** by protocol, server, or name
|
|
127
|
+
|
|
128
|
+
### REST API
|
|
129
|
+
|
|
130
|
+
The plugin exposes a REST API at `/api/plugins/proxies/proxies/`.
|
|
131
|
+
|
|
132
|
+
**List proxies:**
|
|
133
|
+
```bash
|
|
134
|
+
curl -H "Authorization: Token <your-token>" \
|
|
135
|
+
http://netbox.example.com/api/plugins/proxies/proxies/
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Create a proxy:**
|
|
139
|
+
```bash
|
|
140
|
+
curl -X POST \
|
|
141
|
+
-H "Authorization: Token <your-token>" \
|
|
142
|
+
-H "Content-Type: application/json" \
|
|
143
|
+
-d '{"name": "corp-proxy", "protocol": "http", "server": "proxy.corp.com", "port": 8080}' \
|
|
144
|
+
http://netbox.example.com/api/plugins/proxies/proxies/
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Model Reference
|
|
148
|
+
|
|
149
|
+
### Proxy
|
|
150
|
+
|
|
151
|
+
| Field | Type | Required | Description |
|
|
152
|
+
|-------------|---------|----------|--------------------------------------|
|
|
153
|
+
| name | string | Yes | Unique name for the proxy |
|
|
154
|
+
| protocol | choice | Yes | `http`, `https`, `socks4`, `socks5` |
|
|
155
|
+
| server | string | Yes | Proxy server address |
|
|
156
|
+
| port | integer | Yes | Proxy server port |
|
|
157
|
+
| username | string | No | Authentication username |
|
|
158
|
+
| password | string | No | Authentication password |
|
|
159
|
+
| description | string | No | Optional description |
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
Apache License 2.0. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# netbox-proxy-plugin
|
|
2
|
+
|
|
3
|
+
[](https://github.com/thomaschristory/netbox-proxy-plugin/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/thomaschristory/netbox-proxy-plugin/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
A [NetBox](https://github.com/netbox-community/netbox) plugin for managing HTTP proxy configurations through the NetBox web interface and REST API.
|
|
7
|
+
|
|
8
|
+
This plugin integrates with NetBox's [proxy routing system](https://github.com/netbox-community/netbox/pull/18681) (`PROXY_ROUTERS`), allowing you to define and manage proxy configurations from the database instead of static configuration files.
|
|
9
|
+
|
|
10
|
+
## Compatibility
|
|
11
|
+
|
|
12
|
+
| NetBox Version | Plugin Version |
|
|
13
|
+
|----------------|----------------|
|
|
14
|
+
| 4.2+ | 0.1.x |
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Create, edit, and delete proxy configurations via the NetBox UI
|
|
19
|
+
- Support for HTTP, HTTPS, SOCKS4, and SOCKS5 protocols
|
|
20
|
+
- REST API for programmatic proxy management
|
|
21
|
+
- Bulk import/edit/delete operations
|
|
22
|
+
- Filtering and search
|
|
23
|
+
- Optional proxy router that resolves proxies from the plugin database
|
|
24
|
+
- Tags and custom fields support
|
|
25
|
+
|
|
26
|
+
## Requirements
|
|
27
|
+
|
|
28
|
+
- NetBox 4.2 or later
|
|
29
|
+
- Python 3.10 or later
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
### 1. Install the package
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install netbox-proxy-plugin
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or for development:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
cd netbox-proxy-plugin
|
|
43
|
+
pip install -e .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Enable the plugin
|
|
47
|
+
|
|
48
|
+
Add to your NetBox `configuration.py`:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
PLUGINS = [
|
|
52
|
+
"netbox_proxy_plugin",
|
|
53
|
+
]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 3. Run migrations
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
cd /opt/netbox/netbox
|
|
60
|
+
python manage.py migrate
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 4. Restart NetBox
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
sudo systemctl restart netbox netbox-rq
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Configuration
|
|
70
|
+
|
|
71
|
+
### Using the Plugin Proxy Router
|
|
72
|
+
|
|
73
|
+
To have NetBox resolve proxies from the plugin database, add the `PluginProxyRouter` to your `PROXY_ROUTERS` setting in `configuration.py`:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
PROXY_ROUTERS = [
|
|
77
|
+
"netbox_proxy_plugin.proxy_router.PluginProxyRouter",
|
|
78
|
+
"utilities.proxy.DefaultProxyRouter",
|
|
79
|
+
]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The plugin router is listed first so it takes priority. If no matching proxy is found in the database, the default router falls back to the `HTTP_PROXIES` static configuration.
|
|
83
|
+
|
|
84
|
+
### How Proxy Routing Works
|
|
85
|
+
|
|
86
|
+
NetBox's proxy routing system (introduced in [PR #18681](https://github.com/netbox-community/netbox/pull/18681)) calls `resolve_proxies()` whenever an outbound HTTP request needs proxy configuration. Each router in `PROXY_ROUTERS` is tried in order. The first router to return a non-empty result wins.
|
|
87
|
+
|
|
88
|
+
The `PluginProxyRouter` queries the plugin's `Proxy` model and returns matching entries as a dictionary:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
{"http": "http://proxy.example.com:8080", "https": "https://proxy.example.com:8443"}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
### Web Interface
|
|
97
|
+
|
|
98
|
+
After installation, a **Proxies** menu appears in the NetBox navigation. From there you can:
|
|
99
|
+
|
|
100
|
+
- **List** all configured proxies
|
|
101
|
+
- **Add** a new proxy with protocol, server, port, and optional credentials
|
|
102
|
+
- **Edit** or **delete** existing proxies
|
|
103
|
+
- **Bulk import** proxies from CSV
|
|
104
|
+
- **Filter** by protocol, server, or name
|
|
105
|
+
|
|
106
|
+
### REST API
|
|
107
|
+
|
|
108
|
+
The plugin exposes a REST API at `/api/plugins/proxies/proxies/`.
|
|
109
|
+
|
|
110
|
+
**List proxies:**
|
|
111
|
+
```bash
|
|
112
|
+
curl -H "Authorization: Token <your-token>" \
|
|
113
|
+
http://netbox.example.com/api/plugins/proxies/proxies/
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Create a proxy:**
|
|
117
|
+
```bash
|
|
118
|
+
curl -X POST \
|
|
119
|
+
-H "Authorization: Token <your-token>" \
|
|
120
|
+
-H "Content-Type: application/json" \
|
|
121
|
+
-d '{"name": "corp-proxy", "protocol": "http", "server": "proxy.corp.com", "port": 8080}' \
|
|
122
|
+
http://netbox.example.com/api/plugins/proxies/proxies/
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Model Reference
|
|
126
|
+
|
|
127
|
+
### Proxy
|
|
128
|
+
|
|
129
|
+
| Field | Type | Required | Description |
|
|
130
|
+
|-------------|---------|----------|--------------------------------------|
|
|
131
|
+
| name | string | Yes | Unique name for the proxy |
|
|
132
|
+
| protocol | choice | Yes | `http`, `https`, `socks4`, `socks5` |
|
|
133
|
+
| server | string | Yes | Proxy server address |
|
|
134
|
+
| port | integer | Yes | Proxy server port |
|
|
135
|
+
| username | string | No | Authentication username |
|
|
136
|
+
| password | string | No | Authentication password |
|
|
137
|
+
| description | string | No | Optional description |
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
Apache License 2.0. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from netbox.plugins import PluginConfig
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.0"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class NetboxProxyPluginConfig(PluginConfig):
|
|
7
|
+
name = "netbox_proxy_plugin"
|
|
8
|
+
verbose_name = "Proxies"
|
|
9
|
+
description = "Manage HTTP proxy configurations for NetBox"
|
|
10
|
+
version = __version__
|
|
11
|
+
author = "thomaschristory"
|
|
12
|
+
base_url = "proxies"
|
|
13
|
+
min_version = "4.2.0"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
config = NetboxProxyPluginConfig
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
2
|
+
|
|
3
|
+
from ..models import Proxy
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ProxySerializer(NetBoxModelSerializer):
|
|
7
|
+
class Meta:
|
|
8
|
+
model = Proxy
|
|
9
|
+
fields = (
|
|
10
|
+
"id",
|
|
11
|
+
"url",
|
|
12
|
+
"display",
|
|
13
|
+
"name",
|
|
14
|
+
"protocol",
|
|
15
|
+
"server",
|
|
16
|
+
"port",
|
|
17
|
+
"username",
|
|
18
|
+
"description",
|
|
19
|
+
"tags",
|
|
20
|
+
"custom_fields",
|
|
21
|
+
"created",
|
|
22
|
+
"last_updated",
|
|
23
|
+
)
|
|
24
|
+
brief_fields = ("id", "url", "display", "name", "protocol")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from netbox.api.viewsets import NetBoxModelViewSet
|
|
2
|
+
|
|
3
|
+
from ..filtersets import ProxyFilterSet
|
|
4
|
+
from ..models import Proxy
|
|
5
|
+
from .serializers import ProxySerializer
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ProxyViewSet(NetBoxModelViewSet):
|
|
9
|
+
queryset = Proxy.objects.all()
|
|
10
|
+
serializer_class = ProxySerializer
|
|
11
|
+
filterset_class = ProxyFilterSet
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import django_filters
|
|
2
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
3
|
+
|
|
4
|
+
from .models import Proxy, ProxyProtocolChoices
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ProxyFilterSet(NetBoxModelFilterSet):
|
|
8
|
+
protocol = django_filters.MultipleChoiceFilter(
|
|
9
|
+
choices=ProxyProtocolChoices,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
class Meta:
|
|
13
|
+
model = Proxy
|
|
14
|
+
fields = ("id", "name", "protocol", "server", "port")
|
|
15
|
+
|
|
16
|
+
def search(self, queryset, name, value):
|
|
17
|
+
return queryset.filter(name__icontains=value)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from netbox.forms import NetBoxModelFilterSetForm, NetBoxModelForm, NetBoxModelImportForm
|
|
2
|
+
from utilities.forms.fields import CommentField
|
|
3
|
+
|
|
4
|
+
from .models import Proxy, ProxyProtocolChoices
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ProxyForm(NetBoxModelForm):
|
|
8
|
+
comments = CommentField()
|
|
9
|
+
|
|
10
|
+
class Meta:
|
|
11
|
+
model = Proxy
|
|
12
|
+
fields = (
|
|
13
|
+
"name",
|
|
14
|
+
"protocol",
|
|
15
|
+
"server",
|
|
16
|
+
"port",
|
|
17
|
+
"username",
|
|
18
|
+
"password",
|
|
19
|
+
"description",
|
|
20
|
+
"tags",
|
|
21
|
+
"comments",
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ProxyImportForm(NetBoxModelImportForm):
|
|
26
|
+
class Meta:
|
|
27
|
+
model = Proxy
|
|
28
|
+
fields = (
|
|
29
|
+
"name",
|
|
30
|
+
"protocol",
|
|
31
|
+
"server",
|
|
32
|
+
"port",
|
|
33
|
+
"username",
|
|
34
|
+
"password",
|
|
35
|
+
"description",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class ProxyFilterForm(NetBoxModelFilterSetForm):
|
|
40
|
+
model = Proxy
|
|
41
|
+
protocol = ProxyProtocolChoices
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from django.db import models
|
|
2
|
+
from django.urls import reverse
|
|
3
|
+
from netbox.models import NetBoxModel
|
|
4
|
+
from utilities.choices import ChoiceSet
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ProxyProtocolChoices(ChoiceSet):
|
|
8
|
+
key = "Proxy.protocol"
|
|
9
|
+
|
|
10
|
+
CHOICES = [
|
|
11
|
+
("http", "HTTP", "blue"),
|
|
12
|
+
("https", "HTTPS", "green"),
|
|
13
|
+
("socks4", "SOCKS4", "orange"),
|
|
14
|
+
("socks5", "SOCKS5", "purple"),
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Proxy(NetBoxModel):
|
|
19
|
+
name = models.CharField(
|
|
20
|
+
max_length=100,
|
|
21
|
+
unique=True,
|
|
22
|
+
)
|
|
23
|
+
protocol = models.CharField(
|
|
24
|
+
max_length=10,
|
|
25
|
+
choices=ProxyProtocolChoices,
|
|
26
|
+
)
|
|
27
|
+
server = models.CharField(
|
|
28
|
+
max_length=255,
|
|
29
|
+
help_text="Proxy server address (e.g. proxy.example.com)",
|
|
30
|
+
)
|
|
31
|
+
port = models.PositiveIntegerField()
|
|
32
|
+
username = models.CharField(
|
|
33
|
+
max_length=255,
|
|
34
|
+
blank=True,
|
|
35
|
+
)
|
|
36
|
+
password = models.CharField(
|
|
37
|
+
max_length=255,
|
|
38
|
+
blank=True,
|
|
39
|
+
)
|
|
40
|
+
description = models.CharField(
|
|
41
|
+
max_length=200,
|
|
42
|
+
blank=True,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
class Meta:
|
|
46
|
+
ordering = ("name",)
|
|
47
|
+
verbose_name_plural = "proxies"
|
|
48
|
+
|
|
49
|
+
def __str__(self):
|
|
50
|
+
return self.name
|
|
51
|
+
|
|
52
|
+
def get_absolute_url(self):
|
|
53
|
+
return reverse("plugins:netbox_proxy_plugin:proxy", args=[self.pk])
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def url(self):
|
|
57
|
+
"""Build the full proxy URL."""
|
|
58
|
+
if self.username:
|
|
59
|
+
return f"{self.protocol}://{self.username}:{self.password}@{self.server}:{self.port}"
|
|
60
|
+
return f"{self.protocol}://{self.server}:{self.port}"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from netbox.plugins import PluginMenu, PluginMenuButton, PluginMenuItem
|
|
2
|
+
from utilities.choices import ButtonColorChoices
|
|
3
|
+
|
|
4
|
+
proxy_items = (
|
|
5
|
+
PluginMenuItem(
|
|
6
|
+
link="plugins:netbox_proxy_plugin:proxy_list",
|
|
7
|
+
link_text="Proxies",
|
|
8
|
+
buttons=(
|
|
9
|
+
PluginMenuButton(
|
|
10
|
+
link="plugins:netbox_proxy_plugin:proxy_add",
|
|
11
|
+
title="Add",
|
|
12
|
+
icon_class="mdi mdi-plus-thick",
|
|
13
|
+
color=ButtonColorChoices.GREEN,
|
|
14
|
+
),
|
|
15
|
+
PluginMenuButton(
|
|
16
|
+
link="plugins:netbox_proxy_plugin:proxy_import",
|
|
17
|
+
title="Import",
|
|
18
|
+
icon_class="mdi mdi-upload",
|
|
19
|
+
color=ButtonColorChoices.CYAN,
|
|
20
|
+
),
|
|
21
|
+
),
|
|
22
|
+
),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
menu = PluginMenu(
|
|
26
|
+
label="Proxies",
|
|
27
|
+
groups=(("Proxy Management", proxy_items),),
|
|
28
|
+
icon_class="mdi mdi-server-network",
|
|
29
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from urllib.parse import urlparse
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class PluginProxyRouter:
|
|
5
|
+
"""
|
|
6
|
+
A proxy router that resolves proxies from the netbox_proxy_plugin plugin database.
|
|
7
|
+
|
|
8
|
+
Add to your NetBox configuration:
|
|
9
|
+
PROXY_ROUTERS = [
|
|
10
|
+
"netbox_proxy_plugin.proxy_router.PluginProxyRouter",
|
|
11
|
+
"utilities.proxy.DefaultProxyRouter",
|
|
12
|
+
]
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
@staticmethod
|
|
16
|
+
def _get_protocol_from_url(url):
|
|
17
|
+
return urlparse(url).scheme
|
|
18
|
+
|
|
19
|
+
def route(self, url=None, protocol=None, context=None):
|
|
20
|
+
from .models import Proxy
|
|
21
|
+
|
|
22
|
+
if url and protocol is None:
|
|
23
|
+
protocol = self._get_protocol_from_url(url)
|
|
24
|
+
|
|
25
|
+
proxies = Proxy.objects.all()
|
|
26
|
+
if protocol:
|
|
27
|
+
proxies = proxies.filter(protocol=protocol)
|
|
28
|
+
|
|
29
|
+
result = {}
|
|
30
|
+
for proxy in proxies:
|
|
31
|
+
result[proxy.protocol] = proxy.url
|
|
32
|
+
|
|
33
|
+
return result or None
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import django_tables2 as tables
|
|
2
|
+
from netbox.tables import ChoiceFieldColumn, NetBoxTable
|
|
3
|
+
|
|
4
|
+
from .models import Proxy
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ProxyTable(NetBoxTable):
|
|
8
|
+
name = tables.Column(linkify=True)
|
|
9
|
+
protocol = ChoiceFieldColumn()
|
|
10
|
+
|
|
11
|
+
class Meta(NetBoxTable.Meta):
|
|
12
|
+
model = Proxy
|
|
13
|
+
fields = (
|
|
14
|
+
"pk",
|
|
15
|
+
"id",
|
|
16
|
+
"name",
|
|
17
|
+
"protocol",
|
|
18
|
+
"server",
|
|
19
|
+
"port",
|
|
20
|
+
"description",
|
|
21
|
+
)
|
|
22
|
+
default_columns = (
|
|
23
|
+
"pk",
|
|
24
|
+
"name",
|
|
25
|
+
"protocol",
|
|
26
|
+
"server",
|
|
27
|
+
"port",
|
|
28
|
+
"description",
|
|
29
|
+
)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{% extends 'generic/object.html' %}
|
|
2
|
+
{% load helpers %}
|
|
3
|
+
|
|
4
|
+
{% block content %}
|
|
5
|
+
<div class="row mb-3">
|
|
6
|
+
<div class="col col-md-6">
|
|
7
|
+
<div class="card">
|
|
8
|
+
<h5 class="card-header">Proxy Configuration</h5>
|
|
9
|
+
<table class="table table-hover attr-table">
|
|
10
|
+
<tr>
|
|
11
|
+
<th scope="row">Name</th>
|
|
12
|
+
<td>{{ object.name }}</td>
|
|
13
|
+
</tr>
|
|
14
|
+
<tr>
|
|
15
|
+
<th scope="row">Protocol</th>
|
|
16
|
+
<td>{% badge object.get_protocol_display bg_color=object.get_protocol_color %}</td>
|
|
17
|
+
</tr>
|
|
18
|
+
<tr>
|
|
19
|
+
<th scope="row">Server</th>
|
|
20
|
+
<td>{{ object.server }}</td>
|
|
21
|
+
</tr>
|
|
22
|
+
<tr>
|
|
23
|
+
<th scope="row">Port</th>
|
|
24
|
+
<td>{{ object.port }}</td>
|
|
25
|
+
</tr>
|
|
26
|
+
<tr>
|
|
27
|
+
<th scope="row">Username</th>
|
|
28
|
+
<td>{{ object.username|placeholder }}</td>
|
|
29
|
+
</tr>
|
|
30
|
+
<tr>
|
|
31
|
+
<th scope="row">Proxy URL</th>
|
|
32
|
+
<td><code>{{ object.url }}</code></td>
|
|
33
|
+
</tr>
|
|
34
|
+
<tr>
|
|
35
|
+
<th scope="row">Description</th>
|
|
36
|
+
<td>{{ object.description|placeholder }}</td>
|
|
37
|
+
</tr>
|
|
38
|
+
</table>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
{% include 'inc/panels/tags.html' %}
|
|
42
|
+
{% include 'inc/panels/comments.html' %}
|
|
43
|
+
</div>
|
|
44
|
+
{% endblock %}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from netbox.views import generic
|
|
2
|
+
from utilities.views import register_model_view
|
|
3
|
+
|
|
4
|
+
from . import filtersets, forms, models, tables
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@register_model_view(models.Proxy)
|
|
8
|
+
class ProxyView(generic.ObjectView):
|
|
9
|
+
queryset = models.Proxy.objects.all()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@register_model_view(models.Proxy, "list", path="")
|
|
13
|
+
class ProxyListView(generic.ObjectListView):
|
|
14
|
+
queryset = models.Proxy.objects.all()
|
|
15
|
+
table = tables.ProxyTable
|
|
16
|
+
filterset = filtersets.ProxyFilterSet
|
|
17
|
+
filterset_form = forms.ProxyFilterForm
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@register_model_view(models.Proxy, "add")
|
|
21
|
+
class ProxyEditView(generic.ObjectEditView):
|
|
22
|
+
queryset = models.Proxy.objects.all()
|
|
23
|
+
form = forms.ProxyForm
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@register_model_view(models.Proxy, "delete")
|
|
27
|
+
class ProxyDeleteView(generic.ObjectDeleteView):
|
|
28
|
+
queryset = models.Proxy.objects.all()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@register_model_view(models.Proxy, "bulk_import")
|
|
32
|
+
class ProxyBulkImportView(generic.BulkImportView):
|
|
33
|
+
queryset = models.Proxy.objects.all()
|
|
34
|
+
model_form = forms.ProxyImportForm
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@register_model_view(models.Proxy, "bulk_edit")
|
|
38
|
+
class ProxyBulkEditView(generic.BulkEditView):
|
|
39
|
+
queryset = models.Proxy.objects.all()
|
|
40
|
+
filterset = filtersets.ProxyFilterSet
|
|
41
|
+
table = tables.ProxyTable
|
|
42
|
+
form = forms.ProxyForm
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@register_model_view(models.Proxy, "bulk_delete")
|
|
46
|
+
class ProxyBulkDeleteView(generic.BulkDeleteView):
|
|
47
|
+
queryset = models.Proxy.objects.all()
|
|
48
|
+
filterset = filtersets.ProxyFilterSet
|
|
49
|
+
table = tables.ProxyTable
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "netbox-proxy-plugin"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "NetBox plugin for managing HTTP proxy configurations"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "thomaschristory"},
|
|
14
|
+
]
|
|
15
|
+
keywords = ["netbox", "netbox-plugin", "proxy", "http-proxy", "socks"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Framework :: Django",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"License :: OSI Approved :: Apache Software License",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://github.com/thomaschristory/netbox-proxy-plugin"
|
|
25
|
+
Repository = "https://github.com/thomaschristory/netbox-proxy-plugin"
|
|
26
|
+
Issues = "https://github.com/thomaschristory/netbox-proxy-plugin/issues"
|
|
27
|
+
Documentation = "https://github.com/thomaschristory/netbox-proxy-plugin#readme"
|
|
28
|
+
Changelog = "https://github.com/thomaschristory/netbox-proxy-plugin/blob/main/CHANGELOG.md"
|
|
29
|
+
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
dev = [
|
|
32
|
+
"ruff",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["netbox_proxy_plugin"]
|
|
37
|
+
|
|
38
|
+
[tool.hatch.build.targets.sdist]
|
|
39
|
+
include = ["netbox_proxy_plugin/**", "LICENSE", "README.md", "CHANGELOG.md"]
|
|
40
|
+
|
|
41
|
+
[tool.ruff]
|
|
42
|
+
target-version = "py310"
|
|
43
|
+
line-length = 120
|
|
44
|
+
|
|
45
|
+
[tool.ruff.lint]
|
|
46
|
+
select = ["E", "F", "I", "W"]
|
|
47
|
+
|
|
48
|
+
[tool.ruff.lint.isort]
|
|
49
|
+
known-third-party = ["django", "django_filters", "django_tables2"]
|
|
50
|
+
known-first-party = ["netbox_proxy_plugin"]
|