feat: add certificate management with expiration reminders
Add a Certificate model alongside software licenses with type, common name, SANs, issuer, serial number, fingerprint, validity period, auto renewal, certificate file and storage locations. Certificates can be assigned to software products, installations, devices, virtual machines and tenants. Extract the expiration reminder settings and logic into a shared ExpirationNotificationModel base and a generic notification job, so certificates get the same default/custom reminders, NetBox notifications and optional SMTP emails as licenses (separate event type, log model and email permission). Includes UI views, filters, table, bulk import/edit, REST API endpoint, migration 0015, German translations, tests and README/CHANGELOG updates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
32d62f26b2
commit
02d965a77b
22 files changed
+1547
-102
No files matched your search
+69
-1
@@ -3,7 +3,13 @@ from django.db.models import Count, F, Value
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from netbox.tables import NetBoxTable, ToggleColumn, columns
|
||||
from netbox_slm.models import SoftwareProduct, SoftwareProductVersion, SoftwareProductInstallation, SoftwareLicense
|
||||
from netbox_slm.models import (
|
||||
Certificate,
|
||||
SoftwareProduct,
|
||||
SoftwareProductVersion,
|
||||
SoftwareProductInstallation,
|
||||
SoftwareLicense,
|
||||
)
|
||||
|
||||
|
||||
class SoftwareProductTable(NetBoxTable):
|
||||
@@ -195,3 +201,65 @@ class SoftwareLicenseTable(NetBoxTable):
|
||||
|
||||
def render_installation(self, **kwargs):
|
||||
return f"{kwargs['record'].installation.platform}"
|
||||
|
||||
|
||||
class CertificateTable(NetBoxTable):
|
||||
"""Table for displaying Certificate objects."""
|
||||
|
||||
pk = ToggleColumn()
|
||||
name = tables.LinkColumn()
|
||||
|
||||
type = tables.Column()
|
||||
stored_location = tables.Column(accessor="stored_location_txt", linkify=lambda record: record.stored_location_url)
|
||||
software_product = tables.Column(accessor="software_product", verbose_name=_("Software Product"), linkify=True)
|
||||
installation = tables.Column(accessor="installation", linkify=True)
|
||||
device = tables.Column(accessor="device", linkify=True)
|
||||
virtualmachine = tables.Column(accessor="virtualmachine", verbose_name=_("Virtual Machine"), linkify=True)
|
||||
tenant_group = tables.Column(accessor="tenant_group", verbose_name=_("Tenant Group"), linkify=True)
|
||||
tenant = tables.Column(accessor="tenant", linkify=True)
|
||||
provider_portal_url = tables.Column(verbose_name=_("Provider Portal"), linkify=True)
|
||||
|
||||
tags = columns.TagColumn(url_name="plugins:netbox_slm:certificate_list")
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = Certificate
|
||||
fields = (
|
||||
"pk",
|
||||
"name",
|
||||
"description",
|
||||
"type",
|
||||
"common_name",
|
||||
"issuer",
|
||||
"serial_number",
|
||||
"fingerprint",
|
||||
"start_date",
|
||||
"expiration_date",
|
||||
"auto_renewal",
|
||||
"stored_location",
|
||||
"software_product",
|
||||
"installation",
|
||||
"device",
|
||||
"virtualmachine",
|
||||
"tenant_group",
|
||||
"tenant",
|
||||
"provider_portal_url",
|
||||
"expiration_notifications_enabled",
|
||||
"email_notifications",
|
||||
"tags",
|
||||
)
|
||||
default_columns = (
|
||||
"pk",
|
||||
"name",
|
||||
"type",
|
||||
"common_name",
|
||||
"issuer",
|
||||
"device",
|
||||
"virtualmachine",
|
||||
"tenant",
|
||||
"expiration_date",
|
||||
"expiration_notifications_enabled",
|
||||
"tags",
|
||||
)
|
||||
|
||||
def render_installation(self, **kwargs):
|
||||
return f"{kwargs['record'].installation.platform}"
|
||||
Reference in new issue
Block a user