Giter Club home page Giter Club logo

netbox-otp-plugin's Introduction

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

This plugin in compatible with 3.1 and later.

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

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

PLUGINS = ['netbox_otp_plugin']

Run migration:

./manage.py migrate

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 in the admin site or 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 admin site or the command:

./manage.py resettotp <username>

The plugin has additional options:

  • otp_required - if set to True then two-factor authentication will be always required even if a user doesn't have an OTP device yet. False value required to authenticate users only with an OTP device attached only. Default: True.
  • issuer - the issuer parameter for the otpauth URL (see more https://github.com/google/google-authenticator/wiki/Key-Uri-Format). Default: 'Netbox'.

Example

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

netbox-otp-plugin's People

Contributors

k1nky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

netbox-otp-plugin's Issues

Bug: OTP input field removes remote authentication backends

Bug description
When having the plugin enabled, and using a remote authentication backend (SAML in my case), the buttons to log in with a remote backend disappear, in favor of the OTP code input field.

To Reproduce

  1. Set up a remote authentication backend (OpenID, SAML, Social SSO)
  2. Enable the plugin
  3. Go to the login page

Expected behavior
I should see the login form, with OTP input field, and the remote backends I have enabled

Screenshots
Login page without OTP plugin, but with remote backend:
image
Login page with OTP plugin and remote backend:
image
Expected result (mockup):
mockup

Version info
Netbox v3.4.2
netbox-otp-plugin latest

The page isn’t redirecting properly

If "Login Required" is set to true in the configuration file, I receive the error "The page isn’t redirecting properly" from the browser, when trying to access netbox.

Netbox Ver. 3.5.3
Plugin Ver. 1.0.5

BUG: Too Many Redirects

Hi, after installing plugin and logout from Netbox, browser can't connect to Netbox because looping redirect from /login/?next=/plugins/otp to /plugins/otp and again, calling browser error TOO_MANY_REDIRECTS.

Changing browser, re-installing did not help.
Netbox version: 3.5.1
netbox-otp-plugin version: 1.0.5

Sorry for bad english, i'm not good at it

Typo in readme

Hello,

Thank you for your plugin.
There is a typo in your readme :

# BAD
echo nextbox_otp_plugin >> local_requirements.txt
# GOOD
echo netbox-otp-plugin >> local_requirements.txt

Feature request: Add possibility to configure name for TOTP

The plugin works like it should. However, adding the QR-code to Google Authenticator, it's added with the username as description. It would be great to configure this, since in my case I have the same username in three different environments, dev, test and prod, and would like to be able to name them differently automatically (for example: Netbox DEV)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.