# NetBox SLM Software lifecycle and license management for NetBox: software products, versions, installations, licenses and certificates — with expiry notifications and optional tenant assignment. | | | |---|---| | **Plugin name** | `netbox_slm` | | **Package** | `netbox-slm` | | **NetBox** | `4.6.5` – `4.7.x` | | **Python** | `>=3.11` | | **Repository** | | ## Features - Manage software products and manufacturers - Track versions, release types and support periods - Assign installations to devices, virtual machines or clusters - Manage software licenses including term, scope and storage location - Lifetime licenses or renewal intervals in days, months or years - Store license files, license keys and links to the vendor portal - Expiry warnings one month and one week before license end by default - Additional custom warning period in days, weeks or months - NetBox notifications and optional e-mail via NetBox's SMTP configuration - Assign licenses to tenant groups and tenants - Manage certificates with common name, SANs, issuer, serial number, fingerprint and validity period - Assign certificates to software products, installations, devices, virtual machines and tenants - Store certificate files and storage locations (private keys are intentionally not stored) - Full NetBox UI and REST API - Filters, bulk import and bulk edit - UI available in English and German (follows the user's NetBox language) > **Note:** License keys are stored in the NetBox database and license files in > NetBox's media directory. Protect and back up the database, REST API and media > directory accordingly. ## Compatibility - NetBox `4.6.5` – `4.7.x` (verified with 4.7.2) - Python `>=3.11` ## Installation All paths assume a standard installation under `/opt/netbox`. ### 1. Install the package ```bash /opt/netbox/venv/bin/pip install --upgrade --force-reinstall \ "git+https://git.mrblake.cc/MrBlake/NetBox-SLM.git@master" ``` For reproducible production installs, replace `master` with a release tag or a full commit ID. ### 2. Add the plugin to `local_requirements.txt` This makes `upgrade.sh` reinstall the plugin automatically on every NetBox upgrade: ```bash grep -qxF "git+https://git.mrblake.cc/MrBlake/NetBox-SLM.git@master" /opt/netbox/local_requirements.txt \ || echo "git+https://git.mrblake.cc/MrBlake/NetBox-SLM.git@master" | sudo tee -a /opt/netbox/local_requirements.txt ``` If the repository is private, the NetBox server needs a read-only deploy token or an SSH key. Do not store credentials in `local_requirements.txt`. ### 3. Enable the plugin In `/opt/netbox/netbox/netbox/configuration.py`: ```python PLUGINS = [ "netbox_slm", ] ``` If other plugins are already configured, add `netbox_slm` to the existing list. No `PLUGINS_CONFIG` is required for standard operation. ### 4. Apply migrations, collect static files, restart ```bash cd /opt/netbox/netbox /opt/netbox/venv/bin/python manage.py migrate netbox_slm /opt/netbox/venv/bin/python manage.py collectstatic --no-input sudo systemctl restart netbox netbox-rq ``` Check the installed version: ```bash /opt/netbox/venv/bin/pip show netbox-slm ``` ## Update ```bash /opt/netbox/venv/bin/pip install --upgrade --force-reinstall \ "git+https://git.mrblake.cc/MrBlake/NetBox-SLM.git@master" cd /opt/netbox/netbox /opt/netbox/venv/bin/python manage.py migrate netbox_slm /opt/netbox/venv/bin/python manage.py collectstatic --no-input sudo systemctl restart netbox netbox-rq ``` `--force-reinstall` makes pip pick up branch changes even if the package version has not been bumped. When NetBox itself is upgraded, `upgrade.sh` reinstalls the plugin from `local_requirements.txt` and runs migrations and `collectstatic`: ```bash sudo /opt/netbox/upgrade.sh sudo systemctl restart netbox netbox-rq ``` ## Uninstall 1. Remove `"netbox_slm"` from `PLUGINS`. 2. Remove the line from `/opt/netbox/local_requirements.txt`. 3. Uninstall the package and restart NetBox: ```bash /opt/netbox/venv/bin/pip uninstall netbox-slm sudo systemctl restart netbox netbox-rq ``` The plugin's database tables are not dropped automatically. ## Usage ### Expiry notifications Notifications are enabled by default for licenses and certificates with an expiry date. Both use the same settings, so this section applies to certificates as well. The default reminders are one month and one week before expiry. Per license, an additional custom warning period can be set or the defaults can be disabled. Recipients decide themselves whether they are notified: sales, the responsible technician or other users open the license and click the NetBox **Subscribe** action (**Unsubscribe** stops it). Without subscribers no message is sent. A NetBox notification is always created. If **E-mail notifications** is enabled on the license, the plugin also sends an e-mail to the address stored in the user account; NetBox SMTP must be configured for this. Enabling e-mail delivery can only be changed by administrators or users with the permission `netbox_slm.manage_softwarelicense_email_notifications` (licenses) or `netbox_slm.manage_certificate_email_notifications` (certificates). SMTP credentials are maintained only in the NetBox server configuration and are not visible in the plugin. The check runs once a day as a NetBox system job (one job each for licenses and certificates). Once the first configured reminder date is reached, subscribers are notified on every job run up to and including the expiry date. The NetBox RQ worker must run with scheduler support, which is the default for a standard NetBox installation with `rqworker`. ### Certificates Certificates are managed under **Licences → Certificates**. Each certificate stores: - Name, description and type (TLS server, TLS client, certificate authority, code signing, S/MIME email, other) - Common name, subject alternative names (one DNS name or IP address per line), issuer, serial number and SHA-256 fingerprint - Validity period (valid from / valid until) and an automatic renewal flag - Certificate file, storage location (with optional URL) and provider portal URL - Optional assignment to a software product, installation, device, virtual machine, tenant group and tenant When a certificate file (PEM or DER) is uploaded, the common name, subject alternative names, issuer, serial number, SHA-256 fingerprint and validity period are read from the file and overwrite the corresponding fields. Name and type are only filled in if they were left empty (the type is derived from the CA flag and extended key usage). For PEM bundles the first certificate is used. Files that contain a private key are rejected. > **Note:** Private keys are intentionally not stored. Keep them in a dedicated > secret store and reference that location through the storage location fields. Certificates are available in the REST API at `/api/plugins/slm/certificates/` and can be filtered by e.g. `type`, `common_name`, `issuer`, `device_id`, `virtualmachine_id`, `tenant_id`, `expiration_date__lte` and `expiration_date__gte`. ## Origin and license This repository is based on the original project [ICTU/netbox_slm](https://github.com/ICTU/netbox_slm). **ICTU** is the original author and publisher; [Mart Visser](https://github.com/MartVisser) is named as the contact in the original project. The changes in this fork are maintained at [git.mrblake.cc/MrBlake/NetBox-SLM](https://git.mrblake.cc/MrBlake/NetBox-SLM). Licensed under the [Apache License 2.0](LICENSE). Notices of the original authors are retained.