netbox-secrets 2.0.2__tar.gz → 2.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_secrets-2.0.2/netbox_secrets.egg-info → netbox_secrets-2.1.0}/PKG-INFO +2 -1
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/README.md +1 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/__init__.py +2 -2
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/api/serializers.py +0 -1
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/api/views.py +33 -6
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/graphql/filters.py +2 -2
- netbox_secrets-2.1.0/netbox_secrets/graphql/schema.py +15 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0004_populate_secrets.py +1 -1
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/userkey_list.html +5 -3
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/views.py +6 -2
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0/netbox_secrets.egg-info}/PKG-INFO +2 -1
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/setup.py +1 -1
- netbox_secrets-2.0.2/netbox_secrets/graphql/schema.py +0 -22
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/LICENSE.md +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/MANIFEST.in +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/api/__init__.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/api/urls.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/constants.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/exceptions.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/filtersets.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/forms/__init__.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/forms/bulk_edit.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/forms/bulk_import.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/forms/filterset.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/forms/model_forms.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/graphql/__init__.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/graphql/types.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/hashers.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0001_initial.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0002_populate_userkeys.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0003_populate_secretroles.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0005_alter_secret_custom_field_data_and_more.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0006_alter_userkey_created_alter_userkey_last_updated.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0007_secret__object_repr_secret_comments_and_more.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0008_userkey_custom_field_data_userkey_tags.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/__init__.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/models/__init__.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/models/secrets.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/navigation.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/querysets.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/static/netbox_secrets/secrets.js +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/static/netbox_secrets/secrets.js.map +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/tables.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/template_content.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/activate_keys.html +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/inc/private_key_modal.html +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/inc/secret_actions.html +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/inc/secret_add_button.html +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/inc/secrets_panel.html +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/secret.html +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/secret_edit.html +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/secretrole.html +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/userkey.html +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/userkey_edit.html +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/tests/__init__.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/tests/constants.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/tests/test_api.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/tests/test_filters.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/tests/test_form.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/tests/test_models.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/tests/test_views.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/urls.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/utils/__init__.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/utils/crypto.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/utils/hashers.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/utils/helpers.py +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets.egg-info/SOURCES.txt +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets.egg-info/dependency_links.txt +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets.egg-info/not-zip-safe +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets.egg-info/requires.txt +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets.egg-info/top_level.txt +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/pyproject.toml +0 -0
- {netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: netbox-secrets
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Enhance your secret management with encrypted storage and flexible, user-friendly features.
|
|
5
5
|
Home-page: https://github.com/Onemind-Services-LLC/netbox-secrets/
|
|
6
6
|
Author: Abhimanyu Saharan
|
|
@@ -41,6 +41,7 @@ and stability.
|
|
|
41
41
|
| 3.6.x | 1.9.x |
|
|
42
42
|
| 3.7.x | 1.10.x |
|
|
43
43
|
| 4.0.x | 2.0.x |
|
|
44
|
+
| 4.1.x | 2.1.x |
|
|
44
45
|
|
|
45
46
|
# Installation
|
|
46
47
|
|
|
@@ -15,8 +15,8 @@ class NetBoxSecrets(PluginConfig):
|
|
|
15
15
|
author = metadata.get('Author')
|
|
16
16
|
author_email = metadata.get('Author-email')
|
|
17
17
|
base_url = 'secrets'
|
|
18
|
-
min_version = '4.
|
|
19
|
-
max_version = '4.
|
|
18
|
+
min_version = '4.1.0'
|
|
19
|
+
max_version = '4.1.99'
|
|
20
20
|
required_settings = []
|
|
21
21
|
default_settings = {
|
|
22
22
|
'apps': ['dcim.device', 'virtualization.virtualmachine'],
|
|
@@ -4,16 +4,16 @@ from Crypto.PublicKey import RSA
|
|
|
4
4
|
from django.conf import settings
|
|
5
5
|
from django.http import HttpResponseBadRequest
|
|
6
6
|
from drf_spectacular import utils as drf_utils
|
|
7
|
+
from netbox.api.viewsets import BaseViewSet, NetBoxModelViewSet, mixins
|
|
7
8
|
from rest_framework import mixins as drf_mixins, status
|
|
8
|
-
from rest_framework.exceptions import ValidationError
|
|
9
|
+
from rest_framework.exceptions import PermissionDenied, ValidationError
|
|
9
10
|
from rest_framework.parsers import FormParser, JSONParser, MultiPartParser
|
|
10
11
|
from rest_framework.permissions import IsAuthenticated
|
|
11
12
|
from rest_framework.response import Response
|
|
12
13
|
from rest_framework.routers import APIRootView
|
|
13
14
|
from rest_framework.viewsets import ReadOnlyModelViewSet, ViewSet
|
|
14
|
-
|
|
15
|
-
from netbox.api.viewsets import BaseViewSet, NetBoxModelViewSet, mixins
|
|
16
15
|
from utilities.query import count_related
|
|
16
|
+
|
|
17
17
|
from . import serializers
|
|
18
18
|
from .. import constants, exceptions, filtersets, models
|
|
19
19
|
|
|
@@ -347,16 +347,43 @@ class GetSessionKeyViewSet(ViewSet):
|
|
|
347
347
|
|
|
348
348
|
class ActivateUserKeyViewSet(ViewSet):
|
|
349
349
|
"""
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
350
|
+
This endpoint expects a private key and a list of user keys to be activated.
|
|
351
|
+
The private key is used to derive a master key, which is then used to activate
|
|
352
|
+
each user key provided.
|
|
353
353
|
"""
|
|
354
354
|
|
|
355
355
|
permission_classes = [IsAuthenticated]
|
|
356
356
|
serializer_class = serializers.ActivateUserKeySerializer
|
|
357
357
|
parser_classes = [JSONParser, FormParser, MultiPartParser]
|
|
358
358
|
|
|
359
|
+
@drf_utils.extend_schema(
|
|
360
|
+
request=serializers.ActivateUserKeySerializer,
|
|
361
|
+
responses={
|
|
362
|
+
200: drf_utils.OpenApiResponse(
|
|
363
|
+
description="User keys activated successfully.",
|
|
364
|
+
response={
|
|
365
|
+
'type': 'string',
|
|
366
|
+
},
|
|
367
|
+
),
|
|
368
|
+
400: drf_utils.OpenApiResponse(
|
|
369
|
+
description="User key activation failed.",
|
|
370
|
+
response={
|
|
371
|
+
'type': 'string',
|
|
372
|
+
},
|
|
373
|
+
examples=[
|
|
374
|
+
drf_utils.OpenApiExample(name=ERR_PRIVKEY_MISSING, value=ERR_PRIVKEY_MISSING),
|
|
375
|
+
drf_utils.OpenApiExample(name=ERR_USERKEY_MISSING, value=ERR_USERKEY_MISSING),
|
|
376
|
+
drf_utils.OpenApiExample(name=ERR_USERKEY_INACTIVE, value=ERR_USERKEY_INACTIVE),
|
|
377
|
+
drf_utils.OpenApiExample(name=ERR_PRIVKEY_INVALID, value=ERR_PRIVKEY_INVALID),
|
|
378
|
+
],
|
|
379
|
+
),
|
|
380
|
+
},
|
|
381
|
+
)
|
|
359
382
|
def create(self, request):
|
|
383
|
+
# Check if the user has the permission to change UserKey
|
|
384
|
+
if not request.user.has_perm('netbox_secrets.change_userkey'):
|
|
385
|
+
raise PermissionDenied("You do not have permission to active User Keys.")
|
|
386
|
+
|
|
360
387
|
serializer = self.serializer_class(data=request.data)
|
|
361
388
|
if not serializer.is_valid():
|
|
362
389
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import strawberry_django
|
|
2
|
-
from netbox.graphql.filter_mixins import autotype_decorator, BaseFilterMixin
|
|
3
2
|
|
|
4
|
-
from
|
|
3
|
+
from netbox.graphql.filter_mixins import BaseFilterMixin, autotype_decorator
|
|
5
4
|
from ..filtersets import *
|
|
5
|
+
from ..models import *
|
|
6
6
|
|
|
7
7
|
__all__ = [
|
|
8
8
|
'SecretFilter',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
import strawberry
|
|
4
|
+
import strawberry_django
|
|
5
|
+
|
|
6
|
+
from .types import *
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@strawberry.type(name='Query')
|
|
10
|
+
class NetboxSecretsQuery:
|
|
11
|
+
secret_roles: List[SecretRoleType] = strawberry_django.field()
|
|
12
|
+
secret_roles_list: List[SecretRoleType] = strawberry_django.field()
|
|
13
|
+
|
|
14
|
+
secrets: List[SecretType] = strawberry_django.field()
|
|
15
|
+
secrets_list: List[SecretType] = strawberry_django.field()
|
{netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0004_populate_secrets.py
RENAMED
|
@@ -50,7 +50,7 @@ def update_objectchanges(apps, schema_editor):
|
|
|
50
50
|
"""
|
|
51
51
|
Update the ObjectChange records to reflect the new model name.
|
|
52
52
|
"""
|
|
53
|
-
ObjectChange = apps.get_model('
|
|
53
|
+
ObjectChange = apps.get_model('core', 'ObjectChange')
|
|
54
54
|
ContentType = apps.get_model('contenttypes', 'ContentType')
|
|
55
55
|
|
|
56
56
|
try:
|
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
{% endif %}
|
|
16
16
|
</a>
|
|
17
17
|
{% endif %}
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
|
|
18
|
+
{% if perms.netbox_secrets.change_userkey %}
|
|
19
|
+
<a href="{% url 'plugins:netbox_secrets:userkey_activate' %}" type="button" class="btn btn-primary">
|
|
20
|
+
<i class="mdi mdi-auto-fix"></i> Activate User Key
|
|
21
|
+
</a>
|
|
22
|
+
{% endif %}
|
|
21
23
|
</div>
|
|
22
24
|
{% endblock controls %}
|
|
@@ -4,16 +4,17 @@ from django.conf import settings
|
|
|
4
4
|
from django.contrib import messages
|
|
5
5
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
6
6
|
from django.contrib.contenttypes.models import ContentType
|
|
7
|
+
from django.core.exceptions import PermissionDenied
|
|
7
8
|
from django.db import transaction
|
|
8
9
|
from django.shortcuts import get_object_or_404, redirect, render
|
|
9
10
|
from django.utils.html import escape
|
|
10
11
|
from django.utils.safestring import mark_safe
|
|
11
12
|
from django.utils.translation import gettext as _
|
|
12
13
|
from django.views.generic.base import View
|
|
14
|
+
from netbox_secrets.models import UserKey
|
|
13
15
|
|
|
14
|
-
from
|
|
16
|
+
from core.signals import clear_events
|
|
15
17
|
from netbox.views import generic
|
|
16
|
-
from netbox_secrets.models import UserKey
|
|
17
18
|
from tenancy.views import ObjectContactsView
|
|
18
19
|
from utilities.exceptions import AbortRequest, PermissionsViolation
|
|
19
20
|
from utilities.forms import restrict_form_fields
|
|
@@ -385,6 +386,9 @@ class ActivateUserkeyView(LoginRequiredMixin, GetReturnURLMixin, View):
|
|
|
385
386
|
)
|
|
386
387
|
|
|
387
388
|
def post(self, request):
|
|
389
|
+
if not request.user.has_perm('netbox_secrets.change_userkey'):
|
|
390
|
+
raise PermissionDenied("You do not have permission to activate User Keys.")
|
|
391
|
+
|
|
388
392
|
if not self.userkey or not self.userkey.is_active():
|
|
389
393
|
messages.error(request, "You do not have an active User Key.")
|
|
390
394
|
return redirect('plugins:netbox_secrets:userkey_activate')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: netbox-secrets
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Enhance your secret management with encrypted storage and flexible, user-friendly features.
|
|
5
5
|
Home-page: https://github.com/Onemind-Services-LLC/netbox-secrets/
|
|
6
6
|
Author: Abhimanyu Saharan
|
|
@@ -41,6 +41,7 @@ and stability.
|
|
|
41
41
|
| 3.6.x | 1.9.x |
|
|
42
42
|
| 3.7.x | 1.10.x |
|
|
43
43
|
| 4.0.x | 2.0.x |
|
|
44
|
+
| 4.1.x | 2.1.x |
|
|
44
45
|
|
|
45
46
|
# Installation
|
|
46
47
|
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
|
-
import strawberry
|
|
4
|
-
import strawberry_django
|
|
5
|
-
|
|
6
|
-
from ..models import *
|
|
7
|
-
from .types import *
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@strawberry.type
|
|
11
|
-
class NetboxSecretsQuery:
|
|
12
|
-
@strawberry.field
|
|
13
|
-
def secret_roles(self, id: int) -> List[SecretRoleType]:
|
|
14
|
-
return SecretRole.objects.get(pk=id)
|
|
15
|
-
|
|
16
|
-
secret_roles_list: List[SecretRoleType] = strawberry_django.field()
|
|
17
|
-
|
|
18
|
-
@strawberry.field
|
|
19
|
-
def secrets(self, id: int) -> List[SecretType]:
|
|
20
|
-
return Secret.objects.get(pk=id)
|
|
21
|
-
|
|
22
|
-
secrets_list: List[SecretType] = strawberry_django.field()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0002_populate_userkeys.py
RENAMED
|
File without changes
|
{netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/migrations/0003_populate_secretroles.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/static/netbox_secrets/secrets.js
RENAMED
|
File without changes
|
{netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/static/netbox_secrets/secrets.js.map
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/secret.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_secrets-2.0.2 → netbox_secrets-2.1.0}/netbox_secrets/templates/netbox_secrets/userkey.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|