diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 02b6cf96c757d66a4c17d9111152335c3854b2d7..455adfff7b11a6a8ffc6cc6e9370a51c10757604 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,9 @@ # The base container already has entrypoint, vscode user account, etc. out of the box FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-22.04 +# Containerlab version will be set in devcontainer.json +ARG _CLAB_VERSION + # Set permissions for mounts in devcontainer.json RUN mkdir -p /home/vscode/.vscode-server/bin RUN chown -R vscode:vscode /home/vscode/.vscode-server @@ -28,6 +31,9 @@ RUN apt-get update \ # Install gnmic RUN bash -c "$(curl -sL https://get-gnmic.openconfig.net)" +# Install preferred version of the containerlab +RUN bash -c "$(curl -sL https://get.containerlab.dev)" -- -v ${_CLAB_VERSION} + # Install oh-my-zsh for more terminal features and set is as primary shell ENV SHELL /bin/zsh RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3055a7f505412f280c5f2812fc0c45c7a7ca0eb0..23d5443d122ef631302e9485ae870b2a22b72563 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,10 @@ { "name": "quant-develop-go", "build": { - "dockerfile": "Dockerfile" + "dockerfile": "Dockerfile", + "args": { + "_CLAB_VERSION": "0.54.2" + } }, "features": { "ghcr.io/devcontainers/features/go:1": { diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 69ed07274c5da39c313782c5eec94639e7727fc5..b89441d8858255400031a9ba6fdf5a4afb7e726a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,9 +22,9 @@ variables: build-kms: script: - - IMAGE_NAME="$IMAGE_PATH/kms" + - IMAGE_NAME="$IMAGE_PATH/gokms" - TAG=$CI_COMMIT_REF_SLUG - - docker buildx build --push -t "$IMAGE_NAME:$TAG" -f ekms/Dockerfile --build-arg "GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/" --build-arg GITLAB_LOGIN=${GITLAB_LOGIN} --build-arg GITLAB_TOKEN=${GITLAB_TOKEN} --build-arg GOLANG_VERSION=${GOLANG_VERSION} . + - docker buildx build --push -t "$IMAGE_NAME:$TAG" -f goKMS/Dockerfile --build-arg "GITLAB_PROXY=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/" --build-arg GITLAB_LOGIN=${GITLAB_LOGIN} --build-arg GITLAB_TOKEN=${GITLAB_TOKEN} --build-arg GOLANG_VERSION=${GOLANG_VERSION} . - TAG=${TAG}_integration-test - apk add openssl make - make generate-certs @@ -100,7 +100,7 @@ integration-test-kms: alias: akms-simulator_1 - name: $IMAGE_PATH/akms-simulator:$CI_COMMIT_REF_SLUG alias: akms-simulator_2 - - name: $IMAGE_PATH/kms:${CI_COMMIT_REF_SLUG}_integration-test + - name: $IMAGE_PATH/gokms:${CI_COMMIT_REF_SLUG}_integration-test alias: kms_1 command: [ @@ -110,7 +110,7 @@ integration-test-kms: "/config/kms/kms_1.yaml", "--insecure", ] - - name: $IMAGE_PATH/kms:${CI_COMMIT_REF_SLUG}_integration-test + - name: $IMAGE_PATH/gokms:${CI_COMMIT_REF_SLUG}_integration-test alias: kms_2 command: [ diff --git a/.gitmodules b/.gitmodules index 9bc116484576d0b65889784d84690599a1faa5b2..52e76cb62298b1b4f54693bac7ce1f6d5b67fce8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "models/third_party/openconfig"] - path = ekms/models/third_party/openconfig +[submodule "goKMS/models/third_party/openconfig"] + path = goKMS/models/third_party/openconfig url = https://github.com/openconfig/public.git diff --git a/.golangci.yml b/.golangci.yml index 7b7b42a06c36820616ec9de6072dc70e96eb02ee..03b2caf9ceea8b923b52153e93ff43b2990b0bdc 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,10 +26,10 @@ issues: exclude-use-default: false exclude-dirs: - .git/ - - ekms/model - - ekms/models + - goKMS/model + - goKMS/models - artifacts/ - - ekms/api/go + - goKMS/api/gen max-issues-per-linter: 0 max-same-issues: 0 diff --git a/.vscode/launch.json b/.vscode/launch.json index ebcf0f5a2e68389cd9b10f127a953c7e075fed1c..0470d666079a49810f1eda959fe12b8d3f04b8a4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -16,7 +16,7 @@ "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/ekms/main.go", + "program": "${workspaceFolder}/goKMS/main.go", "env": {}, "args": [ "start", "--log", "debug", "--kms_config", "${workspaceFolder}/debug_configs/config/kms/kms_1.yaml", "--insecure" @@ -27,10 +27,10 @@ "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/ekms/main.go", + "program": "${workspaceFolder}/goKMS/main.go", "env": {}, "args": [ - "start", "--log", "debug", "--kms_config", "${workspaceFolder}/config/ekms/example_debug.yaml", "--insecure" + "start", "--log", "debug", "--kms_config", "${workspaceFolder}/config/goKMS/example_debug.yaml", "--insecure" ] }, ] diff --git a/Makefile b/Makefile index cfe0a23a65aec34b9fd4d758c031f6fb36e9ec93..0243d71653189199ea5066216902b513ec9b96ef 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PROGNAME=ekms +PROGNAME=goKMS OUTPUT=${PROGNAME}_${CI_COMMIT_TAG}_${GOOS}_${GOARCH} MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) @@ -42,10 +42,10 @@ lint-fix: install-tools ./$(TOOLS_DIR)/golangci-lint run --config .golangci.yml --fix unit-test: - go test -coverprofile=coverage.out -v ./ekms/... ./quantumlayer/... + go test -coverprofile=coverage.out -v ./goKMS/... ./quantumlayer/... -build-ekms: pre - CGO_ENABLED=0 $(GOBUILD) -o $(BUILD_ARTIFACTS_PATH)/ekms ./ekms/main.go +build-gokms: pre + CGO_ENABLED=0 $(GOBUILD) -o $(BUILD_ARTIFACTS_PATH)/goKMS ./goKMS/main.go build-quantumlayer: pre $(GOBUILD) -o $(BUILD_ARTIFACTS_PATH)/quantumlayer ./quantumlayer/main/main.go @@ -62,26 +62,26 @@ quantumlayer-container: etsi14module-container: docker buildx build --rm -t etsi14module --load -f ./etsi14module/Dockerfile --build-arg GOLANG_VERSION=${GOLANG_VERSION} . -ekms-build-debug: pre - $(GOBUILD) -gcflags="all=-N -l" -o $(BUILD_ARTIFACTS_PATH)/ekms ./ekms/main.go +gokms-build-debug: pre + $(GOBUILD) -gcflags="all=-N -l" -o $(BUILD_ARTIFACTS_PATH)/goKMS ./goKMS/main.go generate-yang-models: install-tools - cd ekms/model &&\ + cd goKMS/model &&\ ../../$(TOOLS_DIR)/go-ygot-generator-generator config.yaml gostructs.go &&\ go generate -ekms-container: - docker buildx build --rm -t ekms --load -f ./ekms/Dockerfile --build-arg GITLAB_LOGIN=${GITLAB_LOGIN} --build-arg GITLAB_TOKEN=${GITLAB_TOKEN} --build-arg GOLANG_VERSION=${GOLANG_VERSION} . +gokms-container: + docker buildx build --rm -t gokms --load -f ./goKMS/Dockerfile --build-arg GITLAB_LOGIN=${GITLAB_LOGIN} --build-arg GITLAB_TOKEN=${GITLAB_TOKEN} --build-arg GOLANG_VERSION=${GOLANG_VERSION} . -ekms-container-debug: - docker buildx build --rm -t ekms-debug --load -f ./ekms/Dockerfile.debug --build-arg GITLAB_LOGIN=${GITLAB_LOGIN} --build-arg GITLAB_TOKEN=${GITLAB_TOKEN} --build-arg GOLANG_VERSION=${GOLANG_VERSION} . +gokms-container-debug: + docker buildx build --rm -t gokms-debug --load -f ./goKMS/Dockerfile.debug --build-arg GITLAB_LOGIN=${GITLAB_LOGIN} --build-arg GITLAB_TOKEN=${GITLAB_TOKEN} --build-arg GOLANG_VERSION=${GOLANG_VERSION} . akms-simulator-container: docker buildx build --rm -t akms-simulator --load -f ./akms-simulator/Dockerfile --build-arg GOLANG_VERSION=${GOLANG_VERSION} . -build-images: ekms-container quantumlayer-container akms-simulator-container +build-images: gokms-container quantumlayer-container akms-simulator-container -compose-up: generate-ekms-certs build-images +compose-up: generate-gokms-certs build-images docker-compose up -d compose-down: @@ -118,7 +118,7 @@ playground-stop: playground-graph: sudo containerlab graph --topo playground.clab.yaml -generate-certs: generate-root-ca generate-ekms-certs generate-debug-certs generate-integration-test-certs +generate-certs: generate-root-ca generate-gokms-certs generate-debug-certs generate-integration-test-certs generate-root-ca: pre if [ ! -d "$(BUILD_ARTIFACTS_PATH)/ssl" ]; then \ @@ -128,8 +128,8 @@ generate-root-ca: pre openssl x509 -in $(BUILD_ARTIFACTS_PATH)/ssl/ca.crt -noout -text; \ fi -generate-ekms-certs: generate-root-ca - ./config/ekms/generate-ekms-certs.sh +generate-gokms-certs: generate-root-ca + ./config/goKMS/generate-kms-certs.sh generate-debug-certs: generate-root-ca ./debug_configs/config/kms/generate-debug-certs.sh @@ -156,9 +156,6 @@ generate-etsi-rest-server: openapi-generator generate -i etsi014/openapiv3/etsi14.yaml -g go-server -o etsi014/go/rest/etsi/server --package-name etsi14 -v --git-host code.fbi.h-da.de --git-repo-id quant/etsi014/go/rest/etsi/server --git-user-id danet rm etsi014/go/rest/etsi/server/go.mod etsi014/go/rest/etsi/server/main.go etsi014/go/rest/etsi/server/Dockerfile - - - # Warning: Depending on your go and development configuration might also clean caches, modules and docker containers from your other projects. clean: rm -rf $(BUILD_ARTIFACTS_PATH) diff --git a/README.md b/README.md index 400849f9f117c6a18e6f84e28f7504833d945c01..aa555fbf4bbf3ee08d12583529069efb7537f831 100644 --- a/README.md +++ b/README.md @@ -4,45 +4,45 @@ The `quant` repository contains a prototypical software stack that allows to emulate a key exchange within a Quantum Key Distribution Network (QKDN). -Currently `quant` contains the following three main parts: `ekms`, `quantumlayer`, `akms-simulator` +Currently `quant` contains the following three main parts: `goKMS`, `quantumlayer`, `akms-simulator` -## ekms +## goKMS -A prototypical Key Management System (KMS) for QKDN. +A Key Management System (KMS) for QKDN written in go. The KMS receives an amount or random numbers (called bulk keys) from the quantumlayers, whereas the actual amount will vary over time. Processes them and provides a key store for each registered peer. So called forwarding routes can be set through gnmi, either via `assign-forwarding` or -`key-routing-sessions` (see [temp.yang](ekms/models/danet/temp.yang)). +`key-routing-sessions` (see [temp.yang](goKMS/models/danet/temp.yang)). -If a route is configured the `ekms` that has no `prev-hop` provided within its +If a route is configured the `goKMS` that has no `prev-hop` provided within its route configuration, will initiate the process to exchange a so-called -`platform-key`. After this both, start and end `ekms` should have a +`platform-key`. After this both, start and end `goKMS` should have a platform-key for a KSA key exchange available. **Note well:** _This is currently not intended to be used in production environments, neither in networks that can be reached by everybody, nor in other uncontrolled settings._ -### Configuration of a ekms +### Configuration of a goKMS -A ekms can be configured through a configuration file, as seen below: +A goKMS can be configured through a configuration file, as seen below: ```yaml -Id: "0ff33c82-7fe1-482b-a0ca-67565806ee4b" # ID of the ekms -Name: ekms01 # name of the ekms +Id: "0ff33c82-7fe1-482b-a0ca-67565806ee4b" # ID of the kms +Name: kms01 # name of the kms InterComAddr: 172.100.20.10:50910 # Address of the endpoint for inter communication GRPCAddr: 172.100.20.10:50900 # deprecated AkmsURL: "http://172.100.20.22:4444/api/v1/keys/push_ksa_key" # address of the rest endpoint of a connected AKMS (used for sending KSA key to the AKMS). AkmsCkmsServerPort: "9696" # Port of connected AKMS -Peers: # Peers to other ekms - # peer to ekms02 +Peers: # Peers to other goKMS + # peer to goKMS02 - PeerId: "5e41c291-6121-4335-84f6-41e04b8bdaa2" # id of the peer PeerInterComAddr: 172.100.20.11:50910 # inter com endpoint of the peer Sync: true # determines which peer partner is responsible for syncing QuantumModule: # Quantum module used for this peer Type: emulated # Type of the quantum module e.g. emulated or etsi Address: 172.100.20.14 # Address of the quantum module - # peer to ekms03 + # peer to goKMS03 - PeerId: "f80db2c0-2480-46b9-b7d1-b63f954e8227" PeerInterComAddr: 172.100.20.12:50910 Sync: false @@ -58,7 +58,7 @@ Peers: # Peers to other ekms This interface is required for the communication between the peering KMS in order to coordinate their actions for key selection and key forwardwing path configuration. The definition can be found in: -[api/kmsintercom/kmsintercom/kmsintercom.proto](ekms/internal/api/kmsintercom/kmsintercom/kmsintercom.proto) +[api/kmsintercom/kmsintercom/kmsintercom.proto](goKMS/internal/api/kmsintercom/kmsintercom/kmsintercom.proto) #### Interface to quantum modules @@ -66,7 +66,7 @@ This interface is solely a go API within the proto-kms and is accessible here [quantumlayer/quantumlayer.go](quantumlayer/quantumlayer.go) as the interface definitions. -The `ekms` currently has two interfaces to communicate with a quantum module. +The `goKMS` currently has two interfaces to communicate with a quantum module. - First there is our own interface implementation which can be found under: [danet/quipsec](https://code.fbi.h-da.de/danet/quipsec) This is the @@ -79,11 +79,11 @@ The `ekms` currently has two interfaces to communicate with a quantum module. #### gNMI -To manage the ekms we provide an gNMI endpoint. +To manage the goKMS we provide an gNMI endpoint. By using the [gnmi-target](https://code.fbi.h-da.de/danet/gnmi-target) package it is possible to manage (GET/SET/subscribe) configuration data of the KMS. -Currently we use the [temp.yang](ekms/models/danet/temp.yang) file for this and only a part of +Currently we use the [temp.yang](goKMS/models/danet/temp.yang) file for this and only a part of it is implemented yet. ## quantumlayer @@ -96,7 +96,7 @@ The generation of random numbers is done via the golang's and sends them by means of an UDP datagram to the receiving quantumlayer. If the exchange was successful the corresponding quantumlayers forward the -random numbers to the connected ekms for further processing. +random numbers to the connected goKMS for further processing. For this a quantumlayer uses the gRPC interface defined in: [danet/quipsec](https://code.fbi.h-da.de/danet/quipsec). @@ -105,7 +105,7 @@ For this a quantumlayer uses the gRPC interface defined in: A quantumlayer can be configured through a configuration file, as seen below: ```yaml -KMSAddr: "172.100.20.10:50910" # The address of the connected ekms. +KMSAddr: "172.100.20.10:50910" # The address of the connected goKMS. UDPAddr: "172.100.20.14:50901" # The UDP address of the quantumlayer itself (used for the exchange of random numbers). PeerUDPAddr: "172.100.20.15:50901" # The UDP address of the peer quantumlayer. GenerateKeys: true # Sets the quantumlayer to generate keys and send them to the peer quantumlayer (only one of both should have this setting set to true). @@ -130,7 +130,7 @@ Future versions of the quantum layer may include implementations of emulations o ## akms-simulator -A simple simulation of an AKMS endpoint. This provides a REST endpoint to receive KSA keys from a `ekms`. The following functionalities are not implemented, the explanation is just there as a means of describing the KMS type. The 'A' stands for access and one of the main purposes of this type of KMS is providing a security barrier protecting the core network of a provider from malicious activity of an end user. It's further purpose is to interact with AAA instances of providers for contractual matters. +A simple simulation of an AKMS endpoint. This provides a REST endpoint to receive KSA keys from a `goKMS`. The following functionalities are not implemented, the explanation is just there as a means of describing the KMS type. The 'A' stands for access and one of the main purposes of this type of KMS is providing a security barrier protecting the core network of a provider from malicious activity of an end user. It's further purpose is to interact with AAA instances of providers for contractual matters. ## Usage @@ -143,7 +143,7 @@ A docker-compose file provides a minimal test setup to play around with `quant`. <img src="./figures/quant-docker-setup.png" alt= "Minimal docker test setup" width="80%"> -This minimal setup contains four `ekms`, with `ekms01` and `ekms04` as endpoints. +This minimal setup contains four `goKMS`, with `goKMS01` and `goKMS04` as endpoints. Both of those are then connected to a `akms-simulator`. `Quantumlayers` are used as quantum modules. @@ -153,22 +153,22 @@ By running `make compose-up` and `make compose-down` the setup can be started or stopped with its default config. The default config is based on the configuration files provided in the -[config/ekms](config/ekms) and [config/quantumlayer](config/quantumlayer) folder. +[config/goKMS](config/goKMS) and [config/quantumlayer](config/quantumlayer) folder. #### Setting routes We provide some example `.json` files to configure forwarding routes. They can be found under [config](config). -It is possible to configure the `ekms` through +It is possible to configure the `goKMS` through [gNMI](https://github.com/openconfig/gnmi). This also applies for setting -entries within the ekms internal routing table. Therefore the paths +entries within the goKMS internal routing table. Therefore the paths `assign-forwarding` as well as `key-routing-sessions` are both suitable. The following is an example of a gNMI set request sent through [gnmic](https://github.com/openconfig/gnmic): -`gnmic -a "172.100.20.12:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=38e0588b-6a2d-42c9-85a0-887cc877c299]' --update-file ./config/ekms02-a.json` +`gnmic -a "172.100.20.12:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=38e0588b-6a2d-42c9-85a0-887cc877c299]' --update-file ./config/goKMS02-a.json` The `.json` provided in this case contains information about previous and next hops, as well as a path id. @@ -204,7 +204,7 @@ After that two requests from an AKMS are simulated through two curl requests. There is an additional playground where the [goSDN-Controller](https://code.fbi.h-da.de/danet/gosdn) can be used to -configure ekms. Therefore a small lab is provided. +configure goKMS. Therefore a small lab is provided. **Requirements:** @@ -214,7 +214,7 @@ configure ekms. Therefore a small lab is provided. Below is a short demo video of this setup in combination with the [goSDN-Controller](https://code.fbi.h-da.de/danet/gosdn). - + ## Contributing diff --git a/akms-simulator/.dockerignore b/akms-simulator/.dockerignore index a1383681a6b77e9cccd58ae31d597b17b9ec305c..c90f618683525972d3adbddf8708fe6829ec3ad1 100644 --- a/akms-simulator/.dockerignore +++ b/akms-simulator/.dockerignore @@ -10,6 +10,6 @@ doc artifacts build-tools models -ekms +goKMS quantumlayer config diff --git a/config/configure-and-run-docker-playground.sh b/config/configure-and-run-docker-playground.sh index 67a6b310a004fa815d79f104e9c34742d512661e..dfcc87a781a1e1db3e46f749f150f3cbc3686d8f 100755 --- a/config/configure-and-run-docker-playground.sh +++ b/config/configure-and-run-docker-playground.sh @@ -1,14 +1,14 @@ #! /bin/sh sleep 2 -gnmic -a "172.100.20.13:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=38e0588b-6a2d-42c9-85a0-887cc877c299]' --update-file ./config/ekms03-a.json -gnmic -a "172.100.20.12:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=38e0588b-6a2d-42c9-85a0-887cc877c299]' --update-file ./config/ekms02-a.json -gnmic -a "172.100.20.10:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=38e0588b-6a2d-42c9-85a0-887cc877c299]' --update-file ./config/ekms01-a.json +gnmic -a "172.100.20.13:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=38e0588b-6a2d-42c9-85a0-887cc877c299]' --update-file ./config/kms03-a.json +gnmic -a "172.100.20.12:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=38e0588b-6a2d-42c9-85a0-887cc877c299]' --update-file ./config/kms02-a.json +gnmic -a "172.100.20.10:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=38e0588b-6a2d-42c9-85a0-887cc877c299]' --update-file ./config/kms01-a.json sleep 2 -gnmic -a "172.100.20.13:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=f6a575e5-c7f9-4765-8890-134ae5b8f451]' --update-file ./config/ekms03-b.json -gnmic -a "172.100.20.11:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=f6a575e5-c7f9-4765-8890-134ae5b8f451]' --update-file ./config/ekms02-b.json -gnmic -a "172.100.20.10:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=f6a575e5-c7f9-4765-8890-134ae5b8f451]' --update-file ./config/ekms01-b.json +gnmic -a "172.100.20.13:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=f6a575e5-c7f9-4765-8890-134ae5b8f451]' --update-file ./config/kms03-b.json +gnmic -a "172.100.20.11:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=f6a575e5-c7f9-4765-8890-134ae5b8f451]' --update-file ./config/kms02-b.json +gnmic -a "172.100.20.10:7030" -u admin -p admin --insecure -e JSON_IETF set --update-path 'key-routing-sessions/routing-sessions[path-id=f6a575e5-c7f9-4765-8890-134ae5b8f451]' --update-file ./config/kms01-b.json sleep 2 diff --git a/config/ekms/generate-ekms-certs.sh b/config/ekms/generate-ekms-certs.sh deleted file mode 100755 index dcb2b0b29c0b05864a6378140c424789f3263785..0000000000000000000000000000000000000000 --- a/config/ekms/generate-ekms-certs.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -dirPath="artifacts/ssl" - -if [ ! -d "${dirPath}/ekms" ]; then - mkdir $dirPath/ekms - counter=1 - for FILE in ./config/ekms/tlsConfigs/*.txt; - do openssl req -x509 -nodes -days 365 -newkey rsa:4096 -config $FILE \ - -CA $dirPath/ca.crt -CAkey $dirPath/ca.key \ - -keyout "$dirPath/ekms/ekms$counter-selfsigned.key" -out "$dirPath/ekms/ekms$counter-selfsigned.crt"; \ - openssl x509 -in "$dirPath/ekms/ekms$counter-selfsigned.crt" -noout -text - counter=$((counter+1)); - done - fi - diff --git a/config/ekms/example01.yaml b/config/goKMS/example01.yaml similarity index 85% rename from config/ekms/example01.yaml rename to config/goKMS/example01.yaml index 5798168e0c4069eff52e1f4a0036357b5d7a8756..707ebc42dd73305ce8cecaff07f2be95aea3b09e 100644 --- a/config/ekms/example01.yaml +++ b/config/goKMS/example01.yaml @@ -1,5 +1,5 @@ Id: "0ff33c82-7fe1-482b-a0ca-67565806ee4b" -Name: ekms01 +Name: kms01 InterComAddr: 172.100.20.10:50910 QuantumAddr: 172.100.20.10:50911 GRPCAddr: 172.100.20.10:50900 @@ -8,10 +8,10 @@ AkmsCkmsServerPort: "9696" TLS: true ETSI14TLS: true CAFile: "ssl/ca.crt" -CertFile: "ssl/ekms/ekms1-selfsigned.crt" -KeyFile: "ssl/ekms/ekms1-selfsigned.key" +CertFile: "ssl/kms/kms1-selfsigned.crt" +KeyFile: "ssl/kms/kms1-selfsigned.key" Peers: - # peer to ekms02 + # peer to kms02 - PeerId: "5e41c291-6121-4335-84f6-41e04b8bdaa2" PeerInterComAddr: 172.100.20.11:50910 Sync: true @@ -20,7 +20,7 @@ Peers: QuantumModule: Type: emulated Address: 172.100.20.14 - # peer to ekms03 + # peer to kms03 - PeerId: "f80db2c0-2480-46b9-b7d1-b63f954e8227" PeerInterComAddr: 172.100.20.12:50910 Sync: false diff --git a/config/ekms/example02.yaml b/config/goKMS/example02.yaml similarity index 83% rename from config/ekms/example02.yaml rename to config/goKMS/example02.yaml index 8b76cb8b04ec590f7ac286fc028902cbb5d1f4b7..a6fca31113991e8a2680a0deae204912b0f23622 100644 --- a/config/ekms/example02.yaml +++ b/config/goKMS/example02.yaml @@ -1,15 +1,15 @@ Id: "5e41c291-6121-4335-84f6-41e04b8bdaa2" -Name: ekms02 +Name: kms02 InterComAddr: 172.100.20.11:50910 QuantumAddr: 172.100.20.11:50911 GRPCAddr: 172.100.20.11:50900 TLS: true ETSI14TLS: true CAFile: "ssl/ca.crt" -CertFile: "ssl/ekms/ekms2-selfsigned.crt" -KeyFile: "ssl/ekms/ekms2-selfsigned.key" +CertFile: "ssl/kms/kms2-selfsigned.crt" +KeyFile: "ssl/kms/kms2-selfsigned.key" Peers: - # peer to ekms01 + # peer to kms01 - PeerId: "0ff33c82-7fe1-482b-a0ca-67565806ee4b" PeerInterComAddr: 172.100.20.10:50910 Sync: false @@ -18,7 +18,7 @@ Peers: QuantumModule: Type: emulated Address: 172.100.20.15 - # peer to ekms04 + # peer to kms04 - PeerId: "968fd594-b0e7-41f0-ba4b-de259047a933" PeerInterComAddr: 172.100.20.13:50910 Sync: true diff --git a/config/ekms/example03.yaml b/config/goKMS/example03.yaml similarity index 83% rename from config/ekms/example03.yaml rename to config/goKMS/example03.yaml index 4b8845e415b9951638912e384001f8eadc28a961..046b105608ae4fa5944237e10b98cd191254a226 100644 --- a/config/ekms/example03.yaml +++ b/config/goKMS/example03.yaml @@ -1,15 +1,15 @@ Id: "f80db2c0-2480-46b9-b7d1-b63f954e8227" -Name: ekms03 +Name: kms03 InterComAddr: 172.100.20.12:50910 QuantumAddr: 172.100.20.12:50911 GRPCAddr: 172.100.20.12:50900 TLS: true ETSI14TLS: true CAFile: "ssl/ca.crt" -CertFile: "ssl/ekms/ekms3-selfsigned.crt" -KeyFile: "ssl/ekms/ekms3-selfsigned.key" +CertFile: "ssl/kms/kms3-selfsigned.crt" +KeyFile: "ssl/kms/kms3-selfsigned.key" Peers: - # peer to ekms01 + # peer to kms01 - PeerId: "0ff33c82-7fe1-482b-a0ca-67565806ee4b" PeerInterComAddr: 172.100.20.10:50910 Sync: true @@ -18,7 +18,7 @@ Peers: QuantumModule: Type: emulated Address: 172.100.20.19 - # peer to ekms04 + # peer to kms04 - PeerId: "968fd594-b0e7-41f0-ba4b-de259047a933" PeerInterComAddr: 172.100.20.13:50910 Sync: true diff --git a/config/ekms/example04.yaml b/config/goKMS/example04.yaml similarity index 85% rename from config/ekms/example04.yaml rename to config/goKMS/example04.yaml index 7f07c0dbc05198c93cbf6dd96afdd8079670b997..76a5869916d34fab411b7b8c5f859dc06861bf14 100644 --- a/config/ekms/example04.yaml +++ b/config/goKMS/example04.yaml @@ -1,5 +1,5 @@ Id: "968fd594-b0e7-41f0-ba4b-de259047a933" -Name: ekms04 +Name: kms04 InterComAddr: 172.100.20.13:50910 QuantumAddr: 172.100.20.13:50911 GRPCAddr: 172.100.20.13:50900 @@ -8,10 +8,10 @@ AkmsCkmsServerPort: "9696" TLS: true ETSI14TLS: true CAFile: "ssl/ca.crt" -CertFile: "ssl/ekms/ekms4-selfsigned.crt" -KeyFile: "ssl/ekms/ekms4-selfsigned.key" +CertFile: "ssl/kms/kms4-selfsigned.crt" +KeyFile: "ssl/kms/kms4-selfsigned.key" Peers: - # peer to ekms02 + # peer to kms02 - PeerId: "5e41c291-6121-4335-84f6-41e04b8bdaa2" PeerInterComAddr: 172.100.20.11:50910 Sync: false @@ -20,7 +20,7 @@ Peers: QuantumModule: Type: emulated Address: 172.100.20.17 - # peer to ekms03 + # peer to kms03 - PeerId: "f80db2c0-2480-46b9-b7d1-b63f954e8227" PeerInterComAddr: 172.100.20.12:50910 Sync: false diff --git a/config/goKMS/generate-kms-certs.sh b/config/goKMS/generate-kms-certs.sh new file mode 100755 index 0000000000000000000000000000000000000000..85a95e4bcaf812490174edef4670ac147f0ead66 --- /dev/null +++ b/config/goKMS/generate-kms-certs.sh @@ -0,0 +1,15 @@ +#!/bin/sh +dirPath="artifacts/ssl" + +if [ ! -d "${dirPath}/kms" ]; then + mkdir $dirPath/kms + counter=1 + for FILE in ./config/kms/tlsConfigs/*.txt; + do openssl req -x509 -nodes -days 365 -newkey rsa:4096 -config $FILE \ + -CA $dirPath/ca.crt -CAkey $dirPath/ca.key \ + -keyout "$dirPath/kms/kms$counter-selfsigned.key" -out "$dirPath/kms/kms$counter-selfsigned.crt"; \ + openssl x509 -in "$dirPath/kms/kms$counter-selfsigned.crt" -noout -text + counter=$((counter+1)); + done + fi + diff --git a/config/ekms/small_kms_1.yaml b/config/goKMS/small_kms_1.yaml similarity index 100% rename from config/ekms/small_kms_1.yaml rename to config/goKMS/small_kms_1.yaml diff --git a/config/ekms/small_kms_2.yaml b/config/goKMS/small_kms_2.yaml similarity index 100% rename from config/ekms/small_kms_2.yaml rename to config/goKMS/small_kms_2.yaml diff --git a/config/ekms/tlsConfigs/ekms01ReqConfig.txt b/config/goKMS/tlsConfigs/ekms01ReqConfig.txt similarity index 92% rename from config/ekms/tlsConfigs/ekms01ReqConfig.txt rename to config/goKMS/tlsConfigs/ekms01ReqConfig.txt index 36758d167531fabd854521e44505472a79513036..7e04c5832da9d211753cfc9ce72535d381fc512f 100644 --- a/config/ekms/tlsConfigs/ekms01ReqConfig.txt +++ b/config/goKMS/tlsConfigs/ekms01ReqConfig.txt @@ -7,12 +7,12 @@ prompt = no [req_distinguished_name] C = DE O = H_DA -CN = ekms01 +CN = kms01 [v3_req] keyUsage = keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth, clientAuth subjectAltName = @alt_names [alt_names] IP.1 = 172.100.20.10 -DNS.1 = ekms01 +DNS.1 = kms01 DNS.2 = kms_1 diff --git a/config/ekms/tlsConfigs/ekms02ReqConfig.txt b/config/goKMS/tlsConfigs/ekms02ReqConfig.txt similarity index 92% rename from config/ekms/tlsConfigs/ekms02ReqConfig.txt rename to config/goKMS/tlsConfigs/ekms02ReqConfig.txt index 5baacdf0b8a09ead3567250f1c7e1f6a97c735e6..b6bcadaaea1545bf0b59e05fc74fca827b072aa3 100644 --- a/config/ekms/tlsConfigs/ekms02ReqConfig.txt +++ b/config/goKMS/tlsConfigs/ekms02ReqConfig.txt @@ -7,12 +7,12 @@ prompt = no [req_distinguished_name] C = DE O = H_DA -CN = ekms02 +CN = kms02 [v3_req] keyUsage = keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth, clientAuth subjectAltName = @alt_names [alt_names] IP.1 = 172.100.20.11 -DNS.1 = ekms02 +DNS.1 = kms02 DNS.2 = kms_2 diff --git a/config/ekms/tlsConfigs/ekms03ReqConfig.txt b/config/goKMS/tlsConfigs/ekms03ReqConfig.txt similarity index 92% rename from config/ekms/tlsConfigs/ekms03ReqConfig.txt rename to config/goKMS/tlsConfigs/ekms03ReqConfig.txt index 1406bd287d603953406017faa2646fc505cb6c61..46bc8d838f07c5fc899d1eaf62882392f160871b 100644 --- a/config/ekms/tlsConfigs/ekms03ReqConfig.txt +++ b/config/goKMS/tlsConfigs/ekms03ReqConfig.txt @@ -7,12 +7,12 @@ prompt = no [req_distinguished_name] C = DE O = H_DA -CN = ekms03 +CN = kms03 [v3_req] keyUsage = keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth, clientAuth subjectAltName = @alt_names [alt_names] IP.1 = 172.100.20.12 -DNS.1 = ekms03 +DNS.1 = kms03 DNS.2 = kms_3 diff --git a/config/ekms/tlsConfigs/ekms04ReqConfig.txt b/config/goKMS/tlsConfigs/ekms04ReqConfig.txt similarity index 92% rename from config/ekms/tlsConfigs/ekms04ReqConfig.txt rename to config/goKMS/tlsConfigs/ekms04ReqConfig.txt index 58e5b79b27a6c8344e37b84b19186968d9a9bd82..136bb8240842756f3eb7b5bd0d1dbd51ea268808 100644 --- a/config/ekms/tlsConfigs/ekms04ReqConfig.txt +++ b/config/goKMS/tlsConfigs/ekms04ReqConfig.txt @@ -7,12 +7,12 @@ prompt = no [req_distinguished_name] C = DE O = H_DA -CN = ekms04 +CN = kms04 [v3_req] keyUsage = keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth, clientAuth subjectAltName = @alt_names [alt_names] IP.1 = 172.100.20.13 -DNS.1 = ekms04 +DNS.1 = kms04 DNS.2 = kms_4 diff --git a/config/ekms01-a.json b/config/kms01-a.json similarity index 100% rename from config/ekms01-a.json rename to config/kms01-a.json diff --git a/config/ekms01-b.json b/config/kms01-b.json similarity index 100% rename from config/ekms01-b.json rename to config/kms01-b.json diff --git a/config/ekms02-a.json b/config/kms02-a.json similarity index 100% rename from config/ekms02-a.json rename to config/kms02-a.json diff --git a/config/ekms02-b.json b/config/kms02-b.json similarity index 100% rename from config/ekms02-b.json rename to config/kms02-b.json diff --git a/config/ekms03-a.json b/config/kms03-a.json similarity index 100% rename from config/ekms03-a.json rename to config/kms03-a.json diff --git a/config/ekms03-b.json b/config/kms03-b.json similarity index 100% rename from config/ekms03-b.json rename to config/kms03-b.json diff --git a/debug_configs/config/kms/generate-debug-certs.sh b/debug_configs/config/kms/generate-debug-certs.sh index 8db4b5fd8d6714850d0e8e07caef8d1885d72c16..cc0cdc0ecd327071f3d3b1e098c62c6875d33f45 100755 --- a/debug_configs/config/kms/generate-debug-certs.sh +++ b/debug_configs/config/kms/generate-debug-certs.sh @@ -1,14 +1,14 @@ #!/bin/sh dirPath="artifacts/ssl" -if [ ! -d "${dirPath}/debug-ekms" ]; then - mkdir $dirPath/debug-ekms +if [ ! -d "${dirPath}/debug-kms" ]; then + mkdir $dirPath/debug-kms counter=1 for FILE in ./debug_configs/config/kms/tlsConfigs/*.txt; do openssl req -x509 -nodes -days 365 -newkey rsa:4096 -config $FILE \ -CA $dirPath/ca.crt -CAkey $dirPath/ca.key \ - -keyout "$dirPath/debug-ekms/ekms$counter-selfsigned.key" -out "$dirPath/debug-ekms/ekms$counter-selfsigned.crt"; \ - openssl x509 -in "$dirPath/debug-ekms/ekms$counter-selfsigned.crt" -noout -text + -keyout "$dirPath/debug-kms/kms$counter-selfsigned.key" -out "$dirPath/debug-kms/kms$counter-selfsigned.crt"; \ + openssl x509 -in "$dirPath/debug-kms/kms$counter-selfsigned.crt" -noout -text counter=$((counter+1)); done fi diff --git a/debug_configs/config/kms/kms_1.yaml b/debug_configs/config/kms/kms_1.yaml index fbd96212feef6ceca1fcf94c73b67a2900e41e69..47ffa2e8efd729721a71c48c8f1f2cc53f832ffc 100644 --- a/debug_configs/config/kms/kms_1.yaml +++ b/debug_configs/config/kms/kms_1.yaml @@ -7,8 +7,8 @@ AkmsURL: "http://127.0.0.1:4444/api/v1/keys/push_ksa_key" AkmsCkmsServerPort: "9696" TLS: true CAFile: "../artifacts/ssl/ca.crt" -CertFile: "../artifacts/ssl/debug-ekms/ekms1-selfsigned.crt" -KeyFile: "../artifacts/ssl/debug-ekms/ekms1-selfsigned.key" +CertFile: "../artifacts/ssl/debug-kms/kms1-selfsigned.crt" +KeyFile: "../artifacts/ssl/debug-kms/kms1-selfsigned.key" Peers: # peer to kms_2 - PeerId: '5e41c291-6121-4335-84f6-41e04b8bdaa2' diff --git a/debug_configs/config/kms/kms_2.yaml b/debug_configs/config/kms/kms_2.yaml index 98a4e7263d468e9d346a6ecc9346ae00ca70c1ff..ff1248a36b614b961c3d0b25f502437f14c7ad3e 100644 --- a/debug_configs/config/kms/kms_2.yaml +++ b/debug_configs/config/kms/kms_2.yaml @@ -7,8 +7,8 @@ AkmsURL: "http://akms-simulator_2:4444/api/v1/keys/push_ksa_key" AkmsCkmsServerPort: "9696" TLS: true CAFile: "ssl/ca.crt" -CertFile: "ssl/debug-ekms/ekms2-selfsigned.crt" -KeyFile: "ssl/debug-ekms/ekms2-selfsigned.key" +CertFile: "ssl/debug-kms/kms2-selfsigned.crt" +KeyFile: "ssl/debug-kms/kms2-selfsigned.key" Peers: # peer to kms_1 - PeerId: '0ff33c82-7fe1-482b-a0ca-67565806ee4b' diff --git a/docker-compose.yml b/docker-compose.yml index 363d275fa2133ccaed58771050e067242b91a5e8..743dc2c745ad5fd4e6ee4869aa6f0cd1a03890d7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,42 +1,42 @@ services: - ekms01: - image: ekms - command: ["start", "--log", "debug", "--kms_config", "/tmp/kms/config/ekms01.yaml", "--insecure"] + kms_1: + image: gokms + command: ["--log", "debug", "--kms_config", "/tmp/kms/config/kms01.yaml", "--insecure"] volumes: - - ./config/ekms/example01.yaml:/tmp/kms/config/ekms01.yaml + - ./config/goKMS/example01.yaml:/tmp/kms/config/kms01.yaml - ./artifacts/ssl:/ssl networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.10 - ekms02: - image: ekms - command: ["start", "--log", "debug", "--kms_config", "/tmp/kms/config/ekms02.yaml", "--insecure"] + kms_2: + image: gokms + command: ["--log", "debug", "--kms_config", "/tmp/kms/config/kms02.yaml", "--insecure"] volumes: - - ./config/ekms/example02.yaml:/tmp/kms/config/ekms02.yaml + - ./config/goKMS/example02.yaml:/tmp/kms/config/kms02.yaml - ./artifacts/ssl:/ssl networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.11 - ekms03: - image: ekms - command: ["start", "--log", "debug", "--kms_config", "/tmp/kms/config/ekms03.yaml", "--insecure"] + kms_3: + image: gokms + command: ["--log", "debug", "--kms_config", "/tmp/kms/config/kms03.yaml", "--insecure"] volumes: - - ./config/ekms/example03.yaml:/tmp/kms/config/ekms03.yaml + - ./config/goKMS/example03.yaml:/tmp/kms/config/kms03.yaml - ./artifacts/ssl:/ssl networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.12 - ekms04: - image: ekms - command: ["start", "--log", "debug", "--kms_config", "/tmp/kms/config/ekms04.yaml", "--insecure"] + kms_4: + image: gokms + command: ["--log", "debug", "--kms_config", "/tmp/kms/config/kms04.yaml", "--insecure"] volumes: - - ./config/ekms/example04.yaml:/tmp/kms/config/ekms04.yaml + - ./config/goKMS/example04.yaml:/tmp/kms/config/kms04.yaml - ./artifacts/ssl:/ssl networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.13 @@ -46,7 +46,7 @@ services: volumes: - ./config/quantumlayer/example01.yaml:/tmp/quantumlayer/config/quantumlayer01.yaml networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.14 qlayer02: @@ -55,7 +55,7 @@ services: volumes: - ./config/quantumlayer/example02.yaml:/tmp/quantumlayer/config/quantumlayer02.yaml networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.15 qlayer03: @@ -64,7 +64,7 @@ services: volumes: - ./config/quantumlayer/example03.yaml:/tmp/quantumlayer/config/quantumlayer03.yaml networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.16 qlayer04: @@ -73,7 +73,7 @@ services: volumes: - ./config/quantumlayer/example04.yaml:/tmp/quantumlayer/config/quantumlayer04.yaml networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.17 qlayer05: @@ -82,7 +82,7 @@ services: volumes: - ./config/quantumlayer/example05.yaml:/tmp/quantumlayer/config/quantumlayer05.yaml networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.18 qlayer06: @@ -91,7 +91,7 @@ services: volumes: - ./config/quantumlayer/example06.yaml:/tmp/quantumlayer/config/quantumlayer06.yaml networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.19 qlayer07: @@ -100,7 +100,7 @@ services: volumes: - ./config/quantumlayer/example07.yaml:/tmp/quantumlayer/config/quantumlayer07.yaml networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.20 qlayer08: @@ -109,26 +109,26 @@ services: volumes: - ./config/quantumlayer/example08.yaml:/tmp/quantumlayer/config/quantumlayer08.yaml networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.21 akms-receiver01: image: akms-simulator networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.22 akms-receiver02: image: akms-simulator networks: - ekms-net: + kms-net: ipv4_address: 172.100.20.23 networks: - ekms-net: + kms-net: ipam: driver: default config: - subnet: "172.100.20.0/24" - name: ekms-net + name: kms-net diff --git a/docker-compose_debug_kms.yml b/docker-compose_debug_kms.yml index 03314cc28cd3c56ab9b51c60de7c6e014271db8c..6a7ff0ad39e25ffc2384b04ef693b0ca9d773b89 100644 --- a/docker-compose_debug_kms.yml +++ b/docker-compose_debug_kms.yml @@ -1,7 +1,7 @@ services: #kms_1: - #image: ekms - #command: ["start", "--log", "debug", "--kms_config", "/tmp/kms/config/kms_1.yaml", "--insecure"] + #image: gokms + #command: ["--log", "debug", "--kms_config", "/tmp/kms/config/kms_1.yaml", "--insecure"] #volumes: # - ./debug_configs/config/kms/kms_1.yaml:/tmp/kms/config/kms_1.yaml #ports: @@ -9,8 +9,8 @@ services: # - "127.0.0.1:9696:9696" kms_2: - image: ekms - command: ["start", "--log", "debug", "--kms_config", "/tmp/kms/config/kms_2.yaml", "--insecure"] + image: gokms + command: ["--log", "debug", "--kms_config", "/tmp/kms/config/kms_2.yaml", "--insecure"] volumes: - ./debug_configs/config/kms/kms_2.yaml:/tmp/kms/config/kms_2.yaml - ./artifacts/ssl:/ssl @@ -20,7 +20,7 @@ services: extra_hosts: - "host.docker.internal:host-gateway" networks: - ekms-debug-net: + kms-debug-net: ipv4_address: 172.200.20.12 quantumlayer_1: @@ -31,7 +31,7 @@ services: extra_hosts: - "host.docker.internal:host-gateway" networks: - ekms-debug-net: + kms-debug-net: ipv4_address: 172.200.20.20 quantumlayer_2: @@ -40,27 +40,27 @@ services: volumes: - ./debug_configs/config/quantumlayer/quantumlayer_2.yaml:/tmp/quantumlayer/config/quantumlayer_2.yaml networks: - ekms-debug-net: + kms-debug-net: akms-simulator_1: image: akms-simulator ports: - "127.0.0.1:4444:4444" networks: - ekms-debug-net: + kms-debug-net: akms-simulator_2: image: akms-simulator ports: - "127.0.0.1:4445:4444" networks: - ekms-debug-net: + kms-debug-net: networks: - ekms-debug-net: + kms-debug-net: ipam: driver: default config: - subnet: "172.200.20.0/24" - name: ekms-debug-net + name: kms-debug-net diff --git a/docker-compose_small_random.yml b/docker-compose_small_random.yml index 6caab755f3aafab665d49a718599d13e2fb1bb8c..ff5712416dedffaed969c08f595a613b33b05403 100644 --- a/docker-compose_small_random.yml +++ b/docker-compose_small_random.yml @@ -1,18 +1,18 @@ services: kms_1: - image: ekms - command: ["start", "--log", "debug", "--kms_config", "/tmp/kms/config/kms_1.yaml", "--insecure"] + image: gokms + command: ["--log", "debug", "--kms_config", "/tmp/kms/config/kms_1.yaml", "--insecure"] volumes: - - ./config/ekms/small_kms_1.yaml:/tmp/kms/config/kms_1.yaml + - ./config/goKMS/small_kms_1.yaml:/tmp/kms/config/kms_1.yaml ports: - "127.0.0.1:7030:7030" - "127.0.0.1:9696:9696" kms_2: - image: ekms - command: ["start", "--log", "debug", "--kms_config", "/tmp/kms/config/kms_2.yaml", "--insecure"] + image: gokms + command: ["--log", "debug", "--kms_config", "/tmp/kms/config/kms_2.yaml", "--insecure"] volumes: - - ./config/ekms/small_kms_2.yaml:/tmp/kms/config/kms_2.yaml + - ./config/goKMS/small_kms_2.yaml:/tmp/kms/config/kms_2.yaml ports: - "127.0.0.1:7031:7030" diff --git a/docker-compose_small_replay.yml b/docker-compose_small_replay.yml index 133ed44063d65247b3c2a0fb6796d935ecf91e02..a84a9de8ca3820a64f2153ebdd3f0e2954e13802 100644 --- a/docker-compose_small_replay.yml +++ b/docker-compose_small_replay.yml @@ -1,18 +1,18 @@ services: kms_1: - image: ekms - command: ["start", "--log", "debug", "--kms_config", "/tmp/kms/config/kms_1.yaml", "--insecure"] + image: gokms + command: ["--log", "debug", "--kms_config", "/tmp/kms/config/kms_1.yaml", "--insecure"] volumes: - - ./config/ekms/small_kms_1.yaml:/tmp/kms/config/kms_1.yaml + - ./config/goKMS/small_kms_1.yaml:/tmp/kms/config/kms_1.yaml ports: - "127.0.0.1:7030:7030" - "127.0.0.1:9696:9696" kms_2: - image: ekms - command: ["start", "--log", "debug", "--kms_config", "/tmp/kms/config/kms_2.yaml", "--insecure"] + image: gokms + command: ["--log", "debug", "--kms_config", "/tmp/kms/config/kms_2.yaml", "--insecure"] volumes: - - ./config/ekms/small_kms_2.yaml:/tmp/kms/config/kms_2.yaml + - ./config/goKMS/small_kms_2.yaml:/tmp/kms/config/kms_2.yaml ports: - "127.0.0.1:7031:7030" diff --git a/ekms/models/third_party/openconfig b/ekms/models/third_party/openconfig deleted file mode 160000 index 0bd68159424078c8fbc3724a4bc1ef4e947eb3cf..0000000000000000000000000000000000000000 --- a/ekms/models/third_party/openconfig +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0bd68159424078c8fbc3724a4bc1ef4e947eb3cf diff --git a/etsi014/buf.gen.yaml b/etsi014/buf.gen.yaml index 9e37a8ea0c9672424902d23f460d43df168e09fe..9e9455f48894ce9e3c14c4a9dada776629166e55 100644 --- a/etsi014/buf.gen.yaml +++ b/etsi014/buf.gen.yaml @@ -12,7 +12,7 @@ plugins: out: openapiv2 opt: - allow_merge=true - - merge_file_name=ekms_etsi14 + - merge_file_name=kms_etsi14 # - generate_unbound_methods=true # - include_package_in_tags=false # dependencies diff --git a/figures/gosdn-ekms-example.mp4 b/figures/gosdn-kms-example.mp4 similarity index 100% rename from figures/gosdn-ekms-example.mp4 rename to figures/gosdn-kms-example.mp4 diff --git a/ekms/.dockerignore b/goKMS/.dockerignore similarity index 100% rename from ekms/.dockerignore rename to goKMS/.dockerignore diff --git a/ekms/Dockerfile b/goKMS/Dockerfile similarity index 86% rename from ekms/Dockerfile rename to goKMS/Dockerfile index 7d0f4f1da4bf53e7c05d98144751a13cf08e2c8e..e1a1ec6565acb94abd820262fdb7807d8bda1adf 100644 --- a/ekms/Dockerfile +++ b/goKMS/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get update && apt-get upgrade -y COPY . . RUN --mount=type=cache,target=/root/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build \ - make build-ekms + make build-gokms FROM ${GITLAB_PROXY}debian:12-slim as debian RUN apt-get update && apt-get upgrade -y @@ -19,7 +19,7 @@ RUN apt-get install -y iproute2 RUN apt-get install -y iputils-ping RUN apt-get install -y openssh-client openssh-server RUN apt-get install -y libssl-dev -COPY --from=builder app/artifacts/ekms /usr/bin/ekms +COPY --from=builder app/artifacts/goKMS /usr/bin/goKMS EXPOSE 7030 EXPOSE 50900 -ENTRYPOINT ["/usr/bin/ekms"] +ENTRYPOINT ["/usr/bin/goKMS"] diff --git a/ekms/Dockerfile.debug b/goKMS/Dockerfile.debug similarity index 89% rename from ekms/Dockerfile.debug rename to goKMS/Dockerfile.debug index 51a851806962eae99a48ac7d048bf44d114896b7..c459a6f8182df454bd18af22c4e5861468232a40 100644 --- a/ekms/Dockerfile.debug +++ b/goKMS/Dockerfile.debug @@ -10,7 +10,7 @@ COPY . . RUN --mount=type=cache,target=/root/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build RUN go install github.com/go-delve/delve/cmd/dlv@v1.20.2 -RUN make ekms-build-debug +RUN make kms-build-debug FROM debian:12 as debian EXPOSE 7030 @@ -21,5 +21,5 @@ RUN apt-get install -y iputils-ping RUN apt-get install -y openssh-client openssh-server RUN apt-get install -y libssl-dev COPY --from=builder /go/bin/dlv /debug/ -COPY --from=builder /app/artifacts/ekms /debug/ -CMD [ "/debug/dlv", "--listen=:4000", "--headless=true", "--log=true", "--accept-multiclient", "--api-version=2", "exec", "/debug/ekms", "start" ] +COPY --from=builder /app/artifacts/kms /debug/ +CMD [ "/debug/dlv", "--listen=:4000", "--headless=true", "--log=true", "--accept-multiclient", "--api-version=2", "exec", "/debug/kms", "start" ] diff --git a/ekms/LICENSE b/goKMS/LICENSE similarity index 100% rename from ekms/LICENSE rename to goKMS/LICENSE diff --git a/ekms/README.md b/goKMS/README.md similarity index 99% rename from ekms/README.md rename to goKMS/README.md index 53af6590a362d6e5935998746c34b53b9fdf17bd..3671ca0e50072f3de852972d6cdb49c2352f83ba 100644 --- a/ekms/README.md +++ b/goKMS/README.md @@ -1,4 +1,4 @@ -# Proto KMS +# KMS This is a prototypically Key Management System (KMS) for Quantum Key Distribution Networks (QKDN). diff --git a/ekms/api/buf.gen.yaml b/goKMS/api/buf.gen.yaml similarity index 80% rename from ekms/api/buf.gen.yaml rename to goKMS/api/buf.gen.yaml index 63433bd25b23db707c6540ab434b83b5b045c42f..569be1e5f477e05b00fc8d48de60164dbb27d780 100644 --- a/ekms/api/buf.gen.yaml +++ b/goKMS/api/buf.gen.yaml @@ -2,7 +2,7 @@ version: v1 managed: enabled: true go_package_prefix: - default: code.fbi.h-da.de/danet/quant/ekms/api/gen/proto/go + default: code.fbi.h-da.de/danet/quant/goKMS/api/gen/proto/go plugins: - plugin: buf.build/grpc/go out: gen/proto/go diff --git a/ekms/api/buf.work.yaml b/goKMS/api/buf.work.yaml similarity index 100% rename from ekms/api/buf.work.yaml rename to goKMS/api/buf.work.yaml diff --git a/ekms/api/gen/proto/go/kmsintercom/kmsintercom.pb.go b/goKMS/api/gen/proto/go/kmsintercom/kmsintercom.pb.go similarity index 100% rename from ekms/api/gen/proto/go/kmsintercom/kmsintercom.pb.go rename to goKMS/api/gen/proto/go/kmsintercom/kmsintercom.pb.go diff --git a/ekms/api/gen/proto/go/kmsintercom/kmsintercom_grpc.pb.go b/goKMS/api/gen/proto/go/kmsintercom/kmsintercom_grpc.pb.go similarity index 100% rename from ekms/api/gen/proto/go/kmsintercom/kmsintercom_grpc.pb.go rename to goKMS/api/gen/proto/go/kmsintercom/kmsintercom_grpc.pb.go diff --git a/ekms/api/kmsintercom/kmsintercom/buf.lock b/goKMS/api/kmsintercom/kmsintercom/buf.lock similarity index 100% rename from ekms/api/kmsintercom/kmsintercom/buf.lock rename to goKMS/api/kmsintercom/kmsintercom/buf.lock diff --git a/ekms/api/kmsintercom/kmsintercom/buf.yaml b/goKMS/api/kmsintercom/kmsintercom/buf.yaml similarity index 100% rename from ekms/api/kmsintercom/kmsintercom/buf.yaml rename to goKMS/api/kmsintercom/kmsintercom/buf.yaml diff --git a/ekms/api/kmsintercom/kmsintercom/kmsintercom.proto b/goKMS/api/kmsintercom/kmsintercom/kmsintercom.proto similarity index 100% rename from ekms/api/kmsintercom/kmsintercom/kmsintercom.proto rename to goKMS/api/kmsintercom/kmsintercom/kmsintercom.proto diff --git a/ekms/config/config.go b/goKMS/config/config.go similarity index 69% rename from ekms/config/config.go rename to goKMS/config/config.go index 4277d2b40fd61deeb51ef910c0e9ba021e02aa3e..63af65d69e7ab58fc86150ff1c8117282c330e23 100644 --- a/ekms/config/config.go +++ b/goKMS/config/config.go @@ -33,51 +33,51 @@ type QuantumModule struct { MasterMode bool `yaml:"MasterMode"` } -func NewEKMSInfo(id uuid.UUID, version *ekmsVersionInformation, channel chan string) *EKMSInfo { - return &EKMSInfo{ +func NewKMSInfo(id uuid.UUID, version *kmsVersionInformation, channel chan string) *KMSInfo { + return &KMSInfo{ id: id, version: version, KmsPeerUpdateChannel: channel, } } -type EKMSInfo struct { +type KMSInfo struct { // Information used to fill the ETSI GS QKD 15 yang model id uuid.UUID - version *ekmsVersionInformation + version *kmsVersionInformation KmsPeerUpdateChannel chan string // used to get updates from KmsPeer part } -func NewEKMSVersionInformation(firmware string, swVersion string, hwVersion string) *ekmsVersionInformation { - return &ekmsVersionInformation{ +func NewKMSVersionInformation(firmware string, swVersion string, hwVersion string) *kmsVersionInformation { + return &kmsVersionInformation{ firmware: firmware, swVersion: swVersion, hwVersion: hwVersion, } } -type ekmsVersionInformation struct { +type kmsVersionInformation struct { firmware string swVersion string hwVersion string } -func (evi *ekmsVersionInformation) Firmware() string { - return evi.firmware +func (kvi *kmsVersionInformation) Firmware() string { + return kvi.firmware } -func (evi *ekmsVersionInformation) SoftwareVersion() string { - return evi.swVersion +func (kvi *kmsVersionInformation) SoftwareVersion() string { + return kvi.swVersion } -func (evi *ekmsVersionInformation) HardwareVersion() string { - return evi.hwVersion +func (kvi *kmsVersionInformation) HardwareVersion() string { + return kvi.hwVersion } -func (qkdnInfo *EKMSInfo) Version() *ekmsVersionInformation { +func (qkdnInfo *KMSInfo) Version() *kmsVersionInformation { return qkdnInfo.version } -func (qkdnInfo *EKMSInfo) ID() uuid.UUID { +func (qkdnInfo *KMSInfo) ID() uuid.UUID { return qkdnInfo.id } diff --git a/ekms/gnmiHandlers/kms/assignForwardingHandler.go b/goKMS/gnmiHandlers/kms/assignForwardingHandler.go similarity index 92% rename from ekms/gnmiHandlers/kms/assignForwardingHandler.go rename to goKMS/gnmiHandlers/kms/assignForwardingHandler.go index f230f01969329bf0a3bd78df4544a56ea2b2331f..6f8d4682590e2dbf1ccee259f10d0ce3b92e46d2 100644 --- a/ekms/gnmiHandlers/kms/assignForwardingHandler.go +++ b/goKMS/gnmiHandlers/kms/assignForwardingHandler.go @@ -4,8 +4,8 @@ import ( "fmt" "code.fbi.h-da.de/danet/gnmi-target/handler" - "code.fbi.h-da.de/danet/quant/ekms/kms" - gnmitargetygot "code.fbi.h-da.de/danet/quant/ekms/model" + "code.fbi.h-da.de/danet/quant/goKMS/kms" + gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model" "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/ygot/ygot" log "github.com/sirupsen/logrus" @@ -14,10 +14,10 @@ import ( // AssignForwardingHandler is the implementation of a gnmitarget.PathHandler. type AssignForwardingHandler struct { handler.DefaultPathHandler - kms *kms.EKMS + kms *kms.KMS } -func NewAssignForwardingHandler(kms *kms.EKMS) *AssignForwardingHandler { +func NewAssignForwardingHandler(kms *kms.KMS) *AssignForwardingHandler { return &AssignForwardingHandler{ DefaultPathHandler: handler.DefaultPathHandler{ Name: "kms-assign-forwarding-handler", diff --git a/ekms/gnmiHandlers/kms/createRouteHandler.go b/goKMS/gnmiHandlers/kms/createRouteHandler.go similarity index 93% rename from ekms/gnmiHandlers/kms/createRouteHandler.go rename to goKMS/gnmiHandlers/kms/createRouteHandler.go index 87a651536fc5957a0a0c3045f307c3307b9716a2..69e58c50eb242199b7b7f0b18408d059494256a6 100644 --- a/ekms/gnmiHandlers/kms/createRouteHandler.go +++ b/goKMS/gnmiHandlers/kms/createRouteHandler.go @@ -4,9 +4,9 @@ import ( "fmt" "code.fbi.h-da.de/danet/gnmi-target/handler" - "code.fbi.h-da.de/danet/quant/ekms/kms" - "code.fbi.h-da.de/danet/quant/ekms/kms/event" - gnmitargetygot "code.fbi.h-da.de/danet/quant/ekms/model" + "code.fbi.h-da.de/danet/quant/goKMS/kms" + "code.fbi.h-da.de/danet/quant/goKMS/kms/event" + gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model" "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/ygot/ygot" log "github.com/sirupsen/logrus" @@ -14,11 +14,11 @@ import ( type CreateRouteHandler struct { handler.DefaultPathHandler - kms *kms.EKMS + kms *kms.KMS events <-chan event.Event } -func NewCreateRouteHandler(kms *kms.EKMS) *CreateRouteHandler { +func NewCreateRouteHandler(kms *kms.KMS) *CreateRouteHandler { return &CreateRouteHandler{ DefaultPathHandler: handler.DefaultPathHandler{ Name: "kms-create-route-handler", diff --git a/ekms/gnmiHandlers/kms/keyRoutingSessionsHandler.go b/goKMS/gnmiHandlers/kms/keyRoutingSessionsHandler.go similarity index 94% rename from ekms/gnmiHandlers/kms/keyRoutingSessionsHandler.go rename to goKMS/gnmiHandlers/kms/keyRoutingSessionsHandler.go index 8c4495dff7522acc3a67d979e4deab52471a9adb..625af8133d95f8a150797a6a9426ea746217f48f 100644 --- a/ekms/gnmiHandlers/kms/keyRoutingSessionsHandler.go +++ b/goKMS/gnmiHandlers/kms/keyRoutingSessionsHandler.go @@ -5,9 +5,9 @@ import ( "strings" "code.fbi.h-da.de/danet/gnmi-target/handler" - "code.fbi.h-da.de/danet/quant/ekms/kms" - "code.fbi.h-da.de/danet/quant/ekms/kms/event" - gnmitargetygot "code.fbi.h-da.de/danet/quant/ekms/model" + "code.fbi.h-da.de/danet/quant/goKMS/kms" + "code.fbi.h-da.de/danet/quant/goKMS/kms/event" + gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model" "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/ygot/ygot" log "github.com/sirupsen/logrus" @@ -15,11 +15,11 @@ import ( type KeyRoutingSessionHandler struct { handler.DefaultPathHandler - kms *kms.EKMS + kms *kms.KMS events <-chan event.Event } -func NewKeyRoutingSessionHandler(kms *kms.EKMS) *KeyRoutingSessionHandler { +func NewKeyRoutingSessionHandler(kms *kms.KMS) *KeyRoutingSessionHandler { return &KeyRoutingSessionHandler{ DefaultPathHandler: handler.DefaultPathHandler{ Name: "kms-key-routing-session-handler", @@ -143,7 +143,7 @@ func (yh *KeyRoutingSessionHandler) Update(c ygot.ValidatedGoStruct, jobs []*gnm return nil } -func (yh *KeyRoutingSessionHandler) updateOrCreateKeyRoutingSessions(kms *kms.EKMS) ([]*gnmi.Notification, error) { +func (yh *KeyRoutingSessionHandler) updateOrCreateKeyRoutingSessions(kms *kms.KMS) ([]*gnmi.Notification, error) { yh.Config.Lock() defer yh.Config.Unlock() @@ -159,9 +159,9 @@ func (yh *KeyRoutingSessionHandler) updateOrCreateKeyRoutingSessions(kms *kms.EK confKeyRoutingSessions := newConfig.GetOrCreateKeyRoutingSessions() - ekmsRoutingTable := kms.RoutingTableDeepCopy() + kmsRoutingTable := kms.RoutingTableDeepCopy() - for _, route := range ekmsRoutingTable { + for _, route := range kmsRoutingTable { confTempRoutingSession := confKeyRoutingSessions.GetOrCreateRoutingSessions(route.PathId.String()) if route.Previous != nil { diff --git a/ekms/gnmiHandlers/kms/kmsHandler.go b/goKMS/gnmiHandlers/kms/kmsHandler.go similarity index 70% rename from ekms/gnmiHandlers/kms/kmsHandler.go rename to goKMS/gnmiHandlers/kms/kmsHandler.go index 407f4f5d10dfde262fde49d6e2935c2376bed92a..87a4a64978a2c4a714ca659141c38c2884caf546 100644 --- a/ekms/gnmiHandlers/kms/kmsHandler.go +++ b/goKMS/gnmiHandlers/kms/kmsHandler.go @@ -4,18 +4,18 @@ import ( "fmt" "code.fbi.h-da.de/danet/gnmi-target/handler" - "code.fbi.h-da.de/danet/quant/ekms/config" - gnmitargetygot "code.fbi.h-da.de/danet/quant/ekms/model" + "code.fbi.h-da.de/danet/quant/goKMS/config" + gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model" "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/ygot/ygot" ) type KmsHandler struct { handler.DefaultPathHandler - ekmsInfo *config.EKMSInfo + kmsInfo *config.KMSInfo } -func NewKmsHandler(ekmsInfo *config.EKMSInfo) *KmsHandler { +func NewKmsHandler(kmsInfo *config.KMSInfo) *KmsHandler { return &KmsHandler{ DefaultPathHandler: handler.DefaultPathHandler{ Name: "kms-handler", @@ -23,7 +23,7 @@ func NewKmsHandler(ekmsInfo *config.EKMSInfo) *KmsHandler { "/kms": {}, }, }, - ekmsInfo: ekmsInfo, + kmsInfo: kmsInfo, } } @@ -32,7 +32,7 @@ func (yh *KmsHandler) Init(config *handler.Config, publishToSubsFunc func([]*gnm yh.PublishToSubs = publishToSubsFunc // Fill out the known fields in the ygot structs - _, err := yh.updateOrCreateKMS(yh.ekmsInfo) + _, err := yh.updateOrCreateKMS(yh.kmsInfo) if err != nil { return err } @@ -45,7 +45,7 @@ func (yh *KmsHandler) Update(c ygot.ValidatedGoStruct, jobs []*gnmi.Update) erro return nil } -func (yh *KmsHandler) updateOrCreateKMS(ekmsInfo *config.EKMSInfo) ([]*gnmi.Notification, error) { +func (yh *KmsHandler) updateOrCreateKMS(kmsInfo *config.KMSInfo) ([]*gnmi.Notification, error) { yh.Config.Lock() defer yh.Config.Unlock() @@ -61,12 +61,12 @@ func (yh *KmsHandler) updateOrCreateKMS(ekmsInfo *config.EKMSInfo) ([]*gnmi.Noti confKMS := newConfig.GetOrCreateKms() - confKMS.KmsId = ygot.String(ekmsInfo.ID().String()) + confKMS.KmsId = ygot.String(kmsInfo.ID().String()) confVersionInfo := confKMS.GetOrCreateVersionInformation() - confVersionInfo.Firmware = ygot.String(ekmsInfo.Version().Firmware()) - confVersionInfo.HwVersion = ygot.String(ekmsInfo.Version().HardwareVersion()) - confVersionInfo.SwVersion = ygot.String(ekmsInfo.Version().SoftwareVersion()) + confVersionInfo.Firmware = ygot.String(kmsInfo.Version().Firmware()) + confVersionInfo.HwVersion = ygot.String(kmsInfo.Version().HardwareVersion()) + confVersionInfo.SwVersion = ygot.String(kmsInfo.Version().SoftwareVersion()) //validate struct if err := newConfig.Validate(); err != nil { diff --git a/ekms/gnmiHandlers/kms/peerHandler.go b/goKMS/gnmiHandlers/kms/peerHandler.go similarity index 90% rename from ekms/gnmiHandlers/kms/peerHandler.go rename to goKMS/gnmiHandlers/kms/peerHandler.go index 8054eec394c0b348533c8d745a4a510b84dd3a37..e8475ec55fb8995b0dbebe9a8ca5efd503593c66 100644 --- a/ekms/gnmiHandlers/kms/peerHandler.go +++ b/goKMS/gnmiHandlers/kms/peerHandler.go @@ -4,10 +4,10 @@ import ( "fmt" "code.fbi.h-da.de/danet/gnmi-target/handler" - "code.fbi.h-da.de/danet/quant/ekms/kms" - "code.fbi.h-da.de/danet/quant/ekms/kms/event" - "code.fbi.h-da.de/danet/quant/ekms/kms/peers" - gnmitargetygot "code.fbi.h-da.de/danet/quant/ekms/model" + "code.fbi.h-da.de/danet/quant/goKMS/kms" + "code.fbi.h-da.de/danet/quant/goKMS/kms/event" + "code.fbi.h-da.de/danet/quant/goKMS/kms/peers" + gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model" "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/ygot/ygot" log "github.com/sirupsen/logrus" @@ -16,10 +16,10 @@ import ( type PeerHandler struct { handler.DefaultPathHandler events <-chan event.Event - kms *kms.EKMS + kms *kms.KMS } -func NewPeerHandler(kms *kms.EKMS) *PeerHandler { +func NewPeerHandler(kms *kms.KMS) *PeerHandler { return &PeerHandler{ DefaultPathHandler: handler.DefaultPathHandler{ Name: "kms-peer-handler", @@ -75,7 +75,7 @@ func (yh *PeerHandler) Update(c ygot.ValidatedGoStruct, jobs []*gnmi.Update) err return nil } -func (yh *PeerHandler) updateOrCreatePeerTable(ekms *kms.EKMS) ([]*gnmi.Notification, error) { +func (yh *PeerHandler) updateOrCreatePeerTable(kms *kms.KMS) ([]*gnmi.Notification, error) { yh.Config.Lock() defer yh.Config.Unlock() @@ -92,7 +92,7 @@ func (yh *PeerHandler) updateOrCreatePeerTable(ekms *kms.EKMS) ([]*gnmi.Notifica // Create ygot structs for the kms confKmsPeerTable := newConfig.GetOrCreateKmsPeerTable() - kmsPeers := ekms.PeersDeepCopy() + kmsPeers := kms.PeersDeepCopy() for _, peer := range kmsPeers { confTempKmsPeer := confKmsPeerTable.GetOrCreateKmsPeers(peer.GetKmsPeerId().String()) diff --git a/ekms/gnmiHandlers/system/hostnameHandler.go b/goKMS/gnmiHandlers/system/hostnameHandler.go similarity index 95% rename from ekms/gnmiHandlers/system/hostnameHandler.go rename to goKMS/gnmiHandlers/system/hostnameHandler.go index 461319ce29f8a1a511348a75cda7febd2fe66a74..42aa9e1affe571b3e1cd83c148651ab45d32cd73 100644 --- a/ekms/gnmiHandlers/system/hostnameHandler.go +++ b/goKMS/gnmiHandlers/system/hostnameHandler.go @@ -4,8 +4,8 @@ import ( "fmt" "code.fbi.h-da.de/danet/gnmi-target/handler" - gnmitargetygot "code.fbi.h-da.de/danet/quant/ekms/model" - "code.fbi.h-da.de/danet/quant/ekms/osclient" + gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model" + "code.fbi.h-da.de/danet/quant/goKMS/osclient" "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/ygot/ygot" "github.com/sirupsen/logrus" diff --git a/ekms/gnmiHandlers/system/memoryHandler.go b/goKMS/gnmiHandlers/system/memoryHandler.go similarity index 95% rename from ekms/gnmiHandlers/system/memoryHandler.go rename to goKMS/gnmiHandlers/system/memoryHandler.go index adb09b43e396b0c67e39c72f27c30e0fc483f00e..02fcb723f4ab7e737388c48b7e48682a4d330792 100644 --- a/ekms/gnmiHandlers/system/memoryHandler.go +++ b/goKMS/gnmiHandlers/system/memoryHandler.go @@ -4,8 +4,8 @@ import ( "fmt" "code.fbi.h-da.de/danet/gnmi-target/handler" - gnmitargetygot "code.fbi.h-da.de/danet/quant/ekms/model" - "code.fbi.h-da.de/danet/quant/ekms/osclient" + gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model" + "code.fbi.h-da.de/danet/quant/goKMS/osclient" "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/ygot/ygot" ) diff --git a/ekms/gnmiHandlers/system/stateHandler.go b/goKMS/gnmiHandlers/system/stateHandler.go similarity index 95% rename from ekms/gnmiHandlers/system/stateHandler.go rename to goKMS/gnmiHandlers/system/stateHandler.go index 461a2a5ae8e4ef917f7e6b8a058e4e574f33572a..989c5eb2dbb1058f9d54ac11061a887f315309ee 100644 --- a/ekms/gnmiHandlers/system/stateHandler.go +++ b/goKMS/gnmiHandlers/system/stateHandler.go @@ -5,8 +5,8 @@ import ( "time" "code.fbi.h-da.de/danet/gnmi-target/handler" - gnmitargetygot "code.fbi.h-da.de/danet/quant/ekms/model" - "code.fbi.h-da.de/danet/quant/ekms/osclient" + gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model" + "code.fbi.h-da.de/danet/quant/goKMS/osclient" "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/ygot/ygot" gopshost "github.com/shirou/gopsutil/host" diff --git a/ekms/gnmiHandlers/system/systemHandler.go b/goKMS/gnmiHandlers/system/systemHandler.go similarity index 95% rename from ekms/gnmiHandlers/system/systemHandler.go rename to goKMS/gnmiHandlers/system/systemHandler.go index 69b6eea1a2cf6243abea9bfc4e077d03bf6fe87b..4f253968c5201ed581d7c6f7de9c386048de13e3 100644 --- a/ekms/gnmiHandlers/system/systemHandler.go +++ b/goKMS/gnmiHandlers/system/systemHandler.go @@ -5,8 +5,8 @@ import ( "strings" "code.fbi.h-da.de/danet/gnmi-target/handler" - gnmitargetygot "code.fbi.h-da.de/danet/quant/ekms/model" - "code.fbi.h-da.de/danet/quant/ekms/osclient" + gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model" + "code.fbi.h-da.de/danet/quant/goKMS/osclient" "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/ygot/ygot" ) diff --git a/ekms/kms/akms/client/client.go b/goKMS/kms/akms/client/client.go similarity index 100% rename from ekms/kms/akms/client/client.go rename to goKMS/kms/akms/client/client.go diff --git a/ekms/kms/akms/server/receiver.go b/goKMS/kms/akms/server/receiver.go similarity index 100% rename from ekms/kms/akms/server/receiver.go rename to goKMS/kms/akms/server/receiver.go diff --git a/ekms/kms/akms/server/server.go b/goKMS/kms/akms/server/server.go similarity index 98% rename from ekms/kms/akms/server/server.go rename to goKMS/kms/akms/server/server.go index 98d7c8720bf24fd8d93dd16497142bf8222a7ece..879a7370b4373a99d2e9a6f0a74a593951820127 100644 --- a/ekms/kms/akms/server/server.go +++ b/goKMS/kms/akms/server/server.go @@ -4,7 +4,7 @@ import ( "encoding/json" "net/http" - "code.fbi.h-da.de/danet/quant/ekms/kms/event" + "code.fbi.h-da.de/danet/quant/goKMS/kms/event" "github.com/google/uuid" "github.com/sirupsen/logrus" ) diff --git a/ekms/kms/crypto/crypto.go b/goKMS/kms/crypto/crypto.go similarity index 100% rename from ekms/kms/crypto/crypto.go rename to goKMS/kms/crypto/crypto.go diff --git a/ekms/kms/crypto/utils.go b/goKMS/kms/crypto/utils.go similarity index 100% rename from ekms/kms/crypto/utils.go rename to goKMS/kms/crypto/utils.go diff --git a/ekms/kms/event/bus.go b/goKMS/kms/event/bus.go similarity index 100% rename from ekms/kms/event/bus.go rename to goKMS/kms/event/bus.go diff --git a/ekms/kms/event/event.go b/goKMS/kms/event/event.go similarity index 100% rename from ekms/kms/event/event.go rename to goKMS/kms/event/event.go diff --git a/ekms/kms/kms.go b/goKMS/kms/kms.go similarity index 86% rename from ekms/kms/kms.go rename to goKMS/kms/kms.go index 304bcd8ad4a7f0486f8472e83c57d25bda9aa3e8..f8588b483b4f01b71df3457cdfff0690bd869483 100644 --- a/ekms/kms/kms.go +++ b/goKMS/kms/kms.go @@ -21,15 +21,15 @@ import ( healthpb "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/metadata" - pbIC "code.fbi.h-da.de/danet/quant/ekms/api/gen/proto/go/kmsintercom" - "code.fbi.h-da.de/danet/quant/ekms/config" - "code.fbi.h-da.de/danet/quant/ekms/kms/akms/client" - "code.fbi.h-da.de/danet/quant/ekms/kms/akms/server" - "code.fbi.h-da.de/danet/quant/ekms/kms/crypto" - "code.fbi.h-da.de/danet/quant/ekms/kms/event" - "code.fbi.h-da.de/danet/quant/ekms/kms/peers" - "code.fbi.h-da.de/danet/quant/ekms/kms/store" - "code.fbi.h-da.de/danet/quant/ekms/kms/util" + pbIC "code.fbi.h-da.de/danet/quant/goKMS/api/gen/proto/go/kmsintercom" + "code.fbi.h-da.de/danet/quant/goKMS/config" + "code.fbi.h-da.de/danet/quant/goKMS/kms/akms/client" + "code.fbi.h-da.de/danet/quant/goKMS/kms/akms/server" + "code.fbi.h-da.de/danet/quant/goKMS/kms/crypto" + "code.fbi.h-da.de/danet/quant/goKMS/kms/event" + "code.fbi.h-da.de/danet/quant/goKMS/kms/peers" + "code.fbi.h-da.de/danet/quant/goKMS/kms/store" + "code.fbi.h-da.de/danet/quant/goKMS/kms/util" pbQS "code.fbi.h-da.de/danet/quipsec/gen/go/quipsec" "github.com/google/uuid" ) @@ -62,7 +62,7 @@ type PlatformKey struct { } // The general emulated KMS. -type EKMS struct { +type KMS struct { kmsName string kmsUUID uuid.UUID interComAddr string @@ -84,8 +84,8 @@ type EKMS struct { pbIC.UnimplementedKmsTalkerServer supportedKeyLengths map[BitKeyLength]bool eventBus *event.EventBus - CkmsAkmsClient client.CkmsAkmsClient - CkmsAkmsServer *server.AKMSReceiverServer + CKMSAkmsClient client.CkmsAkmsClient + CKMSAkmsServer *server.AKMSReceiverServer } type TlsData struct { @@ -103,7 +103,7 @@ type QuantumElementInterface interface { GetQlID() qlElementId }*/ -func NewEKMS(kmsUUID uuid.UUID, logOutput io.Writer, logLevel log.Level, logInJson bool, config *config.Config) (newEKMS *EKMS) { +func NewKMS(kmsUUID uuid.UUID, logOutput io.Writer, logLevel log.Level, logInJson bool, config *config.Config) (newKMS *KMS) { /* * Setup logging */ @@ -133,7 +133,7 @@ func NewEKMS(kmsUUID uuid.UUID, logOutput io.Writer, logLevel log.Level, logInJs ckmsAkmsClient := client.NewCkmsAkmsClient(config.AkmsURL) - createdEKMS := &EKMS{ + createdEKMS := &KMS{ kmsName: config.Name, kmsUUID: kmsUUID, interComAddr: config.InterComAddr, @@ -146,7 +146,7 @@ func NewEKMS(kmsUUID uuid.UUID, logOutput io.Writer, logLevel log.Level, logInJs KmsPeers: make(map[string]*peers.Peer), supportedKeyLengths: make(map[BitKeyLength]bool), eventBus: event.NewEventBus(), - CkmsAkmsClient: ckmsAkmsClient, + CKMSAkmsClient: ckmsAkmsClient, } createdEKMS.supportedKeyLengths[BitKeyLen256] = true @@ -162,15 +162,15 @@ func NewEKMS(kmsUUID uuid.UUID, logOutput io.Writer, logLevel log.Level, logInJs // Start the akmsCkmsReceiverServer if config.AkmsCkmsServerPort != "" { - createdEKMS.CkmsAkmsServer = server.NewAKMSReceiver(config.AkmsCkmsServerPort, createdEKMS.eventBus, createdEKMS.GenerateAndSendKSAKey) + createdEKMS.CKMSAkmsServer = server.NewAKMSReceiver(config.AkmsCkmsServerPort, createdEKMS.eventBus, createdEKMS.GenerateAndSendKSAKey) log.Infof("Starting AKMS receiver server on port: %s", config.AkmsCkmsServerPort) - go createdEKMS.CkmsAkmsServer.Serve() + go createdEKMS.CKMSAkmsServer.Serve() } return createdEKMS } -func initializePeers(ekms *EKMS, config *config.Config) error { +func initializePeers(kms *KMS, config *config.Config) error { var qm peers.QuantumModule var err error for _, peer := range config.Peers { @@ -189,7 +189,7 @@ func initializePeers(ekms *EKMS, config *config.Config) error { return nil } - err := ekms.AddQuantumElement(qm) + err := kms.AddQuantumElement(qm) if err != nil { log.Fatalf("Failed to add quantum element: %s", err) return nil @@ -217,7 +217,7 @@ func initializePeers(ekms *EKMS, config *config.Config) error { client.KmsTalkerClient = pbIC.NewKmsTalkerClient(newPeerConn) } - p, err := ekms.AddPeer(peer.PeerId, peer.PeerInterComAddr, qm, client) + p, err := kms.AddPeer(peer.PeerId, peer.PeerInterComAddr, qm, client) if err != nil { log.Fatalf("Failed to create a peer: %s", err) return nil @@ -239,7 +239,7 @@ func initializePeers(ekms *EKMS, config *config.Config) error { return nil } -func (kms *EKMS) startGRPC(interComAddr string, quantumAddress string, tlsData TlsData) { +func (kms *KMS) startGRPC(interComAddr string, quantumAddress string, tlsData TlsData) { interKMSLis, err := net.Listen("tcp", interComAddr) if err != nil { log.Fatalf("failed to listen: %v", err) @@ -261,7 +261,7 @@ func (kms *EKMS) startGRPC(interComAddr string, quantumAddress string, tlsData T healthpb.RegisterHealthServer(interKMSServer, healthCheck) pbIC.RegisterKmsTalkerServer(interKMSServer, &kmsTalkerServer{ keyNegotiationMap: make(map[uuid.UUID]*store.KmsKSElement), - eKMS: kms, + KMS: kms, }) quantumLis, err := net.Listen("tcp", quantumAddress) @@ -270,7 +270,7 @@ func (kms *EKMS) startGRPC(interComAddr string, quantumAddress string, tlsData T } quantumServ := grpc.NewServer() pbQS.RegisterKmsQkdmCommunicationServiceServer(quantumServ, &quipSecServer{ - eKMS: kms, + KMS: kms, }) go func() { @@ -290,7 +290,7 @@ func (kms *EKMS) startGRPC(interComAddr string, quantumAddress string, tlsData T } } -func (kms *EKMS) AddQuantumElement(qm peers.QuantumModule) error { +func (kms *KMS) AddQuantumElement(qm peers.QuantumModule) error { kms.quantumModulesMutex.Lock() defer kms.quantumModulesMutex.Unlock() log.Infof("quantum module address: %s ", qm.Address()) @@ -298,7 +298,7 @@ func (kms *EKMS) AddQuantumElement(qm peers.QuantumModule) error { return nil } -func (kms *EKMS) AddPeer(peerKmsId string, kmsPeerSocket string, servingQLE peers.QuantumModule, client *peers.GRPCClient) (*peers.Peer, error) { +func (kms *KMS) AddPeer(peerKmsId string, kmsPeerSocket string, servingQLE peers.QuantumModule, client *peers.GRPCClient) (*peers.Peer, error) { // check if peer exists if _, there := kms.KmsPeers[peerKmsId]; there { log.Errorf("Trying to add existing peer %s, with KMS ID %s", kmsPeerSocket, peerKmsId) @@ -318,7 +318,7 @@ func (kms *EKMS) AddPeer(peerKmsId string, kmsPeerSocket string, servingQLE peer return peer, nil } -func (kms *EKMS) AssignForwardingRoute(pId, pHop, nHop string, remoteKMS *RemoteKMS) error { +func (kms *KMS) AssignForwardingRoute(pId, pHop, nHop string, remoteKMS *RemoteKMS) error { pathId, err := uuid.Parse(pId) if err != nil { return fmt.Errorf("the given path id %s is no uuid; err = %w", pathId, err) @@ -402,7 +402,7 @@ func (kms *EKMS) AssignForwardingRoute(pId, pHop, nHop string, remoteKMS *Remote return nil } -func (kms *EKMS) GetSpecificPK(remoteKMSId string, keyId uuid.UUID) (*PlatformKey, error) { +func (kms *KMS) GetSpecificPK(remoteKMSId string, keyId uuid.UUID) (*PlatformKey, error) { kms.PKStoreMutex.Lock() defer kms.PKStoreMutex.Unlock() @@ -419,7 +419,7 @@ func (kms *EKMS) GetSpecificPK(remoteKMSId string, keyId uuid.UUID) (*PlatformKe return pk, nil } -func (kms *EKMS) GetRandomItemFromPKStore(remoteKMSId string) (uuid.UUID, *PlatformKey, error) { +func (kms *KMS) GetRandomItemFromPKStore(remoteKMSId string) (uuid.UUID, *PlatformKey, error) { kms.PKStoreMutex.Lock() defer kms.PKStoreMutex.Unlock() @@ -432,7 +432,7 @@ func (kms *EKMS) GetRandomItemFromPKStore(remoteKMSId string) (uuid.UUID, *Platf return util.RandomItemFromMapAndRemove(keyIds) } -func (kms *EKMS) GetRemoteKMS(remoteKMSId string) (*RemoteKMS, error) { +func (kms *KMS) GetRemoteKMS(remoteKMSId string) (*RemoteKMS, error) { kms.remoteKMSMappingMutex.RLock() defer kms.remoteKMSMappingMutex.RUnlock() @@ -444,7 +444,7 @@ func (kms *EKMS) GetRemoteKMS(remoteKMSId string) (*RemoteKMS, error) { } // NOTE: address/remoteid still have to decide. -func (kms *EKMS) GenerateAndSendKSAKey(remoteKMSId string, pathId uuid.UUID, requestId string, number int) error { +func (kms *KMS) GenerateAndSendKSAKey(remoteKMSId string, pathId uuid.UUID, requestId string, number int) error { if number < 1 { log.Errorf("number must be positive and at least 1, provided: %d\n", number) return fmt.Errorf("number must be positive and at least 1, provided: %d", number) @@ -536,7 +536,7 @@ func (kms *EKMS) GenerateAndSendKSAKey(remoteKMSId string, pathId uuid.UUID, req } // Use the real processID when we know what it is - err = kms.CkmsAkmsClient.SendKSAKeys(requestId, pk.ProcessId, akmsKSAKeys) + err = kms.CKMSAkmsClient.SendKSAKeys(requestId, pk.ProcessId, akmsKSAKeys) if err != nil { log.Error(err) return err @@ -545,12 +545,12 @@ func (kms *EKMS) GenerateAndSendKSAKey(remoteKMSId string, pathId uuid.UUID, req return nil } -func (kms *EKMS) EventBus() *event.EventBus { +func (kms *KMS) EventBus() *event.EventBus { return kms.eventBus } // TODO/XXX error handling. -func (kms *EKMS) RemovePeer(kmsPeerSocket string) { +func (kms *KMS) RemovePeer(kmsPeerSocket string) { if _, there := kms.KmsPeers[kmsPeerSocket]; there { // peer.quit <- true delete(kms.KmsPeers, kmsPeerSocket) @@ -559,7 +559,7 @@ func (kms *EKMS) RemovePeer(kmsPeerSocket string) { log.Errorf("%s: Can not find a peer with socket: %s", kms.kmsName, kmsPeerSocket) } -func (kms *EKMS) FindPeerUuid(lookup uuid.UUID) (peer *peers.Peer) { +func (kms *KMS) FindPeerUuid(lookup uuid.UUID) (peer *peers.Peer) { if kms.KmsPeers != nil { for _, peer = range kms.KmsPeers { if peer.Id() == lookup { @@ -571,7 +571,7 @@ func (kms *EKMS) FindPeerUuid(lookup uuid.UUID) (peer *peers.Peer) { return nil } -func (kms *EKMS) RoutingTableDeepCopy() map[uuid.UUID]*Route { +func (kms *KMS) RoutingTableDeepCopy() map[uuid.UUID]*Route { routingTableCopy := make(map[uuid.UUID]*Route, len(kms.KmsPeers)) kms.routingTableMutex.Lock() @@ -583,7 +583,7 @@ func (kms *EKMS) RoutingTableDeepCopy() map[uuid.UUID]*Route { return routingTableCopy } -func (kms *EKMS) PeersDeepCopy() map[string]*peers.Peer { +func (kms *KMS) PeersDeepCopy() map[string]*peers.Peer { peersCopy := make(map[string]*peers.Peer, len(kms.KmsPeers)) kms.kmsPeersMutex.Lock() diff --git a/ekms/kms/kmsintercom.go b/goKMS/kms/kmsintercom.go similarity index 88% rename from ekms/kms/kmsintercom.go rename to goKMS/kms/kmsintercom.go index 320b345c49f2774ba63a45d05c0e686e59fe5421..65e205912a3a9f168990d9376f992315fb6e91de 100644 --- a/ekms/kms/kmsintercom.go +++ b/goKMS/kms/kmsintercom.go @@ -9,14 +9,14 @@ import ( "github.com/google/uuid" log "github.com/sirupsen/logrus" - pb "code.fbi.h-da.de/danet/quant/ekms/api/gen/proto/go/kmsintercom" - "code.fbi.h-da.de/danet/quant/ekms/kms/akms/client" - "code.fbi.h-da.de/danet/quant/ekms/kms/crypto" - "code.fbi.h-da.de/danet/quant/ekms/kms/event" - "code.fbi.h-da.de/danet/quant/ekms/kms/peers" - "code.fbi.h-da.de/danet/quant/ekms/kms/store" - "code.fbi.h-da.de/danet/quant/ekms/kms/util" etsi14 "code.fbi.h-da.de/danet/quant/etsi014/go/rest/etsi/client" + pb "code.fbi.h-da.de/danet/quant/goKMS/api/gen/proto/go/kmsintercom" + "code.fbi.h-da.de/danet/quant/goKMS/kms/akms/client" + "code.fbi.h-da.de/danet/quant/goKMS/kms/crypto" + "code.fbi.h-da.de/danet/quant/goKMS/kms/event" + "code.fbi.h-da.de/danet/quant/goKMS/kms/peers" + "code.fbi.h-da.de/danet/quant/goKMS/kms/store" + "code.fbi.h-da.de/danet/quant/goKMS/kms/util" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" @@ -28,7 +28,7 @@ import ( type kmsTalkerServer struct { pb.UnimplementedKmsTalkerServer keyNegotiationMap map[uuid.UUID]*store.KmsKSElement - eKMS *EKMS + KMS *KMS } // This must somehow find out and agree to a specific key length. @@ -47,7 +47,7 @@ func (s *kmsTalkerServer) InterComCapabilities(ctx context.Context, in *pb.Inter func (s *kmsTalkerServer) KeyIdNotification(ctx context.Context, in *pb.KeyIdNotificationRequest) (*pb.KeyIdNotificationResponse, error) { // check if a peer exists - peer, ok := s.eKMS.KmsPeers[in.GetKmsId()] + peer, ok := s.KMS.KmsPeers[in.GetKmsId()] if !ok { // TODO: proper error message return nil, status.Error(codes.Internal, "peer does not exist") @@ -102,7 +102,7 @@ func (s *kmsTalkerServer) SyncQkdBulk(ctx context.Context, in *pb.SyncQkdBulkReq p, _ := peer.FromContext(ctx) log.Infof("Received SyncQkdBulkRequest from %s", p.Addr.String()) // check if a peer exists - peer, ok := s.eKMS.KmsPeers[in.GetKmsId()] + peer, ok := s.KMS.KmsPeers[in.GetKmsId()] if !ok { // TODO: proper error message return nil, status.Errorf(codes.Internal, "peer does not exist") @@ -128,7 +128,7 @@ func (s *kmsTalkerServer) SyncQkdBulk(ctx context.Context, in *pb.SyncQkdBulkReq } func (s *kmsTalkerServer) SyncKeyIdsForBulk(ctx context.Context, in *pb.SyncKeyIdsForBulkRequest) (*pb.SyncKeyIdsForBulkResponse, error) { - peer, ok := s.eKMS.KmsPeers[in.GetKmsId()] + peer, ok := s.KMS.KmsPeers[in.GetKmsId()] if !ok { return nil, status.Errorf(codes.Internal, "For KMS id: %s, no peer exists", in.GetKmsId()) } @@ -187,7 +187,7 @@ func (s *kmsTalkerServer) InterComTransportKeyNegotiation(ctx context.Context, i return nil, status.Errorf(codes.InvalidArgument, "path id: %s can not be parsed to uuid", in.GetPathID()) } - route, ok := s.eKMS.routingTable[pathId] + route, ok := s.KMS.routingTable[pathId] if !ok { return nil, status.Errorf(codes.Internal, "There is no route for the given pathID: %s .", in.PathID) } @@ -229,12 +229,12 @@ func (s *kmsTalkerServer) KeyForwarding(ctx context.Context, in *pb.KeyForwardin return nil, status.Errorf(codes.InvalidArgument, "") } - route, ok := s.eKMS.routingTable[pathId] + route, ok := s.KMS.routingTable[pathId] if !ok { return nil, status.Errorf(codes.Internal, "There is no route for the given pathID: %s .", in.PathId) } - log.Infof("%s received a key: %s, from %s", s.eKMS.kmsName, in.GetKey(), route.Previous.TcpSocketStr) + log.Infof("%s received a key: %s, from %s", s.KMS.kmsName, in.GetKey(), route.Previous.TcpSocketStr) keyAsByte, err := base64.StdEncoding.DecodeString(in.GetKey().GetKey()) if err != nil { @@ -253,7 +253,7 @@ func (s *kmsTalkerServer) KeyForwarding(ctx context.Context, in *pb.KeyForwardin keyID, err := uuid.Parse(in.GetKey().GetId()) if route.Next != nil { - log.Infof("%s forwards payload to : %s", s.eKMS.kmsName, route.Next.TcpSocketStr) + log.Infof("%s forwards payload to : %s", s.KMS.kmsName, route.Next.TcpSocketStr) if err != nil { return nil, status.Errorf(codes.Internal, "%s", err) } @@ -264,11 +264,11 @@ func (s *kmsTalkerServer) KeyForwarding(ctx context.Context, in *pb.KeyForwardin Key: decryptedKey, }, pathId, processId) } else { - log.Infof("%s received the final payload: %s", s.eKMS.kmsName, string(decryptedKey)) - s.eKMS.PKStoreMutex.Lock() - keys, ok := s.eKMS.PKStore[route.RemoteKMS.Id] + log.Infof("%s received the final payload: %s", s.KMS.kmsName, string(decryptedKey)) + s.KMS.PKStoreMutex.Lock() + keys, ok := s.KMS.PKStore[route.RemoteKMS.Id] if !ok { - s.eKMS.PKStore[route.RemoteKMS.Id] = map[uuid.UUID]*PlatformKey{ + s.KMS.PKStore[route.RemoteKMS.Id] = map[uuid.UUID]*PlatformKey{ keyID: { Id: keyID, Value: decryptedKey, @@ -283,12 +283,12 @@ func (s *kmsTalkerServer) KeyForwarding(ctx context.Context, in *pb.KeyForwardin } } - log.Debug("Current PKSTORE: ", s.eKMS.PKStore) - s.eKMS.PKStoreMutex.Unlock() + log.Debug("Current PKSTORE: ", s.KMS.PKStore) + s.KMS.PKStoreMutex.Unlock() var gRPCTransportCreds credentials.TransportCredentials - if s.eKMS.tlsData.TLS { - gRPCTransportCreds, err = util.GenerateGRPCClientTransportCredsWithTLS(s.eKMS.tlsData.CaFile, s.eKMS.tlsData.CertFile, s.eKMS.tlsData.KeyFile) + if s.KMS.tlsData.TLS { + gRPCTransportCreds, err = util.GenerateGRPCClientTransportCredsWithTLS(s.KMS.tlsData.CaFile, s.KMS.tlsData.CertFile, s.KMS.tlsData.KeyFile) if err != nil { log.Fatalf("unable to generate TLS creds: %v", err) } @@ -329,7 +329,7 @@ func (s *kmsTalkerServer) AckKeyForwarding(ctx context.Context, in *pb.AckKeyFor // - Are pathId and processId valid? // - Is the keyId valid? - err = s.eKMS.CkmsAkmsServer.Receiver.InformReceiver(pathId) + err = s.KMS.CKMSAkmsServer.Receiver.InformReceiver(pathId) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "Failed while informing Receiver; err: %v", err) } @@ -345,7 +345,7 @@ func (s *kmsTalkerServer) KeyDelivery(ctx context.Context, in *pb.KeyDeliveryReq } // look up PK - pk, err := s.eKMS.GetSpecificPK(in.GetKmsId(), keyId) + pk, err := s.KMS.GetSpecificPK(in.GetKmsId(), keyId) if err != nil { return nil, status.Errorf(codes.NotFound, "%s", err) } @@ -382,7 +382,7 @@ func (s *kmsTalkerServer) KeyDelivery(ctx context.Context, in *pb.KeyDeliveryReq } // Use the real processID when we know what it is - go s.eKMS.CkmsAkmsClient.SendKSAKeys(in.GetRequestId(), pk.ProcessId, akmsKSAKeys) //nolint:errcheck + go s.KMS.CKMSAkmsClient.SendKSAKeys(in.GetRequestId(), pk.ProcessId, akmsKSAKeys) //nolint:errcheck return &pb.KeyDeliveryResponse{Timestamp: time.Now().Unix()}, nil } diff --git a/ekms/kms/peers/peers.go b/goKMS/kms/peers/peers.go similarity index 97% rename from ekms/kms/peers/peers.go rename to goKMS/kms/peers/peers.go index 1ed10f12cb5d1a4ab28e699aad5f701625f80035..7d606f9b3985f4c600a62b0f66d25ff8593d141a 100644 --- a/ekms/kms/peers/peers.go +++ b/goKMS/kms/peers/peers.go @@ -7,9 +7,9 @@ import ( "net" "time" - pbIC "code.fbi.h-da.de/danet/quant/ekms/api/gen/proto/go/kmsintercom" - "code.fbi.h-da.de/danet/quant/ekms/kms/crypto" - "code.fbi.h-da.de/danet/quant/ekms/kms/event" + pbIC "code.fbi.h-da.de/danet/quant/goKMS/api/gen/proto/go/kmsintercom" + "code.fbi.h-da.de/danet/quant/goKMS/kms/crypto" + "code.fbi.h-da.de/danet/quant/goKMS/kms/event" "github.com/google/uuid" log "github.com/sirupsen/logrus" ) diff --git a/ekms/kms/peers/qmodule.go b/goKMS/kms/peers/qmodule.go similarity index 97% rename from ekms/kms/peers/qmodule.go rename to goKMS/kms/peers/qmodule.go index 053013685716cb49645e81e3141feb19bdaca4d0..3fa2bfe4de0d40ecb0b2eecb05bcfffd5294e957 100644 --- a/ekms/kms/peers/qmodule.go +++ b/goKMS/kms/peers/qmodule.go @@ -12,12 +12,12 @@ import ( "sync" "time" - pbIC "code.fbi.h-da.de/danet/quant/ekms/api/gen/proto/go/kmsintercom" - "code.fbi.h-da.de/danet/quant/ekms/kms/event" - "code.fbi.h-da.de/danet/quant/ekms/kms/store" - "code.fbi.h-da.de/danet/quant/ekms/kms/util" - restclient "code.fbi.h-da.de/danet/quant/ekms/restclient" etsi14 "code.fbi.h-da.de/danet/quant/etsi014/go/rest/etsi/client" + pbIC "code.fbi.h-da.de/danet/quant/goKMS/api/gen/proto/go/kmsintercom" + "code.fbi.h-da.de/danet/quant/goKMS/kms/event" + "code.fbi.h-da.de/danet/quant/goKMS/kms/store" + "code.fbi.h-da.de/danet/quant/goKMS/kms/util" + restclient "code.fbi.h-da.de/danet/quant/goKMS/restclient" "code.fbi.h-da.de/danet/quant/quantumlayer" "github.com/google/uuid" "github.com/sirupsen/logrus" diff --git a/ekms/kms/quipsec.go b/goKMS/kms/quipsec.go similarity index 89% rename from ekms/kms/quipsec.go rename to goKMS/kms/quipsec.go index 7c026d4962a1859ff0e32e1936885fd30f155138..127ec781073d4ba8ccdf9fd959ea7ac10206e04b 100644 --- a/ekms/kms/quipsec.go +++ b/goKMS/kms/quipsec.go @@ -6,7 +6,7 @@ import ( "strconv" "time" - "code.fbi.h-da.de/danet/quant/ekms/kms/peers" + "code.fbi.h-da.de/danet/quant/goKMS/kms/peers" "code.fbi.h-da.de/danet/quant/quantumlayer" pb "code.fbi.h-da.de/danet/quipsec/gen/go/quipsec" "github.com/sirupsen/logrus" @@ -17,7 +17,7 @@ import ( type quipSecServer struct { pb.UnimplementedKmsQkdmCommunicationServiceServer - eKMS *EKMS + KMS *KMS } func (qs *quipSecServer) PushKeys(ctx context.Context, req *pb.PushKeysRequest) (*pb.PushKeysResponse, error) { @@ -31,7 +31,7 @@ func (qs *quipSecServer) PushKeys(ctx context.Context, req *pb.PushKeysRequest) // TODO: qm.address is used as key for map. could be // used here to directly access. - for _, qm := range qs.eKMS.quantumModules { + for _, qm := range qs.KMS.quantumModules { if qm.Address() == host { eqm, ok := qm.(*peers.EmulatedQuantumModule) if !ok { @@ -53,7 +53,7 @@ func (qs *quipSecServer) PushKeys(ctx context.Context, req *pb.PushKeysRequest) BulkKey: &req.GetKeyBulk().Keys, } eqm.RawBulkKeysMutex.Unlock() - logrus.Debugf("%s received a new bulk from: %s with id: %s and a length of: %d", qs.eKMS.kmsName, qm.Address(), req.GetKeyBulk().GetKeyId(), req.GetKeyBulk().GetKeyLength()) + logrus.Debugf("%s received a new bulk from: %s with id: %s and a length of: %d", qs.KMS.kmsName, qm.Address(), req.GetKeyBulk().GetKeyId(), req.GetKeyBulk().GetKeyLength()) return &pb.PushKeysResponse{Timestamp: time.Now().Unix()}, nil } } diff --git a/ekms/kms/store/kms-keystore.go b/goKMS/kms/store/kms-keystore.go similarity index 100% rename from ekms/kms/store/kms-keystore.go rename to goKMS/kms/store/kms-keystore.go diff --git a/ekms/kms/util/util.go b/goKMS/kms/util/util.go similarity index 100% rename from ekms/kms/util/util.go rename to goKMS/kms/util/util.go diff --git a/ekms/main.go b/goKMS/main.go similarity index 87% rename from ekms/main.go rename to goKMS/main.go index 19387329775e0761af8f428459a379219db8f4ed..18d552c537effd0206716aa3a03a423c8a8dd06c 100644 --- a/ekms/main.go +++ b/goKMS/main.go @@ -38,11 +38,11 @@ import ( gnmitarget "code.fbi.h-da.de/danet/gnmi-target" "code.fbi.h-da.de/danet/gnmi-target/handler" - "code.fbi.h-da.de/danet/quant/ekms/config" - kmsHandler "code.fbi.h-da.de/danet/quant/ekms/gnmiHandlers/kms" - "code.fbi.h-da.de/danet/quant/ekms/gnmiHandlers/system" - "code.fbi.h-da.de/danet/quant/ekms/kms" - gnmitargetygot "code.fbi.h-da.de/danet/quant/ekms/model" + "code.fbi.h-da.de/danet/quant/goKMS/config" + kmsHandler "code.fbi.h-da.de/danet/quant/goKMS/gnmiHandlers/kms" + "code.fbi.h-da.de/danet/quant/goKMS/gnmiHandlers/system" + "code.fbi.h-da.de/danet/quant/goKMS/kms" + gnmitargetygot "code.fbi.h-da.de/danet/quant/goKMS/model" "github.com/google/uuid" log "github.com/sirupsen/logrus" "gopkg.in/yaml.v3" @@ -82,17 +82,17 @@ func main() { } // initialize id for the kms - var ekmsId uuid.UUID + var kmsId uuid.UUID if kmsConfig.Id != "" { - ekmsId = uuid.MustParse(kmsConfig.Id) + kmsId = uuid.MustParse(kmsConfig.Id) } else { - ekmsId = uuid.New() + kmsId = uuid.New() } resolveHostnameToIPForQuantumModules(kmsConfig) - ekmsInfo := generateKMSInfo(ekmsId) + kmsInfo := generateKMSInfo(kmsId) - kms := kms.NewEKMS(ekmsId, os.Stdout, log.GetLevel(), false, kmsConfig) + kms := kms.NewKMS(kmsId, os.Stdout, log.GetLevel(), false, kmsConfig) schema, err := gnmitargetygot.Schema() if err != nil { @@ -108,7 +108,7 @@ func main() { system.NewStateHandler(), system.NewSystemHandler(), kmsHandler.NewCreateRouteHandler(kms), - kmsHandler.NewKmsHandler(ekmsInfo), + kmsHandler.NewKmsHandler(kmsInfo), kmsHandler.NewPeerHandler(kms), kmsHandler.NewKeyRoutingSessionHandler(kms), kmsHandler.NewAssignForwardingHandler(kms), @@ -120,7 +120,7 @@ func main() { } } -// TODO: a better place would probably kms.NewEKMS(). +// TODO: a better place would probably kms.NewKMS(). func resolveHostnameToIPForQuantumModules(config *config.Config) { const connectionRetries = 60 var ipAddr []net.IP @@ -154,8 +154,8 @@ func resolveHostnameToIPForQuantumModules(config *config.Config) { } } -func generateKMSInfo(id uuid.UUID) *config.EKMSInfo { - ekmsVersionInformation := config.NewEKMSVersionInformation("danet-emulated-kms", "0.1.0", "0.1.0") +func generateKMSInfo(id uuid.UUID) *config.KMSInfo { + kmsVersionInformation := config.NewKMSVersionInformation("danet-emulated-kms", "0.1.0", "0.1.0") - return config.NewEKMSInfo(id, ekmsVersionInformation, make(chan string)) + return config.NewKMSInfo(id, kmsVersionInformation, make(chan string)) } diff --git a/ekms/model/config.yaml b/goKMS/model/config.yaml similarity index 100% rename from ekms/model/config.yaml rename to goKMS/model/config.yaml diff --git a/ekms/model/yang.go b/goKMS/model/yang.go similarity index 100% rename from ekms/model/yang.go rename to goKMS/model/yang.go diff --git a/ekms/models/danet/temp.yang b/goKMS/models/danet/temp.yang similarity index 100% rename from ekms/models/danet/temp.yang rename to goKMS/models/danet/temp.yang diff --git a/ekms/models/third_party/etsi/qkd/etsi-qkd-node-types.yang b/goKMS/models/third_party/etsi/qkd/etsi-qkd-node-types.yang similarity index 100% rename from ekms/models/third_party/etsi/qkd/etsi-qkd-node-types.yang rename to goKMS/models/third_party/etsi/qkd/etsi-qkd-node-types.yang diff --git a/ekms/models/third_party/etsi/qkd/etsi-qkd-sdn-node-no-notififcations.yang b/goKMS/models/third_party/etsi/qkd/etsi-qkd-sdn-node-no-notififcations.yang similarity index 100% rename from ekms/models/third_party/etsi/qkd/etsi-qkd-sdn-node-no-notififcations.yang rename to goKMS/models/third_party/etsi/qkd/etsi-qkd-sdn-node-no-notififcations.yang diff --git a/goKMS/models/third_party/openconfig b/goKMS/models/third_party/openconfig new file mode 160000 index 0000000000000000000000000000000000000000..bf857b7f09425b8e1b88e64745315d9b5e816b46 --- /dev/null +++ b/goKMS/models/third_party/openconfig @@ -0,0 +1 @@ +Subproject commit bf857b7f09425b8e1b88e64745315d9b5e816b46 diff --git a/ekms/osclient/additions/system.go b/goKMS/osclient/additions/system.go similarity index 100% rename from ekms/osclient/additions/system.go rename to goKMS/osclient/additions/system.go diff --git a/ekms/osclient/additions/system_freebsd.go b/goKMS/osclient/additions/system_freebsd.go similarity index 96% rename from ekms/osclient/additions/system_freebsd.go rename to goKMS/osclient/additions/system_freebsd.go index e7c287a5b958a766661a9ef36fb1561fc7a125b9..781572e554d4488b3ef3515b070e34f76b63277e 100644 --- a/ekms/osclient/additions/system_freebsd.go +++ b/goKMS/osclient/additions/system_freebsd.go @@ -60,7 +60,7 @@ func (sys *system) GetUsedMemory() uint64 { // TODO: replace by real motd and not just this text. func (sys *system) GetMotd() (string, error) { - return "generic ekms motd. Not real OS motd, sorry.", nil + return "generic kms motd. Not real OS motd, sorry.", nil } func (sys *system) SetMotd(message string) error { diff --git a/ekms/osclient/additions/system_freebsd_test.go b/goKMS/osclient/additions/system_freebsd_test.go similarity index 100% rename from ekms/osclient/additions/system_freebsd_test.go rename to goKMS/osclient/additions/system_freebsd_test.go diff --git a/ekms/osclient/additions/system_linux.go b/goKMS/osclient/additions/system_linux.go similarity index 100% rename from ekms/osclient/additions/system_linux.go rename to goKMS/osclient/additions/system_linux.go diff --git a/ekms/osclient/additions/system_linux_test.go b/goKMS/osclient/additions/system_linux_test.go similarity index 100% rename from ekms/osclient/additions/system_linux_test.go rename to goKMS/osclient/additions/system_linux_test.go diff --git a/ekms/osclient/additions/types.go b/goKMS/osclient/additions/types.go similarity index 100% rename from ekms/osclient/additions/types.go rename to goKMS/osclient/additions/types.go diff --git a/ekms/osclient/client.go b/goKMS/osclient/client.go similarity index 88% rename from ekms/osclient/client.go rename to goKMS/osclient/client.go index c37ec4addfaf707b9115e2645e032d7a127e3f76..ed07cc7217af0ac4da48afa361835de76f56be00 100644 --- a/ekms/osclient/client.go +++ b/goKMS/osclient/client.go @@ -1,7 +1,7 @@ package osclient import ( - "code.fbi.h-da.de/danet/quant/ekms/osclient/additions" + "code.fbi.h-da.de/danet/quant/goKMS/osclient/additions" "github.com/openconfig/ygot/ygot" ) diff --git a/ekms/restclient/restclient.go b/goKMS/restclient/restclient.go similarity index 100% rename from ekms/restclient/restclient.go rename to goKMS/restclient/restclient.go diff --git a/integration-tests/docker-compose_integration_test.yml b/integration-tests/docker-compose_integration_test.yml index 9daa904751bcb55fafcd3738cb2b1b2b498a9c2a..4c6dacf19900291f05baf2fbad26c7ad9874c8fd 100644 --- a/integration-tests/docker-compose_integration_test.yml +++ b/integration-tests/docker-compose_integration_test.yml @@ -1,6 +1,6 @@ services: kms_1: - image: ekms + image: gokms command: [ "--log", @@ -17,7 +17,7 @@ services: - "127.0.0.1:9696:9696" kms_2: - image: ekms + image: gokms command: [ "--log", diff --git a/playground.clab.yaml b/playground.clab.yaml index 5152142cf1f8811897cbaf3ad807327d851ac299..8dc09fb6ac19e9626e274c5939271c19ffd31f47 100644 --- a/playground.clab.yaml +++ b/playground.clab.yaml @@ -8,7 +8,7 @@ topology: nodes: gosdn: kind: linux - image: registry.code.fbi.h-da.de/danet/gosdn:186ee2883e513cc6cdc0856da61aa4b1e0e562ad + image: registry.code.fbi.h-da.de/danet/gosdn:latest ports: - 55055:55055 - 8080:8080 @@ -27,50 +27,50 @@ topology: gosdnc: kind: linux - image: registry.code.fbi.h-da.de/danet/gosdn/gosdnc:186ee2883e513cc6cdc0856da61aa4b1e0e562ad + image: registry.code.fbi.h-da.de/danet/gosdn/gosdnc:latest mgmt-ipv4: 172.100.20.4 binds: - - ./config/ekms01-a.json:/ekms01-a.json - - ./config/ekms02-a.json:/ekms02-a.json - - ./config/ekms03-a.json:/ekms03-a.json - - ./config/ekms01-b.json:/ekms01-b.json - - ./config/ekms02-b.json:/ekms02-b.json - - ./config/ekms03-b.json:/ekms03-b.json + - ./config/kms01-a.json:/kms01-a.json + - ./config/kms02-a.json:/kms02-a.json + - ./config/kms03-a.json:/kms03-a.json + - ./config/kms01-b.json:/kms01-b.json + - ./config/kms02-b.json:/kms02-b.json + - ./config/kms03-b.json:/kms03-b.json - ./config/scripts/add_kms_to_controller.sh:/scripts/add_kms_to_controller.sh exec: - bash /scripts/add_kms_to_controller.sh kms1: kind: linux - image: registry.code.fbi.h-da.de/danet/quant/ekms:master + image: registry.code.fbi.h-da.de/danet/quant/gokms:latest mgmt-ipv4: 172.100.20.10 binds: - - ./config/ekms/example01.yaml:/tmp/kms/config/ekms01.yaml - cmd: start --log debug --kms_config /tmp/kms/config/ekms01.yaml --insecure + - ./config/kms/example01.yaml:/tmp/kms/config/kms01.yaml + cmd: --log debug --kms_config /tmp/kms/config/kms01.yaml --insecure kms2: kind: linux - image: registry.code.fbi.h-da.de/danet/quant/ekms:master + image: registry.code.fbi.h-da.de/danet/quant/gokms:latest mgmt-ipv4: 172.100.20.11 binds: - - ./config/ekms/example02.yaml:/tmp/kms/config/ekms02.yaml - cmd: start --log debug --kms_config /tmp/kms/config/ekms02.yaml --insecure + - ./config/kms/example02.yaml:/tmp/kms/config/kms02.yaml + cmd: --log debug --kms_config /tmp/kms/config/kms02.yaml --insecure kms3: kind: linux - image: registry.code.fbi.h-da.de/danet/quant/ekms:master + image: registry.code.fbi.h-da.de/danet/quant/gokms:latest mgmt-ipv4: 172.100.20.12 binds: - - ./config/ekms/example03.yaml:/tmp/kms/config/ekms03.yaml - cmd: start --log debug --kms_config /tmp/kms/config/ekms03.yaml --insecure + - ./config/kms/example03.yaml:/tmp/kms/config/kms03.yaml + cmd: --log debug --kms_config /tmp/kms/config/kms03.yaml --insecure kms4: kind: linux - image: registry.code.fbi.h-da.de/danet/quant/ekms:master + image: registry.code.fbi.h-da.de/danet/quant/gokms:latest mgmt-ipv4: 172.100.20.13 binds: - - ./config/ekms/example04.yaml:/tmp/kms/config/ekms04.yaml - cmd: start --log debug --kms_config /tmp/kms/config/ekms04.yaml --insecure + - ./config/kms/example04.yaml:/tmp/kms/config/kms04.yaml + cmd: --log debug --kms_config /tmp/kms/config/kms04.yaml --insecure qlayer01: kind: linux diff --git a/quantumlayer/.dockerignore b/quantumlayer/.dockerignore index de153db3b796413119418ec4b9f82dad2e8cb939..4a13f17ca81f6c80fcc90db7f54315dee3fbbb0a 100644 --- a/quantumlayer/.dockerignore +++ b/quantumlayer/.dockerignore @@ -1 +1,2 @@ artifacts +goKMS diff --git a/quantumlayer/quantumlayer-emulator.go b/quantumlayer/quantumlayer-emulator.go index c6d2ef91fe816675c44b03a404314659cd3d2b56..644306784330861ae972fcca6ae62f0fd0968cf5 100644 --- a/quantumlayer/quantumlayer-emulator.go +++ b/quantumlayer/quantumlayer-emulator.go @@ -36,10 +36,12 @@ func (ql *QuantumlayerEmulator) Start() { data, length, err := ql.randomNumberSource.GenerateRandomBytes() if err != nil { logrus.Error("Error generating random numbers: ", err) + continue } err = ql.sendDatatoKMS(data, length, iteration) if err != nil { logrus.Error("Error sending data to KMS: ", err) + continue } logrus.Infof("Iteration %d: Sent %d bytes to KMS", iteration, length) iteration++