Skip to content

DINA-community/DDDC-Netbox-plugin

Repository files navigation

NetBox Plugin DDDC

Even if there are tools in Malcolm and NetBox itself getting data into NetBox, this data should be standardized. This is done by this plugin, which contains the source code for the BSI Project 507 TP2. The DDDC plugin can receive input data from various sources, supports the processing and approval of this data in order to build a standardized device database within NetBox.\ The main features are further developed in the repository String-Atlas. This processes the data before it is placed in the NetBox framework. This ensures that the data is adapted to support IT security management tasks such as device management, vulnerability management and patch management.

In addition to the plugin code, this repository contains additional files for the community-driven Docker image integrating the DDDC Plugin in development mode. This is primarily used for test purposes for the CI/CD pipeline and can be used for testing the plugin within an exemplary NetBox environment.

Installation of the DDDC Plugin

As the DDDC plugin is a standard NetBox plugin, it can be installed according to the NetBox documentation. This plugin is compatible with NetBox version 4.2.7 and ensured by the docker file.

Additionally, this repository contains files from the community-driven Docker image to set up NetBox, along with all its dependencies, such as a PostgreSQL database. Please note: This is not an installation for a production environment, as it uses default passwords and API keys as specified in the project's files. Furthermore, this installation sets up NetBox in 'developer mode', which means that the user will receive detailed information in case of an exception. This is very useful for alpha and beta testing, which is why this installation option is described below:

Adding the plugin to an existing netbox-docker installation

Set the proper netbox docker version

DDDC is only compatible with NetBox 4.2 and therefore with netbox-docker 3.2.1. For a new install, clone from tag 3.2.1:

git clone -b 3.2.1 https://github.com/netbox-community/netbox-docker.git

For existing installations, switch to tag 3.2.1 before continuing:

git checkout 3.2.1

Add plugin

The Plugin can be added to any existing or new setup of netbox-docker by following their plugin instructions.

  1. Create the file plugin_requirements.txt with the following content:

    git+https://github.com/DINA-community/DDDC-Netbox-plugin.git
  2. Create the file Dockerfile-Plugins with the content from the netbox-docker documentation. Add this snippet before the line RUN /usr/local/bin/uv pip:

    RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt install -y git

    Also, replace

    FROM netboxcommunity/netbox:latest

    with

    FROM netboxcommunity/netbox:v4.2-3.2.1

    Matching the version of netbox-docker.

  3. Create the file docker-compose.override.yml with the content from the netbox-docker documentation.

    You can also create a superuser by adding these lines with meaningful values. Alternatively, create the superuser in step 6.

          environment:
             SKIP_SUPERUSER: "false"
             #SUPERUSER_API_TOKEN: ""
             SUPERUSER_EMAIL: ""
             SUPERUSER_NAME: ""
             SUPERUSER_PASSWORD: ""

    Also, change the image versions

       image: netbox:v4.2-3.2.1

    for all services

  4. Add this to configuration/plugins.py:

    PLUGINS = ["d3c"]

    You can also add a section PLUGINS_CONFIG for d3c here.

  5. Build and run it (see Troubleshoot):

    docker compose build --no-cache
    docker compose up -d
  6. Access your local netbox by http://127.0.0.1:8000. To create an admin user, run this command:

    docker compose exec netbox /opt/netbox/netbox/manage.py createsuperuser

Installation via Docker for developing and testing purposes

Prerequisites

This Dockerfile simply extends the netbox-docker project with the custom DDDC-plugin. Therefore, the dependencies of the netbox-docker project also apply for this installation:

Recommendation: Install docker with the Compose v2 already integrated into the Docker CLI platform.

To check the version installed on your system run docker --version and docker compose version.

After the installation, NetBox is available at http://127.0.0.1:8000. Therefore, for simplicity, a web browser should be available on the installed system.

Installation for developing and testing purposes

  1. Execute the following commands for ubuntu:

    # Add official GPG key from docker
    apt update
    apt install apt-transport-https ca-certificates curl
    echo "deb [signed-by=/etc/apt/trusted.gpg.d/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
    curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/docker.gpg > /dev/null
    apt-cache policy docker-ce
    apt-get install docker-ce
    git clone https://github.com/DINA-community/DDDC-Netbox-plugin.git
    cd DDDC-Netbox-plugin/
    docker compose build --no-cache
    docker compose up
  2. Wait until Initialization is done. is printed. Afterwards the GUI can be accessed via http://127.0.0.1:8000.

  3. Login as

    • BN: admin
    • PW: admin

After testing, the containers can be stopped by pressing Ctrl+C and restarted using docker-compose up.

Debug mode

To enable the netbox debug mode, to get long and detailed tracebacks, add this to docker-compose.override.yml in the section netbox:

    environment:
      - DEBUG=True

Notes regarding the installation of this plugin via the provided files

The installation will provide a warning message since the installation is using the default security token:

⚠️ Warning: You have the old default admin token in your database. This token is widely known; please remove it.

In theory, you can add an alternative security token in the file netbox.env by adding the following line:

SUPERUSER_API_TOKEN=<Token>

However, an important aspect of an installation in a production environment is the creation of users, tokens, and their permissions. This must be done for each NetBox installation separately and in accordance with the specific requirements in place.

Testing

The unit tests of NetBox can be executed via ./docker-ci/test.sh.

Help

This section contains links for familiarizing yourself with Django, NetBox, and plugins.

General

Development

About

NetBox plugin for importing (analyzed) network data and asset lists

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7

Languages