Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/navv-build-push-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4.3.0
uses: actions/setup-python@v4.5.0
with:
python-version: "3.10"
- name: Install pypa/build
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

© 2021 Battelle Energy Alliance, LLC
© 2023 Battelle Energy Alliance, LLC
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Github cisagov/network-architecture-verification-and-validation
Licensed under BSD-3 License.


© 2021 Battelle Energy Alliance, LLC
© 2023 Battelle Energy Alliance, LLC
ALL RIGHTS RESERVED

Prepared by Battelle Energy Alliance, LLC
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ See [`docker/README.md`](./docker/README.md) for setup and instructions for runn

## <a name="Footer"></a>Copyright

[NAVV](https://github.com/cisagov/network-architecture-verification-and-validation) is Copyright 2021 Battelle Energy Alliance, LLC, licensed under the BSD-3 Clause License.
[NAVV](https://github.com/cisagov/network-architecture-verification-and-validation) is Copyright 2023 Battelle Energy Alliance, LLC, licensed under the BSD-3 Clause License.

See [`LICENSE`](./LICENSE) for the terms of its release.

Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:22.04

# Copyright 2021 Battelle Energy Alliance, LLC
# Copyright 2023 Battelle Energy Alliance, LLC

LABEL maintainer="seth.grover@inl.gov"
LABEL org.opencontainers.image.authors='seth.grover@inl.gov'
Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ total 9.4M
```
## <a name="Footer"></a>Copyright

[NAVV](https://github.com/cisagov/network-architecture-verification-and-validation) is Copyright 2021 Battelle Energy Alliance, LLC, licensed under the BSD-3 Clause License.
[NAVV](https://github.com/cisagov/network-architecture-verification-and-validation) is Copyright 2023 Battelle Energy Alliance, LLC, licensed under the BSD-3 Clause License.

See [`LICENSE`](./LICENSE) for the terms of its release.
26 changes: 16 additions & 10 deletions docker/backup_docker.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
#!/usr/bin/env bash

# Copyright 2021 Battelle Energy Alliance, LLC
# Copyright 2023 Battelle Energy Alliance, LLC

set -e
set -o pipefail
set -u

ENCODING="utf-8"

# image name (can be overriden via NAVV_DOCKER_IMAGE env. var.)
NAVV_DOCKER_IMAGE="${NAVV_DOCKER_IMAGE:-ghcr.io/cisagov/network-architecture-verification-and-validation:latest}"
# container engine (docker vs. podman, can be overriden via CONTAINER_ENGINE env. var.)
CONTAINER_ENGINE="${CONTAINER_ENGINE:-docker}"

[[ "$(uname -s)" = 'Darwin' ]] && REALPATH=grealpath || REALPATH=realpath
[[ "$(uname -s)" = 'Darwin' ]] && DIRNAME=gdirname || DIRNAME=dirname
if ! (type "$REALPATH" && type "$DIRNAME" && type docker) > /dev/null; then
echo "$(basename "${BASH_SOURCE[0]}") requires docker, $REALPATH and $DIRNAME"
if ! (type "$REALPATH" && type "$DIRNAME" && type "$CONTAINER_ENGINE") > /dev/null; then
echo "$(basename "${BASH_SOURCE[0]}") requires $CONTAINER_ENGINE, $REALPATH and $DIRNAME"
exit 1
fi
export SCRIPT_PATH="$($DIRNAME $($REALPATH -e "${BASH_SOURCE[0]}"))"

# default docker image name (can be overriden via NAVV_DOCKER_IMAGE env. var.)
NAVV_DOCKER_IMAGE="${NAVV_DOCKER_IMAGE:-ghcr.io/cisagov/network-architecture-verification-and-validation:latest}"

# save tarball with image creation date and sha
DOCKER_BACKUP_FILENAME=navv-docker_$(date -d "$(docker inspect --format='{{.Created}}' "$NAVV_DOCKER_IMAGE")" +"%Y%m%d_%H%M%S")_$(docker images --no-trunc --quiet "$NAVV_DOCKER_IMAGE" | cut -d: -f2 | cut -c 1-12).tar.gz
DOCKER_BACKUP_FILENAME=navv-$CONTAINER_ENGINE-$(date -d "$($CONTAINER_ENGINE inspect --format='{{.Created}}' "$NAVV_DOCKER_IMAGE" | sed "s/ /T/" | sed "s/ +0000 UTC/Z/")" +"%Y%m%d_%H%M%S")_$($CONTAINER_ENGINE images --no-trunc --quiet "$NAVV_DOCKER_IMAGE" | cut -d: -f2 | cut -c 1-12).tar.gz

# backup docker image and navv-docker.sh
docker save "$NAVV_DOCKER_IMAGE" | gzip > "$DOCKER_BACKUP_FILENAME"
# backup image and navv-docker.sh
if [[ "$CONTAINER_ENGINE" == "podman" ]]; then
$CONTAINER_ENGINE save --format oci-archive "$NAVV_DOCKER_IMAGE" | gzip > "$DOCKER_BACKUP_FILENAME"
else
$CONTAINER_ENGINE save "$NAVV_DOCKER_IMAGE" | gzip > "$DOCKER_BACKUP_FILENAME"
fi
[[ ! -r navv-docker.sh ]] && cp "$SCRIPT_PATH"/navv-docker.sh ./

echo "Transfer $DOCKER_BACKUP_FILENAME and navv-docker.sh to destination host" | tee ./navv_export.txt
echo "Import $NAVV_DOCKER_IMAGE with docker load -i $DOCKER_BACKUP_FILENAME" | tee -a ./navv_export.txt
echo "Import $NAVV_DOCKER_IMAGE with $CONTAINER_ENGINE load -i $DOCKER_BACKUP_FILENAME" | tee -a ./navv_export.txt
echo "Run with navv-docker.sh" | tee -a ./navv_export.txt
13 changes: 9 additions & 4 deletions docker/build_docker.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
#!/usr/bin/env bash

# Copyright 2021 Battelle Energy Alliance, LLC
# Copyright 2023 Battelle Energy Alliance, LLC

set -e
set -o pipefail
set -u

ENCODING="utf-8"

# image name (can be overriden via NAVV_DOCKER_IMAGE env. var.)
NAVV_DOCKER_IMAGE="${NAVV_DOCKER_IMAGE:-ghcr.io/cisagov/network-architecture-verification-and-validation:latest}"
# container engine (docker vs. podman, can be overriden via CONTAINER_ENGINE env. var.)
CONTAINER_ENGINE="${CONTAINER_ENGINE:-docker}"

[[ "$(uname -s)" = 'Darwin' ]] && REALPATH=grealpath || REALPATH=realpath
[[ "$(uname -s)" = 'Darwin' ]] && DIRNAME=gdirname || DIRNAME=dirname
if ! (type "$REALPATH" && type "$DIRNAME" && type docker) > /dev/null; then
echo "$(basename "${BASH_SOURCE[0]}") requires docker, $REALPATH and $DIRNAME"
if ! (type "$REALPATH" && type "$DIRNAME" && type $CONTAINER_ENGINE) > /dev/null; then
echo "$(basename "${BASH_SOURCE[0]}") requires $CONTAINER_ENGINE, $REALPATH and $DIRNAME"
exit 1
fi
export SCRIPT_PATH="$($DIRNAME $($REALPATH -e "${BASH_SOURCE[0]}"))"

pushd "$SCRIPT_PATH"/.. >/dev/null 2>&1

docker build -f docker/Dockerfile -t ghcr.io/cisagov/network-architecture-verification-and-validation:latest "$@" .
$CONTAINER_ENGINE build -f docker/Dockerfile -t ghcr.io/cisagov/network-architecture-verification-and-validation:latest "$@" .

popd >/dev/null 2>&1
2 changes: 1 addition & 1 deletion docker/navv-build-for-export.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2021 Battelle Energy Alliance, LLC
# Copyright 2023 Battelle Energy Alliance, LLC

set -o pipefail
set -u
Expand Down
27 changes: 18 additions & 9 deletions docker/navv-docker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2021 Battelle Energy Alliance, LLC
# Copyright 2023 Battelle Energy Alliance, LLC

# navv_docker.sh
#
Expand All @@ -17,20 +17,29 @@ shopt -s nullglob

ENCODING="utf-8"

# default docker image name (can be overriden via NAVV_DOCKER_IMAGE env. var.)
# image name (can be overriden via NAVV_DOCKER_IMAGE env. var.)
NAVV_DOCKER_IMAGE="${NAVV_DOCKER_IMAGE:-ghcr.io/cisagov/network-architecture-verification-and-validation:latest}"
# container engine (docker vs. podman, can be overriden via CONTAINER_ENGINE env. var.)
CONTAINER_ENGINE="${CONTAINER_ENGINE:-docker}"
if [[ "$CONTAINER_ENGINE" == "podman" ]]; then
PUID=0
PGID=0
else
PUID=$(id -u)
PGID=$(id -g)
fi

# run navv -h to get help
function print_usage() {
docker run --rm "$NAVV_DOCKER_IMAGE" -h | sed "s/\(optional arguments\):/\1 (use short option syntax for docker):/" >&2
$CONTAINER_ENGINE run --rm "$NAVV_DOCKER_IMAGE" -h | sed "s/\(options\):/\1 (use short option syntax for $CONTAINER_ENGINE):/" >&2
}

# figure out actual executable names for realpath, dirname and basename
[[ "$(uname -s)" = 'Darwin' ]] && REALPATH=grealpath || REALPATH=realpath
[[ "$(uname -s)" = 'Darwin' ]] && DIRNAME=gdirname || DIRNAME=dirname
[[ "$(uname -s)" = 'Darwin' ]] && BASENAME=gbasename || BASENAME=basename
if ! (type "$REALPATH" && type "$DIRNAME" && type "$BASENAME" && type docker) > /dev/null; then
echo "$(basename "${BASH_SOURCE[0]}") requires $REALPATH, $DIRNAME, $BASENAME and docker"
if ! (type "$REALPATH" && type "$DIRNAME" && type "$BASENAME" && type $CONTAINER_ENGINE) > /dev/null; then
echo "$(basename "${BASH_SOURCE[0]}") requires $REALPATH, $DIRNAME, $BASENAME and $CONTAINER_ENGINE"
exit 1
fi

Expand All @@ -51,7 +60,7 @@ while getopts 'vxeho:p:z:' OPTION; do

# show version and exit
v)
docker run --rm \
$CONTAINER_ENGINE run --rm \
-e PUID=$(id -u) -e PGID=$(id -g) \
"$NAVV_DOCKER_IMAGE" --version ACME
exit 0
Expand Down Expand Up @@ -171,9 +180,9 @@ elif [[ -r "$SCRIPT_PATH"/local.zeek ]]; then
MOUNT_ARGS+=( "$SCRIPT_PATH/local.zeek:/opt/zeek/share/zeek/site/local.zeek:ro" )
fi

# run the navv docker image and remove it when it finishes
docker run --rm \
-e PUID=$(id -u) -e PGID=$(id -g) \
# run a navv container and remove it when it finishes
$CONTAINER_ENGINE run --rm \
-e PUID=$PUID -e PGID=$PUID \
-w /output \
"${MOUNT_ARGS[@]}" \
"$NAVV_DOCKER_IMAGE" \
Expand Down
2 changes: 1 addition & 1 deletion src/navv/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""This file defines the version of this module."""
__version__ = "3.0.4"
__version__ = "3.0.5"
2 changes: 1 addition & 1 deletion src/navv/data_types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright 2021 Battelle Energy Alliance, LLC
# Copyright 2023 Battelle Energy Alliance, LLC

import netaddr

Expand Down
2 changes: 1 addition & 1 deletion src/navv/network_analysis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright 2021 Battelle Energy Alliance, LLC
# Copyright 2023 Battelle Energy Alliance, LLC

# python std library imports
import argparse
Expand Down
2 changes: 1 addition & 1 deletion src/navv/spreadsheet_tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright 2021 Battelle Energy Alliance, LLC
# Copyright 2023 Battelle Energy Alliance, LLC

import os
import itertools
Expand Down
2 changes: 1 addition & 1 deletion src/navv/utilities.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright 2021 Battelle Energy Alliance, LLC
# Copyright 2023 Battelle Energy Alliance, LLC

import os
import contextlib
Expand Down