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

allow users to more easily add NetBox plugins #530

Closed
mmguero opened this issue Aug 1, 2024 · 5 comments
Closed

allow users to more easily add NetBox plugins #530

mmguero opened this issue Aug 1, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request netbox Related to Malcolm's use of NetBox
Milestone

Comments

@mmguero
Copy link
Collaborator

mmguero commented Aug 1, 2024

There are two steps to adding a NetBox plugin to Malcolm's instance of NetBox. I'll use the netbox-initializers as an example:

  1. Use the NetBox Python venv's pip to install the plugin
  2. Specify the plugin in config/plugins.py

At the moment for a normal user to do this they would have to:

  1. Modify or extend the netbox docker container to do step 1 above
  2. Modify plugins.py or use a docker bind mount to override it at runtime

It would be good if we added an easier way to specify a custom netbox plugin, somewhat like we do for other custom rules and scripts.

Probably what we'll do is have a netbox/custom-plugins directory where they'd have a sub-directory with the plugin they want. That sub-directory would need to be pip-installable (basically they'd clone it or download it there from GitHub). And on the netbox container's initialization we'd pip install that directory and tweak plugins.py dynamically.

@mmguero mmguero added enhancement New feature or request netbox Related to Malcolm's use of NetBox labels Aug 1, 2024
@mmguero mmguero modified the milestones: z.staging, v24.08.0 Aug 1, 2024
@mmguero mmguero self-assigned this Aug 14, 2024
@mmguero
Copy link
Collaborator Author

mmguero commented Aug 14, 2024

One thing I'm not 100% sure about is what about the dependencies that pip would also need to install? as we can be guaranteed internet connectivity?

@mmguero
Copy link
Collaborator Author

mmguero commented Aug 14, 2024

todo: don't forget kubernetes stuff for this

@mmguero
Copy link
Collaborator Author

mmguero commented Aug 14, 2024

see cisagov/discussions/329

mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Aug 14, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Aug 14, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Aug 15, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Aug 15, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Aug 15, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Aug 15, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Aug 15, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Aug 15, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Aug 15, 2024
@mmguero
Copy link
Collaborator Author

mmguero commented Aug 15, 2024

I think this is done.

I've tested it with several plugins and it seems to works. If we find issues with specific plugins (and it's something that can be fixed on our end) then we can address those as we go.

Note that some plugins that aren't handling things like BASE_PATH right (see netbox-community/netbox-floorplan-plugin#37 for one example) there's not a ton I can do on our side.

From the new documentation:

NetBox Plugins

NetBox's functionality can be extended with plugins that can provide "new data models, integrations, and more" (see also the NetBox Wiki).

When Malcolm's NetBox container [starts up]({{ site.github.repository_url }}/blob/{{ site.github.build_revision }}/netbox/scripts/netbox_install_plugins.py), it installs (using pip) any NetBox plugins that have cloned or downloaded and extracted into subdirectories in ./netbox/custom-plugins/ in the Malcolm installation directory. In instances where Malcolm is being run in an offline/airgapped configuration, the plugins' additional dependencies must also be present under ./netbox/custom-plugins/requirements/, where they will be automatically installed first.

The following warning is quoted from the NetBox documentation:

Plugins extend NetBox by allowing external code to run with the same access and privileges as NetBox itself. Only install plugins from trusted sources. The NetBox maintainers make absolutely no guarantees about the integrity or security of your installation with plugins enabled.

@mmguero mmguero closed this as completed Aug 15, 2024
@mmguero
Copy link
Collaborator Author

mmguero commented Aug 15, 2024

reopening, need to handle in K8s

@mmguero mmguero reopened this Aug 15, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Aug 16, 2024
@mmguero mmguero closed this as completed Aug 16, 2024
This was referenced Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request netbox Related to Malcolm's use of NetBox
Projects
Status: Released
Development

No branches or pull requests

1 participant