From cc907c21df335b612e3e5d6928a39f45407aa925 Mon Sep 17 00:00:00 2001 From: SG Date: Mon, 19 Sep 2022 15:40:30 -0600 Subject: [PATCH] Fix envs for netbox --- README.md | 4 ++++ docker-compose-standalone.yml | 8 ++++---- docker-compose.yml | 8 ++++---- scripts/control.py | 15 ++++++++++++++- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b1bf64d3c..e05a135a4 100644 --- a/README.md +++ b/README.md @@ -256,6 +256,9 @@ Malcolm leverages the following excellent open source tools, among others. * [jQuery File Upload](https://github.com/blueimp/jQuery-File-Upload) - for uploading PCAP files and Zeek logs for processing * [List.js](https://github.com/javve/list.js) - for the [host and subnet name mapping](#HostAndSubnetNaming) interface * [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) - for simple, reproducible deployment of the Malcolm appliance across environments and to coordinate communication between its various components +* [NetBox](https://netbox.dev/) - a suite for modeling and documenting modern networks +* [PostgreSQL](https://www.postgresql.org/) - a relational database for persisting NetBox's data +* [Redis](https://redis.io/) - an in-memory data store for caching NetBox session information * [Nginx](https://nginx.org/) - for HTTPS and reverse proxying Malcolm components * [nginx-auth-ldap](https://github.com/kvspb/nginx-auth-ldap) - an LDAP authentication module for nginx * [Fluent Bit](https://fluentbit.io/) - for forwarding metrics to Malcolm from [network sensors](#Hedgehog) (packet capture appliances) @@ -378,6 +381,7 @@ Checking out the [Malcolm source code](https://github.com/idaholab/Malcolm/tree/ * `logstash` - code and configuration for the `logstash` container which parses Zeek logs and forwards them to the `opensearch` container * `malcolm-iso` - code and configuration for building an [installer ISO](#ISO) for a minimal Debian-based Linux installation for running Malcolm * `name-map-ui` - code and configuration for the `name-map-ui` container which provides the [host and subnet name mapping](#HostAndSubnetNaming) interface +* `netbox` - code and configuration for the `netbox`, `netbox-postgres`, `netbox-redis` and `netbox-redis-cache` containers which provide asset management capabilities * `nginx` - configuration for the `nginx` reverse proxy container * `pcap` - an initially empty directory for PCAP files to be uploaded, processed, and stored * `pcap-capture` - code and configuration for the `pcap-capture` container which can capture network traffic diff --git a/docker-compose-standalone.yml b/docker-compose-standalone.yml index 26760863f..cd172f3d7 100644 --- a/docker-compose-standalone.yml +++ b/docker-compose-standalone.yml @@ -890,10 +890,10 @@ services: hostname: netbox networks: - default + env_file: ./netbox/env/netbox.env environment: << : *process-variables VIRTUAL_HOST : 'netbox.malcolm.local' - env_file: ./netbox/env/netbox.env depends_on: - netbox-postgres - netbox-redis @@ -918,10 +918,10 @@ services: hostname: netbox-postgres networks: - default + env_file: ./netbox/env/postgres.env environment: << : *process-variables VIRTUAL_HOST : 'netbox-postgres.malcolm.local' - env_file: ./netbox/env/postgres.env volumes: - ./netbox/postgres:/var/lib/postgresql/data:rw healthcheck: @@ -938,10 +938,10 @@ services: hostname: netbox-redis networks: - default + env_file: ./netbox/env/redis.env environment: << : *process-variables VIRTUAL_HOST : 'netbox-redis.malcolm.local' - env_file: ./netbox/env/redis.env command: - sh - -c @@ -962,10 +962,10 @@ services: hostname: netbox-redis-cache networks: - default + env_file: ./netbox/env/redis-cache.env environment: << : *process-variables VIRTUAL_HOST : 'netbox-redis-cache.malcolm.local' - env_file: ./netbox/env/redis-cache.env command: - sh - -c diff --git a/docker-compose.yml b/docker-compose.yml index 28ca975fa..6c15f2e08 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -950,10 +950,10 @@ services: hostname: netbox networks: - default + env_file: ./netbox/env/netbox.env environment: << : *process-variables VIRTUAL_HOST : 'netbox.malcolm.local' - env_file: ./netbox/env/netbox.env depends_on: - netbox-postgres - netbox-redis @@ -978,10 +978,10 @@ services: hostname: netbox-postgres networks: - default + env_file: ./netbox/env/postgres.env environment: << : *process-variables VIRTUAL_HOST : 'netbox-postgres.malcolm.local' - env_file: ./netbox/env/postgres.env volumes: - ./netbox/postgres:/var/lib/postgresql/data:rw healthcheck: @@ -998,10 +998,10 @@ services: hostname: netbox-redis networks: - default + env_file: ./netbox/env/redis.env environment: << : *process-variables VIRTUAL_HOST : 'netbox-redis.malcolm.local' - env_file: ./netbox/env/redis.env command: - sh - -c @@ -1022,10 +1022,10 @@ services: hostname: netbox-redis-cache networks: - default + env_file: ./netbox/env/redis-cache.env environment: << : *process-variables VIRTUAL_HOST : 'netbox-redis-cache.malcolm.local' - env_file: ./netbox/env/redis-cache.env command: - sh - -c diff --git a/scripts/control.py b/scripts/control.py index ddc151971..67a999d64 100755 --- a/scripts/control.py +++ b/scripts/control.py @@ -472,7 +472,17 @@ def stop(wipe=False): ) # delete data files (backups, zeek logs, arkime logs, PCAP files, captured PCAP files) - for dataDir in ['opensearch-backup', 'zeek-logs', 'suricata-logs', 'arkime-logs', 'pcap', 'arkime-raw']: + for dataDir in [ + 'opensearch-backup', + 'zeek-logs', + 'suricata-logs', + 'arkime-logs', + 'pcap', + 'arkime-raw', + os.path.join('netbox', 'media'), + os.path.join('netbox', 'postgres'), + os.path.join('netbox', 'redis'), + ]: for root, dirnames, filenames in os.walk(os.path.join(MalcolmPath, dataDir), topdown=True, onerror=None): for file in filenames: fileSpec = os.path.join(root, file) @@ -489,6 +499,9 @@ def stop(wipe=False): os.path.join('zeek-logs', 'current'), os.path.join('zeek-logs', 'live'), os.path.join('suricata-logs'), + os.path.join('netbox', 'media'), + os.path.join('netbox', 'postgres'), + os.path.join('netbox', 'redis'), ]: RemoveEmptyFolders(dataDir, removeRoot=False)