k1nky / netbox-otp-plugin

This netbox plugin adds support for one-time password (OTP) to Netbox.
Apache License 2.0
23 stars 3 forks source link
netbox netbox-plugin otp-verification

Netbox OTP Plugin

Two-factor authentication for NetBox. The plugin provides user OTP token verification and OTP device management is provided and bases on django-otp with Time-based One-time Password algorithm.

alt text

Compatibility

NetBox Version Plugin Version
4.1 1.3.0+
4.0 1.1.0+
3.1+ 1.0.7

Installation

The plugin is available as a Python package in pypi and can be installed with pip

source /opt/netbox/venv/bin/activate
python -m pip install netbox-otp-plugin
# or
# python -m pip install netbox-otp-plugin==<version>

Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:

PLUGINS = ['netbox_otp_plugin']

Run migration:

./manage.py makemigrations netbox_otp_plugin
./manage.py migrate netbox_otp_plugin

To ensure the plugin is automatically re-installed during future upgrades, create a file named local_requirements.txt (if not already existing) in the NetBox root directory (alongside requirements.txt) and append the netbox-otp-plugin package:

echo netbox-otp-plugin >> local_requirements.txt

Configuration

An OTP device can be attached to a user on your NetBox site or using the command:

./manage.py addtotp <username>

Then you will see a QR code that you can add to an TOTP authenticator.

To reset user OTP device use the site or the command:

./manage.py resettotp <username>

The plugin has additional options:

Example

PLUGINS_CONFIG = {
    'netbox_otp_plugin': {
        'otp_required': False,
        'issuer': 'MyOrgNetbox'
    }
}

Screenshots

alt text

alt text

alt text