Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possiblity for multiple Napalm device credentials to be added #11881

Closed
tobicodesstuff opened this issue Mar 2, 2023 · 4 comments
Closed
Labels
type: feature Introduction of new functionality to the application

Comments

@tobicodesstuff
Copy link

NetBox version

v3.4.5

Feature type

Change to existing functionality

Proposed functionality

  • Make it possible to add NAPALM_USERNAME and NAPALM_PASSWORD per device.
  • Relevant code is at /netbox/dcim/api/views.py (lines 488-491) and /netbox/netbox/config/parameters.py (lines 153-183)
  • The device in question is available within /netbox/dcim/api.views.py at line 438, my idea was to possibly add a custom field following a certain pattern probably (NAPALM_DEVICE_{PK}_USERNAME?) and to check if such a field is present. If yes, override the credentials present, if not proceed as usual.

Nice to have:

  • A further implementation could be to have a device tab to edit such variables
  • A table somewhere containing the login credentials for all devices in a central place

Use case

  • Would like to use Napalm to inspect multiple devices, but having a single credential set for possibly tens of devices seems like a security risk

Database changes

None (custom field solution) or new configuration table (further more central implementation)

External dependencies

None

@tobicodesstuff tobicodesstuff added the type: feature Introduction of new functionality to the application label Mar 2, 2023
@candlerb
Copy link
Contributor

candlerb commented Mar 2, 2023

Another option would be to defined name sets of credentials, which could just be arguments to the napalm driver:

NAPALM_ARGUMENTS = {
    "default": {
        "username": "foo",
        "password": "bar",
    },
    "firewall": {
        "username": "baz",
        "password": "qux",
        "optional_args": {"port": 12443},
    },
}

Then the per-device setting would just be the credential type (e.g. "default" or "firewall") and the actual values are not exposed to the UI or the database at all.

Another option would be to get the settings through the config contexts mechanism.

@jeremystretch
Copy link
Member

We're not accepting new feature requests for the NAPALM integration as it's being removed in NetBox v3.5 (see #10520). However, you're welcome to submit feature requests against the new netbox-napalm plugin once it's released.

@jeremystretch jeremystretch closed this as not planned Won't fix, can't repro, duplicate, stale Mar 2, 2023
@tobicodesstuff
Copy link
Author

Thank you for the reply, I have seen the plugin and have played around with it, but didn't see #10520.

@tobicodesstuff
Copy link
Author

Another option would be to defined name sets of credentials, which could just be arguments to the napalm driver:

NAPALM_ARGUMENTS = {
    "default": {
        "username": "foo",
        "password": "bar",
    },
    "firewall": {
        "username": "baz",
        "password": "qux",
        "optional_args": {"port": 12443},
    },
}

Then the per-device setting would just be the credential type (e.g. "default" or "firewall") and the actual values are not exposed to the UI or the database at all.

Another option would be to get the settings through the config contexts mechanism.

@candlerb I've mentioned your suggestion in the new issue as it seemed helpful.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

3 participants