diff --git a/security/py-netbox-secretstore/Makefile b/security/py-netbox-secretstore/Makefile index 6aeed0a86090..aad6bdf31053 100644 --- a/security/py-netbox-secretstore/Makefile +++ b/security/py-netbox-secretstore/Makefile @@ -1,26 +1,29 @@ PORTNAME= netbox-secretstore DISTVERSION= 1.4.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= security python MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= kai@FreeBSD.org COMMENT= Secret store for NetBox WWW= https://github.com/dansheps/netbox-secretstore LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE.txt +DEPRECATED= No longer maintained by upstream, not compatible with NetBox 3.5, please migrate to security/py-netbox-secrets +EXPIRATION_DATE= 2023-08-15 + RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}importlib-metadata>0:devel/py-importlib-metadata@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pycryptodome>0:security/py-pycryptodome@${PY_FLAVOR} USES= python:3.8+ USE_PYTHON= autoplist distutils NO_ARCH= yes SUB_FILES= pkg-message SUB_LIST= PYTHON_VER=${PYTHON_VER} .include diff --git a/security/py-netbox-secretstore/files/patch-netbox__secretstore_migrations_0006__alter__secret__custom__field__data__and__more.py b/security/py-netbox-secretstore/files/patch-netbox__secretstore_migrations_0006__alter__secret__custom__field__data__and__more.py index ba6e41dd0b31..4da31820f74e 100644 --- a/security/py-netbox-secretstore/files/patch-netbox__secretstore_migrations_0006__alter__secret__custom__field__data__and__more.py +++ b/security/py-netbox-secretstore/files/patch-netbox__secretstore_migrations_0006__alter__secret__custom__field__data__and__more.py @@ -1,35 +1,60 @@ From: Daniel Sheppard Date: Tue, 24 Jan 2023 13:51:57 -0600 Subject: [PATCH] Update for missing migrations Obtained from: https://github.com/DanSheps/netbox-secretstore/commit/9c3f69e5af6f5e8d6af11f5c8ea41433ef51145c ---- netbox_secretstore/migrations/0006_alter_secret_custom_field_data_and_more.py.orig 2023-03-16 06:29:56 UTC +From: Abhimanyu Saharan +Date: Wed, 12 Apr 2023 21:01:43 +0530 +Subject: [PATCH] fix migrations + +Obtained from: + +https://github.com/Onemind-Services-LLC/netbox-secretstore/commit/248330409413f1858daf13902fd1b409053fd846.patch + +--- netbox_secretstore/migrations/0006_alter_secret_custom_field_data_and_more.py.orig 2023-05-08 17:51:21 UTC +++ netbox_secretstore/migrations/0006_alter_secret_custom_field_data_and_more.py -@@ -0,0 +1,24 @@ -+# Generated by Django 4.1.4 on 2023-01-24 19:50 +@@ -0,0 +1,41 @@ ++# Generated by Django 4.1.7 on 2023-04-12 15:31 + ++from django.conf import settings +from django.db import migrations, models ++import django.db.models.deletion +import utilities.json + + +class Migration(migrations.Migration): + + dependencies = [ -+ ('netbox_secretstore', '0005_alter_secret_created_alter_secret_id_and_more'), ++ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ++ ("netbox_secretstore", "0005_alter_secret_created_alter_secret_id_and_more"), + ] + + operations = [ + migrations.AlterField( -+ model_name='secret', -+ name='custom_field_data', -+ field=models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), ++ model_name="secret", ++ name="custom_field_data", ++ field=models.JSONField( ++ blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder ++ ), ++ ), ++ migrations.AlterField( ++ model_name="secretrole", ++ name="custom_field_data", ++ field=models.JSONField( ++ blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder ++ ), + ), + migrations.AlterField( -+ model_name='secretrole', -+ name='custom_field_data', -+ field=models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), ++ model_name="userkey", ++ name="user", ++ field=models.OneToOneField( ++ editable=False, ++ on_delete=django.db.models.deletion.CASCADE, ++ related_name="user_key_secretstore", ++ to=settings.AUTH_USER_MODEL, ++ ), + ), + ] diff --git a/security/py-netbox-secretstore/files/patch-netbox__secretstore_models_secrets.py b/security/py-netbox-secretstore/files/patch-netbox__secretstore_models_secrets.py new file mode 100644 index 000000000000..af682f8b802a --- /dev/null +++ b/security/py-netbox-secretstore/files/patch-netbox__secretstore_models_secrets.py @@ -0,0 +1,51 @@ +From: Abhimanyu Saharan +Date: Wed, 12 Apr 2023 21:01:43 +0530 +Subject: [PATCH] fix migrations + +Obtained from: + +https://github.com/Onemind-Services-LLC/netbox-secretstore/commit/248330409413f1858daf13902fd1b409053fd846.patch + +--- netbox_secretstore/models/secrets.py.orig 2022-12-31 01:50:00 UTC ++++ netbox_secretstore/models/secrets.py +@@ -21,6 +21,7 @@ from netbox_secretstore.utils import encrypt_master_ke + from netbox_secretstore.hashers import SecretValidationHasher + from netbox_secretstore.querysets import UserKeyQuerySet + from netbox_secretstore.utils import encrypt_master_key, decrypt_master_key, generate_random_key ++from taggit.managers import TaggableManager + + + __all__ = ( +@@ -47,7 +48,7 @@ class UserKey(models.Model): + user = models.OneToOneField( + to=User, + on_delete=models.CASCADE, +- related_name='user_key', ++ related_name='user_key_secretstore', + editable=False + ) + public_key = models.TextField( +@@ -256,6 +257,11 @@ class SecretRole(OrganizationalModel): + blank=True, + ) + ++ tags = TaggableManager( ++ through='extras.TaggedItem', ++ related_name='netbox_secretstore_secretroles' ++ ) ++ + objects = RestrictedQuerySet.as_manager() + + csv_headers = ['name', 'slug', 'description'] +@@ -312,6 +318,11 @@ class Secret(NetBoxModel): + hash = models.CharField( + max_length=128, + editable=False ++ ) ++ ++ tags = TaggableManager( ++ through='extras.TaggedItem', ++ related_name='netbox_secretstore_secret' + ) + + objects = RestrictedQuerySet.as_manager() diff --git a/security/py-netbox-secretstore/files/patch-netbox__secretstore_views.py b/security/py-netbox-secretstore/files/patch-netbox__secretstore_views.py new file mode 100644 index 000000000000..b9f12b55e322 --- /dev/null +++ b/security/py-netbox-secretstore/files/patch-netbox__secretstore_views.py @@ -0,0 +1,33 @@ +From: Daniel Sheppard +Date: Tue, 11 Apr 2023 08:34:04 -0500 +Subject: [PATCH] #12087 - Fix Bulk Edit update when M2M operations are present. + +Obtained from: + +https://github.com/DanSheps/netbox-secretstore/commit/7ad1ba639aa077c45bcac05dc025132c6bd9139e.patch + +--- netbox_secretstore/views.py.orig 2022-12-31 01:50:00 UTC ++++ netbox_secretstore/views.py +@@ -156,15 +156,15 @@ class SecretEditView(ObjectEditView): + secret.plaintext = str(form.cleaned_data['plaintext']) + secret.encrypt(master_key) + +- secret.save() +- form.save_m2m() ++ secret.save() ++ form.save_m2m() + +- msg = '{} secret'.format('Created' if not form.instance.pk else 'Modified') +- logger.info(f"{msg} {secret} (PK: {secret.pk})") +- msg = f'{msg} {escape(secret)}' +- messages.success(request, mark_safe(msg)) ++ msg = '{} secret'.format('Created' if not form.instance.pk else 'Modified') ++ logger.info(f"{msg} {secret} (PK: {secret.pk})") ++ msg = f'{msg} {escape(secret)}' ++ messages.success(request, mark_safe(msg)) + +- return redirect(self.get_return_url(request, secret)) ++ return redirect(self.get_return_url(request, secret)) + + else: + logger.debug("Form validation failed") diff --git a/security/py-netbox-secretstore/files/pkg-message.in b/security/py-netbox-secretstore/files/pkg-message.in index 4957b1933eb1..5e2a87dc3ef3 100644 --- a/security/py-netbox-secretstore/files/pkg-message.in +++ b/security/py-netbox-secretstore/files/pkg-message.in @@ -1,57 +1,110 @@ [ { type: install message: < output.sql + + 6. Run the output of the previous command in the database, e.g.: + + # psql -d NETBOXDB < output.sql + + 7. You can now remove netbox-secretstore from the application by removing it + from the PLUGINS line in the netbox configuration: + + PLUGINS = ['netbox_secrets'] + + 8. Collect static files of the netbox-secrets plugin: + + # python%%PYTHON_VER%% manage.py collectstatic --no-input + + 9. Restart WSGI/httpd environment (supervisord/apache/nginx/etc.). + +10. You may have clean up your database of the old tables manually, e.g.: + + DROP TABLE netbox_secretstore_secret; + DROP TABLE netbox_secretstore_secretrole; + DROP TABLE netbox_secretstore_sessionkey; + DROP TABLE netbox_secretstore_userkey; + +11. Uninstall security/py-netbox-secretstore. +EOD +} ]