Native OTP support #7331

Closed
opened 2025-12-29 20:22:00 +01:00 by adam · 1 comment
Owner

Originally created by @k1nky on GitHub (Dec 7, 2022).

NetBox version

v3.3.9

Feature type

Change to existing functionality

Proposed functionality

This feature request has already been discussed #118 and #1989. But it seems to me that native support for two-factor authentication is still actual.

I suggest to use django_otp with Time-based One-time Password algorithm. Support for user OTP token verification and OTP device management is provided by this module. I have already tried it here.

The user can enable OTP support in the configuration. After the user must also specify a one-time password during authentication. The form of authentication is determined depending on the value of this option. OTP devices can be managed in the admin site. Since after enabling OTP support, a stuff user may not have an active OTP device, he can add it through the appropriate django command.

With a separate option, it is possible to provide behavior in case the OTP device is not set for the user. For example, allow authenticate without a one-time password only to the site (not to the admin site).

Use case

Netbox is "source of truth" and may content a lot of critical and valuable information about the infrastructure. This information should be protected and kept as secure as possible.

No need to use an external application to make Netbox more secure in general.

Database changes

Models from django_otp are required only when OTP support is enabled. But it requires to run additional migration after enabling.

External dependencies

  • django_otp
  • qrcode (to add 2fa device by qrcode)
Originally created by @k1nky on GitHub (Dec 7, 2022). ### NetBox version v3.3.9 ### Feature type Change to existing functionality ### Proposed functionality This feature request has already been discussed [#118](https://github.com/netbox-community/netbox/issues/118) and [#1989](https://github.com/netbox-community/netbox/issues/1989). But it seems to me that native support for two-factor authentication is still actual. I suggest to use [django_otp](https://github.com/django-otp/django-otp) with Time-based One-time Password algorithm. Support for user OTP token verification and OTP device management is provided by this module. I have already tried it [here](https://github.com/netbox-community/netbox/compare/develop...k1nky:netbox:feat-otp). The user can enable OTP support in the configuration. After the user must also specify a one-time password during authentication. The form of authentication is determined depending on the value of this option. OTP devices can be managed in the admin site. Since after enabling OTP support, a stuff user may not have an active OTP device, he can add it through the appropriate django command. With a separate option, it is possible to provide behavior in case the OTP device is not set for the user. For example, allow authenticate without a one-time password only to the site (not to the admin site). ### Use case Netbox is "source of truth" and may content a lot of critical and valuable information about the infrastructure. This information should be protected and kept as secure as possible. No need to use an external application to make Netbox more secure in general. ### Database changes Models from django_otp are required only when OTP support is enabled. But it requires to run additional migration after enabling. ### External dependencies - django_otp - qrcode (to add 2fa device by qrcode)
adam added the type: feature label 2025-12-29 20:22:00 +01:00
adam closed this issue 2025-12-29 20:22:00 +01:00
Author
Owner

@k1nky commented on GitHub (Dec 22, 2022):

Did it as a plugin netbox-otp-plugin. Seems to be working...

@k1nky commented on GitHub (Dec 22, 2022): Did it as a plugin [netbox-otp-plugin](https://github.com/k1nky/netbox-otp-plugin). Seems to be working...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7331