From cd547f8852e425a53673571dd07b6dd7a4612467 Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Thu, 13 Jul 2023 14:51:14 -0400 Subject: [PATCH 01/29] update getZiti in ziti-cli-functions --- quickstart/docker/image/ziti-cli-functions.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 9e38332aa..426c29632 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -695,11 +695,6 @@ function getZiti { # Unzip the files tar -xf "${ziti_binaries_file_abspath}" --directory "${ZITI_BIN_DIR}" - # Files unzip to a /ziti subdirectory, move them into ZITI_BIN_DIR - # Have to rename the directory first since 'ziti' matches the filename for the 'ziti' binary - mv "${ZITI_BIN_DIR}/ziti" "${ZITI_BIN_DIR}/ziti-extract" - mv "${ZITI_BIN_DIR}/ziti-extract"/* "${ZITI_BIN_DIR}" - # Cleanup rm "${ziti_binaries_file_abspath}" # Remove zip rm -rf "${ZITI_BIN_DIR}/ziti-extract" # Remove extract folder From 1abcacbb6c682817d8d01615df0abc01626f37d9 Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:02:16 -0400 Subject: [PATCH 02/29] add a couple of useful functions back --- quickstart/docker/image/ziti-cli-functions.sh | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 426c29632..fc4068e49 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -1498,4 +1498,43 @@ function waitForController { _wait_for_controller } +function printUsage() { + echo "Usage: ${1-} [cert to test] [ca pool to use]" +} + +function verifyCertAgainstPool() { + if [[ "" == "${1-}" ]] + then + printUsage "verifyCertAgainstPool" + return 1 + fi + + if [[ "" == "$2" ]] + then + printUsage "verifyCertAgainstPool" + return 1 + fi + + echo " Verifying that this certificate:" + echo " - ${1-}" + echo " is valid for this ca pool:" + echo " - $2" + echo "" + openssl verify -partial_chain -CAfile "$2" "${1-}" + # shellcheck disable=SC2181 + if [ $? -eq 0 ]; then + echo "" + echo "============ SUCCESS! ============" + else + echo "" + echo "============ FAILED TO VALIDATE ============" + fi +} + +function showIssuerAndSubjectForPEM() { + echo "Displaying Issuer and Subject for cert pool:" + echo " ${1-}" + openssl crl2pkcs7 -nocrl -certfile "${1-}" | openssl pkcs7 -print_certs -text -noout | grep -E "(Subject|Issuer)" +} set +uo pipefail + From c1daaea08561a7e27d19fd106c51cac1e8bc247b Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:08:42 -0400 Subject: [PATCH 03/29] remove extra line --- quickstart/docker/image/ziti-cli-functions.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index fc4068e49..1886c51d4 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -1537,4 +1537,3 @@ function showIssuerAndSubjectForPEM() { openssl crl2pkcs7 -nocrl -certfile "${1-}" | openssl pkcs7 -print_certs -text -noout | grep -E "(Subject|Issuer)" } set +uo pipefail - From f1a53ae3ee40a4ddb757966531395fb1e0826e7e Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Fri, 14 Jul 2023 13:59:20 -0400 Subject: [PATCH 04/29] fix edge->not edge --- quickstart/docker/image/ziti-cli-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 1886c51d4..b5cf07785 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -322,7 +322,7 @@ function setupEnvironment { if [[ "${ZITI_CTRL_BIND_ADDRESS-}" != "" ]]; then echo "ZITI_CTRL_BIND_ADDRESS overridden: ${ZITI_CTRL_BIND_ADDRESS}"; fi if [[ "${ZITI_CTRL_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_ADDRESS="${ZITI_NETWORK-}"; else echo "ZITI_CTRL_ADVERTISED_ADDRESS overridden: ${ZITI_CTRL_ADVERTISED_ADDRESS}"; fi if [[ "${ZITI_CTRL_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_PORT="6262"; else echo "ZITI_CTRL_ADVERTISED_PORT overridden: ${ZITI_CTRL_ADVERTISED_PORT}"; fi - if [[ "${ZITI_PKI_CTRL_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_ROOTCA_NAME}"; fi + if [[ "${ZITI_PKI_CTRL_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_ROOTCA_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_ROOTCA_NAME}"; fi if [[ "${ZITI_PKI_CTRL_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_INTERMEDIATE_NAME}"; fi if [[ "${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_EDGE_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME}"; fi if [[ "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}"; fi From c048faa533e9c58f1f47966825e6a6c75525f69d Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Fri, 14 Jul 2023 14:48:00 -0400 Subject: [PATCH 05/29] more ZITI_CTRL_EDGE_ADVERTISED_ADDRESS-->ZITI_CTRL_ADVERTISED_ADDRESS --- quickstart/docker/image/ziti-cli-functions.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index b5cf07785..3cf187f69 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -323,13 +323,13 @@ function setupEnvironment { if [[ "${ZITI_CTRL_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_ADDRESS="${ZITI_NETWORK-}"; else echo "ZITI_CTRL_ADVERTISED_ADDRESS overridden: ${ZITI_CTRL_ADVERTISED_ADDRESS}"; fi if [[ "${ZITI_CTRL_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_PORT="6262"; else echo "ZITI_CTRL_ADVERTISED_PORT overridden: ${ZITI_CTRL_ADVERTISED_PORT}"; fi if [[ "${ZITI_PKI_CTRL_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_ROOTCA_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_ROOTCA_NAME}"; fi - if [[ "${ZITI_PKI_CTRL_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_INTERMEDIATE_NAME}"; fi + if [[ "${ZITI_PKI_CTRL_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_INTERMEDIATE_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_INTERMEDIATE_NAME}"; fi if [[ "${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_EDGE_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME}"; fi if [[ "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}"; fi - if [[ "${ZITI_PKI_CTRL_SERVER_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_SERVER_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-server.chain.pem"; else echo "ZITI_PKI_CTRL_SERVER_CERT overridden: ${ZITI_PKI_CTRL_SERVER_CERT}"; fi - if [[ "${ZITI_PKI_CTRL_KEY-}" == "" ]]; then export ZITI_PKI_CTRL_KEY="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/keys/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-server.key"; else echo "ZITI_PKI_CTRL_KEY overridden: ${ZITI_PKI_CTRL_KEY}"; fi + if [[ "${ZITI_PKI_CTRL_SERVER_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_SERVER_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_ADVERTISED_ADDRESS}-server.chain.pem"; else echo "ZITI_PKI_CTRL_SERVER_CERT overridden: ${ZITI_PKI_CTRL_SERVER_CERT}"; fi + if [[ "${ZITI_PKI_CTRL_KEY-}" == "" ]]; then export ZITI_PKI_CTRL_KEY="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/keys/${ZITI_CTRL_ADVERTISED_ADDRESS}-server.key"; else echo "ZITI_PKI_CTRL_KEY overridden: ${ZITI_PKI_CTRL_KEY}"; fi if [[ "${ZITI_PKI_CTRL_CA-}" == "" ]]; then export ZITI_PKI_CTRL_CA="${ZITI_PKI}/cas.pem"; else echo "ZITI_PKI_CTRL_CA overridden: ${ZITI_PKI_CTRL_CA}"; fi - if [[ "${ZITI_PKI_CTRL_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-client.cert"; else echo "ZITI_PKI_CTRL_CERT overridden: ${ZITI_PKI_CTRL_CERT}"; fi + if [[ "${ZITI_PKI_CTRL_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_ADVERTISED_ADDRESS}-client.cert"; else echo "ZITI_PKI_CTRL_CERT overridden: ${ZITI_PKI_CTRL_CERT}"; fi if [[ "${ZITI_PKI_EDGE_CERT-}" == "" ]]; then export ZITI_PKI_EDGE_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-client.cert"; else echo "ZITI_PKI_EDGE_CERT overridden: ${ZITI_PKI_EDGE_CERT}"; fi if [[ "${ZITI_PKI_EDGE_SERVER_CERT}" == "" ]]; then export ZITI_PKI_EDGE_SERVER_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-server.chain.pem"; else echo "ZITI_PKI_EDGE_SERVER_CERT overridden: ${ZITI_PKI_EDGE_SERVER_CERT}"; fi if [[ "${ZITI_PKI_EDGE_KEY}" == "" ]]; then export ZITI_PKI_EDGE_KEY="${ZITI_PKI}/${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}/keys/${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-server.key"; else echo "ZITI_PKI_EDGE_KEY overridden: ${ZITI_PKI_EDGE_KEY}"; fi @@ -735,8 +735,8 @@ function createPki { if [[ "${ZITI_CTRL_EDGE_IP_OVERRIDE}" != "" ]]; then pki_allow_list_ip="${pki_allow_list_ip},${ZITI_EDGE_CONTROLLER_IP_OVERRIDE}"; fi if [[ "${EXTERNAL_IP}" != "" ]]; then pki_allow_list_ip="${pki_allow_list_ip},${EXTERNAL_IP}"; fi - pki_allow_list_dns="${pki_allow_list_dns},${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS},localhost,${ZITI_NETWORK}" - _pki_client_server "${pki_allow_list_dns}" "${ZITI_PKI_CTRL_INTERMEDIATE_NAME}" "${pki_allow_list_ip}" "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}" + pki_allow_list_dns="${pki_allow_list_dns},${ZITI_CTRL_ADVERTISED_ADDRESS},localhost,${ZITI_NETWORK}" + _pki_client_server "${pki_allow_list_dns}" "${ZITI_PKI_CTRL_INTERMEDIATE_NAME}" "${pki_allow_list_ip}" "${ZITI_CTRL_ADVERTISED_ADDRESS}" echo -e "$(GREEN "PKI generated successfully")" echo -e "" } From 1ae550c8378e29dd43d8a85c2a058b3a5763b0b7 Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Fri, 14 Jul 2023 15:59:22 -0400 Subject: [PATCH 06/29] update quickstart. put edge pki back --- quickstart/.gitignore | 1 + quickstart/docker/image/ziti-cli-functions.sh | 20 +++++++------- quickstart/test/quickstart_test.go | 26 ++++++++++++++----- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/quickstart/.gitignore b/quickstart/.gitignore index 31e10f210..a9feee445 100644 --- a/quickstart/.gitignore +++ b/quickstart/.gitignore @@ -1 +1,2 @@ ziti-bin +test/gotester.json diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 3cf187f69..803f9e4f1 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -324,8 +324,8 @@ function setupEnvironment { if [[ "${ZITI_CTRL_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_PORT="6262"; else echo "ZITI_CTRL_ADVERTISED_PORT overridden: ${ZITI_CTRL_ADVERTISED_PORT}"; fi if [[ "${ZITI_PKI_CTRL_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_ROOTCA_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_ROOTCA_NAME}"; fi if [[ "${ZITI_PKI_CTRL_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_INTERMEDIATE_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_INTERMEDIATE_NAME}"; fi - if [[ "${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_EDGE_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME}"; fi - if [[ "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}"; fi + if [[ "${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-edge-root-ca"; else echo "ZITI_PKI_CTRL_EDGE_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME}"; fi + if [[ "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-edge-intermediate"; else echo "ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}"; fi if [[ "${ZITI_PKI_CTRL_SERVER_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_SERVER_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_ADVERTISED_ADDRESS}-server.chain.pem"; else echo "ZITI_PKI_CTRL_SERVER_CERT overridden: ${ZITI_PKI_CTRL_SERVER_CERT}"; fi if [[ "${ZITI_PKI_CTRL_KEY-}" == "" ]]; then export ZITI_PKI_CTRL_KEY="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/keys/${ZITI_CTRL_ADVERTISED_ADDRESS}-server.key"; else echo "ZITI_PKI_CTRL_KEY overridden: ${ZITI_PKI_CTRL_KEY}"; fi if [[ "${ZITI_PKI_CTRL_CA-}" == "" ]]; then export ZITI_PKI_CTRL_CA="${ZITI_PKI}/cas.pem"; else echo "ZITI_PKI_CTRL_CA overridden: ${ZITI_PKI_CTRL_CA}"; fi @@ -338,7 +338,7 @@ function setupEnvironment { # Router Values if [[ "${ZITI_ROUTER_NAME-}" == "" ]]; then export ZITI_ROUTER_NAME="${ZITI_NETWORK}-edge-router"; else echo "ZITI_ROUTER_NAME overridden: ${ZITI_ROUTER_NAME}"; fi if [[ "${ZITI_ROUTER_PORT-}" == "" ]]; then export ZITI_ROUTER_PORT="3022"; else echo "ZITI_ROUTER_PORT overridden: ${ZITI_ROUTER_PORT}"; fi - if [[ "${ZITI_ROUTER_LISTENER_BIND_PORT-}" == "" ]]; then export ZITI_ROUTER_LISTENER_BIND_PORT="8444"; else echo "ZITI_ROUTER_LISTENER_BIND_PORT overridden: ${ZITI_ROUTER_LISTENER_BIND_PORT}"; fi + if [[ "${ZITI_ROUTER_LISTENER_BIND_PORT-}" == "" ]]; then export ZITI_ROUTER_LISTENER_BIND_PORT="10080"; else echo "ZITI_ROUTER_LISTENER_BIND_PORT overridden: ${ZITI_ROUTER_LISTENER_BIND_PORT}"; fi if [[ "${EXTERNAL_DNS-}" != "" ]]; then export ZITI_ROUTER_ADVERTISED_HOST="${EXTERNAL_DNS}"; fi # Set up directories @@ -728,15 +728,15 @@ function createPki { _pki_create_intermediate "${ZITI_PKI_SIGNER_ROOTCA_NAME}" "${ZITI_SPURIOUS_INTERMEDIATE}" 2 _pki_create_intermediate "${ZITI_SPURIOUS_INTERMEDIATE}" "${ZITI_PKI_SIGNER_INTERMEDIATE_NAME}" 1 - pki_allow_list_dns="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS},localhost,${ZITI_NETWORK}" - if [[ "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}" != "" ]]; then pki_allow_list_dns="${pki_allow_list_dns},${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}"; fi - if [[ "${EXTERNAL_DNS}" != "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}" ]]; then pki_allow_list_dns="${pki_allow_list_dns},${EXTERNAL_DNS}"; fi + echo " " + pki_allow_list="${ZITI_CTRL_ADVERTISED_ADDRESS},localhost,${ZITI_NETWORK}" pki_allow_list_ip="127.0.0.1" - if [[ "${ZITI_CTRL_EDGE_IP_OVERRIDE}" != "" ]]; then pki_allow_list_ip="${pki_allow_list_ip},${ZITI_EDGE_CONTROLLER_IP_OVERRIDE}"; fi - if [[ "${EXTERNAL_IP}" != "" ]]; then pki_allow_list_ip="${pki_allow_list_ip},${EXTERNAL_IP}"; fi + _pki_client_server "${pki_allow_list}" "${ZITI_PKI_CTRL_INTERMEDIATE_NAME}" "${pki_allow_list_ip}" "${ZITI_CTRL_ADVERTISED_ADDRESS}" + + pki_allow_list="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS},localhost,${ZITI_NETWORK}" + pki_allow_list_ip="127.0.0.1" + _pki_client_server "${pki_allow_list}" "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}" "${pki_allow_list_ip}" "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}" - pki_allow_list_dns="${pki_allow_list_dns},${ZITI_CTRL_ADVERTISED_ADDRESS},localhost,${ZITI_NETWORK}" - _pki_client_server "${pki_allow_list_dns}" "${ZITI_PKI_CTRL_INTERMEDIATE_NAME}" "${pki_allow_list_ip}" "${ZITI_CTRL_ADVERTISED_ADDRESS}" echo -e "$(GREEN "PKI generated successfully")" echo -e "" } diff --git a/quickstart/test/quickstart_test.go b/quickstart/test/quickstart_test.go index 302a66f5c..e8885a100 100644 --- a/quickstart/test/quickstart_test.go +++ b/quickstart/test/quickstart_test.go @@ -3,6 +3,7 @@ package test import ( "archive/tar" "context" + "crypto/tls" "crypto/x509" "encoding/json" "fmt" @@ -26,6 +27,7 @@ import ( "net" "net/http" "os" + "strconv" "strings" "testing" "time" @@ -119,13 +121,19 @@ func TestSimpleWebService(t *testing.T) { if advPort == "" { advPort = "1280" } - ctrlAddress := "https://" + advAddy + ":" + advPort + erName := os.Getenv("ZITI_ROUTER_NAME") + if erName == "" { + erName = "ziti-edge-router" + } - hostingRouterName := "ziti-edge-router" + ctrlAddress := "https://" + advAddy + ":" + advPort + bindHostAddress := os.Getenv("ZITI_QUICKSTART_SERVICE") + if bindHostAddress == "" { + bindHostAddress = ctrlAddress + } + hostingRouterName := erName dialAddress := "simple.web.smoke.test" dialPort := 80 - bindHostAddress := "web-test-blue" - bindHostPort := 8000 serviceName := "basic.web.smoke.test.service" wd, _ := os.Getwd() @@ -178,13 +186,15 @@ func TestSimpleWebService(t *testing.T) { defer func() { _ = deleteServiceConfigByID(client, dialSvcConfig.ID) }() // Provide host config for the hostname - bindSvcConfig := createHostV1ServiceConfig(client, "basic.smoke.bind", "tcp", bindHostAddress, bindHostPort) + bindPort, _ := strconv.Atoi(advPort) + bindSvcConfig := createHostV1ServiceConfig(client, "basic.smoke.bind", "tcp", advAddy, bindPort) defer func() { _ = deleteServiceConfigByID(client, bindSvcConfig.ID) }() // Create a service that "links" the dial and bind configs createService(client, serviceName, []string{bindSvcConfig.ID, dialSvcConfig.ID}) // Create a service policy to allow the router to host the web test service + fmt.Println("finding hostingRouterName: ", hostingRouterName) hostRouterIdent := getIdentityByName(client, hostingRouterName) webTestService := getServiceByName(client, serviceName) defer func() { _ = deleteServiceByID(client, *webTestService.ID) }() @@ -192,6 +202,7 @@ func TestSimpleWebService(t *testing.T) { defer func() { _ = deleteServicePolicyByID(client, bindSP.ID) }() // Create a service policy to allow tester to dial the service + fmt.Println("finding testerUsername: ", testerUsername) testerIdent := getIdentityByName(client, testerUsername) dialSP := createServicePolicy(client, "basic.web.smoke.test.service.dial", rest_model.DialBindDial, rest_model.Roles{"@" + *testerIdent.ID}, rest_model.Roles{"@" + *webTestService.ID}) defer func() { _ = deleteServicePolicyByID(client, dialSP.ID) }() @@ -202,9 +213,10 @@ func TestSimpleWebService(t *testing.T) { if !termCntReached { fmt.Println("Unable to detect a terminator for the edge router") } - helloUrl := fmt.Sprintf("http://%s:%d", serviceName, dialPort) + helloUrl := fmt.Sprintf("https://%s:%d", serviceName, dialPort) log.Infof("created url: %s", helloUrl) httpClient := createZitifiedHttpClient(wd + "/" + testerUsername + ".json") + resp, e := httpClient.Get(helloUrl) if e != nil { panic(e) @@ -265,6 +277,7 @@ func createZitifiedHttpClient(idFile string) http.Client { } zitiTransport := http.DefaultTransport.(*http.Transport).Clone() // copy default transport zitiTransport.DialContext = Dial //zitiDialContext.Dial + zitiTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} return http.Client{Transport: zitiTransport} } @@ -335,6 +348,7 @@ func getIdentityByName(client *rest_management_api_client.ZitiEdgeManagement, na log.Fatalf("Could not obtain an ID for the identity named %s", name) fmt.Println(err) } + return resp.GetPayload().Data[0] } From c352634447e715d742476613e01ddbf5a7beecbf Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Fri, 14 Jul 2023 16:23:11 -0400 Subject: [PATCH 07/29] remove extra -edge --- quickstart/docker/image/ziti-cli-functions.sh | 4 ++-- quickstart/test/quickstart_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 803f9e4f1..10d074fb2 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -324,8 +324,8 @@ function setupEnvironment { if [[ "${ZITI_CTRL_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_PORT="6262"; else echo "ZITI_CTRL_ADVERTISED_PORT overridden: ${ZITI_CTRL_ADVERTISED_PORT}"; fi if [[ "${ZITI_PKI_CTRL_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_ROOTCA_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_ROOTCA_NAME}"; fi if [[ "${ZITI_PKI_CTRL_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_INTERMEDIATE_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_INTERMEDIATE_NAME}"; fi - if [[ "${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-edge-root-ca"; else echo "ZITI_PKI_CTRL_EDGE_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME}"; fi - if [[ "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-edge-intermediate"; else echo "ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}"; fi + if [[ "${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_EDGE_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME}"; fi + if [[ "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}"; fi if [[ "${ZITI_PKI_CTRL_SERVER_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_SERVER_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_ADVERTISED_ADDRESS}-server.chain.pem"; else echo "ZITI_PKI_CTRL_SERVER_CERT overridden: ${ZITI_PKI_CTRL_SERVER_CERT}"; fi if [[ "${ZITI_PKI_CTRL_KEY-}" == "" ]]; then export ZITI_PKI_CTRL_KEY="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/keys/${ZITI_CTRL_ADVERTISED_ADDRESS}-server.key"; else echo "ZITI_PKI_CTRL_KEY overridden: ${ZITI_PKI_CTRL_KEY}"; fi if [[ "${ZITI_PKI_CTRL_CA-}" == "" ]]; then export ZITI_PKI_CTRL_CA="${ZITI_PKI}/cas.pem"; else echo "ZITI_PKI_CTRL_CA overridden: ${ZITI_PKI_CTRL_CA}"; fi diff --git a/quickstart/test/quickstart_test.go b/quickstart/test/quickstart_test.go index e8885a100..1e048b1a3 100644 --- a/quickstart/test/quickstart_test.go +++ b/quickstart/test/quickstart_test.go @@ -127,7 +127,7 @@ func TestSimpleWebService(t *testing.T) { } ctrlAddress := "https://" + advAddy + ":" + advPort - bindHostAddress := os.Getenv("ZITI_QUICKSTART_SERVICE") + bindHostAddress := os.Getenv("ZITI_QUICKSTART_TEST_ADDRESS") if bindHostAddress == "" { bindHostAddress = ctrlAddress } From 687e840119eb416b753fd777d5bdb8a917b5dceb Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Fri, 14 Jul 2023 16:29:17 -0400 Subject: [PATCH 08/29] more refinement of variable names --- quickstart/docker/image/ziti-cli-functions.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 10d074fb2..6cda2dada 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -317,6 +317,7 @@ function setupEnvironment { # Controller Values if [[ "${ZITI_CTRL_NAME-}" == "" ]]; then export ZITI_CTRL_NAME="${ZITI_NETWORK}"; else echo "ZITI_CTRL_NAME overridden: ${ZITI_CTRL_NAME}"; fi + if [[ "${ZITI_CTRL_EDGE_NAME-}" == "" ]]; then export ZITI_CTRL_EDGE_NAME="${ZITI_NETWORK}-edge-controller"; else echo "ZITI_CTRL_EDGE_NAME overridden: ${ZITI_CTRL_EDGE_NAME}"; fi if [[ "${ZITI_CTRL_EDGE_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_PORT="1280"; else echo "ZITI_CTRL_EDGE_ADVERTISED_PORT overridden: ${ZITI_CTRL_EDGE_ADVERTISED_PORT}"; fi if [[ "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_ADDRESS="${ZITI_NETWORK-}"; else echo "ZITI_CTRL_EDGE_ADVERTISED_ADDRESS overridden: ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}"; fi if [[ "${ZITI_CTRL_BIND_ADDRESS-}" != "" ]]; then echo "ZITI_CTRL_BIND_ADDRESS overridden: ${ZITI_CTRL_BIND_ADDRESS}"; fi @@ -324,8 +325,8 @@ function setupEnvironment { if [[ "${ZITI_CTRL_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_ADVERTISED_PORT="6262"; else echo "ZITI_CTRL_ADVERTISED_PORT overridden: ${ZITI_CTRL_ADVERTISED_PORT}"; fi if [[ "${ZITI_PKI_CTRL_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_ROOTCA_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_ROOTCA_NAME}"; fi if [[ "${ZITI_PKI_CTRL_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_INTERMEDIATE_NAME="${ZITI_CTRL_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_INTERMEDIATE_NAME}"; fi - if [[ "${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_ROOTCA_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-root-ca"; else echo "ZITI_PKI_CTRL_EDGE_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME}"; fi - if [[ "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}-intermediate"; else echo "ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}"; fi + if [[ "${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_ROOTCA_NAME="${ZITI_CTRL_EDGE_NAME}-root-ca"; else echo "ZITI_PKI_CTRL_EDGE_ROOTCA_NAME overridden: ${ZITI_PKI_CTRL_EDGE_ROOTCA_NAME}"; fi + if [[ "${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME-}" == "" ]]; then export ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME="${ZITI_CTRL_EDGE_NAME}-intermediate"; else echo "ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME overridden: ${ZITI_PKI_CTRL_EDGE_INTERMEDIATE_NAME}"; fi if [[ "${ZITI_PKI_CTRL_SERVER_CERT-}" == "" ]]; then export ZITI_PKI_CTRL_SERVER_CERT="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/certs/${ZITI_CTRL_ADVERTISED_ADDRESS}-server.chain.pem"; else echo "ZITI_PKI_CTRL_SERVER_CERT overridden: ${ZITI_PKI_CTRL_SERVER_CERT}"; fi if [[ "${ZITI_PKI_CTRL_KEY-}" == "" ]]; then export ZITI_PKI_CTRL_KEY="${ZITI_PKI}/${ZITI_PKI_CTRL_INTERMEDIATE_NAME}/keys/${ZITI_CTRL_ADVERTISED_ADDRESS}-server.key"; else echo "ZITI_PKI_CTRL_KEY overridden: ${ZITI_PKI_CTRL_KEY}"; fi if [[ "${ZITI_PKI_CTRL_CA-}" == "" ]]; then export ZITI_PKI_CTRL_CA="${ZITI_PKI}/cas.pem"; else echo "ZITI_PKI_CTRL_CA overridden: ${ZITI_PKI_CTRL_CA}"; fi From 3da226f29a37f515b318b382b586f72cd7e80562 Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Fri, 14 Jul 2023 17:03:29 -0400 Subject: [PATCH 09/29] update .env for new container --- quickstart/docker/.env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quickstart/docker/.env b/quickstart/docker/.env index ca3dfe253..39b817c00 100644 --- a/quickstart/docker/.env +++ b/quickstart/docker/.env @@ -9,8 +9,8 @@ ZITI_PWD= # controller name, address/port information ZITI_CTRL_NAME=ziti-controller -#ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=ziti-edge-controller -#ZITI_CTRL_ADVERTISED_ADDRESS=ziti-controller +ZITI_CTRL_EDGE_ADVERTISED_ADDRESS=ziti-edge-controller +ZITI_CTRL_ADVERTISED_ADDRESS=ziti-controller #ZITI_CTRL_EDGE_IP_OVERRIDE=10.10.10.10 #ZITI_CTRL_EDGE_ADVERTISED_PORT=8441 #ZITI_CTRL_ADVERTISED_PORT=8440 From 282f1074a0ea61714b764f5e3f72a73832a334d0 Mon Sep 17 00:00:00 2001 From: gberl002 Date: Mon, 17 Jul 2023 15:59:58 -0400 Subject: [PATCH 10/29] Use printf instead of echo for a more standard output among varying OSs. fixes #1212 Signed-off-by: gberl002 --- quickstart/docker/image/ziti-cli-functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 6cda2dada..bd7646996 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -1047,8 +1047,8 @@ function getLatestZitiVersion { _detect_architecture ziti_latest=$(curl -s https://${GITHUB_TOKEN:+${GITHUB_TOKEN}@}api.github.com/repos/openziti/ziti/releases/latest) - ZITI_BINARIES_FILE=$(echo "${ziti_latest}" | tr '\r\n' ' ' | jq -r '.assets[] | select(.name | startswith("'"ziti-${ZITI_OSTYPE}-${ZITI_ARCH}-"'")) | .name') - ZITI_BINARIES_VERSION=$(echo "${ziti_latest}" | tr '\r\n' ' ' | jq -r '.tag_name') + ZITI_BINARIES_FILE=$(printf "%s" "${ziti_latest}" | tr '\r\n' ' ' | jq -r '.assets[] | select(.name | startswith("'"ziti-${ZITI_OSTYPE}-${ZITI_ARCH}-"'")) | .name') + ZITI_BINARIES_VERSION=$(printf "%s" "${ziti_latest}" | tr '\r\n' ' ' | jq -r '.tag_name') } function createControllerSystemdFile { From 56e12b553efd12332d9d8c1aa809baa76e01bc5f Mon Sep 17 00:00:00 2001 From: gberl002 Date: Mon, 17 Jul 2023 16:18:58 -0400 Subject: [PATCH 11/29] Removing erroneous space Signed-off-by: gberl002 --- quickstart/docker/image/ziti-cli-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index bd7646996..5bb1fcf6b 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -650,7 +650,7 @@ function getZiti { echo -e "ziti found in ZITI_BIN_DIR ($(BLUE "${ZITI_BIN_DIR}"))" # Get the current version and compare with latest local currentVersion - currentVersion="$("${ZITI_BIN_DIR}"/ziti --version) " + currentVersion="$("${ZITI_BIN_DIR}"/ziti --version)" if [[ "${ZITI_BINARIES_VERSION}" != "${currentVersion}" ]]; then # Prompt user for new download echo -en "There is a newer version of OpenZiti, would you like to download it? (Y/n) " From bd1411f6048dd01124aa56a37656752af7942ffc Mon Sep 17 00:00:00 2001 From: gberl002 Date: Tue, 18 Jul 2023 09:16:47 -0400 Subject: [PATCH 12/29] Updating CHANGELOG Signed-off-by: gberl002 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 794c01005..8b3b83895 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# Release 0.29.1 + +## What's New + +## Component Updates and Bug Fixes +* github.com/openziti/ziti: [v0.29.0 -> v0.29.1](https://github.com/openziti/ziti/compare/v0.29.0...v0.29.1) + * [Issue #1212](https://github.com/openziti/ziti/issues/1212) - Fixed getZiti function on Mac/ZSH + # Release 0.29.0 ## What's New From 124fb5cdff3c70ecc8ceb5b409ca77a74a2f0e8b Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 19 Jul 2023 09:45:23 -0400 Subject: [PATCH 13/29] set execute filemode on ziti binaries for macOS and Linux --- .github/workflows/main.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f0dc98243..2eca2e42a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -270,6 +270,20 @@ jobs: name: windows-release-${{ github.run_id }} path: release/ + - name: List downloaded release artifacts + run: | + ls -lR release/ + + - name: Restore execute filemode on macOS and Linux release artifacts before publishing + run: | + find ./release \ + -path "./release/*/darwin/ziti" \ + -o \ + -path "./release/*/linux/ziti" \ + -type f \ + -print0 \ + | xargs -0 chmod -c +x + - name: Install Jfrog CLI uses: jfrog/setup-jfrog-cli@v3 with: From e7c1efe4aae3720728ff784f44042ce76bb53b46 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 19 Jul 2023 11:23:42 -0400 Subject: [PATCH 14/29] order GNU find params to stop conditionally printing results --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2eca2e42a..d9de884b8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -272,16 +272,16 @@ jobs: - name: List downloaded release artifacts run: | - ls -lR release/ + ls -lAhR release/ - name: Restore execute filemode on macOS and Linux release artifacts before publishing run: | find ./release \ + -type f \ + -print0 \ -path "./release/*/darwin/ziti" \ -o \ -path "./release/*/linux/ziti" \ - -type f \ - -print0 \ | xargs -0 chmod -c +x - name: Install Jfrog CLI From e7a2527c80364578f6625b0746cbe55e94f4ec6f Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Wed, 19 Jul 2023 23:43:48 -0400 Subject: [PATCH 15/29] add createBrowZerSystemdFile helper function --- quickstart/docker/image/ziti-cli-functions.sh | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index 5bb1fcf6b..d209c6318 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -1153,6 +1153,51 @@ HeredocForSystemd echo -e "Router systemd file written to: $(BLUE "${output_file}")" } +function createBrowZerSystemdFile { + local retVal output_file node_bin + _check_env_variable ZITI_HOME + retVal=$? + if [[ "${retVal}" != 0 ]]; then + return 1 + fi + + output_file="${ZITI_HOME}/browzer-bootstrapper.service" + + if which node >/dev/null; then + # store the absolute path to the node executable because it's required by systemd on Amazon Linux, at least + node_bin=$(readlink -f "$(which node)") + else + echo "ERROR: missing executable 'node'" >&2 + return 1 + fi + + _get_file_overwrite_permission "${output_file}" + retVal=$? + if [[ "${retVal}" != 0 ]]; then + return 1 + fi + + cat > "${output_file}" << HeredocForSystemd +[Unit] +Description=A systemd unit file for the Ziti BrowZer Bootstrapper +After=network.target + +[Service] +User=root +EnvironmentFile=${ZITI_HOME}/browzer.env +WorkingDirectory=${ZITI_HOME}/ziti-http-agent +ExecStart=${node_bin} "${ZITI_HOME}/ziti-http-agent/index.js" +Restart=always +RestartSec=2 +LimitNOFILE=65536 + +[Install] +WantedBy=multi-user.target + +HeredocForSystemd + echo -e "Ziti BrowZer Bootstrapper systemd file written to: $(BLUE "${output_file}")" +} + function createControllerLaunchdFile { local controller_name retVal output_file # Allow controller name to be passed in as arg From 8f6b4d913b5fdf9e5a58b7a08ad1a036a74265fd Mon Sep 17 00:00:00 2001 From: Andrew Martinez Date: Thu, 27 Jul 2023 12:21:14 -0400 Subject: [PATCH 16/29] fixed #65 adds EC generation support to the PKI sub command --- ziti/cmd/lets_encrypt/accounts_storage.go | 2 +- ziti/cmd/pki.go | 3 +- ziti/cmd/pki_create.go | 193 ++++++++++++++-------- ziti/cmd/pki_create_ca.go | 22 ++- ziti/cmd/pki_create_client.go | 22 ++- ziti/cmd/pki_create_csr.go | 19 +-- ziti/cmd/pki_create_intermediate.go | 26 ++- ziti/cmd/pki_create_key.go | 23 ++- ziti/cmd/pki_create_server.go | 14 +- ziti/pki/certificate/certificate.go | 9 +- ziti/pki/pki/pki.go | 97 +++++++++-- ziti/pki/pki/template.go | 6 +- ziti/pki/store/local.go | 32 +++- ziti/pki/store/store.go | 2 +- 14 files changed, 323 insertions(+), 147 deletions(-) diff --git a/ziti/cmd/lets_encrypt/accounts_storage.go b/ziti/cmd/lets_encrypt/accounts_storage.go index 45faf02c4..1eb73690e 100644 --- a/ziti/cmd/lets_encrypt/accounts_storage.go +++ b/ziti/cmd/lets_encrypt/accounts_storage.go @@ -183,7 +183,7 @@ func (s *AccountsStorage) GetPrivateKey(keyType certcrypto.KeyType) crypto.Priva privateKey, err := loadPrivateKey(accKeyPath) if err != nil { - log.Fatalf("Could not load RSA private key from file %s: %v", accKeyPath, err) + log.Fatalf("Could not load private key from file %s: %v", accKeyPath, err) } return privateKey diff --git a/ziti/cmd/pki.go b/ziti/cmd/pki.go index e1991f270..28c5a1a90 100644 --- a/ziti/cmd/pki.go +++ b/ziti/cmd/pki.go @@ -43,7 +43,7 @@ type PKIFlags struct { CAName string CommonName string CAExpire int - CAMaxpath int + CAMaxPath int CAPrivateKeySize int IntermediateFile string IntermediateName string @@ -61,6 +61,7 @@ type PKIFlags struct { PKI *pki.ZitiPKI SpiffeID string AllowOverwrite bool + EcCurve string } var ( diff --git a/ziti/cmd/pki_create.go b/ziti/cmd/pki_create.go index 4ad54c0d4..9d75dca8e 100644 --- a/ziti/cmd/pki_create.go +++ b/ziti/cmd/pki_create.go @@ -17,16 +17,18 @@ package cmd import ( + "crypto/elliptic" "crypto/x509" "crypto/x509/pkix" "encoding/asn1" "errors" "fmt" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" + "github.com/openziti/ziti/ziti/pki/pki" "github.com/openziti/ziti/ziti/util" "io" - "io/ioutil" "net" + "os" "strings" "sync" "time" @@ -78,32 +80,32 @@ func NewCmdPKICreate(out io.Writer, errOut io.Writer) *cobra.Command { func (options *PKICreateOptions) addPKICreateFlags(cmd *cobra.Command) { viperLock.Lock() cmd.PersistentFlags().StringVarP(&options.Flags.PKIRoot, "pki-root", "", "", "Directory in which to store CA") - cmd.MarkFlagRequired("pki-root") - viper.BindPFlag("pki_root", cmd.PersistentFlags().Lookup("pki-root")) + _ = cmd.MarkFlagRequired("pki-root") + _ = viper.BindPFlag("pki_root", cmd.PersistentFlags().Lookup("pki-root")) cmd.PersistentFlags().StringVarP(&options.Flags.PKIOrganization, "pki-organization", "", "NetFoundry", "Organization") - cmd.MarkFlagRequired("pki-organization") - viper.BindPFlag("pki-organization", cmd.PersistentFlags().Lookup("pki-organization")) + _ = cmd.MarkFlagRequired("pki-organization") + _ = viper.BindPFlag("pki-organization", cmd.PersistentFlags().Lookup("pki-organization")) cmd.PersistentFlags().StringVarP(&options.Flags.PKIOrganizationalUnit, "pki-organizational-unit", "", "ADV-DEV", "Organization unit") - cmd.MarkFlagRequired("pki-organizational-unit") - viper.BindPFlag("pki-organizational-unit", cmd.PersistentFlags().Lookup("pki-organizational-unit")) + _ = cmd.MarkFlagRequired("pki-organizational-unit") + _ = viper.BindPFlag("pki-organizational-unit", cmd.PersistentFlags().Lookup("pki-organizational-unit")) cmd.PersistentFlags().StringVarP(&options.Flags.PKICountry, "pki-country", "", "US", "Country") - cmd.MarkFlagRequired("pki-country") - viper.BindPFlag("pki-country", cmd.PersistentFlags().Lookup("pki-country")) + _ = cmd.MarkFlagRequired("pki-country") + _ = viper.BindPFlag("pki-country", cmd.PersistentFlags().Lookup("pki-country")) cmd.PersistentFlags().StringVarP(&options.Flags.PKILocality, "pki-locality", "", "Charlotte", "Locality/Location") - cmd.MarkFlagRequired("pki-locality") - viper.BindPFlag("pki-locality", cmd.PersistentFlags().Lookup("pki-locality")) + _ = cmd.MarkFlagRequired("pki-locality") + _ = viper.BindPFlag("pki-locality", cmd.PersistentFlags().Lookup("pki-locality")) // cmd.PersistentFlags().StringVarP(&options.Flags.PKILocality, "pki-location", "", "Charlotte", "Location/Locality") // cmd.MarkFlagRequired("pki-location") // viper.BindPFlag("pki-location", cmd.PersistentFlags().Lookup("pki-location")) cmd.PersistentFlags().StringVarP(&options.Flags.PKIProvince, "pki-province", "", "NC", "Province/State") - cmd.MarkFlagRequired("pki-province") - viper.BindPFlag("pki-province", cmd.PersistentFlags().Lookup("pki-province")) + _ = cmd.MarkFlagRequired("pki-province") + _ = viper.BindPFlag("pki-province", cmd.PersistentFlags().Lookup("pki-province")) // cmd.PersistentFlags().StringVarP(&options.Flags.PKIProvince, "pki-state", "", "NC", "State/Province") // cmd.MarkFlagRequired("pki-state") @@ -118,111 +120,111 @@ func (o *PKICreateOptions) Run() error { // ObtainPKIRoot returns the value for pki-root func (o *PKICreateOptions) ObtainPKIRoot() (string, error) { - pkiroot := o.Flags.PKIRoot - if pkiroot == "" { - pkiroot = viper.GetString("pki-root") - if pkiroot == "" { + pkiRoot := o.Flags.PKIRoot + if pkiRoot == "" { + pkiRoot = viper.GetString("pki-root") + if pkiRoot == "" { pkiRootDir, err := util.PKIRootDir() if err != nil { return "", err } - pkiroot, err = util.PickValue("Required flag 'pki-root' not specified; Enter PKI Root now:", pkiRootDir, true) + pkiRoot, err = util.PickValue("Required flag 'pki-root' not specified; Enter PKI Root now:", pkiRootDir, true) if err != nil { return "", err } } } - return pkiroot, nil + return pkiRoot, nil } // ObtainCAFile returns the value for ca-file func (o *PKICreateOptions) ObtainCAFile() (string, error) { - cafile := o.Flags.CAFile - if cafile == "" { - cafile = viper.GetString("ca-file") - if cafile == "" { + caFile := o.Flags.CAFile + if caFile == "" { + caFile = viper.GetString("ca-file") + if caFile == "" { var err error - cafile, err = util.PickValue("Required flag 'ca-file' not specified; Enter CA name now:", "ca", true) + caFile, err = util.PickValue("Required flag 'ca-file' not specified; Enter CA name now:", "ca", true) if err != nil { return "", err } } } - return cafile, nil + return caFile, nil } // ObtainIntermediateCAFile returns the value for intermediate-file func (o *PKICreateOptions) ObtainIntermediateCAFile() (string, error) { - intermediatefile := o.Flags.IntermediateFile - if intermediatefile == "" { - intermediatefile = viper.GetString("intermediate-file") - if intermediatefile == "" { + intermediateFile := o.Flags.IntermediateFile + if intermediateFile == "" { + intermediateFile = viper.GetString("intermediate-file") + if intermediateFile == "" { var err error - intermediatefile, err = util.PickValue("Required flag 'intermediate-file' not specified; Enter Intermediate CA name now:", "intermediate", true) + intermediateFile, err = util.PickValue("Required flag 'intermediate-file' not specified; Enter Intermediate CA name now:", "intermediate", true) if err != nil { return "", err } } } - return intermediatefile, nil + return intermediateFile, nil } // ObtainIntermediateCSRFile returns the value for intermediate-file func (o *PKICreateOptions) ObtainIntermediateCSRFile() (string, error) { - intermediatecsrfile := viper.GetString("intermediate-csr-file") - if intermediatecsrfile == "" { + intermediateCsrFile := viper.GetString("intermediate-csr-file") + if intermediateCsrFile == "" { var err error - intermediatecsrfile, err = util.PickValue("Required flag 'intermediate--csr-file' not specified; Enter Intermediate CSR file name now:", "intermediate-csr", true) + intermediateCsrFile, err = util.PickValue("Required flag 'intermediate--csr-file' not specified; Enter Intermediate CSR file name now:", "intermediate-csr", true) if err != nil { return "", err } } - return intermediatecsrfile, nil + return intermediateCsrFile, nil } // ObtainCSRFile returns the value for csr-file func (o *PKICreateOptions) ObtainCSRFile() (string, error) { - csrfile := viper.GetString("csr-file") - if csrfile == "" { + csrFile := viper.GetString("csr-file") + if csrFile == "" { var err error - csrfile, err = util.PickValue("Required flag 'csr-file' not specified; Enter CSR name now:", "csr", true) + csrFile, err = util.PickValue("Required flag 'csr-file' not specified; Enter CSR name now:", "csr", true) if err != nil { return "", err } } - return csrfile, nil + return csrFile, nil } // ObtainServerCertFile returns the value for server-file func (o *PKICreateOptions) ObtainServerCertFile() (string, error) { - serverfile := o.Flags.ServerFile - if serverfile == "" { - serverfile = viper.GetString("server-file") - if serverfile == "" { + serverFile := o.Flags.ServerFile + if serverFile == "" { + serverFile = viper.GetString("server-file") + if serverFile == "" { var err error - serverfile, err = util.PickValue("Required flag 'server-file' not specified; Enter name now:", "server", true) + serverFile, err = util.PickValue("Required flag 'server-file' not specified; Enter name now:", "server", true) if err != nil { return "", err } } } - return serverfile, nil + return serverFile, nil } // ObtainClientCertFile returns the value for client-file func (o *PKICreateOptions) ObtainClientCertFile() (string, error) { - clientfile := o.Flags.ClientFile - if clientfile == "" { - clientfile = viper.GetString("client-file") - if clientfile == "" { + clientFile := o.Flags.ClientFile + if clientFile == "" { + clientFile = viper.GetString("client-file") + if clientFile == "" { var err error - clientfile, err = util.PickValue("Required flag 'client-file' not specified; Enter name now:", "client", true) + clientFile, err = util.PickValue("Required flag 'client-file' not specified; Enter name now:", "client", true) if err != nil { return "", err } } } - return clientfile, nil + return clientFile, nil } // ObtainKeyFile returns the value for key-file @@ -244,13 +246,13 @@ func (o *PKICreateOptions) ObtainKeyFile(required bool) (string, error) { } // ObtainCAName returns the value for ca-name -func (o *PKICreateOptions) ObtainCAName(pkiroot string) (string, error) { - caname := o.Flags.CAName - if caname == "" { - caname = viper.GetString("ca-name") - if caname == "" { +func (o *PKICreateOptions) ObtainCAName(pkiRoot string) (string, error) { + caName := o.Flags.CAName + if caName == "" { + caName = viper.GetString("ca-name") + if caName == "" { var err error - files, err := ioutil.ReadDir(pkiroot) + files, err := os.ReadDir(pkiRoot) if err != nil { return "", err } @@ -262,14 +264,14 @@ func (o *PKICreateOptions) ObtainCAName(pkiroot string) (string, error) { } } } - caname, err = util.PickName(names, "Required flag 'ca-name' not specified; choose from below (dirs seen in your ZITI_PKI_ROOT):") + caName, err = util.PickName(names, "Required flag 'ca-name' not specified; choose from below (dirs seen in your ZITI_PKI_ROOT):") if err != nil { return "", err } } } - fmt.Println("Using CA name: ", caname) - return caname, nil + fmt.Println("Using CA name: ", caName) + return caName, nil } // ObtainCommonName returns the value for CN @@ -289,9 +291,9 @@ func (o *PKICreateOptions) ObtainCommonName() (string, error) { } // ObtainFileName returns the value for the 'name' used in the PKI request -func (o *PKICreateOptions) ObtainFileName(cafile string, commonName string) string { +func (o *PKICreateOptions) ObtainFileName(caFile string, commonName string) string { var filename string - if filename = cafile; len(cafile) == 0 { + if filename = caFile; len(caFile) == 0 { filename = strings.Replace(commonName, " ", "_", -1) filename = strings.Replace(filename, "*", "wildcard", -1) } @@ -321,18 +323,18 @@ func (o *PKICreateOptions) ObtainPKIRequestTemplate(commonName string) *x509.Cer template := &x509.Certificate{ Subject: subject, NotAfter: time.Now().AddDate(0, 0, o.Flags.CAExpire), - MaxPathLen: o.Flags.CAMaxpath, + MaxPathLen: o.Flags.CAMaxPath, } return template } // ObtainKeyName returns the private key from the key-file -func (o *PKICreateOptions) ObtainKeyName(pkiroot string) (string, error) { - keyname := viper.GetString("key-name") - if keyname == "" { +func (o *PKICreateOptions) ObtainKeyName(pkiRoot string) (string, error) { + keyName := viper.GetString("key-name") + if keyName == "" { var err error - files, err := ioutil.ReadDir(pkiroot) + files, err := os.ReadDir(pkiRoot) if err != nil { return "", err } @@ -342,13 +344,13 @@ func (o *PKICreateOptions) ObtainKeyName(pkiroot string) (string, error) { names = append(names, f.Name()) } } - keyname, err = util.PickName(names, "Required flag 'key-name' not specified; choose from below (dirs seen in your ZITI_PKI_ROOT):") + keyName, err = util.PickName(names, "Required flag 'key-name' not specified; choose from below (dirs seen in your ZITI_PKI_ROOT):") if err != nil { return "", err } } - return keyname, nil + return keyName, nil } // ObtainPKICSRRequestTemplate returns the CSR 'template' used in the PKI request @@ -379,8 +381,7 @@ func (o *PKICreateOptions) ObtainPKICSRRequestTemplate(commonName string) *x509. val, _ := asn1.Marshal(basicConstraints{true, 0}) csrTemplate := &x509.CertificateRequest{ - Subject: subject, - SignatureAlgorithm: x509.SHA512WithRSA, + Subject: subject, ExtraExtensions: []pkix.Extension{ { Id: asn1.ObjectIdentifier{2, 5, 29, 19}, @@ -393,7 +394,7 @@ func (o *PKICreateOptions) ObtainPKICSRRequestTemplate(commonName string) *x509. return csrTemplate } -// ObtainIPsAndDNSNames returns the IP addrs and/or DNS names used in the PKI request template +// ObtainIPsAndDNSNames returns the IP address and/or DNS names used in the PKI request template func (o *PKICreateOptions) ObtainIPsAndDNSNames() ([]net.IP, []string, error) { if (len(o.Flags.IP) == 0) && (len(o.Flags.DNSName) == 0) { @@ -409,3 +410,51 @@ func (o *PKICreateOptions) ObtainIPsAndDNSNames() ([]net.IP, []string, error) { return IPs, o.Flags.DNSName, nil } + +// ObtainPrivateKeyOptions returns the private key options necessary to generate a private key +func (o *PKICreateOptions) ObtainPrivateKeyOptions() (pki.PrivateKeyOptions, error) { + isEc := o.Flags.EcCurve != "" + + if isEc { + return o.obtainEcOptions() + } + + return o.obtainRsaOptions() +} + +func (o *PKICreateOptions) obtainEcOptions() (pki.PrivateKeyOptions, error) { + target := strings.Replace(strings.ToLower(o.Flags.EcCurve), "-", "", -1) + + validCurves := []elliptic.Curve{ + elliptic.P224(), + elliptic.P256(), + elliptic.P384(), + elliptic.P521(), + } + for _, validCurve := range validCurves { + curCurveName := strings.Replace(strings.ToLower(validCurve.Params().Name), "-", "", -1) + + if curCurveName == target { + return &pki.EcPrivateKeyOptions{ + Curve: validCurve, + }, nil + } + } + + validCurveString := "" + + for _, validCurve := range validCurves { + if validCurveString != "" { + validCurveString = validCurveString + ", " + } + + validCurveString = validCurveString + strings.Replace(validCurve.Params().Name, "-", "", -1) + } + return nil, fmt.Errorf("unknown curve name '%s', valid curves (case and dash insensitive) %s", o.Flags.EcCurve, validCurveString) +} + +func (o *PKICreateOptions) obtainRsaOptions() (pki.PrivateKeyOptions, error) { + return &pki.RsaPrivateKeyOptions{ + Size: o.Flags.CAPrivateKeySize, + }, nil +} diff --git a/ziti/cmd/pki_create_ca.go b/ziti/cmd/pki_create_ca.go index 9f1f4e187..581fdb26d 100644 --- a/ziti/cmd/pki_create_ca.go +++ b/ziti/cmd/pki_create_ca.go @@ -17,6 +17,7 @@ package cmd import ( + "fmt" "github.com/openziti/fabric/controller/idgen" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/openziti/ziti/ziti/internal/log" @@ -70,23 +71,24 @@ func (o *PKICreateCAOptions) addPKICreateCAFlags(cmd *cobra.Command) { cmd.Flags().StringVarP(&o.Flags.CAFile, "ca-file", "", "", "Dir/File name (within PKI_ROOT) in which to store new CA") cmd.Flags().StringVarP(&o.Flags.CAName, FlagCaName, "", "NetFoundry Inc. Certificate Authority", "Name of CA") cmd.Flags().IntVarP(&o.Flags.CAExpire, "expire-limit", "", 3650, "Expiration limit in days") - cmd.Flags().IntVarP(&o.Flags.CAMaxpath, "max-path-len", "", -1, "Intermediate maximum path length") - cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the private key") + cmd.Flags().IntVarP(&o.Flags.CAMaxPath, "max-path-len", "", -1, "Intermediate maximum path length") + cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the RSA private key, ignored if -curve is set") + cmd.Flags().StringVarP(&o.Flags.EcCurve, "curve", "", "", "If set an EC private key is generated and -private-key-size is ignored, options: P224, P256, P384, P521") cmd.Flags().StringVar(&o.Flags.SpiffeID, "trust-domain", "", "An optional spiffe trust domain. spiffe:// will be automatically prefixed, if not provided") } // Run implements this command func (o *PKICreateCAOptions) Run() error { - pkiroot, err := o.ObtainPKIRoot() + pkiRoot, err := o.ObtainPKIRoot() if err != nil { return err } o.Flags.PKI = &pki.ZitiPKI{Store: &store.Local{}} local := o.Flags.PKI.Store.(*store.Local) - local.Root = pkiroot + local.Root = pkiRoot - cafile, err := o.ObtainCAFile() + caFile, err := o.ObtainCAFile() if err != nil { return err } @@ -98,7 +100,7 @@ func (o *PKICreateCAOptions) Run() error { commonName := o.Flags.CAName - filename := o.ObtainFileName(cafile, commonName) + filename := o.ObtainFileName(caFile, commonName) template := o.ObtainPKIRequestTemplate(commonName) template.IsCA = true @@ -114,13 +116,19 @@ func (o *PKICreateCAOptions) Run() error { template.URIs = append(template.URIs, spiffeId) } + privateKeyOptions, err := o.ObtainPrivateKeyOptions() + + if err != nil { + return fmt.Errorf("could not resolve private key options: %w", err) + } + var signer *certificate.Bundle req := &pki.Request{ Name: filename, Template: template, IsClientCertificate: false, - PrivateKeySize: o.Flags.CAPrivateKeySize, + PrivateKeyOptions: privateKeyOptions, } if err = o.Flags.PKI.Sign(signer, req); err != nil { diff --git a/ziti/cmd/pki_create_client.go b/ziti/cmd/pki_create_client.go index 4d4f70aaf..56162265a 100644 --- a/ziti/cmd/pki_create_client.go +++ b/ziti/cmd/pki_create_client.go @@ -17,6 +17,7 @@ package cmd import ( + "fmt" "github.com/openziti/fabric/controller/idgen" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/openziti/ziti/ziti/internal/log" @@ -73,21 +74,22 @@ func (o *PKICreateClientOptions) addPKICreateClientFlags(cmd *cobra.Command) { cmd.Flags().StringVarP(&o.Flags.ClientName, FlagCaClientName, "", "NetFoundry Inc. Client", "Common Name (CN) to use for new Client certificate") cmd.Flags().StringSliceVar(&o.Flags.Email, "email", []string{}, "Email addr(s) to add to Subject Alternate Name (SAN) for new Client certificate") cmd.Flags().IntVarP(&o.Flags.CAExpire, "expire-limit", "", 365, "Expiration limit in days") - cmd.Flags().IntVarP(&o.Flags.CAMaxpath, "max-path-len", "", -1, "Intermediate maximum path length") - cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 2048, "Size of the private key") + cmd.Flags().IntVarP(&o.Flags.CAMaxPath, "max-path-len", "", -1, "Intermediate maximum path length") + cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the RSA private key, ignored if -curve is set") + cmd.Flags().StringVarP(&o.Flags.EcCurve, "curve", "", "", "If set an EC private key is generated and -private-key-size is ignored, options: P224, P256, P384, P521") cmd.Flags().StringVar(&o.Flags.SpiffeID, "spiffe-id", "", "Optionally provide the path portion of a SPIFFE id. The trust domain will be taken from the signing certificate.") } // Run implements this command func (o *PKICreateClientOptions) Run() error { - pkiroot, err := o.ObtainPKIRoot() + pkiRoot, err := o.ObtainPKIRoot() if err != nil { return err } o.Flags.PKI = &pki.ZitiPKI{Store: &store.Local{}} local := o.Flags.PKI.Store.(*store.Local) - local.Root = pkiroot + local.Root = pkiRoot if !o.Cmd.Flags().Changed(FlagCaClientName) { o.Flags.ClientName = o.Flags.ClientName + " " + idgen.New() @@ -108,7 +110,7 @@ func (o *PKICreateClientOptions) Run() error { var signer *certificate.Bundle - caname, err := o.ObtainCAName(pkiroot) + caName, err := o.ObtainCAName(pkiRoot) if err != nil { return err } @@ -118,7 +120,7 @@ func (o *PKICreateClientOptions) Run() error { return err } - signer, err = o.Flags.PKI.GetCA(caname) + signer, err = o.Flags.PKI.GetCA(caName) if err != nil { return errors.Wrap(err, "cannot locate signer") } @@ -143,12 +145,18 @@ func (o *PKICreateClientOptions) Run() error { template.URIs = append(template.URIs, &spiffId) } + privateKeyOptions, err := o.ObtainPrivateKeyOptions() + + if err != nil { + return fmt.Errorf("could not resolve private key options: %w", err) + } + req := &pki.Request{ Name: filename, KeyName: keyFile, Template: template, IsClientCertificate: true, - PrivateKeySize: o.Flags.CAPrivateKeySize, + PrivateKeyOptions: privateKeyOptions, } if err := o.Flags.PKI.Sign(signer, req); err != nil { diff --git a/ziti/cmd/pki_create_csr.go b/ziti/cmd/pki_create_csr.go index e45fac863..99cfc7523 100644 --- a/ziti/cmd/pki_create_csr.go +++ b/ziti/cmd/pki_create_csr.go @@ -64,28 +64,27 @@ func (o *PKICreateCSROptions) addPKICreateCSRFlags(cmd *cobra.Command) { cmd.Flags().StringVarP(&o.Flags.CSRName, "csr-name", "", "NetFoundry Inc. CSR", "Name of CSR") cmd.Flags().StringVarP(&o.Flags.KeyName, "key-name", "", "", "Name of file that contains private key for CSR") cmd.Flags().IntVarP(&o.Flags.CAExpire, "expire-limit", "", 365, "Expiration limit in days") - cmd.Flags().IntVarP(&o.Flags.CAMaxpath, "max-path-len", "", -1, "Intermediate maximum path length") - cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the private key") + cmd.Flags().IntVarP(&o.Flags.CAMaxPath, "max-path-len", "", -1, "Intermediate maximum path length") } // Run implements this command func (o *PKICreateCSROptions) Run() error { - pkiroot, err := o.ObtainPKIRoot() + pkiRoot, err := o.ObtainPKIRoot() if err != nil { return fmt.Errorf("%s", err) } o.Flags.PKI = &pki.ZitiPKI{Store: &store.Local{}} local := o.Flags.PKI.Store.(*store.Local) - local.Root = pkiroot + local.Root = pkiRoot - csrfile, err := o.ObtainCSRFile() + csrFile, err := o.ObtainCSRFile() if err != nil { return fmt.Errorf("%s", err) } - keyname, err := o.ObtainKeyName(pkiroot) + keyName, err := o.ObtainKeyName(pkiRoot) if err != nil { return fmt.Errorf("%s", err) } @@ -93,13 +92,13 @@ func (o *PKICreateCSROptions) Run() error { commonName := o.Flags.CSRName template := o.ObtainPKICSRRequestTemplate(commonName) - key, err := o.Flags.PKI.GetPrivateKey(keyname, keyname) + key, err := o.Flags.PKI.GetPrivateKey(keyName, keyName) if err != nil { - return fmt.Errorf("Cannot locate private key: %v", err) + return fmt.Errorf("cannot locate private key: %v", err) } - if err := o.Flags.PKI.CSR(keyname, csrfile, *template, key); err != nil { - return fmt.Errorf("Cannot create CSR: %v", err) + if err := o.Flags.PKI.CSR(keyName, csrFile, *template, key); err != nil { + return fmt.Errorf("cannot create CSR: %v", err) } log.Infoln("Success") diff --git a/ziti/cmd/pki_create_intermediate.go b/ziti/cmd/pki_create_intermediate.go index 0b1648204..2f80ad773 100644 --- a/ziti/cmd/pki_create_intermediate.go +++ b/ziti/cmd/pki_create_intermediate.go @@ -17,6 +17,7 @@ package cmd import ( + "fmt" "github.com/openziti/fabric/controller/idgen" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/openziti/ziti/ziti/internal/log" @@ -70,22 +71,23 @@ func (o *PKICreateIntermediateOptions) addPKICreateIntermediateFlags(cmd *cobra. cmd.Flags().StringVarP(&o.Flags.IntermediateFile, "intermediate-file", "", "intermediate", "Dir/File name (within PKI_ROOT) in which to store new Intermediate CA") cmd.Flags().StringVarP(&o.Flags.IntermediateName, FlagCaIntermediateName, "", "NetFoundry Inc. Intermediate CA", "Common Name (CN) to use for new Intermediate CA") cmd.Flags().IntVarP(&o.Flags.CAExpire, "expire-limit", "", 3650, "Expiration limit in days") - cmd.Flags().IntVarP(&o.Flags.CAMaxpath, "max-path-len", "", 0, "Intermediate maximum path length") - cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the private key") + cmd.Flags().IntVarP(&o.Flags.CAMaxPath, "max-path-len", "", 0, "Intermediate maximum path length") + cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the RSA private key, ignored if -curve is set") + cmd.Flags().StringVarP(&o.Flags.EcCurve, "curve", "", "", "If set an EC private key is generated and -private-key-size is ignored, options: P224, P256, P384, P521") } // Run implements this command func (o *PKICreateIntermediateOptions) Run() error { - pkiroot, err := o.ObtainPKIRoot() + pkiRoot, err := o.ObtainPKIRoot() if err != nil { return err } o.Flags.PKI = &pki.ZitiPKI{Store: &store.Local{}} local := o.Flags.PKI.Store.(*store.Local) - local.Root = pkiroot + local.Root = pkiRoot - intermediatefile, err := o.ObtainIntermediateCAFile() + intermediateFile, err := o.ObtainIntermediateCAFile() if err != nil { return err } @@ -96,19 +98,19 @@ func (o *PKICreateIntermediateOptions) Run() error { commonName := o.Flags.IntermediateName - filename := o.ObtainFileName(intermediatefile, commonName) + filename := o.ObtainFileName(intermediateFile, commonName) template := o.ObtainPKIRequestTemplate(commonName) template.IsCA = true var signer *certificate.Bundle - caname, err := o.ObtainCAName(pkiroot) + caName, err := o.ObtainCAName(pkiRoot) if err != nil { return err } - signer, err = o.Flags.PKI.GetCA(caname) + signer, err = o.Flags.PKI.GetCA(caName) if err != nil { return errors.Wrap(err, "cannot locate signer") } @@ -119,11 +121,17 @@ func (o *PKICreateIntermediateOptions) Run() error { } } + privateKeyOptions, err := o.ObtainPrivateKeyOptions() + + if err != nil { + return fmt.Errorf("could not resolve private key options: %w", err) + } + req := &pki.Request{ Name: filename, Template: template, IsClientCertificate: false, - PrivateKeySize: o.Flags.CAPrivateKeySize, + PrivateKeyOptions: privateKeyOptions, } if err := o.Flags.PKI.Sign(signer, req); err != nil { diff --git a/ziti/cmd/pki_create_key.go b/ziti/cmd/pki_create_key.go index 07954d88a..e2ff8b018 100644 --- a/ziti/cmd/pki_create_key.go +++ b/ziti/cmd/pki_create_key.go @@ -65,27 +65,28 @@ func (o *PKICreateKeyOptions) addPKICreateKeyFlags(cmd *cobra.Command) { cmd.Flags().StringVarP(&o.Flags.PKIRoot, "pki-root", "", "", "Directory in which PKI resides") cmd.Flags().StringVarP(&o.Flags.CAName, "ca-name", "", "intermediate", "Name of Intermediate CA (within PKI_ROOT) to use to sign the new Client certificate") cmd.Flags().StringVarP(&o.Flags.KeyFile, "key-file", "", "key", "Name of file (under chosen CA) in which to store new private key") - cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the private key") + cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the RSA private key, ignored if -curve is set") + cmd.Flags().StringVarP(&o.Flags.EcCurve, "curve", "", "", "If set an EC private key is generated and -private-key-size is ignored, options: P224, P256, P384, P521") } // Run implements this command func (o *PKICreateKeyOptions) Run() error { - pkiroot, err := o.ObtainPKIRoot() + pkiRoot, err := o.ObtainPKIRoot() if err != nil { return fmt.Errorf("%s", err) } o.Flags.PKI = &pki.ZitiPKI{Store: &store.Local{}} local := o.Flags.PKI.Store.(*store.Local) - local.Root = pkiroot + local.Root = pkiRoot keyFile, err := o.ObtainKeyFile(true) if err != nil { return fmt.Errorf("%s", err) } - caname, err := o.ObtainCAName(pkiroot) + caName, err := o.ObtainCAName(pkiRoot) if err != nil { return fmt.Errorf("%s", err) } @@ -93,20 +94,26 @@ func (o *PKICreateKeyOptions) Run() error { template := o.ObtainPKIRequestTemplate("") var signer *certificate.Bundle - signer, err = o.Flags.PKI.GetCA(caname) + signer, err = o.Flags.PKI.GetCA(caName) if err != nil { - return fmt.Errorf("Cannot locate signer: %v", err) + return fmt.Errorf("cannot locate signer: %v", err) + } + + privateKeyOptions, err := o.ObtainPrivateKeyOptions() + + if err != nil { + return fmt.Errorf("could not resolve private key options: %w", err) } req := &pki.Request{ KeyName: keyFile, Template: template, IsClientCertificate: false, - PrivateKeySize: o.Flags.CAPrivateKeySize, + PrivateKeyOptions: privateKeyOptions, } if err := o.Flags.PKI.GeneratePrivateKey(signer, req); err != nil { - return fmt.Errorf("Cannot Generate Private key: %v", err) + return fmt.Errorf("cannot Generate Private key: %v", err) } log.Infoln("Success") diff --git a/ziti/cmd/pki_create_server.go b/ziti/cmd/pki_create_server.go index 6cc578e3d..98deef32d 100644 --- a/ziti/cmd/pki_create_server.go +++ b/ziti/cmd/pki_create_server.go @@ -17,6 +17,7 @@ package cmd import ( + "fmt" "github.com/openziti/fabric/controller/idgen" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/openziti/ziti/ziti/internal/log" @@ -74,8 +75,9 @@ func (o *PKICreateServerOptions) addPKICreateServerFlags(cmd *cobra.Command) { cmd.Flags().StringSliceVar(&o.Flags.DNSName, "dns", []string{}, "DNS name(s) to add to Subject Alternate Name (SAN) for new Server certificate") cmd.Flags().StringSliceVar(&o.Flags.IP, "ip", []string{}, "IP addr(s) to add to Subject Alternate Name (SAN) for new Server certificate") cmd.Flags().IntVarP(&o.Flags.CAExpire, "expire-limit", "", 365, "Expiration limit in days") - cmd.Flags().IntVarP(&o.Flags.CAMaxpath, "max-path-len", "", -1, "Intermediate maximum path length") - cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the private key") + cmd.Flags().IntVarP(&o.Flags.CAMaxPath, "max-path-len", "", -1, "Intermediate maximum path length") + cmd.Flags().IntVarP(&o.Flags.CAPrivateKeySize, "private-key-size", "", 4096, "Size of the RSA private key, ignored if -curve is set") + cmd.Flags().StringVarP(&o.Flags.EcCurve, "curve", "", "", "If set an EC private key is generated and -private-key-size is ignored, options: P224, P256, P384, P521") cmd.Flags().StringVar(&o.Flags.SpiffeID, "spiffe-id", "", "Optionally provide the path portion of a SPIFFE id. The trust domain will be taken from the signing certificate.") cmd.Flags().BoolVar(&o.Flags.AllowOverwrite, "allow-overwrite", false, "Allow overwrite existing certs") } @@ -151,12 +153,18 @@ func (o *PKICreateServerOptions) Run() error { template.URIs = append(template.URIs, &spiffId) } + privateKeyOptions, err := o.ObtainPrivateKeyOptions() + + if err != nil { + return fmt.Errorf("could not resolve private key options: %w", err) + } + req := &pki.Request{ Name: filename, KeyName: keyFile, Template: template, IsClientCertificate: false, - PrivateKeySize: o.Flags.CAPrivateKeySize, + PrivateKeyOptions: privateKeyOptions, AllowOverwrite: o.Flags.AllowOverwrite, } diff --git a/ziti/pki/certificate/certificate.go b/ziti/pki/certificate/certificate.go index 9b229f423..6852ca9ab 100644 --- a/ziti/pki/certificate/certificate.go +++ b/ziti/pki/certificate/certificate.go @@ -17,7 +17,7 @@ package certificate import ( - "crypto/rsa" + "crypto" "crypto/x509" "fmt" ) @@ -25,19 +25,20 @@ import ( // Bundle represents a pair of private key and certificate. type Bundle struct { Name string - Key *rsa.PrivateKey + Key crypto.PrivateKey Cert *x509.Certificate } // Raw returns the raw bytes for the private key and certificate. func (b *Bundle) Raw() ([]byte, []byte) { - return x509.MarshalPKCS1PrivateKey(b.Key), b.Cert.Raw + keyBytes, _ := x509.MarshalPKCS8PrivateKey(b.Key) + return keyBytes, b.Cert.Raw } // RawToBundle creates a bundle from the name and bytes given for a private key // and a certificate. func RawToBundle(name string, key []byte, cert []byte) (*Bundle, error) { - k, err := x509.ParsePKCS1PrivateKey(key) + k, err := x509.ParsePKCS8PrivateKey(key) if err != nil { return nil, fmt.Errorf("failed parsing private key: %v", err) } diff --git a/ziti/pki/pki/pki.go b/ziti/pki/pki/pki.go index e33224f76..e13194ae3 100644 --- a/ziti/pki/pki/pki.go +++ b/ziti/pki/pki/pki.go @@ -20,6 +20,7 @@ package pki import ( "crypto" "crypto/ecdsa" + "crypto/elliptic" "crypto/rand" "crypto/rsa" "crypto/x509" @@ -42,13 +43,40 @@ var ( ErrMaxPathLenReached = errors.New("max path len reached") ) +type PrivateKeyOptions interface { + GenerateKey() (crypto.PrivateKey, error) +} + +var _ PrivateKeyOptions = &RsaPrivateKeyOptions{} + +type RsaPrivateKeyOptions struct { + Size int +} + +func (r *RsaPrivateKeyOptions) GenerateKey() (crypto.PrivateKey, error) { + if r.Size == 0 { + r.Size = defaultPrivateKeySize + } + return rsa.GenerateKey(rand.Reader, r.Size) +} + +var _ PrivateKeyOptions = &EcPrivateKeyOptions{} + +type EcPrivateKeyOptions struct { + Curve elliptic.Curve +} + +func (e *EcPrivateKeyOptions) GenerateKey() (crypto.PrivateKey, error) { + return ecdsa.GenerateKey(e.Curve, rand.Reader) +} + // Request is a struct for providing configuration to // GenerateCertificate when actioning a certification generation request. type Request struct { Name string KeyName string IsClientCertificate bool - PrivateKeySize int + PrivateKeyOptions PrivateKeyOptions Template *x509.Certificate AllowOverwrite bool } @@ -101,13 +129,11 @@ func (e *ZitiPKI) Sign(signer *certificate.Bundle, req *Request) error { } var err error - var privateKey *rsa.PrivateKey + var privateKey crypto.PrivateKey if req.KeyName == "" { - if req.PrivateKeySize == 0 { - req.PrivateKeySize = defaultPrivateKeySize - } - privateKey, err = rsa.GenerateKey(rand.Reader, req.PrivateKeySize) + privateKey, err = req.PrivateKeyOptions.GenerateKey() + if err != nil { return fmt.Errorf("failed generating private key: %v", err) } @@ -118,7 +144,12 @@ func (e *ZitiPKI) Sign(signer *certificate.Bundle, req *Request) error { } privateKey = pk.(*rsa.PrivateKey) } - publicKey := privateKey.Public() + + publicKey, err := publicKeyFromPrivate(privateKey) + + if err != nil { + return err + } if err := defaultTemplate(req, publicKey); err != nil { return fmt.Errorf("failed updating generation request: %v", err) @@ -148,12 +179,29 @@ func (e *ZitiPKI) Sign(signer *certificate.Bundle, req *Request) error { return fmt.Errorf("failed creating and signing certificate: %v", err) } - if err := e.Store.Add(signer.Name, req.Name, req.Template.IsCA, x509.MarshalPKCS1PrivateKey(privateKey), rawCert, req.AllowOverwrite); err != nil { + keyBytes, err := x509.MarshalPKCS8PrivateKey(privateKey) + + if err != nil { + return nil + } + + if err := e.Store.Add(signer.Name, req.Name, req.Template.IsCA, keyBytes, rawCert, req.AllowOverwrite); err != nil { return fmt.Errorf("failed saving generated bundle: %v", err) } return nil } +func publicKeyFromPrivate(key crypto.PrivateKey) (crypto.PublicKey, error) { + switch pk := key.(type) { + case *rsa.PrivateKey: + return &pk.PublicKey, nil + case *ecdsa.PrivateKey: + return &pk.PublicKey, nil + } + + return nil, errors.New("unsupported key type") +} + // Chain will... func (e *ZitiPKI) Chain(signer *certificate.Bundle, req *Request) error { destCA := signer.Name @@ -166,16 +214,22 @@ func (e *ZitiPKI) Chain(signer *certificate.Bundle, req *Request) error { return nil } -// Generate and store a private key +// GeneratePrivateKey generates and stores a private key func (e *ZitiPKI) GeneratePrivateKey(signer *certificate.Bundle, req *Request) error { - if req.PrivateKeySize == 0 { - req.PrivateKeySize = defaultPrivateKeySize - } - privateKey, err := rsa.GenerateKey(rand.Reader, req.PrivateKeySize) + + privateKey, err := req.PrivateKeyOptions.GenerateKey() + if err != nil { return fmt.Errorf("failed generating private key: %v", err) } - if err := e.Store.AddKey(signer.Name, req.KeyName, x509.MarshalPKCS1PrivateKey(privateKey)); err != nil { + + keyBytes, err := x509.MarshalPKCS8PrivateKey(privateKey) + + if err != nil { + return fmt.Errorf("failed marshalling private key: %v", err) + } + + if err := e.Store.AddKey(signer.Name, req.KeyName, keyBytes); err != nil { return fmt.Errorf("failed saving generated key: %v", err) } return nil @@ -200,7 +254,20 @@ func (e *ZitiPKI) CRL(caName string, expire time.Time) ([]byte, error) { return nil, fmt.Errorf("failed retrieving CA bundle %v: %v", caName, err) } - crl, err := ca.Cert.CreateCRL(rand.Reader, ca.Key, revoked, time.Now(), expire) + signer, ok := ca.Key.(crypto.Signer) + + if !ok { + return nil, fmt.Errorf("could not convert %T to %T", ca.Key, signer) + } + + template := &x509.RevocationList{ + RevokedCertificates: revoked, + ThisUpdate: time.Now(), + NextUpdate: expire, + } + + crl, err := x509.CreateRevocationList(rand.Reader, template, ca.Cert, signer) + if err != nil { return nil, fmt.Errorf("failed creating crl for %v: %v", caName, err) } diff --git a/ziti/pki/pki/template.go b/ziti/pki/pki/template.go index 00d2d731a..4dcc30846 100644 --- a/ziti/pki/pki/template.go +++ b/ziti/pki/pki/template.go @@ -19,17 +19,16 @@ package pki import ( "crypto" "crypto/rand" - "crypto/rsa" "crypto/sha1" "crypto/x509" - "encoding/asn1" "fmt" "math/big" "time" ) func defaultTemplate(genReq *Request, publicKey crypto.PublicKey) error { - publicKeyBytes, err := asn1.Marshal(*publicKey.(*rsa.PublicKey)) + publicKeyBytes, err := x509.MarshalPKIXPublicKey(publicKey) + if err != nil { return fmt.Errorf("failed marshaling public key: %v", err) } @@ -45,7 +44,6 @@ func defaultTemplate(genReq *Request, publicKey crypto.PublicKey) error { genReq.Template.SerialNumber = sn genReq.Template.NotBefore = time.Now().Add(-time.Minute) - genReq.Template.SignatureAlgorithm = x509.SHA256WithRSA return nil } diff --git a/ziti/pki/store/local.go b/ziti/pki/store/local.go index 2cdea6ec4..017a1e960 100644 --- a/ziti/pki/store/local.go +++ b/ziti/pki/store/local.go @@ -18,6 +18,8 @@ package store import ( "bufio" + "crypto/ecdsa" + "crypto/rsa" "crypto/x509/pkix" "encoding/pem" "fmt" @@ -156,19 +158,22 @@ func (l *Local) AddCSR(caName, name string, isCa bool, key, cert []byte) error { return nil } -// AddKey adds the given key to the local filesystem. +// AddKey adds the given private key to the local filesystem. func (l *Local) AddKey(caName string, name string, key []byte) error { if l.Exists(caName, name) { return fmt.Errorf("a key already exists for the key name %v within CA %v", name, caName) } - if err := l.writeKey(caName, name, key); err != nil { + + pemType := getPkPemType(key) + + if err := l.writeKey(caName, name, pemType, key); err != nil { return fmt.Errorf("failed writing key %v within CA %v to the local filesystem: %v", name, caName, err) } return nil } // writeKey encodes in PEM format the bundle private key and stores it on the local filesystem. -func (l *Local) writeKey(caName string, name string, key []byte) error { +func (l *Local) writeKey(caName, name, pemType string, key []byte) error { caDir := filepath.Join(l.Root, caName) if _, err := os.Stat(caDir); err != nil { if err := InitCADir(caDir); err != nil { @@ -176,12 +181,26 @@ func (l *Local) writeKey(caName string, name string, key []byte) error { } } keyPath, _ := l.path(caName, name) - if err := encodeAndWrite(keyPath, "RSA PRIVATE KEY", key); err != nil { + if err := encodeAndWrite(keyPath, pemType, key); err != nil { return fmt.Errorf("failed encoding and writing private key file: %v", err) } return nil } +func getPkPemType(key []byte) string { + parsedKey, _ := x509.ParsePKCS8PrivateKey(key) + + keyPemType := "UNKNOWN PRIVATE KEY" + switch parsedKey.(type) { + case *rsa.PrivateKey: + keyPemType = "RSA PRIVATE KEY" + case *ecdsa.PrivateKey: + keyPemType = "EC PRIVATE KEY" + } + + return keyPemType +} + // writeBundle encodes in PEM format the bundle private key and // certificate and stores them on the local filesystem. func (l *Local) writeBundle(caName, name string, isCa bool, key, cert []byte) error { @@ -191,8 +210,11 @@ func (l *Local) writeBundle(caName, name string, isCa bool, key, cert []byte) er return fmt.Errorf("root directory for CA %v does not exist and cannot be created: %v", caDir, err) } } + + keyPemType := getPkPemType(key) + keyPath, certPath := l.path(caName, name) - if err := encodeAndWrite(keyPath, "RSA PRIVATE KEY", key); err != nil { + if err := encodeAndWrite(keyPath, keyPemType, key); err != nil { return fmt.Errorf("failed encoding and writing private key file: %v", err) } if err := encodeAndWrite(certPath, "CERTIFICATE", cert); err != nil { diff --git a/ziti/pki/store/store.go b/ziti/pki/store/store.go index 1060bb6b0..155a6e3e6 100644 --- a/ziti/pki/store/store.go +++ b/ziti/pki/store/store.go @@ -65,7 +65,7 @@ type Store interface { // Args: // The intermediate CA name // The Key name - // The raw private key. + // The private key // // Returns an error if it failed to store the bundle. AddKey(string, string, []byte) error From 9f0da4b97b33ec3b14ef5564e8b3954a592dc550 Mon Sep 17 00:00:00 2001 From: Andrew Martinez Date: Thu, 27 Jul 2023 15:54:02 -0400 Subject: [PATCH 17/29] use fallback PKCS1 parsing for private keys if PKCS8 fails --- ziti/pki/certificate/certificate.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ziti/pki/certificate/certificate.go b/ziti/pki/certificate/certificate.go index 6852ca9ab..9f86648b8 100644 --- a/ziti/pki/certificate/certificate.go +++ b/ziti/pki/certificate/certificate.go @@ -40,7 +40,14 @@ func (b *Bundle) Raw() ([]byte, []byte) { func RawToBundle(name string, key []byte, cert []byte) (*Bundle, error) { k, err := x509.ParsePKCS8PrivateKey(key) if err != nil { - return nil, fmt.Errorf("failed parsing private key: %v", err) + //previous versions may have stored private keys as PKCS1 (aka RSA only) try as a secondary action + var pkcs1Err error + k, pkcs1Err = x509.ParsePKCS1PrivateKey(key) + + if pkcs1Err != nil { + return nil, fmt.Errorf("failed parsing private key PKCS8 error: %w, PKCS1 error: %w", err, pkcs1Err) + } + } c, err := x509.ParseCertificate(cert) if err != nil { From 1bc8bcbee641084a1ba54b91a362886cd3e46fec Mon Sep 17 00:00:00 2001 From: Andrew Martinez Date: Fri, 28 Jul 2023 10:36:31 -0400 Subject: [PATCH 18/29] fix pkcs8 vs pkcs1 vs pkcs EC private key parsing --- ziti/cmd/edge/verify_ca.go | 22 ++++++++++++++++++++-- ziti/cmd/lets_encrypt/accounts_storage.go | 2 ++ ziti/pki/store/local.go | 22 ++++++++++++---------- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/ziti/cmd/edge/verify_ca.go b/ziti/cmd/edge/verify_ca.go index 2a6ea51aa..b702bf165 100644 --- a/ziti/cmd/edge/verify_ca.go +++ b/ziti/cmd/edge/verify_ca.go @@ -21,6 +21,7 @@ import ( "crypto/ecdsa" "crypto/elliptic" "crypto/rand" + "crypto/rsa" "crypto/x509" "crypto/x509/pkix" "encoding/pem" @@ -200,10 +201,27 @@ func generateCert(options *verifyCaOptions, token string) ([]byte, crypto.Signer } var signerInterface crypto.Signer - if caPrivateKeyBlock.Type == "EC PRIVATE KEY" { + + switch caPrivateKeyBlock.Type { + case "EC PRIVATE KEY": signerInterface, err = x509.ParseECPrivateKey(caPrivateKeyBlock.Bytes) - } else { + case "RSA PRIVATE KEY": signerInterface, err = x509.ParsePKCS1PrivateKey(caPrivateKeyBlock.Bytes) + case "PRIVATE KEY": + key, err := x509.ParsePKCS8PrivateKey(caPrivateKeyBlock.Bytes) + + if err != nil { + return nil, nil, fmt.Errorf("could not parse PKCS8 key file (%s)", err) + } + + switch typedKey := key.(type) { + case *rsa.PrivateKey: + signerInterface = typedKey + case *ecdsa.PrivateKey: + signerInterface = typedKey + default: + return nil, nil, fmt.Errorf("unsupported private key parsed from PKCS8 %T", typedKey) + } } if err != nil { diff --git a/ziti/cmd/lets_encrypt/accounts_storage.go b/ziti/cmd/lets_encrypt/accounts_storage.go index 1eb73690e..47fcc614a 100644 --- a/ziti/cmd/lets_encrypt/accounts_storage.go +++ b/ziti/cmd/lets_encrypt/accounts_storage.go @@ -229,6 +229,8 @@ func loadPrivateKey(file string) (crypto.PrivateKey, error) { return x509.ParsePKCS1PrivateKey(keyBlock.Bytes) case "EC PRIVATE KEY": return x509.ParseECPrivateKey(keyBlock.Bytes) + case "PRIVATE KEY": + return x509.ParsePKCS8PrivateKey(keyBlock.Bytes) } return nil, errors.New("unknown private key type") diff --git a/ziti/pki/store/local.go b/ziti/pki/store/local.go index 017a1e960..6047dc4a3 100644 --- a/ziti/pki/store/local.go +++ b/ziti/pki/store/local.go @@ -18,8 +18,6 @@ package store import ( "bufio" - "crypto/ecdsa" - "crypto/rsa" "crypto/x509/pkix" "encoding/pem" "fmt" @@ -188,17 +186,21 @@ func (l *Local) writeKey(caName, name, pemType string, key []byte) error { } func getPkPemType(key []byte) string { - parsedKey, _ := x509.ParsePKCS8PrivateKey(key) + var pkcs1Err error + _, pkcs1Err = x509.ParsePKCS1PrivateKey(key) - keyPemType := "UNKNOWN PRIVATE KEY" - switch parsedKey.(type) { - case *rsa.PrivateKey: - keyPemType = "RSA PRIVATE KEY" - case *ecdsa.PrivateKey: - keyPemType = "EC PRIVATE KEY" + if pkcs1Err == nil { + return "RSA PRIVATE KEY" } - return keyPemType + var pkcsEcErr error + _, pkcsEcErr = x509.ParseECPrivateKey(key) + + if pkcsEcErr == nil { + return "EC PRIVATE KEY" + } + + return "PRIVATE KEY" } // writeBundle encodes in PEM format the bundle private key and From 17134b05ad2a19672a228656d0b690554c8c4b6e Mon Sep 17 00:00:00 2001 From: gberl002 Date: Fri, 28 Jul 2023 15:02:55 -0400 Subject: [PATCH 19/29] Fixed getZiti not respecting user input when asking to use default path or not. Signed-off-by: gberl002 --- CHANGELOG.md | 1 + quickstart/docker/image/ziti-cli-functions.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b3b83895..037c587e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ## Component Updates and Bug Fixes * github.com/openziti/ziti: [v0.29.0 -> v0.29.1](https://github.com/openziti/ziti/compare/v0.29.0...v0.29.1) * [Issue #1212](https://github.com/openziti/ziti/issues/1212) - Fixed getZiti function on Mac/ZSH + * [Issue #1220](https://github.com/openziti/ziti/issues/1220) - Fixed getZiti function not respecting user input for custom path # Release 0.29.0 diff --git a/quickstart/docker/image/ziti-cli-functions.sh b/quickstart/docker/image/ziti-cli-functions.sh index d209c6318..3d86a929f 100644 --- a/quickstart/docker/image/ziti-cli-functions.sh +++ b/quickstart/docker/image/ziti-cli-functions.sh @@ -602,11 +602,11 @@ function getZiti { default_path="${ZITI_HOME}/ziti-bin/ziti-${ZITI_BINARIES_VERSION}" echo -en "The path for ziti binaries has not been set, use the default (${default_path})? (Y/n) " read -r reply - if [[ -z "${reply}" || ${reply} =~ [yY]* ]]; then + if [[ -z "${reply}" || ${reply} =~ [yY] ]]; then echo "INFO: using the default path ${default_path}" ZITI_BIN_DIR="${default_path}" else - echo -en "Enter the preferred path and press (the path will be created if necessary) " + echo -en "Enter the preferred fully qualified path and press (the path will be created if necessary) " read -r ZITI_BIN_DIR fi fi From 729404c1d92c29014e6d7d95fd9191d998966021 Mon Sep 17 00:00:00 2001 From: ekoby <7406535+ekoby@users.noreply.github.com> Date: Mon, 31 Jul 2023 14:21:09 -0400 Subject: [PATCH 20/29] enable to run controller and router listeners on a single port (#1224) * enable to run controller and router listeners on a single port [fixes #1135] technical notes: uses TLS ALPN feature to select proper handler for incoming connection the following application protocols are defined: - ziti-ctrl - control channel - ziti-link - link channel - ziti-edge - edge connection (also accepts ''(blank) for backward compatibility) - Controller REST API endpoint uses standard protocols: 'h2', 'http/1.1', and ''(blank) for SDK clients - Edge Router WSS endpoint uses standard protocols: 'h2', 'http/1.1' * update zititest/go.mod --- go.mod | 22 ++++++---------------- go.sum | 45 ++++++++++++--------------------------------- zititest/go.mod | 12 ++++++------ zititest/go.sum | 24 ++++++++++++------------ 4 files changed, 36 insertions(+), 67 deletions(-) diff --git a/go.mod b/go.mod index e4e1b6b9d..a3961b11d 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/Jeffail/gabs/v2 v2.7.0 github.com/MakeNowJust/heredoc v1.0.0 github.com/blang/semver v3.5.1+incompatible - github.com/docker/docker v20.10.24+incompatible github.com/fatih/color v1.15.0 github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa github.com/go-acme/lego/v4 v4.2.0 @@ -20,17 +19,17 @@ require ( github.com/jedib0t/go-pretty/v6 v6.4.0 github.com/michaelquigley/pfxlog v0.6.10 github.com/openziti/agent v1.0.14 - github.com/openziti/channel/v2 v2.0.84 - github.com/openziti/edge v0.24.364 + github.com/openziti/channel/v2 v2.0.87 + github.com/openziti/edge v0.24.372 github.com/openziti/edge-api v0.25.30 - github.com/openziti/fabric v0.23.45 + github.com/openziti/fabric v0.23.52 github.com/openziti/foundation/v2 v2.0.28 github.com/openziti/identity v1.0.59 github.com/openziti/runzmd v1.0.28 - github.com/openziti/sdk-golang v0.20.78 + github.com/openziti/sdk-golang v0.20.80 github.com/openziti/storage v0.2.11 - github.com/openziti/transport/v2 v2.0.93 - github.com/openziti/xweb/v2 v2.0.2 + github.com/openziti/transport/v2 v2.0.96 + github.com/openziti/xweb/v2 v2.1.0 github.com/openziti/ziti-db-explorer v1.1.1 github.com/pkg/errors v0.9.1 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 @@ -56,7 +55,6 @@ require ( github.com/AppsFlyer/go-sundheit v0.5.0 // indirect github.com/MichaelMure/go-term-markdown v0.1.4 // indirect github.com/MichaelMure/go-term-text v0.3.1 // indirect - github.com/Microsoft/go-winio v0.6.0 // indirect github.com/alecthomas/chroma v0.10.0 // indirect github.com/andybalholm/brotli v1.0.5 // indirect github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211106181442-e4c1a74c66bd // indirect @@ -73,8 +71,6 @@ require ( github.com/dineshappavoo/basex v0.0.0-20170425072625-481a6f6dc663 // indirect github.com/disintegration/imaging v1.6.2 // indirect github.com/dlclark/regexp2 v1.10.0 // indirect - github.com/docker/distribution v2.8.2+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/ef-ds/deque v1.0.4 // indirect github.com/eliukblau/pixterm/pkg/ansimage v0.0.0-20191210081756-9fb6cf8c2f75 // indirect @@ -92,7 +88,6 @@ require ( github.com/go-openapi/spec v0.20.9 // indirect github.com/go-openapi/swag v0.22.4 // indirect github.com/go-openapi/validate v0.22.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a // indirect github.com/google/uuid v1.3.0 // indirect @@ -132,12 +127,8 @@ require ( github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/moby/term v0.0.0-20221120202655-abb19827d345 // indirect - github.com/morikuni/aec v1.0.0 // indirect github.com/natefinch/lumberjack v2.0.0+incompatible // indirect github.com/oklog/ulid v1.3.1 // indirect - github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.0.2 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openziti/dilithium v0.3.3 // indirect github.com/openziti/jwks v1.0.3 // indirect @@ -186,6 +177,5 @@ require ( google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect - gotest.tools/v3 v3.4.0 // indirect nhooyr.io/websocket v1.8.7 // indirect ) diff --git a/go.sum b/go.sum index 99d9299c8..dabb68a29 100644 --- a/go.sum +++ b/go.sum @@ -48,7 +48,6 @@ git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGy github.com/AppsFlyer/go-sundheit v0.5.0 h1:/VxpyigCfJrq1r97mn9HPiAB2qrhcTFHwNIIDr15CZM= github.com/AppsFlyer/go-sundheit v0.5.0/go.mod h1:2ZM0BnfqT/mljBQO224VbL5XH06TgWuQ6Cn+cTtCpTY= github.com/Azure/azure-sdk-for-go v32.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-autorest/autorest v0.1.0/go.mod h1:AKyIcETwSUFxIcs/Wnq/C+kwCtlEYGUVd7FPNb2slmg= github.com/Azure/go-autorest/autorest v0.5.0/go.mod h1:9HLKlQjVBH6U3oDfsXOeVc56THsLPw1L03yban4xThw= github.com/Azure/go-autorest/autorest/adal v0.1.0/go.mod h1:MeS4XhScH55IST095THyTxElntu7WqB7pNbZo8Q5G3E= @@ -76,8 +75,6 @@ github.com/MichaelMure/go-term-markdown v0.1.4 h1:Ir3kBXDUtOX7dEv0EaQV8CNPpH+T7A github.com/MichaelMure/go-term-markdown v0.1.4/go.mod h1:EhcA3+pKYnlUsxYKBJ5Sn1cTQmmBMjeNlpV8nRb+JxA= github.com/MichaelMure/go-term-text v0.3.1 h1:Kw9kZanyZWiCHOYu9v/8pWEgDQ6UVN9/ix2Vd2zzWf0= github.com/MichaelMure/go-term-text v0.3.1/go.mod h1:QgVjAEDUnRMlzpS6ky5CGblux7ebeiLnuy9dAaFZu8o= -github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= -github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -189,12 +186,6 @@ github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55k github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0= github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnsimple/dnsimple-go v0.63.0/go.mod h1:O5TJ0/U6r7AfT8niYNlmohpLbCSG+c71tQlGr9SeGrg= -github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= -github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE= -github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -345,7 +336,6 @@ github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= @@ -665,8 +655,6 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/term v0.0.0-20221120202655-abb19827d345 h1:J9c53/kxIH+2nTKBEfZYFMlhghtHpIHSXpm5VRGHSnU= -github.com/moby/term v0.0.0-20221120202655-abb19827d345/go.mod h1:15ce4BGCFxt7I5NQKT+HV0yEDxmf6fSysfEDiVo3zFM= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -674,8 +662,6 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY4wsPvgQH/jsuJi4XO2ssZbdsIizr4CVC8= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= @@ -705,26 +691,22 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= -github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= -github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openziti/agent v1.0.14 h1:OTYhj2HeIlFwaFNcVT5BlYf7s4xa0TNmhnjmBpN8Afg= github.com/openziti/agent v1.0.14/go.mod h1:zfm53+PVWoGFzjGGgQdKby5749G6VRYHe+eQJmoVKy4= -github.com/openziti/channel/v2 v2.0.84 h1:bIdg2Z2SZan0HqSz2sbtY6Ibo33BH9Ir+qbuzyt9Rhs= -github.com/openziti/channel/v2 v2.0.84/go.mod h1:njjvl7YH6TfbJPbYxz6Y7+7uhv4Ea2GdLEJIcQOZMU8= +github.com/openziti/channel/v2 v2.0.87 h1:+54diAb1NjwnQ3qADptq76gq3IFF+hW+uLD5st5ULAo= +github.com/openziti/channel/v2 v2.0.87/go.mod h1:GggAVKAlOf2ezo8VvgQ2yRK5Gokp6wlvS4kBhmoKn1g= github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k= github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo= -github.com/openziti/edge v0.24.364 h1:58X9C0CcmoEpAWkutxe49vW+Xf46h8iRlfVKXDaoDp0= -github.com/openziti/edge v0.24.364/go.mod h1:tKl9mG3dko3QQc1FQ1YUSF1B2KTW8MUcHMRezjbGiaU= +github.com/openziti/edge v0.24.372 h1:B9zMZUDnoqKu+epTkWEdfm1ugX8X+S0u/Tg23k3+mPc= +github.com/openziti/edge v0.24.372/go.mod h1:nkYAlBPh8q+pbtM5RACeq0/lsxrutqSKeQ5hlYGe49U= github.com/openziti/edge-api v0.25.30 h1:40pAcd3Y2yT8hYYHTJTkSTLA0pvbDCw4prt72JdQMuI= github.com/openziti/edge-api v0.25.30/go.mod h1:ODMG0fB9Dj1pL0UqDC8jzSUAlUZy8aYhzF3xHPg6Xm0= -github.com/openziti/fabric v0.23.45 h1:TnPtN215KX5SBrWLzTVZLS1+xalVkpa+9kb+6U3YNl8= -github.com/openziti/fabric v0.23.45/go.mod h1:GijkTVVj4gUXlez2l+mdedCV15qP91YzX0EdM3tCSA8= +github.com/openziti/fabric v0.23.52 h1:8F4jt00RDrZJz6YiKliJ8UGnknE3jSuWwxsK3641ehE= +github.com/openziti/fabric v0.23.52/go.mod h1:wLYKhlnhthLR7FBqfGlfdCZ0hbQCcSnr5b2wpjA4/vM= github.com/openziti/foundation/v2 v2.0.28 h1:AAdHhtUj1tCIXollSpbDlKwPKRasNAgADpTZAF1WCOQ= github.com/openziti/foundation/v2 v2.0.28/go.mod h1:psKxxQw/zRo5+oKN7AR+MKYaeR3mbBPhb65qq8rqB0U= github.com/openziti/identity v1.0.59 h1:YShXqxa9nTbCnPtIAji10hx7BG1nQukg4ddUJExNXa8= @@ -735,18 +717,18 @@ github.com/openziti/metrics v1.2.30 h1:0ZV9UWPupcBvHigzET1wf47idrTflYSHInNgDtZqk github.com/openziti/metrics v1.2.30/go.mod h1:8xSr4Rl0527Lyp5IKvUYwPNObIFkO8AS3nO2RjvDPSQ= github.com/openziti/runzmd v1.0.28 h1:8VNgENRAm1pfp0YoJWYoW6uBtyMD6ccVTsC24kx2gpk= github.com/openziti/runzmd v1.0.28/go.mod h1:4r4uNOK34lKbilrV7yaiDiPwRGIvj1XQSl6E6U8NmAw= -github.com/openziti/sdk-golang v0.20.78 h1:ts1AXB9rtja/pfnzsaUzojVUNtEDmtHrNLCrokbpBHQ= -github.com/openziti/sdk-golang v0.20.78/go.mod h1:t97RrYAaFq0mGHc08T5OVCnuNvqO4/ERDfXpUvDgN7U= +github.com/openziti/sdk-golang v0.20.80 h1:TG+G4QrVjcA7Q2kiZf8OlplfyHRkoVO7Z1yilUHrEis= +github.com/openziti/sdk-golang v0.20.80/go.mod h1:SvKwsnV7wgRrGq+E+C2ASCEN06t9camcTBANYXXYWro= github.com/openziti/secretstream v0.1.10 h1:aLheoP6vVAv96mItwkXxWr9Ym0tTooJ5o9H1j2fAh04= github.com/openziti/secretstream v0.1.10/go.mod h1:HrS6P9G0jjHNHuKESMaybNdxBHjD1b0SzxSi0rDzshY= github.com/openziti/storage v0.2.11 h1:Ws23any7NtbEKQroFJt6DJmeEFGMPjZqjAK2/Re9LIE= github.com/openziti/storage v0.2.11/go.mod h1:M46XIxPYwTDTgaamI6o9cyEJkYvUYfhJjwvZtQu4tUQ= -github.com/openziti/transport/v2 v2.0.93 h1:CCADtZQki2gMtTYuGuNpxIVuWofxFIWmGbeRZp2MNTY= -github.com/openziti/transport/v2 v2.0.93/go.mod h1:a39vnp7P/ldeSegyRLwYLM+UrK1PjI6pryG3N+lKx6o= +github.com/openziti/transport/v2 v2.0.96 h1:onLHb0oNS+xzmqnAVYHDGb00qtLODzyPVubq+2h5SoY= +github.com/openziti/transport/v2 v2.0.96/go.mod h1:L0MZ3LZsJ9Jheg05Bp6QYJBfuq4fDtjoL9stcTSmtko= github.com/openziti/x509-claims v1.0.3 h1:HNdQ8Nf1agB3lBs1gahcO6zfkeS4S5xoQ2/PkY4HRX0= github.com/openziti/x509-claims v1.0.3/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE= -github.com/openziti/xweb/v2 v2.0.2 h1:XYlVFriTq/U1wcUrc+XPnWJGhXh9NJPhtQ7+r3aC0cU= -github.com/openziti/xweb/v2 v2.0.2/go.mod h1:KQOOlnJk08EZT3TWkvDj/pbIUEVbgG0IrrNzl8gsi40= +github.com/openziti/xweb/v2 v2.1.0 h1:Xhh3C2pZkq/Prr65V+SfFSibLDYteoc4f62KQCcTZF4= +github.com/openziti/xweb/v2 v2.1.0/go.mod h1:wPkjm5y45RYCV8AafjcAXP/ZM4DBOofXhRwSGgjF8w8= github.com/openziti/ziti-db-explorer v1.1.1 h1:G0eoTby+aIjjt5TxEfR+FMI2CWd4RvZFjzaIMX2lEBw= github.com/openziti/ziti-db-explorer v1.1.1/go.mod h1:h76h7Tsb+khb0v+CqYKL6ifUfJbUMjGBFU2IvupfBE4= github.com/oracle/oci-go-sdk v24.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= @@ -1300,7 +1282,6 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1538,8 +1519,6 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= -gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/zititest/go.mod b/zititest/go.mod index 5cf4282de..01e873413 100644 --- a/zititest/go.mod +++ b/zititest/go.mod @@ -9,15 +9,15 @@ require ( github.com/Jeffail/gabs/v2 v2.7.0 github.com/google/uuid v1.3.0 github.com/michaelquigley/pfxlog v0.6.10 - github.com/openziti/channel/v2 v2.0.84 - github.com/openziti/edge v0.24.364 + github.com/openziti/channel/v2 v2.0.87 + github.com/openziti/edge v0.24.372 github.com/openziti/fablab v0.5.5 - github.com/openziti/fabric v0.23.45 + github.com/openziti/fabric v0.23.52 github.com/openziti/foundation/v2 v2.0.28 github.com/openziti/identity v1.0.59 - github.com/openziti/sdk-golang v0.20.78 + github.com/openziti/sdk-golang v0.20.80 github.com/openziti/storage v0.2.11 - github.com/openziti/transport/v2 v2.0.93 + github.com/openziti/transport/v2 v2.0.96 github.com/openziti/ziti v0.28.3 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 @@ -129,7 +129,7 @@ require ( github.com/openziti/runzmd v1.0.28 // indirect github.com/openziti/secretstream v0.1.10 // indirect github.com/openziti/x509-claims v1.0.3 // indirect - github.com/openziti/xweb/v2 v2.0.2 // indirect + github.com/openziti/xweb/v2 v2.1.0 // indirect github.com/openziti/ziti-db-explorer v1.1.1 // indirect github.com/orcaman/concurrent-map/v2 v2.0.1 // indirect github.com/parallaxsecond/parsec-client-go v0.0.0-20221025095442-f0a77d263cf9 // indirect diff --git a/zititest/go.sum b/zititest/go.sum index 3044ead6b..2de16b914 100644 --- a/zititest/go.sum +++ b/zititest/go.sum @@ -641,16 +641,16 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openziti/agent v1.0.14 h1:OTYhj2HeIlFwaFNcVT5BlYf7s4xa0TNmhnjmBpN8Afg= github.com/openziti/agent v1.0.14/go.mod h1:zfm53+PVWoGFzjGGgQdKby5749G6VRYHe+eQJmoVKy4= -github.com/openziti/channel/v2 v2.0.84 h1:bIdg2Z2SZan0HqSz2sbtY6Ibo33BH9Ir+qbuzyt9Rhs= -github.com/openziti/channel/v2 v2.0.84/go.mod h1:njjvl7YH6TfbJPbYxz6Y7+7uhv4Ea2GdLEJIcQOZMU8= -github.com/openziti/edge v0.24.364 h1:58X9C0CcmoEpAWkutxe49vW+Xf46h8iRlfVKXDaoDp0= -github.com/openziti/edge v0.24.364/go.mod h1:tKl9mG3dko3QQc1FQ1YUSF1B2KTW8MUcHMRezjbGiaU= +github.com/openziti/channel/v2 v2.0.87 h1:+54diAb1NjwnQ3qADptq76gq3IFF+hW+uLD5st5ULAo= +github.com/openziti/channel/v2 v2.0.87/go.mod h1:GggAVKAlOf2ezo8VvgQ2yRK5Gokp6wlvS4kBhmoKn1g= +github.com/openziti/edge v0.24.372 h1:B9zMZUDnoqKu+epTkWEdfm1ugX8X+S0u/Tg23k3+mPc= +github.com/openziti/edge v0.24.372/go.mod h1:nkYAlBPh8q+pbtM5RACeq0/lsxrutqSKeQ5hlYGe49U= github.com/openziti/edge-api v0.25.30 h1:40pAcd3Y2yT8hYYHTJTkSTLA0pvbDCw4prt72JdQMuI= github.com/openziti/edge-api v0.25.30/go.mod h1:ODMG0fB9Dj1pL0UqDC8jzSUAlUZy8aYhzF3xHPg6Xm0= github.com/openziti/fablab v0.5.5 h1:wz5rkuGhdDbmNPXC8XtsyHhWk6WJtxCgfhXt5XVWXmY= github.com/openziti/fablab v0.5.5/go.mod h1:xkvaXX6C+bGHH5R4G8/vkz1pbBlwS1EzghF37wcNetM= -github.com/openziti/fabric v0.23.45 h1:TnPtN215KX5SBrWLzTVZLS1+xalVkpa+9kb+6U3YNl8= -github.com/openziti/fabric v0.23.45/go.mod h1:GijkTVVj4gUXlez2l+mdedCV15qP91YzX0EdM3tCSA8= +github.com/openziti/fabric v0.23.52 h1:8F4jt00RDrZJz6YiKliJ8UGnknE3jSuWwxsK3641ehE= +github.com/openziti/fabric v0.23.52/go.mod h1:wLYKhlnhthLR7FBqfGlfdCZ0hbQCcSnr5b2wpjA4/vM= github.com/openziti/foundation/v2 v2.0.28 h1:AAdHhtUj1tCIXollSpbDlKwPKRasNAgADpTZAF1WCOQ= github.com/openziti/foundation/v2 v2.0.28/go.mod h1:psKxxQw/zRo5+oKN7AR+MKYaeR3mbBPhb65qq8rqB0U= github.com/openziti/identity v1.0.59 h1:YShXqxa9nTbCnPtIAji10hx7BG1nQukg4ddUJExNXa8= @@ -661,18 +661,18 @@ github.com/openziti/metrics v1.2.30 h1:0ZV9UWPupcBvHigzET1wf47idrTflYSHInNgDtZqk github.com/openziti/metrics v1.2.30/go.mod h1:8xSr4Rl0527Lyp5IKvUYwPNObIFkO8AS3nO2RjvDPSQ= github.com/openziti/runzmd v1.0.28 h1:8VNgENRAm1pfp0YoJWYoW6uBtyMD6ccVTsC24kx2gpk= github.com/openziti/runzmd v1.0.28/go.mod h1:4r4uNOK34lKbilrV7yaiDiPwRGIvj1XQSl6E6U8NmAw= -github.com/openziti/sdk-golang v0.20.78 h1:ts1AXB9rtja/pfnzsaUzojVUNtEDmtHrNLCrokbpBHQ= -github.com/openziti/sdk-golang v0.20.78/go.mod h1:t97RrYAaFq0mGHc08T5OVCnuNvqO4/ERDfXpUvDgN7U= +github.com/openziti/sdk-golang v0.20.80 h1:TG+G4QrVjcA7Q2kiZf8OlplfyHRkoVO7Z1yilUHrEis= +github.com/openziti/sdk-golang v0.20.80/go.mod h1:SvKwsnV7wgRrGq+E+C2ASCEN06t9camcTBANYXXYWro= github.com/openziti/secretstream v0.1.10 h1:aLheoP6vVAv96mItwkXxWr9Ym0tTooJ5o9H1j2fAh04= github.com/openziti/secretstream v0.1.10/go.mod h1:HrS6P9G0jjHNHuKESMaybNdxBHjD1b0SzxSi0rDzshY= github.com/openziti/storage v0.2.11 h1:Ws23any7NtbEKQroFJt6DJmeEFGMPjZqjAK2/Re9LIE= github.com/openziti/storage v0.2.11/go.mod h1:M46XIxPYwTDTgaamI6o9cyEJkYvUYfhJjwvZtQu4tUQ= -github.com/openziti/transport/v2 v2.0.93 h1:CCADtZQki2gMtTYuGuNpxIVuWofxFIWmGbeRZp2MNTY= -github.com/openziti/transport/v2 v2.0.93/go.mod h1:a39vnp7P/ldeSegyRLwYLM+UrK1PjI6pryG3N+lKx6o= +github.com/openziti/transport/v2 v2.0.96 h1:onLHb0oNS+xzmqnAVYHDGb00qtLODzyPVubq+2h5SoY= +github.com/openziti/transport/v2 v2.0.96/go.mod h1:L0MZ3LZsJ9Jheg05Bp6QYJBfuq4fDtjoL9stcTSmtko= github.com/openziti/x509-claims v1.0.3 h1:HNdQ8Nf1agB3lBs1gahcO6zfkeS4S5xoQ2/PkY4HRX0= github.com/openziti/x509-claims v1.0.3/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE= -github.com/openziti/xweb/v2 v2.0.2 h1:XYlVFriTq/U1wcUrc+XPnWJGhXh9NJPhtQ7+r3aC0cU= -github.com/openziti/xweb/v2 v2.0.2/go.mod h1:KQOOlnJk08EZT3TWkvDj/pbIUEVbgG0IrrNzl8gsi40= +github.com/openziti/xweb/v2 v2.1.0 h1:Xhh3C2pZkq/Prr65V+SfFSibLDYteoc4f62KQCcTZF4= +github.com/openziti/xweb/v2 v2.1.0/go.mod h1:wPkjm5y45RYCV8AafjcAXP/ZM4DBOofXhRwSGgjF8w8= github.com/openziti/ziti-db-explorer v1.1.1 h1:G0eoTby+aIjjt5TxEfR+FMI2CWd4RvZFjzaIMX2lEBw= github.com/openziti/ziti-db-explorer v1.1.1/go.mod h1:h76h7Tsb+khb0v+CqYKL6ifUfJbUMjGBFU2IvupfBE4= github.com/oracle/oci-go-sdk v24.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= From c02051f3d4b07ef7165db665673403ccd5ad1ba0 Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Mon, 31 Jul 2023 15:09:52 -0400 Subject: [PATCH 21/29] fix/rearrange quickstart to work as prior --- quickstart/docker/image/run-router.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/quickstart/docker/image/run-router.sh b/quickstart/docker/image/run-router.sh index 563b09db7..1ab5ab8dd 100755 --- a/quickstart/docker/image/run-router.sh +++ b/quickstart/docker/image/run-router.sh @@ -2,12 +2,6 @@ . "${ZITI_SCRIPTS}/ziti-cli-functions.sh" -# wait for the controller to come online -_wait_for_controller - -# after coming online, give the controller just a second to ramp up in case running via docker compose -sleep 1 - if [[ "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_ADDRESS="ziti-edge-controller"; fi if [[ "${ZITI_CTRL_EDGE_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_PORT="3022"; fi if [[ "${ZITI_ROUTER_PORT-}" == "" ]]; then export ZITI_ROUTER_PORT="3022"; fi @@ -20,6 +14,12 @@ fi . ${ZITI_HOME}/ziti.env +# wait for the controller to come online +_wait_for_controller + +# after coming online, give the controller just a second to ramp up in case running via docker compose +sleep 1 + if [[ "${_ZITI_ROUTER_NAME}" != "" ]]; then export ZITI_ROUTER_NAME="${_ZITI_ROUTER_NAME}" echo "ZITI_ROUTER_NAME set to: ${ZITI_ROUTER_NAME}" From b37e0f92a06169b4e68e61329bb1d02b601c46cf Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Mon, 31 Jul 2023 15:14:55 -0400 Subject: [PATCH 22/29] fix the default port of the controller bug --- quickstart/docker/image/run-router.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart/docker/image/run-router.sh b/quickstart/docker/image/run-router.sh index 1ab5ab8dd..d3c2172f9 100755 --- a/quickstart/docker/image/run-router.sh +++ b/quickstart/docker/image/run-router.sh @@ -3,7 +3,7 @@ . "${ZITI_SCRIPTS}/ziti-cli-functions.sh" if [[ "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_ADDRESS="ziti-edge-controller"; fi -if [[ "${ZITI_CTRL_EDGE_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_PORT="3022"; fi +if [[ "${ZITI_CTRL_EDGE_ADVERTISED_PORT-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_PORT="1280"; fi if [[ "${ZITI_ROUTER_PORT-}" == "" ]]; then export ZITI_ROUTER_PORT="3022"; fi if [[ "${ZITI_ROUTER_ROLES}" == "" ]]; then export ZITI_ROUTER_ROLES="${ZITI_ROUTER_NAME}"; fi From 4c6e60a5d9bcf7317921a980a598ccbb0062383c Mon Sep 17 00:00:00 2001 From: gberl002 Date: Mon, 31 Jul 2023 16:13:11 -0400 Subject: [PATCH 23/29] Fixed some routers intermittently being unable to connect to the controller due to "ziti not found" Signed-off-by: gberl002 --- quickstart/docker/image/run-router.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quickstart/docker/image/run-router.sh b/quickstart/docker/image/run-router.sh index d3c2172f9..2e72ab363 100755 --- a/quickstart/docker/image/run-router.sh +++ b/quickstart/docker/image/run-router.sh @@ -27,9 +27,9 @@ fi _UNIQUE_NAME="${ZITI_HOME}/${ZITI_ROUTER_NAME}-${HOSTNAME}.init" if [ ! -f "${_UNIQUE_NAME}" ]; then echo "system has not been initialized. initializing..." - ziti edge login ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}:${ZITI_CTRL_EDGE_ADVERTISED_PORT} -u $ZITI_USER -p $ZITI_PWD -y + "${ZITI_BIN_DIR-}/ziti" edge login ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}:${ZITI_CTRL_EDGE_ADVERTISED_PORT} -u $ZITI_USER -p $ZITI_PWD -y - echo "---------- Creating edge-router ${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS}...." + echo "---------- Creating edge-router ${ZITI_ROUTER_NAME}...." if [[ "$1" == "edge" ]]; then echo "CREATING EDGE ROUTER CONFIG: ${ZITI_ROUTER_NAME}" From 220be23c04f70eba70755e370c62d06528105786 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Fri, 4 Aug 2023 15:08:00 -0400 Subject: [PATCH 24/29] Fix linter reported issues --- common/enrollment/enroll.go | 10 +- common/getziti/github.go | 3 +- quickstart/test/quickstart_test.go | 135 +------------- ziti-fabric-test/subcmd/client/http.go | 6 +- ziti-fabric-test/subcmd/loop2/protocol.go | 38 ++-- ziti-fabric-test/subcmd/loop2/scenario.go | 4 +- ziti-fabric-test/subcmd/loop3/dialer.go | 2 +- ziti-fabric-test/subcmd/loop3/messages.go | 6 +- .../subcmd/loop3/messages_test.go | 9 +- ziti-fabric-test/subcmd/loop3/protocol.go | 46 +++-- ziti-fabric-test/subcmd/loop3/scenario.go | 4 +- ziti/cmd/agentcli/agent_cluster_list.go | 2 +- ziti/cmd/agentcli/agent_ps.go | 5 +- ziti/cmd/cmd.go | 1 - ziti/cmd/color/color.go | 99 ----------- ziti/cmd/common.go | 6 + ziti/cmd/common_commands.go | 161 ----------------- ziti/cmd/common_init.go | 167 ------------------ ziti/cmd/create_config_environment.go | 1 - ziti/cmd/create_config_router_test.go | 22 +-- ziti/cmd/database/du.go | 19 -- ziti/cmd/demo/echo_server.go | 11 -- ziti/cmd/edge/create_config.go | 7 +- ziti/cmd/edge/create_config_type.go | 7 +- ziti/cmd/edge/create_enrollment.go | 1 - ziti/cmd/edge/create_posture_check.go | 1 - ziti/cmd/edge/create_service.go | 5 +- ziti/cmd/edge/delete.go | 4 - ziti/cmd/edge/encryption_var.go | 2 +- ziti/cmd/edge/list.go | 24 --- ziti/cmd/edge/update_config.go | 7 +- ziti/cmd/edge/update_service.go | 4 +- ziti/cmd/edge/verify.go | 7 - ziti/cmd/edge/verify_ca.go | 18 +- ziti/cmd/fabric/inspect.go | 2 +- ziti/cmd/fabric/stream_traces.go | 8 +- ziti/cmd/helpers/helpers.go | 34 +--- ziti/cmd/install/common_install.go | 101 ----------- ...tall_terraform_provider_edge_controller.go | 3 + ziti/cmd/install/install_ziti_ALL.go | 3 + ziti/cmd/install/install_ziti_controller.go | 3 + ziti/cmd/install/install_ziti_router.go | 3 + ziti/cmd/install/install_ziti_tunnel.go | 3 + ziti/cmd/install/version.go | 30 +++- ziti/cmd/lets_encrypt/KeyTypeVar.go | 25 +-- ziti/cmd/lets_encrypt/accounts_storage.go | 10 +- ziti/cmd/lets_encrypt/certs_storage.go | 10 +- ziti/cmd/lets_encrypt/create.go | 14 +- ziti/cmd/lets_encrypt/list.go | 10 +- ziti/cmd/lets_encrypt/renew.go | 12 +- ziti/cmd/lets_encrypt/revoke.go | 8 +- ziti/cmd/lets_encrypt/setup.go | 45 +---- ziti/cmd/pki_create.go | 33 ++-- ziti/cmd/templates/templater.go | 9 - ziti/cmd/unwrap_identity.go | 10 +- ziti/pki/store/local.go | 9 +- ziti/router/enrollgw.go | 8 +- ziti/router/run.go | 2 +- ziti/util/certs.go | 16 +- ziti/util/commands.go | 126 ------------- ziti/util/dirs.go | 5 +- ziti/util/files.go | 13 +- 62 files changed, 251 insertions(+), 1148 deletions(-) delete mode 100644 ziti/cmd/color/color.go delete mode 100644 ziti/cmd/common_commands.go delete mode 100644 ziti/cmd/common_init.go diff --git a/common/enrollment/enroll.go b/common/enrollment/enroll.go index 1ba66d9f9..3dc7acfb4 100644 --- a/common/enrollment/enroll.go +++ b/common/enrollment/enroll.go @@ -22,7 +22,6 @@ import ( "github.com/openziti/identity/engines" "github.com/openziti/sdk-golang/ziti" "github.com/openziti/ziti/ziti/cmd/common" - "io/ioutil" "os" "strings" @@ -36,7 +35,6 @@ import ( // global state used by all subcommands are located here for easy discovery -const verboseDesc = "Enable verbose logging." const outpathDesc = "Output configuration file." const jwtpathDesc = "Enrollment token (JWT file). Required" const certDesc = "The certificate to present when establishing a connection." @@ -113,10 +111,12 @@ func NewEnrollCommand(p common.OptionsProvider) *cobra.Command { enrollSubCmd.Flags().BoolVar(&action.RemoveJwt, "rm", false, "Remove the JWT on success") enrollSubCmd.Flags().BoolVarP(&action.Verbose, "verbose", "v", false, "Enable verbose logging") - action.KeyAlg.Set("RSA") // set default + if err := action.KeyAlg.Set("RSA"); err != nil { // set default + panic(err) + } enrollSubCmd.Flags().VarP(&action.KeyAlg, "keyAlg", "a", "Crypto algorithm to use when generating private key") - var keyDesc = "" + var keyDesc string certEngines := engines.ListEngines() if len(certEngines) > 0 { keyDesc = fmt.Sprintf("The key to use with the certificate. Optionally specify the engine to use. supported engines: %v", certEngines) @@ -153,7 +153,7 @@ func (e *EnrollAction) Run() error { return fmt.Errorf("the output path must not be the same as the jwt path") } - tokenStr, _ := ioutil.ReadFile(e.JwtPath) + tokenStr, _ := os.ReadFile(e.JwtPath) pfxlog.Logger().Debugf("jwt to parse: %s", tokenStr) tkn, _, err := enroll.ParseToken(string(tokenStr)) diff --git a/common/getziti/github.go b/common/getziti/github.go index 0e62f9687..229c3c445 100644 --- a/common/getziti/github.go +++ b/common/getziti/github.go @@ -129,7 +129,8 @@ func GetLatestGitHubReleaseAsset(appName string, appGitHub string, version strin version = "tags/" + version } - ctx, _ := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancelF := context.WithTimeout(context.Background(), 10*time.Second) + defer cancelF() resp, err := getRequest(verbose). SetContext(ctx). diff --git a/quickstart/test/quickstart_test.go b/quickstart/test/quickstart_test.go index 1e048b1a3..c697e167e 100644 --- a/quickstart/test/quickstart_test.go +++ b/quickstart/test/quickstart_test.go @@ -1,7 +1,6 @@ package test import ( - "archive/tar" "context" "crypto/tls" "crypto/x509" @@ -9,18 +8,14 @@ import ( "fmt" "github.com/openziti/edge-api/rest_management_api_client" api_client_config "github.com/openziti/edge-api/rest_management_api_client/config" - "github.com/openziti/edge-api/rest_management_api_client/edge_router" - "github.com/openziti/edge-api/rest_management_api_client/edge_router_policy" "github.com/openziti/edge-api/rest_management_api_client/identity" "github.com/openziti/edge-api/rest_management_api_client/service" - "github.com/openziti/edge-api/rest_management_api_client/service_edge_router_policy" "github.com/openziti/edge-api/rest_management_api_client/service_policy" "github.com/openziti/edge-api/rest_management_api_client/terminator" "github.com/openziti/edge-api/rest_model" "github.com/openziti/edge-api/rest_util" "github.com/openziti/sdk-golang/ziti" "github.com/openziti/sdk-golang/ziti/enroll" - "github.com/pkg/errors" log "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" "io" @@ -33,69 +28,6 @@ import ( "time" ) -func iterateDir(dirPath string) []string { - dir, err := os.Open(dirPath) - if err != nil { - fmt.Println(err) - log.Fatal("Failed to parse ziti.ignore") - } - defer dir.Close() - fis, err := dir.Readdir(0) - if err != nil { - fmt.Println(err) - log.Fatal("Failed to read directory") - } - var filePaths []string - for _, fi := range fis { - curPath := dirPath + "/" + fi.Name() - if fi.IsDir() { - //TarGzWrite( curPath, tw, fi ) - filePaths = append(filePaths, iterateDir(curPath)...) - } else { - filePaths = append(filePaths, curPath) - //err = addToTar(tw, curPath) - if err != nil { - fmt.Println(err) - log.Fatal("Failed add " + curPath) - } - //TarGzWrite( curPath, tw, fi ) - } - } - return filePaths -} - -func addFileToTarWriter(filePath string, tarWriter *tar.Writer) error { - file, err := os.Open(filePath) - if err != nil { - return errors.New(fmt.Sprintf("Could not open file '%s', got error '%s'", filePath, err.Error())) - } - defer file.Close() - - stat, err := file.Stat() - if err != nil { - return errors.New(fmt.Sprintf("Could not get stat for file '%s', got error '%s'", filePath, err.Error())) - } - - header := &tar.Header{ - Name: filePath, - Size: stat.Size(), - Mode: int64(stat.Mode()), - ModTime: stat.ModTime(), - } - - err = tarWriter.WriteHeader(header) - if err != nil { - return errors.New(fmt.Sprintf("Could not write header for file '%s', got error '%s'", filePath, err.Error())) - } - - _, err = io.Copy(tarWriter, file) - if err != nil { - return errors.New(fmt.Sprintf("Could not copy the file '%s' data to the tarball, got error '%s'", filePath, err.Error())) - } - - return nil -} - /* This is a manually run test that will, with the default values except the admin password, confirm the docker-compose ziti network is running as expected. The values can be edited to confirm other ziti networks but will require an http @@ -127,10 +59,10 @@ func TestSimpleWebService(t *testing.T) { } ctrlAddress := "https://" + advAddy + ":" + advPort - bindHostAddress := os.Getenv("ZITI_QUICKSTART_TEST_ADDRESS") - if bindHostAddress == "" { - bindHostAddress = ctrlAddress - } + //bindHostAddress := os.Getenv("ZITI_QUICKSTART_TEST_ADDRESS") + //if bindHostAddress == "" { + // bindHostAddress = ctrlAddress + //} hostingRouterName := erName dialAddress := "simple.web.smoke.test" dialPort := 80 @@ -367,41 +299,6 @@ func getServiceByName(client *rest_management_api_client.ZitiEdgeManagement, nam return resp.GetPayload().Data[0] } -func getEdgeRouterByName(client *rest_management_api_client.ZitiEdgeManagement, name string) rest_model.EdgeRouterDetail { - filterValues := "name=\"" + name + "\"" - listParams := &edge_router.ListEdgeRoutersParams{ - Filter: &filterValues, - } - listParams.SetTimeout(30 * time.Second) - resp, err := client.EdgeRouter.ListEdgeRouters(listParams, nil) - if err != nil { - fmt.Println(err) - log.Fatal("Could not get edge router filtered by name") - } - return *resp.GetPayload().Data[0] -} - -func createEdgeRouterPolicy(client *rest_management_api_client.ZitiEdgeManagement, name string, roles rest_model.Roles) service_edge_router_policy.CreateServiceEdgeRouterPolicyCreated { - defaultSemantic := rest_model.SemanticAllOf - serp := &rest_model.ServiceEdgeRouterPolicyCreate{ - EdgeRouterRoles: roles, - Name: &name, - Semantic: &defaultSemantic, - ServiceRoles: roles, - } - serpParams := &service_edge_router_policy.CreateServiceEdgeRouterPolicyParams{ - Policy: serp, - Context: context.Background(), - } - serpParams.SetTimeout(30 * time.Second) - resp, err := client.ServiceEdgeRouterPolicy.CreateServiceEdgeRouterPolicy(serpParams, nil) - if err != nil { - fmt.Println(err) - log.Fatal("Could not create service edge router policy") - } - return *resp -} - func createInterceptV1ServiceConfig(client *rest_management_api_client.ZitiEdgeManagement, name string, protocols []string, addresses []string, portRangeLow int, portRangeHigh int) rest_model.CreateLocation { configTypeID := *getConfigTypeByName(client, "intercept.v1").ID interceptData := map[string]interface{}{ @@ -531,30 +428,6 @@ func waitForTerminatorCountByRouterName(client *rest_management_api_client.ZitiE return false } -func deleteEdgeRouterPolicyByID(client *rest_management_api_client.ZitiEdgeManagement, id string) *edge_router_policy.DeleteEdgeRouterPolicyOK { - deleteParams := &edge_router_policy.DeleteEdgeRouterPolicyParams{ - ID: id, - } - deleteParams.SetTimeout(30 * time.Second) - resp, err := client.EdgeRouterPolicy.DeleteEdgeRouterPolicy(deleteParams, nil) - if err != nil { - fmt.Println(err) - } - return resp -} - -func deleteServiceEdgeRouterPolicyByID(client *rest_management_api_client.ZitiEdgeManagement, id string) *service_edge_router_policy.DeleteServiceEdgeRouterPolicyOK { - deleteParams := &service_edge_router_policy.DeleteServiceEdgeRouterPolicyParams{ - ID: id, - } - deleteParams.SetTimeout(30 * time.Second) - resp, err := client.ServiceEdgeRouterPolicy.DeleteServiceEdgeRouterPolicy(deleteParams, nil) - if err != nil { - fmt.Println(err) - } - return resp -} - func deleteServiceConfigByID(client *rest_management_api_client.ZitiEdgeManagement, id string) *api_client_config.DeleteConfigOK { deleteParams := &api_client_config.DeleteConfigParams{ ID: id, diff --git a/ziti-fabric-test/subcmd/client/http.go b/ziti-fabric-test/subcmd/client/http.go index c40961a21..99e4fa975 100644 --- a/ziti-fabric-test/subcmd/client/http.go +++ b/ziti-fabric-test/subcmd/client/http.go @@ -22,12 +22,12 @@ import ( "fmt" "github.com/michaelquigley/pfxlog" "github.com/openziti/fabric/router/xgress_transport" - "github.com/openziti/identity/dotziti" "github.com/openziti/identity" + "github.com/openziti/identity/dotziti" "github.com/openziti/transport/v2" "github.com/openziti/ziti/ziti-fabric-test/subcmd" "github.com/spf13/cobra" - "io/ioutil" + "io" "net" "net/http" ) @@ -83,7 +83,7 @@ func doHttp(cmd *cobra.Command, args []string) { request.Host = httpCmdHost } if response, err := c.Do(request); err == nil { - body, err := ioutil.ReadAll(response.Body) + body, err := io.ReadAll(response.Body) if err != nil { panic(err) } diff --git a/ziti-fabric-test/subcmd/loop2/protocol.go b/ziti-fabric-test/subcmd/loop2/protocol.go index 25014ad0d..dfb419116 100644 --- a/ziti-fabric-test/subcmd/loop2/protocol.go +++ b/ziti-fabric-test/subcmd/loop2/protocol.go @@ -17,16 +17,16 @@ package loop2 import ( - "github.com/openziti/ziti/ziti-fabric-test/subcmd/loop2/pb" - "github.com/openziti/foundation/v2/info" "bytes" "crypto/sha512" "encoding/binary" "encoding/hex" "fmt" - "google.golang.org/protobuf/proto" "github.com/michaelquigley/pfxlog" + "github.com/openziti/foundation/v2/info" + "github.com/openziti/ziti/ziti-fabric-test/subcmd/loop2/pb" "github.com/pkg/errors" + "google.golang.org/protobuf/proto" "io" "math/rand" "time" @@ -89,29 +89,27 @@ func (p *protocol) txer(done chan bool) { defer log.Debug("complete") for p.txCount < p.test.TxRequests { - select { - case block := <-p.txGenerator.blocks: - if block != nil { - if err := p.txBlock(block); err == nil { - p.txCount++ + block := <-p.txGenerator.blocks + if block != nil { + if err := p.txBlock(block); err == nil { + p.txCount++ - if p.test.TxPacing > 0 { - jitter := 0 - if p.test.TxMaxJitter > 0 { - jitter = rand.Intn(int(p.test.TxMaxJitter)) - } - time.Sleep(time.Duration(int(p.test.TxPacing)+jitter) * time.Millisecond) + if p.test.TxPacing > 0 { + jitter := 0 + if p.test.TxMaxJitter > 0 { + jitter = rand.Intn(int(p.test.TxMaxJitter)) } - - } else { - log.Errorf("error sending block (%s)", err) - p.errors <- err - return + time.Sleep(time.Duration(int(p.test.TxPacing)+jitter) * time.Millisecond) } + } else { - log.Errorf("tx blocks chan closed") + log.Errorf("error sending block (%s)", err) + p.errors <- err return } + } else { + log.Errorf("tx blocks chan closed") + return } } diff --git a/ziti-fabric-test/subcmd/loop2/scenario.go b/ziti-fabric-test/subcmd/loop2/scenario.go index ff9d4ab09..8586cd77f 100644 --- a/ziti-fabric-test/subcmd/loop2/scenario.go +++ b/ziti-fabric-test/subcmd/loop2/scenario.go @@ -18,7 +18,7 @@ package loop2 import ( "gopkg.in/yaml.v2" - "io/ioutil" + "os" ) type Scenario struct { @@ -43,7 +43,7 @@ type Test struct { } func LoadScenario(path string) (*Scenario, error) { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { return nil, err } diff --git a/ziti-fabric-test/subcmd/loop3/dialer.go b/ziti-fabric-test/subcmd/loop3/dialer.go index ef47515c9..be2f51a74 100644 --- a/ziti-fabric-test/subcmd/loop3/dialer.go +++ b/ziti-fabric-test/subcmd/loop3/dialer.go @@ -202,7 +202,7 @@ func (cmd *dialerCmd) connect() net.Conn { } } - ConnectionTime.Update(time.Now().Sub(start)) + ConnectionTime.Update(time.Since(start)) return conn } diff --git a/ziti-fabric-test/subcmd/loop3/messages.go b/ziti-fabric-test/subcmd/loop3/messages.go index 724823abc..336792843 100644 --- a/ziti-fabric-test/subcmd/loop3/messages.go +++ b/ziti-fabric-test/subcmd/loop3/messages.go @@ -89,8 +89,8 @@ func (r *Result) Rx(p *protocol) error { const ( BlockTypePlain byte = 1 - BlockTypeLatencyRequest = 2 - BlockTypeLatencyResponse = 3 + BlockTypeLatencyRequest byte = 2 + BlockTypeLatencyResponse byte = 3 ) type Block interface { @@ -233,7 +233,7 @@ func (block *RandHashedBlock) Rx(p *protocol) error { BytesRxRate.Mark(int64(8 + length)) if block.Type == BlockTypeLatencyResponse { - elapsed := time.Now().Sub(block.Timestamp) + elapsed := time.Since(block.Timestamp) MsgLatency.Update(elapsed) } diff --git a/ziti-fabric-test/subcmd/loop3/messages_test.go b/ziti-fabric-test/subcmd/loop3/messages_test.go index f7603ffc6..379fcd0d5 100644 --- a/ziti-fabric-test/subcmd/loop3/messages_test.go +++ b/ziti-fabric-test/subcmd/loop3/messages_test.go @@ -2,11 +2,11 @@ package loop3 import ( "bytes" + "crypto/rand" "crypto/sha512" "github.com/google/go-cmp/cmp" loop3_pb "github.com/openziti/ziti/ziti-fabric-test/subcmd/loop3/pb" "github.com/stretchr/testify/require" - "math/rand" "reflect" "testing" ) @@ -22,7 +22,8 @@ func (t *testPeer) Close() error { func Test_MessageSerDeser(t *testing.T) { req := require.New(t) data := make([]byte, 4192) - rand.Read(data) + _, err := rand.Read(data) + req.NoError(err) hash := sha512.Sum512(data) @@ -50,7 +51,9 @@ func Test_MessageSerDeser(t *testing.T) { req.True(reflect.DeepEqual(block, readBlock), cmp.Diff(block, readBlock)) data = make([]byte, 4192) - rand.Read(data) + _, err = rand.Read(data) + req.NoError(err) + hash = sha512.Sum512(data) block = &RandHashedBlock{ diff --git a/ziti-fabric-test/subcmd/loop3/protocol.go b/ziti-fabric-test/subcmd/loop3/protocol.go index 3e625db08..3eb7da4bc 100644 --- a/ziti-fabric-test/subcmd/loop3/protocol.go +++ b/ziti-fabric-test/subcmd/loop3/protocol.go @@ -20,11 +20,11 @@ import ( "bytes" "encoding/binary" "fmt" - "google.golang.org/protobuf/proto" "github.com/michaelquigley/pfxlog" "github.com/openziti/foundation/v2/info" "github.com/openziti/ziti/ziti-fabric-test/subcmd/loop3/pb" "github.com/pkg/errors" + "google.golang.org/protobuf/proto" "io" "math/rand" "sync/atomic" @@ -144,36 +144,34 @@ func (p *protocol) txer(done chan bool) { time.Sleep(p.txPauseFor) lastPause = time.Now() } - select { - case block := <-p.blocks: - if block != nil { - if p.txPacing > 0 { - jitter := time.Duration(0) - if p.txMaxJitter > 0 { - jitter = time.Duration(rand.Intn(int(p.txMaxJitter))) - } - - nextSend := lastSend.Add(p.txPacing + jitter) - if nextSend.After(now) { - time.Sleep(nextSend.Sub(now)) - lastSend = nextSend - } else { - lastSend = now - } + block := <-p.blocks + if block != nil { + if p.txPacing > 0 { + jitter := time.Duration(0) + if p.txMaxJitter > 0 { + jitter = time.Duration(rand.Intn(int(p.txMaxJitter))) } - block.PrepForSend(p) - if err := block.Tx(p); err == nil { - atomic.AddInt32(&p.txCount, 1) + nextSend := lastSend.Add(p.txPacing + jitter) + if nextSend.After(now) { + time.Sleep(nextSend.Sub(now)) + lastSend = nextSend } else { - log.Errorf("error sending block (%s)", err) - p.errors <- err - return + lastSend = now } + } + + block.PrepForSend(p) + if err := block.Tx(p); err == nil { + atomic.AddInt32(&p.txCount, 1) } else { - log.Errorf("tx blocks chan closed") + log.Errorf("error sending block (%s)", err) + p.errors <- err return } + } else { + log.Errorf("tx blocks chan closed") + return } } diff --git a/ziti-fabric-test/subcmd/loop3/scenario.go b/ziti-fabric-test/subcmd/loop3/scenario.go index 797c4c61f..1995e20e5 100644 --- a/ziti-fabric-test/subcmd/loop3/scenario.go +++ b/ziti-fabric-test/subcmd/loop3/scenario.go @@ -19,7 +19,7 @@ package loop3 import ( loop3_pb "github.com/openziti/ziti/ziti-fabric-test/subcmd/loop3/pb" "gopkg.in/yaml.v2" - "io/ioutil" + "os" "time" ) @@ -108,7 +108,7 @@ type Metrics struct { } func LoadScenario(path string) (*Scenario, error) { - data, err := ioutil.ReadFile(path) + data, err := os.ReadFile(path) if err != nil { return nil, err } diff --git a/ziti/cmd/agentcli/agent_cluster_list.go b/ziti/cmd/agentcli/agent_cluster_list.go index ca5423598..f186420e1 100644 --- a/ziti/cmd/agentcli/agent_cluster_list.go +++ b/ziti/cmd/agentcli/agent_cluster_list.go @@ -18,8 +18,8 @@ package agentcli import ( "fmt" + "google.golang.org/protobuf/proto" - "github.com/golang/protobuf/proto" "github.com/jedib0t/go-pretty/v6/table" "github.com/openziti/channel/v2" "github.com/openziti/fabric/pb/mgmt_pb" diff --git a/ziti/cmd/agentcli/agent_ps.go b/ziti/cmd/agentcli/agent_ps.go index 71587e33b..61ded1ce4 100644 --- a/ziti/cmd/agentcli/agent_ps.go +++ b/ziti/cmd/agentcli/agent_ps.go @@ -105,7 +105,9 @@ func (self *AgentPsAction) Run() error { fmt.Fprint(buf, p.Path) fmt.Fprintln(buf) - buf.WriteTo(os.Stdout) + if _, err := buf.WriteTo(os.Stdout); err != nil { + return err + } } return nil @@ -169,6 +171,7 @@ func FindAll() []P { path, version, agent, ok, err := isGo(pr) if err != nil { // TODO(jbd): Return a list of errors. + return } if !ok { return diff --git a/ziti/cmd/cmd.go b/ziti/cmd/cmd.go index 9169909aa..58e8a752b 100644 --- a/ziti/cmd/cmd.go +++ b/ziti/cmd/cmd.go @@ -76,7 +76,6 @@ func exitWithError(err error) { // Execute is ... func Execute() { - goflag.CommandLine.Parse([]string{}) if err := rootCommand.cobraCommand.Execute(); err != nil { exitWithError(err) } diff --git a/ziti/cmd/color/color.go b/ziti/cmd/color/color.go deleted file mode 100644 index ff8a79f41..000000000 --- a/ziti/cmd/color/color.go +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package color - -import ( - "github.com/fatih/color" - "github.com/openziti/ziti/ziti/util" - "sort" -) - -var colorMap = map[string]color.Attribute{ - // formatting - "bold": color.Bold, - "faint": color.Faint, - "italic": color.Italic, - "underline": color.Underline, - "blinkslow": color.BlinkSlow, - "blinkrapid": color.BlinkRapid, - "reversevideo": color.ReverseVideo, - "concealed": color.Concealed, - "crossedout": color.CrossedOut, - - // Foreground text colors - "black": color.FgBlack, - "red": color.FgRed, - "green": color.FgGreen, - "yellow": color.FgYellow, - "blue": color.FgBlue, - "magenta": color.FgMagenta, - "cyan": color.FgCyan, - "white": color.FgWhite, - - // Foreground Hi-Intensity text colors - "hiblack": color.FgHiBlack, - "hired": color.FgHiRed, - "higreen": color.FgHiGreen, - "hiyellow": color.FgHiYellow, - "hiblue": color.FgHiBlue, - "himagenta": color.FgHiMagenta, - "hicyan": color.FgHiCyan, - "hiwhite": color.FgHiWhite, - - // Background text colors - "bgblack": color.BgBlack, - "bgred": color.BgRed, - "bggreen": color.BgGreen, - "bgyellow": color.BgYellow, - "BgBlue": color.BgBlue, - "bgmagenta": color.BgMagenta, - "bgcyan": color.BgCyan, - "bgwhite": color.BgWhite, - - // Background Hi-Intensity text colors - "bghiblack": color.BgHiBlack, - "bghired": color.BgHiRed, - "bghigreen": color.BgHiGreen, - "bghiyellow": color.BgHiYellow, - "bghiblue": color.BgHiBlue, - "bghimagenta": color.BgHiMagenta, - "bghicyan": color.BgHiCyan, - "bghiwhite": color.BgHiWhite, -} - -// GetColor returns the color for the list of colour names and option name -func GetColor(optionName string, colorNames []string) (*color.Color, error) { - attributes := []color.Attribute{} - for _, colorName := range colorNames { - a := colorMap[colorName] - if a == color.Attribute(0) { - return nil, util.InvalidOption(optionName, colorName, ColorNameValues()) - } - attributes = append(attributes, a) - } - return color.New(attributes...), nil -} - -// ColorNameValues returns all the color names sorted -func ColorNameValues() []string { - answer := []string{} - for k, _ := range colorMap { - answer = append(answer, k) - } - sort.Strings(answer) - return answer -} diff --git a/ziti/cmd/common.go b/ziti/cmd/common.go index 824cb5df8..2deb44796 100644 --- a/ziti/cmd/common.go +++ b/ziti/cmd/common.go @@ -42,3 +42,9 @@ func (options *CommonOptions) AddCommonFlags(cmd *cobra.Command) { cmd.Flags().IntVarP(&options.Timeout, "timeout", "t", 5, "Timeout for REST operations (specified in seconds)") options.Cmd = cmd } + +func (options *CommonOptions) panicOnErr(err error) { + if err != nil { + panic(err) + } +} diff --git a/ziti/cmd/common_commands.go b/ziti/cmd/common_commands.go deleted file mode 100644 index e0be196a1..000000000 --- a/ziti/cmd/common_commands.go +++ /dev/null @@ -1,161 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - "fmt" - "github.com/openziti/ziti/ziti/internal/log" - "github.com/openziti/ziti/ziti/util" - "io/ioutil" - "os" - "os/exec" - "strings" -) - -var cliAgentEnabled bool - -func (o *CommonOptions) startCommandFromDir(dir, name string, args ...string) error { - if cliAgentEnabled { - args = append(args, "--cliagent") - } - e := exec.Command(name, args...) - if dir != "" { - e.Dir = dir - } - e.Stdout = o.Out - e.Stderr = o.Err - os.Setenv("PATH", util.PathWithBinary()) - err := e.Start() - if err != nil { - log.Errorf("Error: Command failed %s/%s %s\n", dir, name, strings.Join(args, " ")) - } - - return err -} - -func (o *CommonOptions) runCommandFromDir(dir, name string, args ...string) error { - e := exec.Command(name, args...) - if dir != "" { - e.Dir = dir - } - e.Stdout = o.Out - e.Stderr = o.Err - os.Setenv("PATH", util.PathWithBinary()) - err := e.Run() - if err != nil { - log.Errorf("Error: Command failed %s/%s %s\n", dir, name, strings.Join(args, " ")) - } - return err -} - -func (o *CommonOptions) runCommand(name string, args ...string) error { - e := exec.Command(name, args...) - if o.Verbose { - e.Stdout = o.Out - e.Stderr = o.Err - } - os.Setenv("PATH", util.PathWithBinary()) - err := e.Run() - if err != nil { - log.Errorf("Error: Command failed %s %s\n", name, strings.Join(args, " ")) - } - return err -} - -func (o *CommonOptions) runCommandVerbose(name string, args ...string) error { - e := exec.Command(name, args...) - e.Stdout = o.Out - e.Stderr = o.Err - os.Setenv("PATH", util.PathWithBinary()) - err := e.Run() - if err != nil { - log.Errorf("Error: Command failed %s %s\n", name, strings.Join(args, " ")) - } - return err -} - -func (o *CommonOptions) runCommandVerboseAt(dir string, name string, args ...string) error { - e := exec.Command(name, args...) - if dir != "" { - e.Dir = dir - } - e.Stdout = o.Out - e.Stderr = o.Err - os.Setenv("PATH", util.PathWithBinary()) - err := e.Run() - if err != nil { - log.Errorf("Error: Command failed %s %s\n", name, strings.Join(args, " ")) - } - return err -} - -func (o *CommonOptions) runCommandQuietly(name string, args ...string) error { - e := exec.Command(name, args...) - e.Stdout = ioutil.Discard - e.Stderr = ioutil.Discard - os.Setenv("PATH", util.PathWithBinary()) - return e.Run() -} - -func (o *CommonOptions) runCommandInteractive(interactive bool, name string, args ...string) error { - e := exec.Command(name, args...) - e.Stdout = o.Out - e.Stderr = o.Err - if interactive { - e.Stdin = os.Stdin - } - os.Setenv("PATH", util.PathWithBinary()) - err := e.Run() - if err != nil { - log.Errorf("Error: Command failed %s %s\n", name, strings.Join(args, " ")) - } - return err -} - -func (o *CommonOptions) runCommandInteractiveInDir(interactive bool, dir string, name string, args ...string) error { - e := exec.Command(name, args...) - e.Stdout = o.Out - e.Stderr = o.Err - if interactive { - e.Stdin = os.Stdin - } - if dir != "" { - e.Dir = dir - } - os.Setenv("PATH", util.PathWithBinary()) - err := e.Run() - if err != nil { - log.Errorf("Error: Command failed %s %s\n", name, strings.Join(args, " ")) - } - return err -} - -// getCommandOutput evaluates the given command and returns the trimmed output -func (o *CommonOptions) getCommandOutput(dir string, name string, args ...string) (string, error) { - os.Setenv("PATH", util.PathWithBinary()) - e := exec.Command(name, args...) - if dir != "" { - e.Dir = dir - } - data, err := e.CombinedOutput() - text := string(data) - text = strings.TrimSpace(text) - if err != nil { - return "", fmt.Errorf("command failed '%s %s': %s %s", name, strings.Join(args, " "), text, err) - } - return text, err -} diff --git a/ziti/cmd/common_init.go b/ziti/cmd/common_init.go deleted file mode 100644 index b1f271d13..000000000 --- a/ziti/cmd/common_init.go +++ /dev/null @@ -1,167 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package cmd - -import ( - "fmt" - c "github.com/openziti/ziti/ziti/constants" - "github.com/openziti/ziti/ziti/util" - "github.com/spf13/viper" - "gopkg.in/AlecAivazis/survey.v1" - "os" - "path/filepath" -) - -var ZITI_COMPONENTS = []string{ - c.ZITI, - c.ZITI_CONTROLLER, - c.ZITI_PROX_C, - c.ZITI_ROUTER, - c.ZITI_TUNNEL, - c.ZITI_EDGE_TUNNEL, -} - -func (o *CommonOptions) GetZitiComponent(p string) (string, error) { - if p == "" { - prompt := &survey.Select{ - Message: "Ziti Component", - Options: ZITI_COMPONENTS, - Default: c.ZITI, - Help: "Choose the Ziti component for which you want to do config initialization", - } - - survey.AskOne(prompt, &p, nil) - } - return p, nil -} - -func (o *CommonOptions) createInitialZitiConfig() error { - - zitiConfigDir, err := util.ZitiAppConfigDir(c.ZITI) - if err != nil { - return err - } - - _, err = util.EnvironmentsDir() - if err != nil { - return err - } - - fileName := filepath.Join(zitiConfigDir, c.CONFIGFILENAME) + ".json" - - _, err = os.Stat(fileName) - if err == nil { - return fmt.Errorf("config file (%s) already exists", fileName) - } - - cfgfile, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0644) - if err != nil { - return err - } - if err := cfgfile.Close(); err != nil { - return err - } - - viper.SetConfigType("json") - viper.SetConfigName(c.CONFIGFILENAME) - viper.AddConfigPath(zitiConfigDir) - - // Set some default values - viper.SetDefault("bin", util.HomeDir()+"/Repos/nf/ziti/bin") - - // Capture AWS creds - awsAccessKey, err := util.PickPassword("AWS_ACCESS_KEY_ID:") - if err != nil { - return err - } - viper.SetDefault("AWS_ACCESS_KEY_ID", awsAccessKey) - awsSecretAccessKey, err := util.PickPassword("AWS_SECRET_ACCESS_KEY:") - if err != nil { - return err - } - viper.SetDefault("AWS_SECRET_ACCESS_KEY", awsSecretAccessKey) - - err = viper.WriteConfig() - if err != nil { - return err - } - - return nil -} - -func (o *CommonOptions) createInitialControllerConfig() error { - - configDir, err := util.ConfigDir() - if err != nil { - return err - } - - controllerConfigDir, err := util.ZitiAppConfigDir(c.ZITI_CONTROLLER) - if err != nil { - return err - } - - fileName := filepath.Join(controllerConfigDir, c.CONFIGFILENAME) + ".json" - - _, err = os.Stat(fileName) - if err == nil { - return fmt.Errorf("config file (%s) already exists", fileName) - } - - cfgfile, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0644) - if err != nil { - return err - } - if err := cfgfile.Close(); err != nil { - return err - } - - viper.SetConfigType("json") - viper.SetConfigName(c.CONFIGFILENAME) - viper.AddConfigPath(controllerConfigDir) - - /* - { - "identity": { - "cert": "etc/ca/intermediate/certs/ctrl-client.cert.pem", - "server_cert": "etc/ca/intermediate/certs/ctrl-server.cert.pem", - "key": "etc/ca/intermediate/private/ctrl.key.pem", - "ca": "etc/ca/intermediate/certs/ca-chain.cert.pem" - }, - - "ctrlListener": "quic:0.0.0.0:6262", - "mgmtListener": "tls:0.0.0.0:10000", - "dbPath": "bin/ctrl.db" - } - */ - - // Set some default values - viper.SetDefault("identity.cert", configDir+"/etc/ca/intermediate/certs/ctrl-client.cert.pem") - viper.SetDefault("identity.server_cert", configDir+"/etc/ca/intermediate/certs/ctrl-server.cert.pem") - viper.SetDefault("identity.key", configDir+"/etc/ca/intermediate/private/ctrl.key.pem") - viper.SetDefault("identity.ca", configDir+"/etc/ca/intermediate/certs/ca-chain.cert.pem") - viper.SetDefault("ctrlListener", "quic:0.0.0.0:6262") - viper.SetDefault("mgmtListener", "tls:0.0.0.0:10000") - viper.SetDefault("dbPath", "ctrl.db") - - err = viper.WriteConfig() - if err != nil { - return err - } - - return nil -} diff --git a/ziti/cmd/create_config_environment.go b/ziti/cmd/create_config_environment.go index d9a0c4fdb..51ae64091 100644 --- a/ziti/cmd/create_config_environment.go +++ b/ziti/cmd/create_config_environment.go @@ -69,7 +69,6 @@ var environmentOptions *CreateConfigEnvironmentOptions type CreateConfigEnvironmentOptions struct { CreateConfigOptions EnvVariableTemplateData - output string } // NewCmdCreateConfigEnvironment creates a command object for the "environment" command diff --git a/ziti/cmd/create_config_router_test.go b/ziti/cmd/create_config_router_test.go index edcdc42b1..01d454d50 100644 --- a/ziti/cmd/create_config_router_test.go +++ b/ziti/cmd/create_config_router_test.go @@ -82,17 +82,17 @@ type Transport struct { } type Ws struct { - writeTimeout int `yaml:"writeTimeout"` - readTimeout int `yaml:"readTimeout"` - idleTimeout int `yaml:"idleTimeout"` - pongTimeout int `yaml:"pongTimeout"` - pingInterval int `yaml:"pingInterval"` - handshakeTimeout int `yaml:"handshakeTimeout"` - readBufferSize int `yaml:"readBufferSize"` - writeBufferSize int `yaml:"writeBufferSize"` - enableCompression string `yaml:"enableCompression"` - server_cert string `yaml:"server_Cert"` - key string `yaml:"key"` + WriteTimeout int `yaml:"writeTimeout"` + ReadTimeout int `yaml:"readTimeout"` + IdleTimeout int `yaml:"idleTimeout"` + PongTimeout int `yaml:"pongTimeout"` + PingInterval int `yaml:"pingInterval"` + HandshakeTimeout int `yaml:"handshakeTimeout"` + ReadBufferSize int `yaml:"readBufferSize"` + WriteBufferSize int `yaml:"writeBufferSize"` + EnableCompression string `yaml:"enableCompression"` + Server_cert string `yaml:"server_Cert"` + Key string `yaml:"key"` } type Forwarder struct { diff --git a/ziti/cmd/database/du.go b/ziti/cmd/database/du.go index f4f9ff4bc..76c1e2625 100644 --- a/ziti/cmd/database/du.go +++ b/ziti/cmd/database/du.go @@ -21,7 +21,6 @@ import ( "github.com/openziti/storage/boltz" "github.com/spf13/cobra" "go.etcd.io/bbolt" - "strings" ) type DiskUsageAction struct { @@ -114,12 +113,6 @@ func (self *sizeVisitor) VisitKeyValue(path string, key, value []byte) bool { return true } -func (self *sizeVisitor) getParent(path string) *sizeNode { - parentPath := self.getParentPath(path) - fmt.Printf("%v has parent %v\n", path, parentPath) - return self.getNode(parentPath) -} - func (self *sizeVisitor) getNode(path string) *sizeNode { if path == "" { return self.getNode("/") @@ -133,15 +126,3 @@ func (self *sizeVisitor) getNode(path string) *sizeNode { } return node } - -func (self *sizeVisitor) getParentPath(path string) string { - idx := strings.LastIndexByte(path, '/') - if idx < 0 { - return path - } - parent := path[0:idx] - if parent == "" { - return "/" - } - return parent -} diff --git a/ziti/cmd/demo/echo_server.go b/ziti/cmd/demo/echo_server.go index 80878ba4e..55f652891 100644 --- a/ziti/cmd/demo/echo_server.go +++ b/ziti/cmd/demo/echo_server.go @@ -17,7 +17,6 @@ package demo import ( - "bufio" "fmt" "github.com/michaelquigley/pfxlog" "github.com/openziti/agent" @@ -343,13 +342,3 @@ func (self *echoServer) SendOpResult(request *channel.Message, ch channel.Channe log.WithError(err).Error("failed to send result") } } - -func (self *echoServer) handleResult(err error, bconn *bufio.ReadWriter) error { - if err != nil { - return err - } - if _, err = bconn.WriteString("OK"); err != nil { - return err - } - return bconn.Flush() -} diff --git a/ziti/cmd/edge/create_config.go b/ziti/cmd/edge/create_config.go index 66f97f205..8474046e0 100644 --- a/ziti/cmd/edge/create_config.go +++ b/ziti/cmd/edge/create_config.go @@ -21,10 +21,9 @@ import ( "fmt" "github.com/openziti/ziti/ziti/cmd/api" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "io" - "io/ioutil" - "github.com/pkg/errors" + "io" + "os" "github.com/Jeffail/gabs" "github.com/spf13/cobra" @@ -76,7 +75,7 @@ func runCreateConfig(o *createConfigOptions) error { return errors.New("config json specified both in file and on command line. please pick one") } var err error - if jsonBytes, err = ioutil.ReadFile(o.jsonFile); err != nil { + if jsonBytes, err = os.ReadFile(o.jsonFile); err != nil { return fmt.Errorf("failed to read config json file %v: %w", o.jsonFile, err) } } diff --git a/ziti/cmd/edge/create_config_type.go b/ziti/cmd/edge/create_config_type.go index d0338cf86..f3bb48666 100644 --- a/ziti/cmd/edge/create_config_type.go +++ b/ziti/cmd/edge/create_config_type.go @@ -21,10 +21,9 @@ import ( "fmt" "github.com/openziti/ziti/ziti/cmd/api" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "io" - "io/ioutil" - "github.com/pkg/errors" + "io" + "os" "github.com/Jeffail/gabs" "github.com/spf13/cobra" @@ -78,7 +77,7 @@ func runCreateConfigType(o *createConfigTypeOptions) error { return errors.New("schema specified both in file and on command line. please pick one") } var err error - if schemaBytes, err = ioutil.ReadFile(o.schemaFile); err != nil { + if schemaBytes, err = os.ReadFile(o.schemaFile); err != nil { return fmt.Errorf("failed to read schema file %v: %w", o.schemaFile, err) } } diff --git a/ziti/cmd/edge/create_enrollment.go b/ziti/cmd/edge/create_enrollment.go index 41a31c0d4..4c9dd3952 100644 --- a/ziti/cmd/edge/create_enrollment.go +++ b/ziti/cmd/edge/create_enrollment.go @@ -45,7 +45,6 @@ func newCreateEnrollmentCmd(out io.Writer, errOut io.Writer) *cobra.Command { type createEnrollmentOptions struct { api.Options - name string duration int64 } diff --git a/ziti/cmd/edge/create_posture_check.go b/ziti/cmd/edge/create_posture_check.go index 407ff7ca3..c1599f012 100644 --- a/ziti/cmd/edge/create_posture_check.go +++ b/ziti/cmd/edge/create_posture_check.go @@ -48,7 +48,6 @@ func newCreatePostureCheckCmd(out io.Writer, errOut io.Writer) *cobra.Command { type createPostureCheckOptions struct { api.EntityOptions - name string roleAttributes []string } diff --git a/ziti/cmd/edge/create_service.go b/ziti/cmd/edge/create_service.go index 700d3531b..df3be3bcc 100644 --- a/ziti/cmd/edge/create_service.go +++ b/ziti/cmd/edge/create_service.go @@ -29,7 +29,6 @@ type createServiceOptions struct { terminatorStrategy string roleAttributes []string configs []string - requireEncryption bool encryption encryptionVar } @@ -58,7 +57,9 @@ func newCreateServiceCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil, "Role attributes of the new service") cmd.Flags().StringSliceVarP(&options.configs, "configs", "c", nil, "Configuration id or names to be associated with the new service") cmd.Flags().StringVar(&options.terminatorStrategy, "terminator-strategy", "", "Specifies the terminator strategy for the service") - options.encryption.Set("ON") + if err := options.encryption.Set("ON"); err != nil { + panic(err) + } cmd.Flags().VarP(&options.encryption, "encryption", "e", "Controls end-to-end encryption for the service") options.AddCommonFlags(cmd) diff --git a/ziti/cmd/edge/delete.go b/ziti/cmd/edge/delete.go index 0c8b07051..526a2f5e3 100644 --- a/ziti/cmd/edge/delete.go +++ b/ziti/cmd/edge/delete.go @@ -173,7 +173,3 @@ func getPlural(entityType string) string { } return entityType + "s" } - -func deleteEntityOfType(entityType string, id string, options *api.Options) error { - return util.ControllerDelete("edge", entityType, id, "", options.Out, options.OutputJSONRequest, options.OutputJSONResponse, options.Timeout, options.Verbose) -} diff --git a/ziti/cmd/edge/encryption_var.go b/ziti/cmd/edge/encryption_var.go index 570b28193..2c30bb443 100644 --- a/ziti/cmd/edge/encryption_var.go +++ b/ziti/cmd/edge/encryption_var.go @@ -31,7 +31,7 @@ func (f *encryptionVar) String() string { func (f *encryptionVar) Set(value string) error { value = strings.ToUpper(value) if value != "ON" && value != "OFF" && value != "TRUE" && value != "FALSE" { - return errors.New("Invalid option -- must specify either 'ON' or 'OFF'") + return errors.New("invalid option -- must specify either 'ON' or 'OFF'") } *f = encryptionVar(value) return nil diff --git a/ziti/cmd/edge/list.go b/ziti/cmd/edge/list.go index f5a7a28b8..d411cf955 100644 --- a/ziti/cmd/edge/list.go +++ b/ziti/cmd/edge/list.go @@ -691,30 +691,6 @@ func runListEnrollments(o *api.Options) error { return outputEnrollments(o, children, pagingInfo) } -func outputExtJwtSigners(o *api.Options, children []*gabs.Container, pagingInfo *api.Paging) error { - if o.OutputJSONResponse { - return nil - } - - t := table.NewWriter() - t.SetStyle(table.StyleRounded) - t.AppendHeader(table.Row{"ID", "Method", "Identity Id", "Identity Name", "Expires At", "Token", "JWT"}) - - for _, entity := range children { - id, _ := entity.Path("id").Data().(string) - method := entity.Path("method").Data().(string) - identityId := entity.Path("identityId").Data().(string) - identityName := entity.Path("identity.name").Data().(string) - expiresAt := entity.Path("expiresAt").Data().(string) - token := entity.Path("token").Data().(string) - jwt := "See json" - - t.AppendRow(table.Row{id, method, identityId, identityName, expiresAt, token, jwt}) - } - api.RenderTable(o, t, pagingInfo) - return nil -} - func runListTerminators(o *api.Options) error { children, pagingInfo, err := listEntitiesWithOptions("terminators", o) if err != nil { diff --git a/ziti/cmd/edge/update_config.go b/ziti/cmd/edge/update_config.go index f9d9f9a27..f8e68fa5d 100644 --- a/ziti/cmd/edge/update_config.go +++ b/ziti/cmd/edge/update_config.go @@ -21,10 +21,9 @@ import ( "fmt" "github.com/openziti/ziti/ziti/cmd/api" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "io" - "io/ioutil" - "github.com/pkg/errors" + "io" + "os" "github.com/Jeffail/gabs" "github.com/spf13/cobra" @@ -93,7 +92,7 @@ func runUpdateConfig(o *updateConfigOptions) error { return errors.New("only one of --data and --json-file is allowed") } var err error - if jsonBytes, err = ioutil.ReadFile(o.jsonFile); err != nil { + if jsonBytes, err = os.ReadFile(o.jsonFile); err != nil { return fmt.Errorf("failed to read config json file %v: %w", o.jsonFile, err) } } diff --git a/ziti/cmd/edge/update_service.go b/ziti/cmd/edge/update_service.go index cde1885c1..57fac1030 100644 --- a/ziti/cmd/edge/update_service.go +++ b/ziti/cmd/edge/update_service.go @@ -62,7 +62,9 @@ func newUpdateServiceCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.Flags().StringVar(&options.terminatorStrategy, "terminator-strategy", "", "Specifies the terminator strategy for the service") cmd.Flags().StringSliceVarP(&options.roleAttributes, "role-attributes", "a", nil, "Set role attributes of the service. Use --role-attributes '' to set an empty list") - options.encryption.Set("ON") + if err := options.encryption.Set("ON"); err != nil { + panic(err) + } cmd.Flags().VarP(&options.encryption, "encryption", "e", "Controls end-to-end encryption for the service") cmd.Flags().StringSliceVarP(&options.configs, "configs", "c", nil, "Configuration id or names to be associated with the new service") diff --git a/ziti/cmd/edge/verify.go b/ziti/cmd/edge/verify.go index 14c79fe6a..d0cb49814 100644 --- a/ziti/cmd/edge/verify.go +++ b/ziti/cmd/edge/verify.go @@ -17,9 +17,7 @@ package edge import ( - "github.com/openziti/ziti/ziti/cmd/api" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" - "github.com/openziti/ziti/ziti/util" "io" "github.com/spf13/cobra" @@ -41,8 +39,3 @@ func newVerifyCmd(out io.Writer, errOut io.Writer) *cobra.Command { return cmd } - -// createEntityOfType create an entity of the given type on the Ziti Edge Controller -func verifyEntityOfType(entityType, body, id string, options *api.Options) error { - return util.EdgeControllerVerify(entityType, id, body, options.Out, options.OutputJSONResponse, options.Timeout, options.Verbose) -} diff --git a/ziti/cmd/edge/verify_ca.go b/ziti/cmd/edge/verify_ca.go index 2a6ea51aa..e18dcfe6b 100644 --- a/ziti/cmd/edge/verify_ca.go +++ b/ziti/cmd/edge/verify_ca.go @@ -35,8 +35,8 @@ import ( "github.com/spf13/cobra" "gopkg.in/resty.v1" "io" - "io/ioutil" "math/big" + "os" "time" ) @@ -85,7 +85,7 @@ func newVerifyCaCmd(out io.Writer, errOut io.Writer) *cobra.Command { if options.certPath != "" { var err error - options.certPemBytes, err = ioutil.ReadFile(options.certPath) + options.certPemBytes, err = os.ReadFile(options.certPath) if err != nil { return fmt.Errorf("could not read --cert file (%s): %v", options.certPath, err) @@ -93,13 +93,13 @@ func newVerifyCaCmd(out io.Writer, errOut io.Writer) *cobra.Command { options.isGenerateCert = false } else if options.caCertPath != "" && options.caKeyPath != "" { var err error - options.caKeyPemBytes, err = ioutil.ReadFile(options.caKeyPath) + options.caKeyPemBytes, err = os.ReadFile(options.caKeyPath) if err != nil { return fmt.Errorf("could not read --cakey file (%s): %v", options.caKeyPath, err) } - options.caCertPemBytes, err = ioutil.ReadFile(options.caCertPath) + options.caCertPemBytes, err = os.ReadFile(options.caCertPath) if err != nil { return fmt.Errorf("could not read --cacert file (%s): %v", options.caCertPath, err) @@ -165,7 +165,7 @@ func runValidateCa(options *verifyCaOptions) error { func generateCert(options *verifyCaOptions, token string) ([]byte, crypto.Signer, error) { - certBlocks := nfpem.PemToX509(string(options.caCertPemBytes)) + certBlocks := nfpem.PemStringToCertificates(string(options.caCertPemBytes)) if len(certBlocks) == 0 { return nil, nil, errors.New("could not parse cert file, 0 PEM blocks detected1") @@ -199,19 +199,17 @@ func generateCert(options *verifyCaOptions, token string) ([]byte, crypto.Signer } } - var signerInterface crypto.Signer + var caKey crypto.Signer if caPrivateKeyBlock.Type == "EC PRIVATE KEY" { - signerInterface, err = x509.ParseECPrivateKey(caPrivateKeyBlock.Bytes) + caKey, err = x509.ParseECPrivateKey(caPrivateKeyBlock.Bytes) } else { - signerInterface, err = x509.ParsePKCS1PrivateKey(caPrivateKeyBlock.Bytes) + caKey, err = x509.ParsePKCS1PrivateKey(caPrivateKeyBlock.Bytes) } if err != nil { return nil, nil, fmt.Errorf("could not parse key file (%s)", err) } - caKey := signerInterface.(crypto.Signer) - if caKey == nil { return nil, nil, fmt.Errorf("key was not of correct type, could not be used as signer") } diff --git a/ziti/cmd/fabric/inspect.go b/ziti/cmd/fabric/inspect.go index a22ca3199..3923b4c6a 100644 --- a/ziti/cmd/fabric/inspect.go +++ b/ziti/cmd/fabric/inspect.go @@ -127,7 +127,7 @@ func (self *InspectAction) inspect(appRegex string, requestValues ...string) err if idx > 0 { fmt.Println() } - fmt.Printf(color.New(color.FgGreen, color.Bold).Sprintf("%v.%v\n", appId, name)) + fmt.Print(color.New(color.FgGreen, color.Bold).Sprintf("%v.%v\n", appId, name)) out = os.Stdout } if err = self.prettyPrint(out, value.Value, 0); err != nil { diff --git a/ziti/cmd/fabric/stream_traces.go b/ziti/cmd/fabric/stream_traces.go index a9691f833..f6cc40134 100644 --- a/ziti/cmd/fabric/stream_traces.go +++ b/ziti/cmd/fabric/stream_traces.go @@ -192,13 +192,13 @@ func (self *streamTracesAction) DecodeTraceAndFormat(decode []byte) string { out += k out += "=[" v := meta[k] - switch v.(type) { + switch val := v.(type) { case string: - out += v.(string) + out += val case float64: - out += fmt.Sprintf("%0.0f", v.(float64)) + out += fmt.Sprintf("%0.0f", val) case bool: - out += fmt.Sprintf("%t", v.(bool)) + out += fmt.Sprintf("%t", val) default: out += fmt.Sprintf("<%s>", reflect.TypeOf(v)) } diff --git a/ziti/cmd/helpers/helpers.go b/ziti/cmd/helpers/helpers.go index e255e4956..9ebcf2557 100644 --- a/ziti/cmd/helpers/helpers.go +++ b/ziti/cmd/helpers/helpers.go @@ -19,38 +19,18 @@ package helpers import ( "fmt" "github.com/michaelquigley/pfxlog" + "github.com/pkg/errors" "net/url" "os" "strings" - - "github.com/spf13/cobra" ) const ( DefaultErrorExitCode = 1 - - DefaultWritePermissions = 0760 ) -type debugError interface { - DebugError() (msg string, args []interface{}) -} - var fatalErrHandler = fatal -// BehaviorOnFatal allows you to override the default behavior when a fatal -// error occurs, which is to call os.Exit(code). You can pass 'panic' as a function -// here if you prefer the panic() over os.Exit(1). -func BehaviorOnFatal(f func(string, int)) { - fatalErrHandler = f -} - -// DefaultBehaviorOnFatal allows you to undo any previous override. Useful in -// tests. -func DefaultBehaviorOnFatal() { - fatalErrHandler = fatal -} - // fatal prints the message (if provided) and then exits. func fatal(msg string, code int) { if len(msg) > 0 { @@ -76,11 +56,6 @@ func CheckErr(err error) { checkErr("", err, fatalErrHandler) } -// checkErrWithPrefix works like CheckErr, but adds a caller-defined prefix to non-nil errors -func checkErrWithPrefix(prefix string, err error) { - checkErr(prefix, err, fatalErrHandler) -} - // checkErr formats a given error as a string and calls the passed handleErr // func with that string and an kubectl exit code. func checkErr(prefix string, err error, handleErr func(string, int)) { @@ -166,14 +141,9 @@ func StandardErrorMessage(err error) (string, bool) { return "", false } -func UsageError(cmd *cobra.Command, format string, args ...interface{}) error { - msg := fmt.Sprintf(format, args...) - return fmt.Errorf("%s\nSee '%s -h' for help and examples.", msg, cmd.CommandPath()) -} - func JFrogAPIKey() string { if h := os.Getenv("JFROG_API_KEY"); h != "" { return h } - panic(fmt.Sprintf("ERROR: the JFROG_API_KEY env variable has not been set")) + panic(errors.New("ERROR: the JFROG_API_KEY env variable has not been set")) } diff --git a/ziti/cmd/install/common_install.go b/ziti/cmd/install/common_install.go index c004079ef..c67e91f3e 100644 --- a/ziti/cmd/install/common_install.go +++ b/ziti/cmd/install/common_install.go @@ -17,13 +17,11 @@ package install import ( - "fmt" "github.com/blang/semver" "github.com/openziti/ziti/common/getziti" c "github.com/openziti/ziti/ziti/constants" "github.com/openziti/ziti/ziti/internal/log" "github.com/openziti/ziti/ziti/util" - "gopkg.in/AlecAivazis/survey.v1" "gopkg.in/resty.v1" "os" "os/exec" @@ -32,50 +30,6 @@ import ( "strings" ) -// installRequirements installs any requirements needed to run the ziti CLI -func (o *InstallOptions) installRequirements(extraDependencies ...string) error { - var deps []string - - for _, dep := range extraDependencies { - deps = o.addRequiredBinary(dep, deps) - } - - return o.installMissingDependencies(deps) -} - -func (o *InstallOptions) addRequiredBinary(binName string, deps []string) []string { - d := binaryShouldBeInstalled(binName) - if d != "" && util.StringArrayIndex(deps, d) < 0 { - deps = append(deps, d) - } - return deps -} - -// appends the binary to the deps array if it cannot be found on the $PATH -func binaryShouldBeInstalled(d string) string { - _, err := exec.LookPath(d) - if err != nil { - // look for windows exec - if runtime.GOOS == "windows" { - d = d + ".exe" - _, err = exec.LookPath(d) - if err == nil { - return "" - } - } - binDir, err := util.BinaryLocation() - if err == nil { - exists, err := util.FileExists(filepath.Join(binDir, d)) - if err == nil && exists { - return "" - } - } - log.Infof("%s not found\n", d) - return d - } - return "" -} - func isBinaryInstalled(d string) bool { binDir, err := util.BinaryLocation() if err == nil { @@ -104,47 +58,6 @@ func (o *InstallOptions) deleteInstalledBinary(d string) bool { return false } -func (o *InstallOptions) installMissingDependencies(deps []string) error { - - if len(deps) == 0 { - return nil - } - - if o.BatchMode { - return fmt.Errorf("run without batch mode or manually install missing dependencies %v", deps) - } - install := []string{} - prompt := &survey.MultiSelect{ - Message: "Installing required dependencies, deselect to avoid auto installing:", - Options: deps, - Default: deps, - } - survey.AskOne(prompt, &install, nil) - - return o.doInstallMissingDependencies(install) -} - -func (o *InstallOptions) doInstallMissingDependencies(install []string) error { - - for _, i := range install { - var err error - switch i { - case "aws": - err = o.installAWSCli() - default: - return fmt.Errorf("unknown dependency to install %s", i) - } - if err != nil { - return fmt.Errorf("error installing %s: %v", i, err) - } - } - return nil -} - -func (o *InstallOptions) installAWSCli() error { - return fmt.Errorf("Ziti's ability to auto-install the AWS CLI is curently un-implemented; For now, you must manually install the AWS CLI") -} - func (o *InstallOptions) shouldInstallBinary(binDir string, name string) (fileName string, download bool, err error) { fileName = name download = false @@ -170,20 +83,6 @@ func (o *InstallOptions) shouldInstallBinary(binDir string, name string) (fileNa return } -func (o *InstallOptions) downloadFile(clientURL string, fullPath string) error { - log.Infof("Downloading %s to %s...\n", util.ColorInfo(clientURL), util.ColorInfo(fullPath)) - err := util.DownloadFile(fullPath, clientURL) - if err != nil { - return fmt.Errorf("Unable to download file %s from %s due to: %v", fullPath, clientURL, err) - } - log.Infof("Downloaded %s\n", util.ColorInfo(fullPath)) - return nil -} - -func (o *InstallOptions) getLatestZitiVersion(branch string) (semver.Version, error) { - return util.GetLatestVersionFromArtifactory(o.Verbose, o.Staging, branch, c.ZITI) -} - func (o *InstallOptions) getLatestZitiAppVersion(branch string, zitiApp string) (semver.Version, error) { return util.GetLatestVersionFromArtifactory(o.Verbose, o.Staging, branch, zitiApp) } diff --git a/ziti/cmd/install/install_terraform_provider_edge_controller.go b/ziti/cmd/install/install_terraform_provider_edge_controller.go index 56c7f0557..46e80b165 100644 --- a/ziti/cmd/install/install_terraform_provider_edge_controller.go +++ b/ziti/cmd/install/install_terraform_provider_edge_controller.go @@ -86,6 +86,9 @@ func (o *InstallTerraformProviderEdgeControllerOptions) Run() error { if o.Version != "" { newVersion, err = semver.Make(o.Version) + if err != nil { + return err + } } log.Infoln("Attempting to install Terraform Provider '" + c.TERRAFORM_PROVIDER_EDGE_CONTROLLER + "' version: " + newVersion.String()) diff --git a/ziti/cmd/install/install_ziti_ALL.go b/ziti/cmd/install/install_ziti_ALL.go index 5416d7960..54b4c4f83 100644 --- a/ziti/cmd/install/install_ziti_ALL.go +++ b/ziti/cmd/install/install_ziti_ALL.go @@ -85,6 +85,9 @@ func (o *InstallZitiALLOptions) install(zitiApp string) error { if o.Version != "" { newVersion, err = semver.Make(o.Version) + if err != nil { + return err + } } log.Infoln("Attempting to install '" + zitiApp + "' version: " + newVersion.String()) diff --git a/ziti/cmd/install/install_ziti_controller.go b/ziti/cmd/install/install_ziti_controller.go index fd84463cc..f7d82b6a5 100644 --- a/ziti/cmd/install/install_ziti_controller.go +++ b/ziti/cmd/install/install_ziti_controller.go @@ -85,6 +85,9 @@ func (o *InstallZitiControllerOptions) Run() error { if o.Version != "" { newVersion, err = semver.Make(o.Version) + if err != nil { + return err + } } log.Infoln("Attempting to install '" + c.ZITI_CONTROLLER + "' version: " + newVersion.String()) diff --git a/ziti/cmd/install/install_ziti_router.go b/ziti/cmd/install/install_ziti_router.go index 26610adc6..bb18bdfcd 100644 --- a/ziti/cmd/install/install_ziti_router.go +++ b/ziti/cmd/install/install_ziti_router.go @@ -85,6 +85,9 @@ func (o *InstallZitiRouterOptions) Run() error { if o.Version != "" { newVersion, err = semver.Make(o.Version) + if err != nil { + return err + } } log.Infoln("Attempting to install '" + c.ZITI_ROUTER + "' version: " + newVersion.String()) diff --git a/ziti/cmd/install/install_ziti_tunnel.go b/ziti/cmd/install/install_ziti_tunnel.go index 809908770..f411ae8ad 100644 --- a/ziti/cmd/install/install_ziti_tunnel.go +++ b/ziti/cmd/install/install_ziti_tunnel.go @@ -85,6 +85,9 @@ func (o *InstallZitiTunnelOptions) Run() error { if o.Version != "" { newVersion, err = semver.Make(o.Version) + if err != nil { + return err + } } log.Infoln("Attempting to install '" + c.ZITI_TUNNEL + "' version: " + newVersion.String()) diff --git a/ziti/cmd/install/version.go b/ziti/cmd/install/version.go index 1c46ecdca..f398866fe 100644 --- a/ziti/cmd/install/version.go +++ b/ziti/cmd/install/version.go @@ -72,8 +72,10 @@ func NewCmdVersion(out io.Writer, errOut io.Writer) *cobra.Command { // Run ... func (o *VersionOptions) Run() error { - - util.ConfigDir() + _, err := util.ConfigDir() + if err != nil { + return err + } info := util.ColorInfo @@ -126,12 +128,24 @@ func (o *VersionOptions) versionPrintZitiApp(zitiApp string, table *table.Table) } func (o *VersionOptions) versionCheck() error { - o.versionCheckZitiApp(c.ZITI) - o.versionCheckZitiApp(c.ZITI_CONTROLLER) - o.versionCheckZitiApp(c.ZITI_PROX_C) - o.versionCheckZitiApp(c.ZITI_ROUTER) - o.versionCheckZitiApp(c.ZITI_TUNNEL) - o.versionCheckZitiApp(c.ZITI_EDGE_TUNNEL) + if err := o.versionCheckZitiApp(c.ZITI); err != nil { + return err + } + if err := o.versionCheckZitiApp(c.ZITI_CONTROLLER); err != nil { + return err + } + if err := o.versionCheckZitiApp(c.ZITI_PROX_C); err != nil { + return err + } + if err := o.versionCheckZitiApp(c.ZITI_ROUTER); err != nil { + return err + } + if err := o.versionCheckZitiApp(c.ZITI_TUNNEL); err != nil { + return err + } + if err := o.versionCheckZitiApp(c.ZITI_EDGE_TUNNEL); err != nil { + return err + } return nil } diff --git a/ziti/cmd/lets_encrypt/KeyTypeVar.go b/ziti/cmd/lets_encrypt/KeyTypeVar.go index 4af713e3c..e52116fa5 100644 --- a/ziti/cmd/lets_encrypt/KeyTypeVar.go +++ b/ziti/cmd/lets_encrypt/KeyTypeVar.go @@ -60,38 +60,23 @@ func (f *KeyTypeVar) Set(value string) error { } func (f *KeyTypeVar) EC256() bool { - if certcrypto.KeyType(*f) == certcrypto.EC256 { - return true - } - return false + return certcrypto.KeyType(*f) == certcrypto.EC256 } func (f *KeyTypeVar) EC384() bool { - if certcrypto.KeyType(*f) == certcrypto.EC384 { - return true - } - return false + return certcrypto.KeyType(*f) == certcrypto.EC384 } func (f *KeyTypeVar) RSA2048() bool { - if certcrypto.KeyType(*f) == certcrypto.RSA2048 { - return true - } - return false + return certcrypto.KeyType(*f) == certcrypto.RSA2048 } func (f *KeyTypeVar) RSA4096() bool { - if certcrypto.KeyType(*f) == certcrypto.RSA4096 { - return true - } - return false + return certcrypto.KeyType(*f) == certcrypto.RSA4096 } func (f *KeyTypeVar) RSA8192() bool { - if certcrypto.KeyType(*f) == certcrypto.RSA8192 { - return true - } - return false + return certcrypto.KeyType(*f) == certcrypto.RSA8192 } func (f *KeyTypeVar) Get() certcrypto.KeyType { diff --git a/ziti/cmd/lets_encrypt/accounts_storage.go b/ziti/cmd/lets_encrypt/accounts_storage.go index 45faf02c4..f55787c6d 100644 --- a/ziti/cmd/lets_encrypt/accounts_storage.go +++ b/ziti/cmd/lets_encrypt/accounts_storage.go @@ -22,9 +22,7 @@ import ( "encoding/json" "encoding/pem" "errors" - "fmt" "github.com/openziti/ziti/ziti/internal/log" - "io/ioutil" "net/url" "os" "path/filepath" @@ -132,11 +130,11 @@ func (s *AccountsStorage) Save(account *Account) error { return err } - return ioutil.WriteFile(s.accountFilePath, jsonBytes, filePerm) + return os.WriteFile(s.accountFilePath, jsonBytes, filePerm) } func (s *AccountsStorage) LoadAccount(options *leOptions, privateKey crypto.PrivateKey) *Account { - fileBytes, err := ioutil.ReadFile(s.accountFilePath) + fileBytes, err := os.ReadFile(s.accountFilePath) if err != nil { log.Fatalf("Could not load file for account %s: %v", s.userID, err) } @@ -217,7 +215,7 @@ func generatePrivateKey(file string, keyType certcrypto.KeyType) (crypto.Private } func loadPrivateKey(file string) (crypto.PrivateKey, error) { - keyBytes, err := ioutil.ReadFile(file) + keyBytes, err := os.ReadFile(file) if err != nil { return nil, err } @@ -238,7 +236,7 @@ func tryRecoverRegistration(options *leOptions, privateKey crypto.PrivateKey) (* // couldn't load account but got a key. Try to look the account up. config := lego.NewConfig(&Account{key: privateKey}) config.CADirURL = options.acmeserver - config.UserAgent = fmt.Sprintf("ziti-cli") + config.UserAgent = "ziti-cli" client, err := lego.NewClient(config) if err != nil { diff --git a/ziti/cmd/lets_encrypt/certs_storage.go b/ziti/cmd/lets_encrypt/certs_storage.go index c19e2f3ab..fa78159d5 100644 --- a/ziti/cmd/lets_encrypt/certs_storage.go +++ b/ziti/cmd/lets_encrypt/certs_storage.go @@ -21,7 +21,6 @@ import ( "crypto/x509" "encoding/json" "github.com/openziti/ziti/ziti/internal/log" - "io/ioutil" "os" "path/filepath" "strconv" @@ -165,7 +164,7 @@ func (s *CertificatesStorage) ExistsFile(domain, extension string) bool { } func (s *CertificatesStorage) ReadFile(domain, extension string) ([]byte, error) { - return ioutil.ReadFile(s.GetFileName(domain, extension)) + return os.ReadFile(s.GetFileName(domain, extension)) } func (s *CertificatesStorage) GetFileName(domain, extension string) string { @@ -184,12 +183,9 @@ func (s *CertificatesStorage) ReadCertificate(domain, extension string) ([]*x509 } func (s *CertificatesStorage) WriteFile(domain, extension string, data []byte) error { - var baseFileName string - baseFileName = sanitizedDomain(domain) - + baseFileName := sanitizedDomain(domain) filePath := filepath.Join(s.rootPath, baseFileName+extension) - - return ioutil.WriteFile(filePath, data, filePerm) + return os.WriteFile(filePath, data, filePerm) } func (s *CertificatesStorage) MoveToArchive(domain string) error { diff --git a/ziti/cmd/lets_encrypt/create.go b/ziti/cmd/lets_encrypt/create.go index 4f34029b2..88171275e 100644 --- a/ziti/cmd/lets_encrypt/create.go +++ b/ziti/cmd/lets_encrypt/create.go @@ -30,8 +30,6 @@ import ( const acmeStaging string = "https://acme-staging-v02.api.letsencrypt.org/directory" const acmeProd string = "https://acme-v02.api.letsencrypt.org/directory" -const rootPathWarningMessage = `!!!! HEADS UP !!!!` - // We need a user or account type that implements acme.User type AcmeUser struct { Email string @@ -70,14 +68,20 @@ func newCreateCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.Flags().SetInterspersed(true) cmd.Flags().StringVarP(&options.domain, "domain", "d", "", "Domain for which Cert is being generated (e.g. me.example.com)") - cmd.MarkFlagRequired("domain") + if err := cmd.MarkFlagRequired("domain"); err != nil { + panic(err) + } cmd.Flags().BoolVarP(&options.staging, "staging", "s", false, "Enable creation of 'staging' Certs (instead of production Certs)") cmd.Flags().StringVarP(&options.acmeserver, "acmeserver", "a", acmeProd, "ACME CA hostname") cmd.Flags().StringVarP(&options.email, "email", "e", "openziti@netfoundry.io", "Email used for registration and recovery contact") - options.keyType.Set("RSA4096") // set default + if err := options.keyType.Set("RSA4096"); err != nil { // set default + panic(err) + } cmd.Flags().VarP(&options.keyType, "keytype", "k", "Key type to use for private keys") cmd.Flags().StringVarP(&options.path, "path", "p", "", "Directory to use for storing the data") - cmd.MarkFlagRequired("path") + if err := cmd.MarkFlagRequired("path"); err != nil { + panic(err) + } cmd.Flags().StringVarP(&options.port, "port", "o", "80", "Port to listen on for HTTP based ACME challenges") cmd.Flags().StringVarP(&options.csr, "csr", "", "", "Certificate Signing Request filename, if an external CSR is to be used") diff --git a/ziti/cmd/lets_encrypt/list.go b/ziti/cmd/lets_encrypt/list.go index 20aac1cdf..5c4cbdde4 100644 --- a/ziti/cmd/lets_encrypt/list.go +++ b/ziti/cmd/lets_encrypt/list.go @@ -21,8 +21,8 @@ import ( "fmt" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "io" - "io/ioutil" "net/url" + "os" "path/filepath" "strings" @@ -52,7 +52,9 @@ func newListCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.Flags().BoolVarP(&options.accounts, "accounts", "a", false, "Display Account info") cmd.Flags().BoolVarP(&options.names, "names", "n", false, "Display Names info") cmd.Flags().StringVarP(&options.path, "path", "p", "", "Directory where data is stored") - cmd.MarkFlagRequired("path") + if err := cmd.MarkFlagRequired("path"); err != nil { + panic(err) + } return cmd } @@ -83,7 +85,7 @@ func listAccount(options *leOptions) error { fmt.Println("Found the following accounts:") for _, filename := range matches { - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { return err } @@ -132,7 +134,7 @@ func listCertificates(options *leOptions) error { continue } - data, err := ioutil.ReadFile(filename) + data, err := os.ReadFile(filename) if err != nil { return err } diff --git a/ziti/cmd/lets_encrypt/renew.go b/ziti/cmd/lets_encrypt/renew.go index 75e811e9c..cc6505fca 100644 --- a/ziti/cmd/lets_encrypt/renew.go +++ b/ziti/cmd/lets_encrypt/renew.go @@ -56,13 +56,19 @@ func newRenewCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.Flags().SetInterspersed(true) cmd.Flags().StringVarP(&options.domain, "domain", "d", "", "Domain for which Cert is being generated (e.g. me.example.com)") - cmd.MarkFlagRequired("domain") + if err := cmd.MarkFlagRequired("domain"); err != nil { + panic(err) + } cmd.Flags().StringVarP(&options.path, "path", "p", "", "Directory where data is stored") - cmd.MarkFlagRequired("path") + if err := cmd.MarkFlagRequired("path"); err != nil { + panic(err) + } cmd.Flags().IntVarP(&options.days, "days", "", 14, "The number of days left on a certificate to renew it") cmd.Flags().BoolVarP(&options.reuseKey, "reuse-key", "r", true, "Used to indicate you want to reuse your current private key for the renewed certificate") cmd.Flags().StringVarP(&options.email, "email", "e", "openziti@netfoundry.io", "Email used for registration and recovery contact") - options.keyType.Set("RSA4096") // set default + if err := options.keyType.Set("RSA4096"); err != nil { // set default + panic(err) + } cmd.Flags().VarP(&options.keyType, "keytype", "k", "Key type to use for private keys") cmd.Flags().StringVarP(&options.acmeserver, "acmeserver", "a", acmeProd, "ACME CA hostname") cmd.Flags().BoolVarP(&options.staging, "staging", "s", false, "Enable creation of 'staging' Certs (instead of production Certs)") diff --git a/ziti/cmd/lets_encrypt/revoke.go b/ziti/cmd/lets_encrypt/revoke.go index db2ccb288..3cf95a457 100644 --- a/ziti/cmd/lets_encrypt/revoke.go +++ b/ziti/cmd/lets_encrypt/revoke.go @@ -44,9 +44,13 @@ func newRevokeCmd(out io.Writer, errOut io.Writer) *cobra.Command { cmd.Flags().SetInterspersed(true) cmd.Flags().StringVarP(&options.domain, "domain", "d", "", "Domain for which Cert is being generated (e.g. me.example.com)") - cmd.MarkFlagRequired("domain") + if err := cmd.MarkFlagRequired("domain"); err != nil { + panic(err) + } cmd.Flags().StringVarP(&options.path, "path", "p", "", "Directory where data is stored") - cmd.MarkFlagRequired("path") + if err := cmd.MarkFlagRequired("path"); err != nil { + panic(err) + } cmd.Flags().StringVarP(&options.email, "email", "e", "openziti@netfoundry.io", "Email used for registration and recovery contact") cmd.Flags().StringVarP(&options.acmeserver, "acmeserver", "a", acmeProd, "ACME CA hostname") cmd.Flags().BoolVarP(&options.staging, "staging", "s", false, "Enable creation of 'staging' Certs (instead of production Certs)") diff --git a/ziti/cmd/lets_encrypt/setup.go b/ziti/cmd/lets_encrypt/setup.go index c52bf3d4f..df31dac55 100644 --- a/ziti/cmd/lets_encrypt/setup.go +++ b/ziti/cmd/lets_encrypt/setup.go @@ -17,11 +17,7 @@ package lets_encrypt import ( - "crypto/x509" - "encoding/pem" - "fmt" "github.com/openziti/ziti/ziti/internal/log" - "io/ioutil" "os" "time" @@ -59,7 +55,7 @@ func newClient(options *leOptions, acc registration.User) *lego.Client { KeyType: options.keyType.Get(), Timeout: time.Duration(30) * time.Second, // Only used when obtaining certificates } - config.UserAgent = fmt.Sprintf("zitii-cli") + config.UserAgent = "ziti-cli" client, err := lego.NewClient(config) if err != nil { @@ -69,14 +65,6 @@ func newClient(options *leOptions, acc registration.User) *lego.Client { return client } -func getEmail(options *leOptions) string { - email := options.email - if len(email) == 0 { - log.Fatal("You have to pass an account (email address) to the program using --email or -m") - } - return email -} - func createNonExistingFolder(path string) error { if _, err := os.Stat(path); os.IsNotExist(err) { return os.MkdirAll(path, 0o700) @@ -85,34 +73,3 @@ func createNonExistingFolder(path string) error { } return nil } - -func readCSRFile(filename string) (*x509.CertificateRequest, error) { - bytes, err := ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - raw := bytes - - // see if we can find a PEM-encoded CSR - var p *pem.Block - rest := bytes - for { - // decode a PEM block - p, rest = pem.Decode(rest) - - // did we fail? - if p == nil { - break - } - - // did we get a CSR? - if p.Type == "CERTIFICATE REQUEST" { - raw = p.Bytes - } - } - - // no PEM-encoded CSR - // assume we were given a DER-encoded ASN.1 CSR - // (if this assumption is wrong, parsing these bytes will fail) - return x509.ParseCertificateRequest(raw) -} diff --git a/ziti/cmd/pki_create.go b/ziti/cmd/pki_create.go index 4ad54c0d4..fe26d2dc0 100644 --- a/ziti/cmd/pki_create.go +++ b/ziti/cmd/pki_create.go @@ -25,8 +25,8 @@ import ( cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/openziti/ziti/ziti/util" "io" - "io/ioutil" "net" + "os" "strings" "sync" "time" @@ -77,38 +77,39 @@ func NewCmdPKICreate(out io.Writer, errOut io.Writer) *cobra.Command { func (options *PKICreateOptions) addPKICreateFlags(cmd *cobra.Command) { viperLock.Lock() + defer viperLock.Unlock() + cmd.PersistentFlags().StringVarP(&options.Flags.PKIRoot, "pki-root", "", "", "Directory in which to store CA") - cmd.MarkFlagRequired("pki-root") - viper.BindPFlag("pki_root", cmd.PersistentFlags().Lookup("pki-root")) + err := viper.BindPFlag("pki_root", cmd.PersistentFlags().Lookup("pki-root")) + options.panicOnErr(err) cmd.PersistentFlags().StringVarP(&options.Flags.PKIOrganization, "pki-organization", "", "NetFoundry", "Organization") - cmd.MarkFlagRequired("pki-organization") - viper.BindPFlag("pki-organization", cmd.PersistentFlags().Lookup("pki-organization")) + err = viper.BindPFlag("pki-organization", cmd.PersistentFlags().Lookup("pki-organization")) + options.panicOnErr(err) cmd.PersistentFlags().StringVarP(&options.Flags.PKIOrganizationalUnit, "pki-organizational-unit", "", "ADV-DEV", "Organization unit") - cmd.MarkFlagRequired("pki-organizational-unit") - viper.BindPFlag("pki-organizational-unit", cmd.PersistentFlags().Lookup("pki-organizational-unit")) + err = viper.BindPFlag("pki-organizational-unit", cmd.PersistentFlags().Lookup("pki-organizational-unit")) + options.panicOnErr(err) cmd.PersistentFlags().StringVarP(&options.Flags.PKICountry, "pki-country", "", "US", "Country") - cmd.MarkFlagRequired("pki-country") - viper.BindPFlag("pki-country", cmd.PersistentFlags().Lookup("pki-country")) + err = viper.BindPFlag("pki-country", cmd.PersistentFlags().Lookup("pki-country")) + options.panicOnErr(err) cmd.PersistentFlags().StringVarP(&options.Flags.PKILocality, "pki-locality", "", "Charlotte", "Locality/Location") - cmd.MarkFlagRequired("pki-locality") - viper.BindPFlag("pki-locality", cmd.PersistentFlags().Lookup("pki-locality")) + err = viper.BindPFlag("pki-locality", cmd.PersistentFlags().Lookup("pki-locality")) + options.panicOnErr(err) // cmd.PersistentFlags().StringVarP(&options.Flags.PKILocality, "pki-location", "", "Charlotte", "Location/Locality") // cmd.MarkFlagRequired("pki-location") // viper.BindPFlag("pki-location", cmd.PersistentFlags().Lookup("pki-location")) cmd.PersistentFlags().StringVarP(&options.Flags.PKIProvince, "pki-province", "", "NC", "Province/State") - cmd.MarkFlagRequired("pki-province") - viper.BindPFlag("pki-province", cmd.PersistentFlags().Lookup("pki-province")) + err = viper.BindPFlag("pki-province", cmd.PersistentFlags().Lookup("pki-province")) + options.panicOnErr(err) // cmd.PersistentFlags().StringVarP(&options.Flags.PKIProvince, "pki-state", "", "NC", "State/Province") // cmd.MarkFlagRequired("pki-state") // viper.BindPFlag("pki-state", cmd.PersistentFlags().Lookup("pki-state")) - viperLock.Unlock() } // Run implements this command @@ -250,7 +251,7 @@ func (o *PKICreateOptions) ObtainCAName(pkiroot string) (string, error) { caname = viper.GetString("ca-name") if caname == "" { var err error - files, err := ioutil.ReadDir(pkiroot) + files, err := os.ReadDir(pkiroot) if err != nil { return "", err } @@ -332,7 +333,7 @@ func (o *PKICreateOptions) ObtainKeyName(pkiroot string) (string, error) { keyname := viper.GetString("key-name") if keyname == "" { var err error - files, err := ioutil.ReadDir(pkiroot) + files, err := os.ReadDir(pkiroot) if err != nil { return "", err } diff --git a/ziti/cmd/templates/templater.go b/ziti/cmd/templates/templater.go index deae8e1c2..e60a141b2 100644 --- a/ziti/cmd/templates/templater.go +++ b/ziti/cmd/templates/templater.go @@ -256,15 +256,6 @@ func rpad(s string, padding int) string { return fmt.Sprintf(template, s) } -func indentLines(s string, indentation int) string { - r := []string{} - for _, line := range strings.Split(s, "\n") { - indented := strings.Repeat(" ", indentation) + line - r = append(r, indented) - } - return strings.Join(r, "\n") -} - func appendIfNotPresent(s, stringToAppend string) string { if strings.Contains(s, stringToAppend) { return s diff --git a/ziti/cmd/unwrap_identity.go b/ziti/cmd/unwrap_identity.go index 2917a9c74..6eda43b1f 100644 --- a/ziti/cmd/unwrap_identity.go +++ b/ziti/cmd/unwrap_identity.go @@ -6,7 +6,7 @@ import ( "github.com/openziti/identity" "github.com/spf13/cobra" "io" - "io/ioutil" + "os" "strings" ) @@ -42,7 +42,7 @@ func NewUnwrapIdentityFileCommand(out io.Writer, errOut io.Writer) *cobra.Comman outCaFile = rootFileName + ".ca" } - identityJson, err := ioutil.ReadFile(identityFile) + identityJson, err := os.ReadFile(identityFile) if err != nil { _, _ = fmt.Fprintf(errOut, "error opening file %s: %v\n", args[0], err) @@ -57,7 +57,7 @@ func NewUnwrapIdentityFileCommand(out io.Writer, errOut io.Writer) *cobra.Comman if strings.HasPrefix(config.ID.Cert, "pem:") { data := strings.TrimPrefix(config.ID.Cert, "pem:") - if err := ioutil.WriteFile(outCertFile, []byte(data), 0); err != nil { + if err := os.WriteFile(outCertFile, []byte(data), 0); err != nil { _, _ = fmt.Fprintf(errOut, "error writing certificate to file [%s]: %v\n", outCertFile, err) return } @@ -67,7 +67,7 @@ func NewUnwrapIdentityFileCommand(out io.Writer, errOut io.Writer) *cobra.Comman if strings.HasPrefix(config.ID.Key, "pem:") { data := strings.TrimPrefix(config.ID.Key, "pem:") - if err := ioutil.WriteFile(outKeyFile, []byte(data), 0); err != nil { + if err := os.WriteFile(outKeyFile, []byte(data), 0); err != nil { _, _ = fmt.Fprintf(errOut, "error writing private key to file [%s]: %v\n", outKeyFile, err) return } @@ -77,7 +77,7 @@ func NewUnwrapIdentityFileCommand(out io.Writer, errOut io.Writer) *cobra.Comman if strings.HasPrefix(config.ID.Key, "pem:") { data := strings.TrimPrefix(config.ID.CA, "pem:") - if err := ioutil.WriteFile(outCaFile, []byte(data), 0); err != nil { + if err := os.WriteFile(outCaFile, []byte(data), 0); err != nil { _, _ = fmt.Fprintf(errOut, "error writing CAs to file [%s]: %v\n", outCaFile, err) return } diff --git a/ziti/pki/store/local.go b/ziti/pki/store/local.go index 2cdea6ec4..0151a6fb9 100644 --- a/ziti/pki/store/local.go +++ b/ziti/pki/store/local.go @@ -377,8 +377,13 @@ func (l *Local) Update(caName string, sn *big.Int, st certificate.State) error { } } - f.Truncate(0) - f.Seek(0, 0) + if err = f.Truncate(0); err != nil { + return err + } + + if _, err = f.Seek(0, 0); err != nil { + return err + } for _, line := range lines { n, err := fmt.Fprintln(f, line) diff --git a/ziti/router/enrollgw.go b/ziti/router/enrollgw.go index fd0175ff4..dce15c515 100644 --- a/ziti/router/enrollgw.go +++ b/ziti/router/enrollgw.go @@ -22,7 +22,7 @@ import ( "github.com/openziti/fabric/router" "github.com/openziti/sdk-golang/ziti" "github.com/spf13/cobra" - "io/ioutil" + "os" ) var jwtPath *string @@ -39,7 +39,9 @@ func NewEnrollGwCmd() *cobra.Command { jwtPath = enrollEdgeRouterCmd.Flags().StringP("jwt", "j", "", "The path to a JWT file") engine = enrollEdgeRouterCmd.Flags().StringP("engine", "e", "", "An engine") - keyAlg.Set("RSA") // set default + if err := keyAlg.Set("RSA"); err != nil { // set default + panic(err) + } enrollEdgeRouterCmd.Flags().VarP(&keyAlg, "keyAlg", "a", "Crypto algorithm to use when generating private key") return enrollEdgeRouterCmd @@ -57,7 +59,7 @@ func enrollGw(cmd *cobra.Command, args []string) { log.Panicf("could not load config: %s", err) } - jwtBuf, err := ioutil.ReadFile(*jwtPath) + jwtBuf, err := os.ReadFile(*jwtPath) if err != nil { log.Panicf("could not load JWT file from path [%s]", *jwtPath) } diff --git a/ziti/router/run.go b/ziti/router/run.go index 4d623469d..533ea0b50 100644 --- a/ziti/router/run.go +++ b/ziti/router/run.go @@ -131,7 +131,7 @@ func getFlags(cmd *cobra.Command) map[string]*pflag.Flag { func waitForShutdown(r *router.Router, config *router.Config) { ch := make(chan os.Signal, 1) - signal.Notify(ch, os.Interrupt, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGKILL, syscall.SIGTERM) + signal.Notify(ch, os.Interrupt, syscall.SIGQUIT, syscall.SIGINT, syscall.SIGTERM) s := <-ch diff --git a/ziti/util/certs.go b/ziti/util/certs.go index c72622361..7398b9e6b 100644 --- a/ziti/util/certs.go +++ b/ziti/util/certs.go @@ -8,7 +8,7 @@ import ( "encoding/pem" "fmt" "github.com/openziti/ziti/ziti/cmd/common" - "io/ioutil" + "io" "net/http" "net/url" "os" @@ -31,7 +31,7 @@ func WriteCert(p common.Printer, id string, cert []byte) (string, error) { return "", errors.Wrapf(err, "unable to create ziti certs dir %v", certsDir) } certFile := filepath.Join(certsDir, id) - if err = ioutil.WriteFile(certFile, cert, 0600); err != nil { + if err = os.WriteFile(certFile, cert, 0600); err != nil { return "", err } p.Printf("Server certificate chain written to %v\n", certFile) @@ -51,7 +51,7 @@ func ReadCert(id string) ([]byte, string, error) { } return nil, "", errors.Wrapf(err, "error while statting cert file for %v", id) } - result, err := ioutil.ReadFile(certFile) + result, err := os.ReadFile(certFile) if err != nil { return nil, "", errors.Wrapf(err, "error while reading cert for %v", id) } @@ -81,11 +81,11 @@ func AreCertsTrusted(host string, certs []byte) (bool, error) { tlsConfig.RootCAs.AppendCertsFromPEM(certs) - transport := *http.DefaultTransport.(*http.Transport) + transport := http.DefaultTransport.(*http.Transport).Clone() transport.TLSClientConfig = tlsConfig client := http.Client{ - Transport: &transport, + Transport: transport, } resp, err := client.Get(fmt.Sprintf("%v/.well-known/est/cacerts", host)) @@ -100,12 +100,12 @@ func AreCertsTrusted(host string, certs []byte) (bool, error) { } func GetWellKnownCerts(host string) ([]byte, []*x509.Certificate, error) { - transport := *http.DefaultTransport.(*http.Transport) + transport := http.DefaultTransport.(*http.Transport).Clone() transport.TLSClientConfig = &tls.Config{ InsecureSkipVerify: true, } client := http.Client{ - Transport: &transport, + Transport: transport, } resp, err := client.Get(fmt.Sprintf("%v/.well-known/est/cacerts", host)) @@ -113,7 +113,7 @@ func GetWellKnownCerts(host string) ([]byte, []*x509.Certificate, error) { return nil, nil, err } defer func() { _ = resp.Body.Close() }() - encoded, err := ioutil.ReadAll(resp.Body) + encoded, err := io.ReadAll(resp.Body) if err != nil { return nil, nil, err } diff --git a/ziti/util/commands.go b/ziti/util/commands.go index 7135774d4..ac9d1c71e 100644 --- a/ziti/util/commands.go +++ b/ziti/util/commands.go @@ -17,13 +17,8 @@ package util import ( - "fmt" - "github.com/openziti/ziti/ziti/internal/log" "github.com/spf13/cobra" - "github.com/spf13/viper" "os" - "os/exec" - "strings" ) const ( @@ -36,127 +31,6 @@ func PathWithBinary() string { return binDir + string(os.PathListSeparator) + path } -// GetCommandOutput evaluates the given command and returns the trimmed output -func GetCommandOutput(dir string, name string, args ...string) (string, error) { - os.Setenv("PATH", PathWithBinary()) - e := exec.Command(name, args...) - if dir != "" { - e.Dir = dir - } - data, err := e.CombinedOutput() - text := string(data) - text = strings.TrimSpace(text) - if err != nil { - return text, fmt.Errorf("error: command failed %s %s %s %s", name, strings.Join(args, " "), text, err) - } - return text, err -} - -// RunCommand evaluates the given command and returns the trimmed output -func RunCommand(dir string, name string, args ...string) error { - os.Setenv("PATH", PathWithBinary()) - e := exec.Command(name, args...) - if dir != "" { - e.Dir = dir - } - e.Stdout = os.Stdout - e.Stderr = os.Stdin - err := e.Run() - if err != nil { - log.Errorf("command failed %s %s\n", name, strings.Join(args, " ")) - } - return err -} - -// RunAWSCommand evaluates the given AWS CLI command and returns the trimmed output -func RunAWSCommand(args ...string) error { - os.Setenv("PATH", PathWithBinary()) - e := exec.Command("aws", args...) - accessKey, err := getAWSConfigValue("AWS_ACCESS_KEY_ID") - if err != nil { - return fmt.Errorf("Cannot find AWS_ACCESS_KEY_ID in config; Please run 'ziti init'") - } - secretKey, err := getAWSConfigValue("AWS_SECRET_ACCESS_KEY") - if err != nil { - return fmt.Errorf("Cannot find AWS_SECRET_ACCESS_KEY in config; Please run 'ziti init'") - } - e.Env = os.Environ() - e.Env = append(e.Env, "AWS_ACCESS_KEY_ID="+accessKey) - e.Env = append(e.Env, "AWS_SECRET_ACCESS_KEY="+secretKey) - e.Stdout = os.Stdout - e.Stderr = os.Stdin - err = e.Run() - if err != nil { - log.Errorf("Command failed %s\n", strings.Join(args, " ")) - } - return err -} - -// getCommandOutput evaluates the given command and returns the trimmed output -func getCommandOutput(dir string, name string, args ...string) (string, error) { - err := os.Setenv("PATH", PathWithBinary()) - - if err != nil { - return "", fmt.Errorf("could not set environment variable PATH: %s", err) - } - - e := exec.Command(name, args...) - if dir != "" { - e.Dir = dir - } - data, err := e.CombinedOutput() - text := string(data) - text = strings.TrimSpace(text) - if err != nil { - return "", fmt.Errorf("command failed 'aws %s %s': %s %s", name, strings.Join(args, " "), text, err) - } - return text, err -} - -// getAWSCommandOutput evaluates the given AWS CLI command and returns the trimmed output -func getAWSCommandOutput(args ...string) (string, error) { - os.Setenv("PATH", PathWithBinary()) - e := exec.Command("aws", args...) - accessKey, err := getAWSConfigValue("AWS_ACCESS_KEY_ID") - if err != nil { - return "", fmt.Errorf("Cannot find AWS_ACCESS_KEY_ID in config; Please run 'ziti init'") - } - secretKey, err := getAWSConfigValue("AWS_SECRET_ACCESS_KEY") - if err != nil { - return "", fmt.Errorf("Cannot find AWS_SECRET_ACCESS_KEY in config; Please run 'ziti init'") - } - e.Env = os.Environ() - e.Env = append(e.Env, "AWS_ACCESS_KEY_ID="+accessKey) - e.Env = append(e.Env, "AWS_SECRET_ACCESS_KEY="+secretKey) - data, err := e.CombinedOutput() - text := string(data) - text = strings.TrimSpace(text) - if err != nil { - return "", fmt.Errorf("command failed 'aws %s': %s %s", strings.Join(args, " "), text, err) - } - return text, err -} - -// getAWSCommandOutput evaluates the given AWS CLI command and returns the trimmed output -func getAWSConfigValue(key string) (string, error) { - viper := viper.New() - viper.SetConfigType("json") - viper.SetConfigName(CONFIGFILENAME) - zitiConfigDir, err := ZitiAppConfigDir("ziti") - if err != nil { - return "", err - } - viper.AddConfigPath(zitiConfigDir) - err = viper.ReadInConfig() - if err != nil { - return "", err - } - - val := viper.GetString(key) - - return val, nil -} - // NewEmptyParentCmd creates a new cobra command with no parent func NewEmptyParentCmd(name string, description string) *cobra.Command { diff --git a/ziti/util/dirs.go b/ziti/util/dirs.go index 9c28744ce..37d2e341c 100644 --- a/ziti/util/dirs.go +++ b/ziti/util/dirs.go @@ -19,7 +19,6 @@ package util import ( "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "runtime" @@ -186,7 +185,7 @@ func WriteZitiAppFile(zitiApp string, fileType string, appData interface{}) erro return err } - return ioutil.WriteFile(filePath, data, 0600) + return os.WriteFile(filePath, data, 0600) } // ReadZitiAppConfigFile reads in the config file data for the given Ziti application from an appropriate location @@ -203,7 +202,7 @@ func ReadZitiAppFile(zitiApp string, fileType string, configData interface{}) er filePath := filepath.Join(configDir, fileType+".json") - data, err := ioutil.ReadFile(filePath) + data, err := os.ReadFile(filePath) if err != nil { return err } diff --git a/ziti/util/files.go b/ziti/util/files.go index 659e05509..305f50c00 100644 --- a/ziti/util/files.go +++ b/ziti/util/files.go @@ -19,7 +19,6 @@ package util import ( "fmt" "io" - "io/ioutil" "os" "path/filepath" "strconv" @@ -27,8 +26,6 @@ import ( const ( DefaultWritePermissions = 0760 - - MaximumNewDirectoryAttempts = 1000 ) func FileExists(path string) (bool, error) { @@ -134,7 +131,7 @@ func CopyDir(src string, dst string, force bool) (err error) { return } - entries, err := ioutil.ReadDir(src) + entries, err := os.ReadDir(src) if err != nil { return } @@ -150,7 +147,7 @@ func CopyDir(src string, dst string, force bool) (err error) { } } else { // Skip symlinks. - if entry.Mode()&os.ModeSymlink != 0 { + if entry.Type()&os.ModeSymlink != 0 { continue } @@ -227,7 +224,7 @@ func CopyDirOverwrite(src string, dst string) (err error) { return } - entries, err := ioutil.ReadDir(src) + entries, err := os.ReadDir(src) if err != nil { return } @@ -243,7 +240,7 @@ func CopyDirOverwrite(src string, dst string) (err error) { } } else { // Skip symlinks. - if entry.Mode()&os.ModeSymlink != 0 { + if entry.Type()&os.ModeSymlink != 0 { continue } @@ -259,7 +256,7 @@ func CopyDirOverwrite(src string, dst string) (err error) { // loads a file func LoadBytes(dir, name string) ([]byte, error) { path := filepath.Join(dir, name) // relative path - bytes, err := ioutil.ReadFile(path) + bytes, err := os.ReadFile(path) if err != nil { return nil, fmt.Errorf("error loading file %s in directory %s, %v", name, dir, err) } From dd521e16164561aa6aa10b2f5ae65ec58785bd52 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Fri, 4 Aug 2023 16:13:01 -0400 Subject: [PATCH 25/29] Remove old utilities in test dir Fix more linter errors Add some test documentation. Add golangci-lint workflow Update dependencies and fix imports for edge package changes Update doc --- .github/workflows/golangci-lint.yml | 44 +++++ .golangci.yml | 4 + TESTS.md | 46 +++++ doc/ha/dev-setup.md | 4 +- doc/ha/overview.md | 11 +- go.mod | 49 ++--- go.sum | 99 +++++----- test/data-maker/data-maker.go | 138 -------------- test/id_test_utils.go | 69 ------- test/multi-conn-test/multi-conn-test.go | 150 ---------------- test/sdk-echo-server/sdk-echo-server.go | 128 ------------- test/zapp-fortio-grpc-server/LICENSE | 1 - test/zapp-fortio-grpc-server/ping.pb.go | 119 ------------ test/zapp-fortio-grpc-server/ping.proto | 15 -- .../zapp-fortio-grpc-server.go | 169 ------------------ ziti/cmd/agentcli/agent_controller_init.go | 2 +- ziti/cmd/common/options.go | 5 +- ziti/cmd/edge/create_identity.go | 5 +- ziti/cmd/fabric/list.go | 23 ++- ziti/router/run.go | 6 +- zititest/go.mod | 47 ++--- zititest/go.sum | 95 ++++++---- 22 files changed, 297 insertions(+), 932 deletions(-) create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .golangci.yml create mode 100644 TESTS.md delete mode 100644 test/data-maker/data-maker.go delete mode 100644 test/id_test_utils.go delete mode 100644 test/multi-conn-test/multi-conn-test.go delete mode 100644 test/sdk-echo-server/sdk-echo-server.go delete mode 100644 test/zapp-fortio-grpc-server/LICENSE delete mode 100644 test/zapp-fortio-grpc-server/ping.pb.go delete mode 100644 test/zapp-fortio-grpc-server/ping.proto delete mode 100644 test/zapp-fortio-grpc-server/zapp-fortio-grpc-server.go diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 000000000..86b714d3a --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,44 @@ +name: golangci-lint +on: + pull_request: +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: '1.20.x' + + - uses: actions/checkout@v3 + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: v1.53.3 + + # Optional: working directory, useful for monorepos + # working-directory: somedir + + # Optional: golangci-lint command line arguments. + args: --build-tags apitests + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true then the all caching functionality will be complete disabled, + # takes precedence over all other caching options. + # skip-cache: true + + # Optional: if set to true then the action don't cache or restore ~/go/pkg. + # skip-pkg-cache: true + + # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. + # skip-build-cache: true diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 000000000..eaba4c25c --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,4 @@ +run: + deadline: 8m + skip-files: + - ziti/cmd/edge/verify_ca.go diff --git a/TESTS.md b/TESTS.md new file mode 100644 index 000000000..88bbe3577 --- /dev/null +++ b/TESTS.md @@ -0,0 +1,46 @@ +# Smoketest + +The ziti project uses a fablab based environment to run smoketests. These tests are run +in github, but can be run locally as well. + +## Running smoketests locally + +First you must have an AWS account with permissions to create VPCs, setup security groups +and run EC2 instances. If you are able to the run the AWS CLI using an access key and +secret token, the smoketest should work as well. + +The following steps assume you are starting at the root of a cloned `ziti` repository. + +``` +$ cd zititest +$ go install ./... +$ simple-transfer create +$ ZITI_VERSION=0.0.0 simple-transfer up +$ go test -v ./tests/... +$ simple-transfer dispose +``` + +## Debugging smoketests + +When a smoketest runs in Github, the fablab instance data is uploaded to s3. This includes +everything need to work with the instance. If the smoketest run fails, the teardown will +be delayed by half of an hour. In that half of an hour the instance data can be downloaded +and the instance can be investigated. If you wish to prevent the instance from being +torn down by the workflow, you can delete the instance data out of S3 and take responsiblility +for cleaning it up yourself. + +The instance data is encrypted and requires a passphrase to decrypt. Here's an example +script which can import a GH actions workflow instance into your local environment. + +``` +aws s3 cp s3://ziti-smoketest-fablab-instances/simple-transfer-$1.tar.gz.gpg ${HOME}/Downloads/simple-transfer-$1.tar.gz.gpg +FABLAB_PASSPHRASE= simple-transfer import ${HOME}/Downloads/simple-transfer-$1.tar.gz.gpg +rm ${HOME}/Downloads/simple-transfer-$1.tar.gz.gpg +``` +You would pass the workflow run number into the script. If you need the GPG passphrase, please ask. + +To delete the instance data out of S3, you would run: + +``` +aws s3 rm s3://ziti-smoketest-fablab-instances/simple-transfer-$1.tar.gz.gpg +``` diff --git a/doc/ha/dev-setup.md b/doc/ha/dev-setup.md index c14d0203d..5030478cd 100644 --- a/doc/ha/dev-setup.md +++ b/doc/ha/dev-setup.md @@ -89,8 +89,8 @@ You should now have a three node cluster running. You can log into each controll You could then create some model data on any controller: ``` -ziti learn demo setup echo client -ziti learn demo setup echo single-sdk-hosted +ziti demo setup echo client +ziti demo setup echo single-sdk-hosted ``` Any view the results on any controller diff --git a/doc/ha/overview.md b/doc/ha/overview.md index 4ef83dd15..7cc7ac31d 100644 --- a/doc/ha/overview.md +++ b/doc/ha/overview.md @@ -66,13 +66,16 @@ There are now three new agent commands specific to the controller. ```shell # Adding Members -ziti agent controller raft-join +ziti agent cluster add # Listing Members -ziti agent controller raft-list +ziti agent cluster list # Removing Members -ziti agent controller raft-remove +ziti agent cluster remove + +# Transfer Leadership +ziti agent cluster transfer-leadership [new leader id] ``` #### Edge Admin Initialization @@ -281,4 +284,4 @@ get more robust and distributed over time. ### Api Sessions, Sessions, Posture Data -API Sessions and Sessions are moving to bearer tokens. Posture Data is TBD. \ No newline at end of file +API Sessions and Sessions are moving to bearer tokens. Posture Data is TBD. diff --git a/go.mod b/go.mod index bf60ec090..2e5f37c98 100644 --- a/go.mod +++ b/go.mod @@ -17,31 +17,31 @@ require ( github.com/gorilla/websocket v1.5.0 github.com/jedib0t/go-pretty/v6 v6.4.0 github.com/michaelquigley/pfxlog v0.6.10 - github.com/openziti/agent v1.0.14 - github.com/openziti/channel/v2 v2.0.87 - github.com/openziti/edge v0.24.372 - github.com/openziti/edge-api v0.25.30 + github.com/openziti/agent v1.0.15 + github.com/openziti/channel/v2 v2.0.89 + github.com/openziti/edge v0.24.374 + github.com/openziti/edge-api v0.25.31 github.com/openziti/fabric v0.23.52 github.com/openziti/foundation/v2 v2.0.28 github.com/openziti/identity v1.0.59 github.com/openziti/runzmd v1.0.28 - github.com/openziti/sdk-golang v0.20.80 + github.com/openziti/sdk-golang v0.20.87 github.com/openziti/storage v0.2.11 - github.com/openziti/transport/v2 v2.0.96 + github.com/openziti/transport/v2 v2.0.97 github.com/openziti/xweb/v2 v2.1.0 github.com/openziti/ziti-db-explorer v1.1.1 github.com/pkg/errors v0.9.1 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 github.com/russross/blackfriday v1.5.2 - github.com/shirou/gopsutil/v3 v3.23.6 + github.com/shirou/gopsutil/v3 v3.23.7 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.10.0 github.com/stretchr/testify v1.8.4 go.etcd.io/bbolt v1.3.7 - golang.org/x/net v0.12.0 - google.golang.org/grpc v1.56.2 + golang.org/x/net v0.14.0 + golang.org/x/text v0.12.0 google.golang.org/protobuf v1.31.0 gopkg.in/AlecAivazis/survey.v1 v1.8.7 gopkg.in/resty.v1 v1.12.0 @@ -81,18 +81,20 @@ require ( github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-openapi/analysis v0.21.4 // indirect github.com/go-openapi/errors v0.20.4 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonpointer v0.20.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/loads v0.21.2 // indirect github.com/go-openapi/spec v0.20.9 // indirect github.com/go-openapi/swag v0.22.4 // indirect github.com/go-openapi/validate v0.22.1 // indirect - github.com/golang-jwt/jwt v3.2.2+incompatible // indirect + github.com/golang-jwt/jwt/v5 v5.0.0 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a // indirect + github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/mux v1.8.0 // indirect + github.com/gorilla/schema v1.2.0 // indirect + github.com/gorilla/securecookie v1.1.1 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-msgpack v0.5.5 // indirect @@ -118,7 +120,7 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-tty v0.0.3 // indirect github.com/mdlayher/netlink v1.7.2 // indirect github.com/mdlayher/socket v0.4.1 // indirect @@ -127,6 +129,7 @@ require ( github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/muhlemmer/gu v0.3.1 // indirect github.com/natefinch/lumberjack v2.0.0+incompatible // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect @@ -144,6 +147,7 @@ require ( github.com/rabbitmq/amqp091-go v1.8.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/rodaine/table v1.0.1 // indirect + github.com/rs/cors v1.9.0 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect github.com/speps/go-hashids v2.0.0+incompatible // indirect @@ -160,22 +164,23 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect - go.mongodb.org/mongo-driver v1.12.0 // indirect + github.com/zitadel/oidc/v2 v2.6.4 // indirect + go.mongodb.org/mongo-driver v1.12.1 // indirect go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect go.opentelemetry.io/otel v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect - golang.org/x/image v0.9.0 // indirect + golang.org/x/crypto v0.12.0 // indirect + golang.org/x/exp v0.0.0-20230807204917-050eac23e9de // indirect + golang.org/x/image v0.11.0 // indirect golang.org/x/mod v0.11.0 // indirect + golang.org/x/oauth2 v0.9.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/term v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/term v0.11.0 // indirect golang.org/x/tools v0.6.0 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/appengine v1.6.7 // indirect gopkg.in/ini.v1 v1.66.2 // indirect - gopkg.in/square/go-jose.v2 v2.5.1 // indirect + gopkg.in/square/go-jose.v2 v2.6.0 // indirect nhooyr.io/websocket v1.8.7 // indirect ) diff --git a/go.sum b/go.sum index dabb68a29..5ca1a95a3 100644 --- a/go.sum +++ b/go.sum @@ -261,8 +261,9 @@ github.com/go-openapi/errors v0.20.4 h1:unTcVm6PispJsMECE3zWgvG4xTiKda1LIR5rCRWL github.com/go-openapi/errors v0.20.4/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= +github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= @@ -338,8 +339,8 @@ github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= -github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= +github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -355,6 +356,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -378,8 +380,8 @@ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8l github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/gomarkdown/markdown v0.0.0-20191123064959-2c17d62f5098/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU= -github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a h1:AWZzzFrqyjYlRloN6edwTLTUbKxf5flLXNuTBDm3Ews= -github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= +github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12 h1:uK3X/2mt4tbSGoHvbLBHUny7CKiuwUip3MArtukol4E= +github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -433,6 +435,10 @@ github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc= +github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= +github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= @@ -544,8 +550,8 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= @@ -617,8 +623,8 @@ github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/mattn/go-tty v0.0.3 h1:5OfyWorkyO7xP52Mq7tB36ajHDG5OHrmBGIS/DtakQI= github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvrWyR0= @@ -662,6 +668,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/muhlemmer/gu v0.3.1 h1:7EAqmFrW7n3hETvuAdmFmn4hS8W+z3LgKtrnow+YzNM= +github.com/muhlemmer/gu v0.3.1/go.mod h1:YHtHR+gxM+bKEIIs7Hmi9sPT3ZDUvTN/i88wQpZkrdM= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY4wsPvgQH/jsuJi4XO2ssZbdsIizr4CVC8= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= @@ -695,16 +703,16 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openziti/agent v1.0.14 h1:OTYhj2HeIlFwaFNcVT5BlYf7s4xa0TNmhnjmBpN8Afg= -github.com/openziti/agent v1.0.14/go.mod h1:zfm53+PVWoGFzjGGgQdKby5749G6VRYHe+eQJmoVKy4= -github.com/openziti/channel/v2 v2.0.87 h1:+54diAb1NjwnQ3qADptq76gq3IFF+hW+uLD5st5ULAo= -github.com/openziti/channel/v2 v2.0.87/go.mod h1:GggAVKAlOf2ezo8VvgQ2yRK5Gokp6wlvS4kBhmoKn1g= +github.com/openziti/agent v1.0.15 h1:NW4egpS3Mw1RQBZWfUEvrmBh9kn/SU/dU5fndsyyhZ4= +github.com/openziti/agent v1.0.15/go.mod h1:zfm53+PVWoGFzjGGgQdKby5749G6VRYHe+eQJmoVKy4= +github.com/openziti/channel/v2 v2.0.89 h1:L6Efndhsb0YgvD5LkU6QAB6si2VP4h0Kn0BmY2iBfjQ= +github.com/openziti/channel/v2 v2.0.89/go.mod h1:O7wkSjV7CuebQQKLHYUL/wPL+8RuZkGQDzd1L7/+8qk= github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k= github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo= -github.com/openziti/edge v0.24.372 h1:B9zMZUDnoqKu+epTkWEdfm1ugX8X+S0u/Tg23k3+mPc= -github.com/openziti/edge v0.24.372/go.mod h1:nkYAlBPh8q+pbtM5RACeq0/lsxrutqSKeQ5hlYGe49U= -github.com/openziti/edge-api v0.25.30 h1:40pAcd3Y2yT8hYYHTJTkSTLA0pvbDCw4prt72JdQMuI= -github.com/openziti/edge-api v0.25.30/go.mod h1:ODMG0fB9Dj1pL0UqDC8jzSUAlUZy8aYhzF3xHPg6Xm0= +github.com/openziti/edge v0.24.374 h1:L1Z3EDrEOHxOj5hip1rTFJAlLuoB7lXKVdb3Jbp+URI= +github.com/openziti/edge v0.24.374/go.mod h1:bPFyx5/N3acmNVODDkGrTyGxYLviO3I52j0Owj8MQvs= +github.com/openziti/edge-api v0.25.31 h1:KiM4pQVIqy/0CN/FW2AgoN7PcejB+y8FdgjN86Jn83Q= +github.com/openziti/edge-api v0.25.31/go.mod h1:7fyXLqNcyC5IG29GuI8danhhppAaxRV6HiCLwN1Kk64= github.com/openziti/fabric v0.23.52 h1:8F4jt00RDrZJz6YiKliJ8UGnknE3jSuWwxsK3641ehE= github.com/openziti/fabric v0.23.52/go.mod h1:wLYKhlnhthLR7FBqfGlfdCZ0hbQCcSnr5b2wpjA4/vM= github.com/openziti/foundation/v2 v2.0.28 h1:AAdHhtUj1tCIXollSpbDlKwPKRasNAgADpTZAF1WCOQ= @@ -717,14 +725,14 @@ github.com/openziti/metrics v1.2.30 h1:0ZV9UWPupcBvHigzET1wf47idrTflYSHInNgDtZqk github.com/openziti/metrics v1.2.30/go.mod h1:8xSr4Rl0527Lyp5IKvUYwPNObIFkO8AS3nO2RjvDPSQ= github.com/openziti/runzmd v1.0.28 h1:8VNgENRAm1pfp0YoJWYoW6uBtyMD6ccVTsC24kx2gpk= github.com/openziti/runzmd v1.0.28/go.mod h1:4r4uNOK34lKbilrV7yaiDiPwRGIvj1XQSl6E6U8NmAw= -github.com/openziti/sdk-golang v0.20.80 h1:TG+G4QrVjcA7Q2kiZf8OlplfyHRkoVO7Z1yilUHrEis= -github.com/openziti/sdk-golang v0.20.80/go.mod h1:SvKwsnV7wgRrGq+E+C2ASCEN06t9camcTBANYXXYWro= +github.com/openziti/sdk-golang v0.20.87 h1:hhJd0/msZf/2vC15xXZ4xF3zbR+Bmx1gmgM4K0l4JxI= +github.com/openziti/sdk-golang v0.20.87/go.mod h1:gszOnLHB9RAuAw5F86uI8fIYNdh3d6+KRHo5zP+uzTU= github.com/openziti/secretstream v0.1.10 h1:aLheoP6vVAv96mItwkXxWr9Ym0tTooJ5o9H1j2fAh04= github.com/openziti/secretstream v0.1.10/go.mod h1:HrS6P9G0jjHNHuKESMaybNdxBHjD1b0SzxSi0rDzshY= github.com/openziti/storage v0.2.11 h1:Ws23any7NtbEKQroFJt6DJmeEFGMPjZqjAK2/Re9LIE= github.com/openziti/storage v0.2.11/go.mod h1:M46XIxPYwTDTgaamI6o9cyEJkYvUYfhJjwvZtQu4tUQ= -github.com/openziti/transport/v2 v2.0.96 h1:onLHb0oNS+xzmqnAVYHDGb00qtLODzyPVubq+2h5SoY= -github.com/openziti/transport/v2 v2.0.96/go.mod h1:L0MZ3LZsJ9Jheg05Bp6QYJBfuq4fDtjoL9stcTSmtko= +github.com/openziti/transport/v2 v2.0.97 h1:BgsxDYdyzBf6sIIicT6X7WV1S2HMXQA1upmo5UFNYfU= +github.com/openziti/transport/v2 v2.0.97/go.mod h1:zXB5jNtmTIe3gMCgLuk2RUEsvc8ysVLExnfrRdSg11M= github.com/openziti/x509-claims v1.0.3 h1:HNdQ8Nf1agB3lBs1gahcO6zfkeS4S5xoQ2/PkY4HRX0= github.com/openziti/x509-claims v1.0.3/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE= github.com/openziti/xweb/v2 v2.1.0 h1:Xhh3C2pZkq/Prr65V+SfFSibLDYteoc4f62KQCcTZF4= @@ -810,6 +818,9 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= +github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -818,8 +829,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb github.com/sacloud/libsacloud v1.36.2/go.mod h1:P7YAOVmnIn3DKHqCZcUKYUXmSwGBm3yS7IBEjKVSrjg= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil/v3 v3.23.6 h1:5y46WPI9QBKBbK7EEccUPNXpJpNrvPuTD0O2zHEHT08= -github.com/shirou/gopsutil/v3 v3.23.6/go.mod h1:j7QX50DrXYggrpN30W0Mo+I4/8U2UUIQrnrhqUeWrAU= +github.com/shirou/gopsutil/v3 v3.23.7 h1:C+fHO8hfIppoJ1WdsVm1RoI0RwXoNdfTK7yWXV0wVj4= +github.com/shirou/gopsutil/v3 v3.23.7/go.mod h1:c4gnmoRC0hQuaLqvxnx1//VXQ0Ms/X9UnJF8pddY5z4= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= @@ -962,6 +973,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/zitadel/oidc/v2 v2.6.4 h1:bruA+KOFHcGpxr++WgtvR82ZlH54kKituu5xE4wpF7o= +github.com/zitadel/oidc/v2 v2.6.4/go.mod h1:owrsdzRqGvIZjBCY9LY1ZUYJ0mRUbGkQpZ3OskXL4wM= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= @@ -971,8 +984,8 @@ go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsX go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= -go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE= -go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0= +go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE= +go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 h1:CCriYyAfq1Br1aIYettdHZTy8mBTIPo7We18TuO/bak= go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= @@ -1029,8 +1042,8 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1041,14 +1054,14 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= -golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20230807204917-050eac23e9de h1:l5Za6utMv/HsBWWqzt4S8X17j+kt1uVETUX5UFhn2rE= +golang.org/x/exp v0.0.0-20230807204917-050eac23e9de/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191206065243-da761ea9ff43/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.9.0 h1:QrzfX26snvCM20hIhBwuHI/ThTg18b/+kcKdXHvnR+g= -golang.org/x/image v0.9.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0= +golang.org/x/image v0.11.0 h1:ds2RoQvBvYTiJkwpSFDwCcDFNX7DqjL2WsUgTNk0Ooo= +golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -1133,8 +1146,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1149,6 +1162,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= +golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1255,15 +1270,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1276,8 +1291,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1385,6 +1400,7 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -1431,8 +1447,6 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -1457,8 +1471,6 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1498,8 +1510,9 @@ gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXL gopkg.in/ns1/ns1-go.v2 v2.4.2/go.mod h1:GMnKY+ZuoJ+lVLL+78uSTjwTz2jMazq6AfGKQOYhsPk= gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w= gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= +gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= diff --git a/test/data-maker/data-maker.go b/test/data-maker/data-maker.go deleted file mode 100644 index 5861ba9ea..000000000 --- a/test/data-maker/data-maker.go +++ /dev/null @@ -1,138 +0,0 @@ -// +build utils - -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package main - -import ( - "fmt" - "github.com/michaelquigley/pfxlog" - "github.com/openziti/sdk-golang/ziti" - "github.com/sirupsen/logrus" - "io" - "log" - "os" - "unicode" -) - -func main() { - service := "data-maker" - pfxlog.Logger().Infof("args %v", os.Args) - if len(os.Args) > 1 { - service = os.Args[1] - } - pfxlog.Logger().Infof("Attempting to host service %v", service) - logrus.SetLevel(logrus.DebugLevel) - ztContext := ziti.NewContext() - listener, err := ztContext.Listen(service) - if err != nil { - log.Fatalf("failed to host service '%v': %v", service, err) - } - - for { - conn, err := listener.Accept() - if err != nil { - panic(err) - } - fmt.Println("Connection received") - go respond(conn) - } -} - -func respond(conn io.ReadWriteCloser) { - defer func() { - if err := conn.Close(); err != nil { - fmt.Printf("Error while closing connection: %v\n", err) - } - fmt.Println("Connection closed") - }() - - for { - buf := make([]byte, 1024) - n, err := conn.Read(buf) - if err != nil { - fmt.Printf("Error while reading: %v\n", err) - break - } - fmt.Printf("Read %v bytes\n", n) - - size := 0 - sizeUnits := 'b' - - cmd := string(buf[:n]) - for _, ch := range cmd { - if unicode.IsDigit(ch) { - num := (int)(ch - '0') - size = size*10 + num - } else { - sizeUnits = ch - break - } - } - - var writeBuf []byte - - if size == 0 { - writeBuf = []byte("Did not understand input, please try again\n") - } else { - switch sizeUnits { - case 'b': - // already there - case 'k': - size = size * 1024 - case 'm': - size = size * 1024 * 1024 - default: - size = 0 - writeBuf = []byte("Did not understand input, please use format . Ex: 1b or 10k or 2m\n") - } - } - - if size > 0 { - writeBuf = make([]byte, size) - fill(writeBuf) - fmt.Printf("sending back %v.\n.Data length: %v\n", string(writeBuf), len(writeBuf)) - } - - if _, err := conn.Write(writeBuf); err != nil { - fmt.Printf("Error while writing: %v\n", err) - break - } - - summaryBuf := []byte(fmt.Sprintf("\nWrote %v bytes\n", len(writeBuf))) - if _, err := conn.Write(summaryBuf); err != nil { - fmt.Printf("Error while writing: %v\n", err) - break - } - - fmt.Printf("Wrote %v bytes\n", n) - } -} - -func fill(buf []byte) { - for i := 0; i < len(buf); i++ { - if (i+1)%1024 == 0 { - k := (i + 1) / 1024 - kBuf := []byte(fmt.Sprintf("%vk", k)) - for j := 0; j < len(kBuf); j++ { - buf[i-j] = kBuf[len(kBuf)-(j+1)] - } - } else { - buf[i] = '.' - } - } -} diff --git a/test/id_test_utils.go b/test/id_test_utils.go deleted file mode 100644 index 562410136..000000000 --- a/test/id_test_utils.go +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package test - -import ( - "github.com/openziti/identity" - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "encoding/pem" - "math/big" - "time" -) - -const ( - Hostname = "localhost" -) - -func mkCert(cn string, dns []string) (*rsa.PrivateKey, *x509.Certificate) { - // key, _ := ecdsa.GenerateKey(elliptic.P224(), rand.Reader) - - key, _ := rsa.GenerateKey(rand.Reader, 2048) - - cert := &x509.Certificate{ - SerialNumber: big.NewInt(169), - SignatureAlgorithm: x509.SHA256WithRSA, - DNSNames: dns, - NotBefore: time.Now().Add(-time.Hour), - NotAfter: time.Now().Add(time.Hour), - BasicConstraintsValid: true, - } - return key, cert -} - -func CreateTestIdentity() (identity.Identity, error) { - // setup - key, cert := mkCert("Test Name", []string{Hostname}) - - certDER, err := x509.CreateCertificate(rand.Reader, cert, cert, key.Public(), key) - if err != nil { - return nil, err - } - - keyPEM := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}) - certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: certDER}) - - cfg := identity.Config{ - Key: "pem:" + string(keyPEM), - Cert: "pem:" + string(certPEM), - ServerCert: "pem:" + string(certPEM), - CA: "pem:" + string(certPEM), - } - - return identity.LoadIdentity(cfg) -} diff --git a/test/multi-conn-test/multi-conn-test.go b/test/multi-conn-test/multi-conn-test.go deleted file mode 100644 index 63de71475..000000000 --- a/test/multi-conn-test/multi-conn-test.go +++ /dev/null @@ -1,150 +0,0 @@ -// +build utils - -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package main - -import ( - "fmt" - "github.com/michaelquigley/pfxlog" - "github.com/openziti/foundation/v2/debugz" - "github.com/openziti/sdk-golang/ziti" - "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - "io" - "math/rand" - "net" - "sync" - "sync/atomic" -) - -func init() { - pfxlog.Global(logrus.InfoLevel) - pfxlog.SetPrefix("github.com/openziti/") - pfxlog.SetDefaultNoColor() -} - -func init() { - root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging") - root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]") - root.PersistentFlags().Uint32VarP(&connCount, "connections", "c", 2, "Number of concurrent connections") - root.PersistentFlags().Uint32VarP(&iterations, "iterations", "i", 10, "Number of iterations") - root.Flags().SetInterspersed(true) -} - -var root = &cobra.Command{ - Use: "multi-conn-test ", - Short: "Multiplexed connection tester Ziti Application", - PersistentPreRun: func(cmd *cobra.Command, args []string) { - if verbose { - logrus.SetLevel(logrus.DebugLevel) - } - - switch logFormatter { - case "pfxlog": - logrus.SetFormatter(pfxlog.NewFormatterStartingToday()) - case "json": - logrus.SetFormatter(&logrus.JSONFormatter{}) - case "text": - logrus.SetFormatter(&logrus.TextFormatter{}) - default: - // let logrus do its own thing - } - }, - Args: cobra.RangeArgs(0, 1), - Run: runFunc, -} - -var verbose bool -var logFormatter string -var connCount uint32 -var iterations uint32 - -var iterCount uint32 - -var service = "echo" -var ztContext ziti.Context - -var waitGroup sync.WaitGroup - -func main() { - debugz.AddStackDumpHandler() - if err := root.Execute(); err != nil { - fmt.Printf("error: %s", err) - } -} - -func runFunc(_ *cobra.Command, args []string) { - ztContext = ziti.NewContext() - - if len(args) > 0 { - service = args[0] - } - - var conns []net.Conn - - waitGroup.Add(int(iterations)) - - for i := uint32(0); i < connCount; i++ { - conn, err := ztContext.Dial(service) - if err != nil { - panic(err) - } - conns = append(conns, conn) - } - - for _, conn := range conns { - iteration := atomic.AddUint32(&iterCount, 1) - go runIteration(iteration, conn) - } - - waitGroup.Wait() -} - -func runIteration(iteration uint32, conn net.Conn) { - defer waitGroup.Done() - - log := pfxlog.Logger() - log.Infof("Starting iteration %v", iteration) - bufferSize := 10 + rand.Int31n(1024) - writeBuf := make([]byte, bufferSize) - readBuf := make([]byte, bufferSize) - for i := 0; i < 10; i++ { - _, _ = rand.Read(writeBuf) - if _, err := conn.Write(writeBuf); err != nil { - panic(err) - } - if _, err := io.ReadFull(conn, readBuf); err != nil { - panic(err) - } - } - nextIteration() -} - -func nextIteration() { - iteration := atomic.AddUint32(&iterCount, 1) - if iteration <= iterations { - conn, err := ztContext.Dial(service) - if err != nil { - panic(err) - } - runIteration(iteration, conn) - } else { - log := pfxlog.Logger() - log.Infof("Reached max iteration count, exiting") - } -} diff --git a/test/sdk-echo-server/sdk-echo-server.go b/test/sdk-echo-server/sdk-echo-server.go deleted file mode 100644 index 5807e8e8b..000000000 --- a/test/sdk-echo-server/sdk-echo-server.go +++ /dev/null @@ -1,128 +0,0 @@ -// +build utils - -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package main - -import ( - "fmt" - "github.com/michaelquigley/pfxlog" - "github.com/openziti/foundation/v2/debugz" - "github.com/openziti/sdk-golang/ziti" - "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - "io" -) - -func init() { - pfxlog.Global(logrus.InfoLevel) - pfxlog.SetPrefix("github.com/openziti/") - pfxlog.SetDefaultNoColor() -} - -func init() { - root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging") - root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]") - root.Flags().SetInterspersed(true) -} - -var root = &cobra.Command{ - Use: "sdk-echo-server ", - Short: "Echos incoming data", - PersistentPreRun: func(cmd *cobra.Command, args []string) { - if verbose { - logrus.SetLevel(logrus.DebugLevel) - } - - switch logFormatter { - case "pfxlog": - logrus.SetFormatter(pfxlog.NewFormatterStartingToday()) - case "json": - logrus.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"}) - case "text": - logrus.SetFormatter(&logrus.TextFormatter{}) - default: - // let logrus do its own thing - } - }, - Args: cobra.RangeArgs(0, 1), - Run: runFunc, -} - -var verbose bool -var logFormatter string - -func main() { - debugz.AddStackDumpHandler() - if err := root.Execute(); err != nil { - fmt.Printf("error: %s", err) - } -} - -func runFunc(_ *cobra.Command, args []string) { - log := pfxlog.Logger() - ztContext := ziti.NewContext() - - service := "echo" - if len(args) > 0 { - service = args[0] - log.Infof("Using service %v", service) - } else { - log.Infof("No service provided, using service %v: ", service) - } - - listener, err := ztContext.Listen(service) - if err != nil { - log.Fatalf("failed to host service %v: %v", service, err) - } - - for { - conn, err := listener.Accept() - if err != nil { - panic(err) - } - log.Infof("Connection received: %v", conn) - go echo(conn) - } -} - -func echo(conn io.ReadWriteCloser) { - log := pfxlog.Logger().WithField("conn", conn) - - defer func() { - if err := conn.Close(); err != nil { - log.WithError(err).Error("Error while closing connection") - } - log.Info("Connection closed") - }() - - for { - buf := make([]byte, 1024) - n, err := conn.Read(buf) - if err != nil { - log.WithError(err).Error("Error while reading") - break - } - log.Infof("Read %v bytes\n", n) - writeBuf := buf[:n] - if _, err := conn.Write(writeBuf); err != nil { - log.WithError(err).Error("Error while writing") - break - } - log.Infof("Wrote %v bytes\n", n) - } -} diff --git a/test/zapp-fortio-grpc-server/LICENSE b/test/zapp-fortio-grpc-server/LICENSE deleted file mode 100644 index 49f8b5bbc..000000000 --- a/test/zapp-fortio-grpc-server/LICENSE +++ /dev/null @@ -1 +0,0 @@ -Copied from https://github.com/fortio/fortio/tree/master/fgrpc under Apache License 2.0 https://github.com/fortio/fortio/blob/master/LICENSE \ No newline at end of file diff --git a/test/zapp-fortio-grpc-server/ping.pb.go b/test/zapp-fortio-grpc-server/ping.pb.go deleted file mode 100644 index 6ac6628d1..000000000 --- a/test/zapp-fortio-grpc-server/ping.pb.go +++ /dev/null @@ -1,119 +0,0 @@ -// +build utils - -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: ping.proto - -package main - -import proto "google.golang.org/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type PingMessage struct { - Seq int64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` - Ts int64 `protobuf:"varint,2,opt,name=ts,proto3" json:"ts,omitempty"` - Payload string `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` - DelayNanos int64 `protobuf:"varint,4,opt,name=delayNanos,proto3" json:"delayNanos,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PingMessage) Reset() { *m = PingMessage{} } -func (m *PingMessage) String() string { return proto.CompactTextString(m) } -func (*PingMessage) ProtoMessage() {} -func (*PingMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_ping_ba7bbf995167e761, []int{0} -} -func (m *PingMessage) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PingMessage.Unmarshal(m, b) -} -func (m *PingMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PingMessage.Marshal(b, m, deterministic) -} -func (dst *PingMessage) XXX_Merge(src proto.Message) { - xxx_messageInfo_PingMessage.Merge(dst, src) -} -func (m *PingMessage) XXX_Size() int { - return xxx_messageInfo_PingMessage.Size(m) -} -func (m *PingMessage) XXX_DiscardUnknown() { - xxx_messageInfo_PingMessage.DiscardUnknown(m) -} - -var xxx_messageInfo_PingMessage proto.InternalMessageInfo - -func (m *PingMessage) GetSeq() int64 { - if m != nil { - return m.Seq - } - return 0 -} - -func (m *PingMessage) GetTs() int64 { - if m != nil { - return m.Ts - } - return 0 -} - -func (m *PingMessage) GetPayload() string { - if m != nil { - return m.Payload - } - return "" -} - -func (m *PingMessage) GetDelayNanos() int64 { - if m != nil { - return m.DelayNanos - } - return 0 -} - -func init() { - proto.RegisterType((*PingMessage)(nil), "fgrpc.PingMessage") -} - -func init() { proto.RegisterFile("ping.proto", fileDescriptor_ping_ba7bbf995167e761) } - -var fileDescriptor_ping_ba7bbf995167e761 = []byte{ - // 160 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0xc8, 0xcc, 0x4b, - 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4d, 0x4b, 0x2f, 0x2a, 0x48, 0x56, 0xca, 0xe4, - 0xe2, 0x0e, 0x00, 0x0a, 0xfa, 0xa6, 0x16, 0x17, 0x27, 0xa6, 0xa7, 0x0a, 0x09, 0x70, 0x31, 0x17, - 0xa7, 0x16, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0x81, 0x98, 0x42, 0x7c, 0x5c, 0x4c, 0x25, - 0xc5, 0x12, 0x4c, 0x60, 0x01, 0x20, 0x4b, 0x48, 0x82, 0x8b, 0xbd, 0x20, 0xb1, 0x32, 0x27, 0x3f, - 0x31, 0x45, 0x82, 0x19, 0x28, 0xc8, 0x19, 0x04, 0xe3, 0x0a, 0xc9, 0x71, 0x71, 0xa5, 0xa4, 0xe6, - 0x24, 0x56, 0xfa, 0x25, 0xe6, 0xe5, 0x17, 0x4b, 0xb0, 0x80, 0x75, 0x20, 0x89, 0x18, 0xd9, 0x71, - 0x71, 0x81, 0xac, 0x0a, 0x4e, 0x2d, 0x2a, 0x4b, 0x2d, 0x12, 0x32, 0xe0, 0x62, 0x01, 0xf1, 0x84, - 0x84, 0xf4, 0xc0, 0x0e, 0xd1, 0x43, 0x72, 0x85, 0x14, 0x16, 0x31, 0x25, 0x86, 0x24, 0x36, 0xb0, - 0xc3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x54, 0x22, 0xa0, 0xfe, 0xc6, 0x00, 0x00, 0x00, -} diff --git a/test/zapp-fortio-grpc-server/ping.proto b/test/zapp-fortio-grpc-server/ping.proto deleted file mode 100644 index 835ecf2f5..000000000 --- a/test/zapp-fortio-grpc-server/ping.proto +++ /dev/null @@ -1,15 +0,0 @@ -// regenerate the .pb.go file after any change using -// protoc ping.proto --go_out=plugins=grpc:. -syntax = "proto3"; -package fgrpc; - -message PingMessage { - int64 seq = 1; // sequence number - int64 ts = 2; // src send ts / dest receive ts - string payload = 3; // extra packet data - int64 delayNanos = 4; // delay the response by x nanoseconds -} - -service PingServer { - rpc Ping (PingMessage) returns (PingMessage) {} -} diff --git a/test/zapp-fortio-grpc-server/zapp-fortio-grpc-server.go b/test/zapp-fortio-grpc-server/zapp-fortio-grpc-server.go deleted file mode 100644 index 8125109e0..000000000 --- a/test/zapp-fortio-grpc-server/zapp-fortio-grpc-server.go +++ /dev/null @@ -1,169 +0,0 @@ -// +build utils - -/* - Copyright NetFoundry Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package main - -import ( - "fmt" - "github.com/michaelquigley/pfxlog" - "github.com/openziti/foundation/v2/debugz" - "github.com/openziti/sdk-golang/ziti" - "github.com/openziti/sdk-golang/ziti/edge" - "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/reflection" - "time" -) - -func init() { - pfxlog.Global(logrus.InfoLevel) - pfxlog.SetPrefix("github.com/openziti/") - pfxlog.SetDefaultNoColor() -} - -func init() { - root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging") - root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]") - - root.Flags().SetInterspersed(true) -} - -var root = &cobra.Command{ - Use: "zapp-fortio-grpc-server ", - Short: "Fortio GRPC Ping Server Ziti Application", - PersistentPreRun: func(cmd *cobra.Command, args []string) { - if verbose { - logrus.SetLevel(logrus.DebugLevel) - } - - switch logFormatter { - case "pfxlog": - logrus.SetFormatter(pfxlog.NewFormatterStartingToday()) - case "json": - logrus.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"}) - case "text": - logrus.SetFormatter(&logrus.TextFormatter{}) - default: - // let logrus do its own thing - } - }, - Args: cobra.RangeArgs(0, 1), - Run: runFunc, -} - -var verbose bool -var logFormatter string - -func main() { - debugz.AddStackDumpHandler() - if err := root.Execute(); err != nil { - fmt.Printf("error: %s", err) - } -} - -func runFunc(_ *cobra.Command, args []string) { - log := pfxlog.Logger() - ztContext := ziti.NewContext() - - service := "fortio-grpc" - if len(args) > 0 { - service = args[0] - } - - listener, err := ztContext.Listen(service) - if err != nil { - log.WithError(err).Fatalf("failed to host %v service", service) - } - - grpcServer := grpc.NewServer() - reflection.Register(grpcServer) - grpcServer.RegisterService(&_PingServer_serviceDesc, &pingSrv{}) - - err = grpcServer.Serve(listener) - - if err != nil { - log.WithError(err).Fatal("failed to start fortio grpc server") - } -} - -type pingSrv struct { -} - -type PingServerServer interface { - Ping(context.Context, *PingMessage) (*PingMessage, error) -} - -var _PingServer_serviceDesc = grpc.ServiceDesc{ - ServiceName: "fgrpc.PingServer", - HandlerType: (*PingServerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Ping", - Handler: _PingServer_Ping_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "ping.proto", -} - -func _PingServer_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PingMessage) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PingServerServer).Ping(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/fgrpc.PingServer/Ping", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PingServerServer).Ping(ctx, req.(*PingMessage)) - } - return interceptor(ctx, in, info, handler) -} - -func (s *pingSrv) Ping(c context.Context, in *PingMessage) (*PingMessage, error) { - log := pfxlog.Logger() - var connId uint32 - if p, ok := peer.FromContext(c); ok { - var msgChanIf interface{} - msgChanIf = p.Addr - if msgChan, ok := msgChanIf.(edge.Identifiable); ok { - connId = msgChan.Id() - } else { - log.Error("Unable to cast peer address to edge.MsgChannel") - } - } else { - log.Error("Unable to get peer from context") - } - - log.WithField("connId", connId).Infof("Ping called %+v (ctx %+v)", *in, c) - out := *in // copy the input including the payload etc - out.Ts = time.Now().UnixNano() - if in.DelayNanos > 0 { - s := time.Duration(in.DelayNanos) - log.Debugf("GRPC ping: sleeping for %v", s) - time.Sleep(s) - } - return &out, nil -} diff --git a/ziti/cmd/agentcli/agent_controller_init.go b/ziti/cmd/agentcli/agent_controller_init.go index ecdcf865f..c617dbf2c 100644 --- a/ziti/cmd/agentcli/agent_controller_init.go +++ b/ziti/cmd/agentcli/agent_controller_init.go @@ -20,7 +20,7 @@ import ( "fmt" "github.com/openziti/channel/v2" "github.com/openziti/channel/v2/protobufs" - "github.com/openziti/edge/pb/edge_mgmt_pb" + "github.com/openziti/edge/common/pb/edge_mgmt_pb" "github.com/openziti/ziti/ziti/cmd/common" "github.com/spf13/cobra" ) diff --git a/ziti/cmd/common/options.go b/ziti/cmd/common/options.go index 116b797e1..392ff5761 100644 --- a/ziti/cmd/common/options.go +++ b/ziti/cmd/common/options.go @@ -76,9 +76,8 @@ func (options *CommonOptions) GetFilter() *string { return nil } -func (options *CommonOptions) GetContext() context.Context { - ctx, _ := context.WithTimeout(context.Background(), time.Second*time.Duration(options.Timeout)) - return ctx +func (options *CommonOptions) GetContext() (context.Context, func()) { + return context.WithTimeout(context.Background(), time.Second*time.Duration(options.Timeout)) } func (options *CommonOptions) Printf(format string, args ...interface{}) { diff --git a/ziti/cmd/edge/create_identity.go b/ziti/cmd/edge/create_identity.go index e50ecab28..869a19d8e 100644 --- a/ziti/cmd/edge/create_identity.go +++ b/ziti/cmd/edge/create_identity.go @@ -21,6 +21,8 @@ import ( "github.com/openziti/ziti/ziti/cmd/api" cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers" "github.com/pkg/errors" + "golang.org/x/text/cases" + "golang.org/x/text/language" "io" "math" "os" @@ -104,7 +106,8 @@ func newCreateIdentityOfTypeCmd(idType string, options *createIdentityOptions) * func runCreateIdentity(idType string, o *createIdentityOptions) error { entityData := gabs.New() api.SetJSONValue(entityData, o.Args[0], "name") - api.SetJSONValue(entityData, strings.Title(idType), "type") + idType = cases.Title(language.English).String(idType) + api.SetJSONValue(entityData, idType, "type") o.username = strings.TrimSpace(o.username) if o.username != "" { diff --git a/ziti/cmd/fabric/list.go b/ziti/cmd/fabric/list.go index fd1ccec54..b6cfbd0fc 100644 --- a/ziti/cmd/fabric/list.go +++ b/ziti/cmd/fabric/list.go @@ -89,9 +89,11 @@ func newListCmdForEntityType(entityType string, command listCommandRunner, optio func runListCircuits(o *api.Options) error { return WithFabricClient(o, func(client *fabric_rest_client.ZitiFabric) error { + ctx, cancelF := o.GetContext() + defer cancelF() result, err := client.Circuit.ListCircuits(&circuit.ListCircuitsParams{ //Filter: o.GetFilter(), - Context: o.GetContext(), + Context: ctx, }) return outputResult(result, err, o, outputCircuits) }) @@ -135,9 +137,11 @@ func outputCircuits(o *api.Options, results *circuit.ListCircuitsOK) error { func runListLinks(o *api.Options) error { return WithFabricClient(o, func(client *fabric_rest_client.ZitiFabric) error { + ctx, cancelF := o.GetContext() + defer cancelF() result, err := client.Link.ListLinks(&link.ListLinksParams{ //Filter: o.GetFilter(), - Context: o.GetContext(), + Context: ctx, }) return outputResult(result, err, o, outputLinks) }) @@ -183,9 +187,12 @@ func outputLinks(o *api.Options, results *link.ListLinksOK) error { func runListTerminators(o *api.Options) error { return WithFabricClient(o, func(client *fabric_rest_client.ZitiFabric) error { + ctx, cancelF := o.GetContext() + defer cancelF() + result, err := client.Terminator.ListTerminators(&terminator.ListTerminatorsParams{ Filter: o.GetFilter(), - Context: o.GetContext(), + Context: ctx, }) return outputResult(result, err, o, outputTerminators) }) @@ -217,9 +224,12 @@ func outputTerminators(o *api.Options, result *terminator.ListTerminatorsOK) err func runListServices(o *api.Options) error { return WithFabricClient(o, func(client *fabric_rest_client.ZitiFabric) error { + ctx, cancelF := o.GetContext() + defer cancelF() + result, err := client.Service.ListServices(&service.ListServicesParams{ Filter: o.GetFilter(), - Context: o.GetContext(), + Context: ctx, }) return outputResult(result, err, o, outputServices) }) @@ -245,9 +255,12 @@ func outputServices(o *api.Options, result *service.ListServicesOK) error { func runListRouters(o *api.Options) error { return WithFabricClient(o, func(client *fabric_rest_client.ZitiFabric) error { + ctx, cancelF := o.GetContext() + defer cancelF() + result, err := client.Router.ListRouters(&router.ListRoutersParams{ Filter: o.GetFilter(), - Context: o.GetContext(), + Context: ctx, }) return outputResult(result, err, o, outputRouters) }) diff --git a/ziti/router/run.go b/ziti/router/run.go index 533ea0b50..0884a2f93 100644 --- a/ziti/router/run.go +++ b/ziti/router/run.go @@ -20,7 +20,7 @@ import ( "fmt" "github.com/michaelquigley/pfxlog" "github.com/openziti/agent" - "github.com/openziti/edge/edge_common" + "github.com/openziti/edge/common" "github.com/openziti/edge/router/debugops" "github.com/openziti/edge/router/fabric" "github.com/openziti/edge/router/xgress_edge" @@ -76,7 +76,7 @@ func run(cmd *cobra.Command, args []string) { stateManager := fabric.NewStateManager() xgressEdgeFactory := xgress_edge.NewFactory(config, version.GetCmdBuildInfo(), stateManager, r.GetMetricsRegistry()) - xgress.GlobalRegistry().Register(edge_common.EdgeBinding, xgressEdgeFactory) + xgress.GlobalRegistry().Register(common.EdgeBinding, xgressEdgeFactory) if err := r.RegisterXrctrl(xgressEdgeFactory); err != nil { logrus.WithError(err).Panic("error registering edge in framework") } @@ -85,7 +85,7 @@ func run(cmd *cobra.Command, args []string) { xgress.GlobalRegistry().Register(xgress_edge_transport.BindingName, xgressEdgeTransportFactory) xgressEdgeTunnelFactory := xgress_edge_tunnel.NewFactory(r, config, stateManager) - xgress.GlobalRegistry().Register(edge_common.TunnelBinding, xgressEdgeTunnelFactory) + xgress.GlobalRegistry().Register(common.TunnelBinding, xgressEdgeTunnelFactory) if err := r.RegisterXrctrl(xgressEdgeTunnelFactory); err != nil { logrus.WithError(err).Panic("error registering edge tunnel in framework") } diff --git a/zititest/go.mod b/zititest/go.mod index 01e873413..13fd3e452 100644 --- a/zititest/go.mod +++ b/zititest/go.mod @@ -9,21 +9,21 @@ require ( github.com/Jeffail/gabs/v2 v2.7.0 github.com/google/uuid v1.3.0 github.com/michaelquigley/pfxlog v0.6.10 - github.com/openziti/channel/v2 v2.0.87 - github.com/openziti/edge v0.24.372 + github.com/openziti/channel/v2 v2.0.89 + github.com/openziti/edge v0.24.374 github.com/openziti/fablab v0.5.5 github.com/openziti/fabric v0.23.52 github.com/openziti/foundation/v2 v2.0.28 github.com/openziti/identity v1.0.59 - github.com/openziti/sdk-golang v0.20.80 + github.com/openziti/sdk-golang v0.20.87 github.com/openziti/storage v0.2.11 - github.com/openziti/transport/v2 v2.0.96 + github.com/openziti/transport/v2 v2.0.97 github.com/openziti/ziti v0.28.3 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.8.4 go.etcd.io/bbolt v1.3.7 - golang.org/x/net v0.12.0 + golang.org/x/net v0.14.0 google.golang.org/protobuf v1.31.0 ) @@ -63,7 +63,7 @@ require ( github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-openapi/analysis v0.21.4 // indirect github.com/go-openapi/errors v0.20.4 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonpointer v0.20.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/loads v0.21.2 // indirect github.com/go-openapi/runtime v0.26.0 // indirect @@ -72,12 +72,14 @@ require ( github.com/go-openapi/swag v0.22.4 // indirect github.com/go-openapi/validate v0.22.1 // indirect github.com/go-resty/resty/v2 v2.7.0 // indirect - github.com/golang-jwt/jwt v3.2.2+incompatible // indirect + github.com/golang-jwt/jwt/v5 v5.0.0 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a // indirect + github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/mux v1.8.0 // indirect + github.com/gorilla/schema v1.2.0 // indirect + github.com/gorilla/securecookie v1.1.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect @@ -107,7 +109,7 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-tty v0.0.3 // indirect github.com/mdlayher/netlink v1.7.2 // indirect github.com/mdlayher/socket v0.4.1 // indirect @@ -117,13 +119,14 @@ require ( github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/muhlemmer/gu v0.3.1 // indirect github.com/natefinch/lumberjack v2.0.0+incompatible // indirect github.com/natefinch/npipe v0.0.0-20160621034901-c1b8fa8bdcce // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect - github.com/openziti/agent v1.0.14 // indirect - github.com/openziti/edge-api v0.25.30 // indirect + github.com/openziti/agent v1.0.15 // indirect + github.com/openziti/edge-api v0.25.31 // indirect github.com/openziti/jwks v1.0.3 // indirect github.com/openziti/metrics v1.2.30 // indirect github.com/openziti/runzmd v1.0.28 // indirect @@ -142,8 +145,9 @@ require ( github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/rodaine/table v1.0.1 // indirect + github.com/rs/cors v1.9.0 // indirect github.com/russross/blackfriday v1.5.2 // indirect - github.com/shirou/gopsutil/v3 v3.23.6 // indirect + github.com/shirou/gopsutil/v3 v3.23.7 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect github.com/speps/go-hashids v2.0.0+incompatible // indirect @@ -163,24 +167,27 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect - go.mongodb.org/mongo-driver v1.12.0 // indirect + github.com/zitadel/oidc/v2 v2.6.4 // indirect + go.mongodb.org/mongo-driver v1.12.1 // indirect go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect go.opentelemetry.io/otel v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect - golang.org/x/image v0.9.0 // indirect + golang.org/x/crypto v0.12.0 // indirect + golang.org/x/exp v0.0.0-20230807204917-050eac23e9de // indirect + golang.org/x/image v0.11.0 // indirect golang.org/x/mod v0.11.0 // indirect + golang.org/x/oauth2 v0.9.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/term v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/term v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect golang.org/x/tools v0.6.0 // indirect + google.golang.org/appengine v1.6.7 // indirect gopkg.in/AlecAivazis/survey.v1 v1.8.7 // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/resty.v1 v1.12.0 // indirect - gopkg.in/square/go-jose.v2 v2.5.1 // indirect + gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.7 // indirect diff --git a/zititest/go.sum b/zititest/go.sum index 2de16b914..47c1d847e 100644 --- a/zititest/go.sum +++ b/zititest/go.sum @@ -232,8 +232,9 @@ github.com/go-openapi/errors v0.20.4 h1:unTcVm6PispJsMECE3zWgvG4xTiKda1LIR5rCRWL github.com/go-openapi/errors v0.20.4/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= +github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= @@ -308,8 +309,8 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= -github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= +github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -322,6 +323,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -344,8 +346,8 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomarkdown/markdown v0.0.0-20191123064959-2c17d62f5098/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU= -github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a h1:AWZzzFrqyjYlRloN6edwTLTUbKxf5flLXNuTBDm3Ews= -github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= +github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12 h1:uK3X/2mt4tbSGoHvbLBHUny7CKiuwUip3MArtukol4E= +github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -396,6 +398,10 @@ github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc= +github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= +github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -502,8 +508,8 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -561,8 +567,8 @@ github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/mattn/go-tty v0.0.3 h1:5OfyWorkyO7xP52Mq7tB36ajHDG5OHrmBGIS/DtakQI= github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvrWyR0= @@ -606,6 +612,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/muhlemmer/gu v0.3.1 h1:7EAqmFrW7n3hETvuAdmFmn4hS8W+z3LgKtrnow+YzNM= +github.com/muhlemmer/gu v0.3.1/go.mod h1:YHtHR+gxM+bKEIIs7Hmi9sPT3ZDUvTN/i88wQpZkrdM= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY4wsPvgQH/jsuJi4XO2ssZbdsIizr4CVC8= github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM= @@ -639,14 +647,14 @@ github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openziti/agent v1.0.14 h1:OTYhj2HeIlFwaFNcVT5BlYf7s4xa0TNmhnjmBpN8Afg= -github.com/openziti/agent v1.0.14/go.mod h1:zfm53+PVWoGFzjGGgQdKby5749G6VRYHe+eQJmoVKy4= -github.com/openziti/channel/v2 v2.0.87 h1:+54diAb1NjwnQ3qADptq76gq3IFF+hW+uLD5st5ULAo= -github.com/openziti/channel/v2 v2.0.87/go.mod h1:GggAVKAlOf2ezo8VvgQ2yRK5Gokp6wlvS4kBhmoKn1g= -github.com/openziti/edge v0.24.372 h1:B9zMZUDnoqKu+epTkWEdfm1ugX8X+S0u/Tg23k3+mPc= -github.com/openziti/edge v0.24.372/go.mod h1:nkYAlBPh8q+pbtM5RACeq0/lsxrutqSKeQ5hlYGe49U= -github.com/openziti/edge-api v0.25.30 h1:40pAcd3Y2yT8hYYHTJTkSTLA0pvbDCw4prt72JdQMuI= -github.com/openziti/edge-api v0.25.30/go.mod h1:ODMG0fB9Dj1pL0UqDC8jzSUAlUZy8aYhzF3xHPg6Xm0= +github.com/openziti/agent v1.0.15 h1:NW4egpS3Mw1RQBZWfUEvrmBh9kn/SU/dU5fndsyyhZ4= +github.com/openziti/agent v1.0.15/go.mod h1:zfm53+PVWoGFzjGGgQdKby5749G6VRYHe+eQJmoVKy4= +github.com/openziti/channel/v2 v2.0.89 h1:L6Efndhsb0YgvD5LkU6QAB6si2VP4h0Kn0BmY2iBfjQ= +github.com/openziti/channel/v2 v2.0.89/go.mod h1:O7wkSjV7CuebQQKLHYUL/wPL+8RuZkGQDzd1L7/+8qk= +github.com/openziti/edge v0.24.374 h1:L1Z3EDrEOHxOj5hip1rTFJAlLuoB7lXKVdb3Jbp+URI= +github.com/openziti/edge v0.24.374/go.mod h1:bPFyx5/N3acmNVODDkGrTyGxYLviO3I52j0Owj8MQvs= +github.com/openziti/edge-api v0.25.31 h1:KiM4pQVIqy/0CN/FW2AgoN7PcejB+y8FdgjN86Jn83Q= +github.com/openziti/edge-api v0.25.31/go.mod h1:7fyXLqNcyC5IG29GuI8danhhppAaxRV6HiCLwN1Kk64= github.com/openziti/fablab v0.5.5 h1:wz5rkuGhdDbmNPXC8XtsyHhWk6WJtxCgfhXt5XVWXmY= github.com/openziti/fablab v0.5.5/go.mod h1:xkvaXX6C+bGHH5R4G8/vkz1pbBlwS1EzghF37wcNetM= github.com/openziti/fabric v0.23.52 h1:8F4jt00RDrZJz6YiKliJ8UGnknE3jSuWwxsK3641ehE= @@ -661,14 +669,14 @@ github.com/openziti/metrics v1.2.30 h1:0ZV9UWPupcBvHigzET1wf47idrTflYSHInNgDtZqk github.com/openziti/metrics v1.2.30/go.mod h1:8xSr4Rl0527Lyp5IKvUYwPNObIFkO8AS3nO2RjvDPSQ= github.com/openziti/runzmd v1.0.28 h1:8VNgENRAm1pfp0YoJWYoW6uBtyMD6ccVTsC24kx2gpk= github.com/openziti/runzmd v1.0.28/go.mod h1:4r4uNOK34lKbilrV7yaiDiPwRGIvj1XQSl6E6U8NmAw= -github.com/openziti/sdk-golang v0.20.80 h1:TG+G4QrVjcA7Q2kiZf8OlplfyHRkoVO7Z1yilUHrEis= -github.com/openziti/sdk-golang v0.20.80/go.mod h1:SvKwsnV7wgRrGq+E+C2ASCEN06t9camcTBANYXXYWro= +github.com/openziti/sdk-golang v0.20.87 h1:hhJd0/msZf/2vC15xXZ4xF3zbR+Bmx1gmgM4K0l4JxI= +github.com/openziti/sdk-golang v0.20.87/go.mod h1:gszOnLHB9RAuAw5F86uI8fIYNdh3d6+KRHo5zP+uzTU= github.com/openziti/secretstream v0.1.10 h1:aLheoP6vVAv96mItwkXxWr9Ym0tTooJ5o9H1j2fAh04= github.com/openziti/secretstream v0.1.10/go.mod h1:HrS6P9G0jjHNHuKESMaybNdxBHjD1b0SzxSi0rDzshY= github.com/openziti/storage v0.2.11 h1:Ws23any7NtbEKQroFJt6DJmeEFGMPjZqjAK2/Re9LIE= github.com/openziti/storage v0.2.11/go.mod h1:M46XIxPYwTDTgaamI6o9cyEJkYvUYfhJjwvZtQu4tUQ= -github.com/openziti/transport/v2 v2.0.96 h1:onLHb0oNS+xzmqnAVYHDGb00qtLODzyPVubq+2h5SoY= -github.com/openziti/transport/v2 v2.0.96/go.mod h1:L0MZ3LZsJ9Jheg05Bp6QYJBfuq4fDtjoL9stcTSmtko= +github.com/openziti/transport/v2 v2.0.97 h1:BgsxDYdyzBf6sIIicT6X7WV1S2HMXQA1upmo5UFNYfU= +github.com/openziti/transport/v2 v2.0.97/go.mod h1:zXB5jNtmTIe3gMCgLuk2RUEsvc8ysVLExnfrRdSg11M= github.com/openziti/x509-claims v1.0.3 h1:HNdQ8Nf1agB3lBs1gahcO6zfkeS4S5xoQ2/PkY4HRX0= github.com/openziti/x509-claims v1.0.3/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE= github.com/openziti/xweb/v2 v2.1.0 h1:Xhh3C2pZkq/Prr65V+SfFSibLDYteoc4f62KQCcTZF4= @@ -746,6 +754,9 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= +github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -754,8 +765,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb github.com/sacloud/libsacloud v1.36.2/go.mod h1:P7YAOVmnIn3DKHqCZcUKYUXmSwGBm3yS7IBEjKVSrjg= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil/v3 v3.23.6 h1:5y46WPI9QBKBbK7EEccUPNXpJpNrvPuTD0O2zHEHT08= -github.com/shirou/gopsutil/v3 v3.23.6/go.mod h1:j7QX50DrXYggrpN30W0Mo+I4/8U2UUIQrnrhqUeWrAU= +github.com/shirou/gopsutil/v3 v3.23.7 h1:C+fHO8hfIppoJ1WdsVm1RoI0RwXoNdfTK7yWXV0wVj4= +github.com/shirou/gopsutil/v3 v3.23.7/go.mod h1:c4gnmoRC0hQuaLqvxnx1//VXQ0Ms/X9UnJF8pddY5z4= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= @@ -859,6 +870,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/zitadel/oidc/v2 v2.6.4 h1:bruA+KOFHcGpxr++WgtvR82ZlH54kKituu5xE4wpF7o= +github.com/zitadel/oidc/v2 v2.6.4/go.mod h1:owrsdzRqGvIZjBCY9LY1ZUYJ0mRUbGkQpZ3OskXL4wM= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= @@ -867,8 +880,8 @@ go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsX go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= -go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE= -go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0= +go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE= +go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 h1:CCriYyAfq1Br1aIYettdHZTy8mBTIPo7We18TuO/bak= go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -913,8 +926,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -925,14 +938,14 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= -golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20230807204917-050eac23e9de h1:l5Za6utMv/HsBWWqzt4S8X17j+kt1uVETUX5UFhn2rE= +golang.org/x/exp v0.0.0-20230807204917-050eac23e9de/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191206065243-da761ea9ff43/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.9.0 h1:QrzfX26snvCM20hIhBwuHI/ThTg18b/+kcKdXHvnR+g= -golang.org/x/image v0.9.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0= +golang.org/x/image v0.11.0 h1:ds2RoQvBvYTiJkwpSFDwCcDFNX7DqjL2WsUgTNk0Ooo= +golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1013,8 +1026,8 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1027,6 +1040,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= +golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1127,15 +1142,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1148,8 +1163,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1249,6 +1264,7 @@ google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1351,8 +1367,9 @@ gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7 gopkg.in/ns1/ns1-go.v2 v2.4.2/go.mod h1:GMnKY+ZuoJ+lVLL+78uSTjwTz2jMazq6AfGKQOYhsPk= gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w= gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= +gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= From b876d428f07973cce3b94633c43328f1bae92c19 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Tue, 8 Aug 2023 14:56:39 -0400 Subject: [PATCH 26/29] Mark the quickstart test as manual so it doesn't run in CI --- quickstart/test/quickstart_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quickstart/test/quickstart_test.go b/quickstart/test/quickstart_test.go index c697e167e..f21598aa0 100644 --- a/quickstart/test/quickstart_test.go +++ b/quickstart/test/quickstart_test.go @@ -1,3 +1,5 @@ +//go:build manual + package test import ( From 9a873cc71580c6db29f7ee70cd4da57489b3c68d Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Wed, 2 Aug 2023 13:09:22 -0400 Subject: [PATCH 27/29] Update deps and changelog for link management changes --- CHANGELOG.md | 131 +++++++++++++++++++++++++++++++++++++++++++++++- go.mod | 30 +++++------ go.sum | 59 +++++++++++----------- version | 2 +- zititest/go.mod | 30 +++++------ zititest/go.sum | 59 +++++++++++----------- 6 files changed, 221 insertions(+), 90 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 037c587e2..c50a53b45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,136 @@ -# Release 0.29.1 +# Release 0.30.0 ## What's New +* Link management is now delegated to routers + +## Link Management Updates + +Previously, the controller would do its best to determine where links needed to be established. +It would send messages to the routers, telling them which addresses to dial on other routes. +The routers would in turn let the controller know if link establishment was successful or +if the router already had a link to the given endpoint. + +With this release, the controller will only let routers know which routers exist, whether they +are currently connected to the controller, and what link listeners they are advertising. The +routers will now decide which links to make and let the controllers know as links are created +and broken. + +### Link Groups + +Both dialers and listeners can now specify a set of groups. If no groups are specified, the +dialer or listener will be placed in the `default` group. Dialers will only attempt to dial +listeners who have at least one group in common with them. + + +### Failed Links + +Previously when a link failed, the controller would show it in the link list as failed for a time +before removing it. Now failed links are removed immediately. There are existing link events for +link creation and link failure which can be used for forensics. + +### Duplicate Links + +There is a new link status `Duplicate` used when a router receives a link request and determines +that it's a duplicate of an existing link. This happens when two routers both have listeners +and dialers. They will often dial each other at the same time, resulting in a duplicate link. + +### Compatibility + +If you use a 0.30+ controller with older routers, the controller will still do link calculation +and send dial messages, as long as the `enableLegacyLinkMgmt` setting is set to true. + +If you use a pre 0.30.0 controller with newer routers, the new routers will still accept the +dial messages. + +### New Configuration + +#### Controller + +The controller has three new options: + +``` +network: + routerMessaging: + queueSize: 100 + maxWorkers: 100 + enableLegacyLinkMgmt: true +``` + +When a router connects or disconnects from the controller, we send two sets of updates. + +1. If a router has connected we send it the the state of the other routers +1. We send all the other routers the updated state of the connecting/disconnecting router + +These messages are sent using a worker pool. The size of the queue feeding the worker pool is controlled with + `routerMessaging.queueSize`. The max size of the worker pool is controlled used the `routerMessaging.maxWorkers` +option. + +* queueSize + * Min value: 0 + * Max value: 1,000,000 + * Default: 100 +* maxWorkers + * Min value: 1 + * Max value: 10,000 + * Default: 100 + +If you have routers older than 0.30.0, the controller will calculate which links to dial. This can be disabled +by setting `enableLegacyLinkMgmt` to false. This setting currently defaults to true, but will default to false +in a future release. In a subsequent release this functionality will be removed all together. + +#### Router + +The router has new configuration options for link dialing. + +``` +link: + dialers: + - binding: transport + groups: + - public + - vpc1234 + healthyDialBackoff: + retryBackoffFactor: 1.5 + minRetryInterval: 5s + maxRetryInterval: 5m + unhealthyDialBackoff: + retryBackoffFactor: 10 + minRetryInterval: 1m + maxRetryInterval: 1h + listeners: + - binding: transport + groups: vpc1234 +``` + +**Groups** + +See above for a description of link groups work. + +Default value: `default` + +**Dial Back-off** + +Dialers can be configured with custom back-off behavior. Each dialer has a back-off policy for dialing +healthy routers (those that are connected to a controller) and a separate policy for unhealthy routers. + +The back-off policies have the following attributes: + +* minRetryInterval - duration specifying the minimum time between dial attempts + * Min value: 10ms + * Max value: 24h + * Default: 5s for healthy, 1m for unhealthy + * Format: Golang Durations, see: https://pkg.go.dev/maze.io/x/duration#ParseDuration +* maxRetryInterval - duration specifying the maximum time between dial attempts + * Min value: 10ms + * Max value: 24h + * Default: 5m for healthy, 1h for unhealthy + * Format: Golang duration, see: https://pkg.go.dev/maze.io/x/duration#ParseDuration +* retryBackoffFactor - factor by which to increase the retry interval between failed dial attempts + * Min value: 1 + * Max value: 100 + * Default: 1.5 for healthy, 100 for unhealthy + ## Component Updates and Bug Fixes * github.com/openziti/ziti: [v0.29.0 -> v0.29.1](https://github.com/openziti/ziti/compare/v0.29.0...v0.29.1) * [Issue #1212](https://github.com/openziti/ziti/issues/1212) - Fixed getZiti function on Mac/ZSH diff --git a/go.mod b/go.mod index 2e5f37c98..c7a9afecf 100644 --- a/go.mod +++ b/go.mod @@ -18,18 +18,18 @@ require ( github.com/jedib0t/go-pretty/v6 v6.4.0 github.com/michaelquigley/pfxlog v0.6.10 github.com/openziti/agent v1.0.15 - github.com/openziti/channel/v2 v2.0.89 - github.com/openziti/edge v0.24.374 + github.com/openziti/channel/v2 v2.0.91 + github.com/openziti/edge v0.24.381 github.com/openziti/edge-api v0.25.31 - github.com/openziti/fabric v0.23.52 - github.com/openziti/foundation/v2 v2.0.28 - github.com/openziti/identity v1.0.59 - github.com/openziti/runzmd v1.0.28 - github.com/openziti/sdk-golang v0.20.87 - github.com/openziti/storage v0.2.11 - github.com/openziti/transport/v2 v2.0.97 + github.com/openziti/fabric v0.24.2 + github.com/openziti/foundation/v2 v2.0.29 + github.com/openziti/identity v1.0.60 + github.com/openziti/runzmd v1.0.29 + github.com/openziti/sdk-golang v0.20.90 + github.com/openziti/storage v0.2.12 + github.com/openziti/transport/v2 v2.0.99 github.com/openziti/xweb/v2 v2.1.0 - github.com/openziti/ziti-db-explorer v1.1.1 + github.com/openziti/ziti-db-explorer v1.1.3 github.com/pkg/errors v0.9.1 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 github.com/russross/blackfriday v1.5.2 @@ -135,7 +135,7 @@ require ( github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openziti/dilithium v0.3.3 // indirect github.com/openziti/jwks v1.0.3 // indirect - github.com/openziti/metrics v1.2.30 // indirect + github.com/openziti/metrics v1.2.31 // indirect github.com/openziti/secretstream v0.1.10 // indirect github.com/openziti/x509-claims v1.0.3 // indirect github.com/orcaman/concurrent-map/v2 v2.0.1 // indirect @@ -156,7 +156,7 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 // indirect - github.com/tklauser/go-sysconf v0.3.11 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect @@ -164,17 +164,17 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect - github.com/zitadel/oidc/v2 v2.6.4 // indirect + github.com/zitadel/oidc/v2 v2.7.0 // indirect go.mongodb.org/mongo-driver v1.12.1 // indirect go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect go.opentelemetry.io/otel v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/crypto v0.12.0 // indirect - golang.org/x/exp v0.0.0-20230807204917-050eac23e9de // indirect + golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect golang.org/x/image v0.11.0 // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/oauth2 v0.9.0 // indirect + golang.org/x/oauth2 v0.10.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/term v0.11.0 // indirect diff --git a/go.sum b/go.sum index 5ca1a95a3..a8edee572 100644 --- a/go.sum +++ b/go.sum @@ -705,40 +705,40 @@ github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTm github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openziti/agent v1.0.15 h1:NW4egpS3Mw1RQBZWfUEvrmBh9kn/SU/dU5fndsyyhZ4= github.com/openziti/agent v1.0.15/go.mod h1:zfm53+PVWoGFzjGGgQdKby5749G6VRYHe+eQJmoVKy4= -github.com/openziti/channel/v2 v2.0.89 h1:L6Efndhsb0YgvD5LkU6QAB6si2VP4h0Kn0BmY2iBfjQ= -github.com/openziti/channel/v2 v2.0.89/go.mod h1:O7wkSjV7CuebQQKLHYUL/wPL+8RuZkGQDzd1L7/+8qk= +github.com/openziti/channel/v2 v2.0.91 h1:HKD7uniGOfiQfbzaP1AJ0JGvls7oejC+fMj6gLJOlW8= +github.com/openziti/channel/v2 v2.0.91/go.mod h1:2uJzEV3pX4soPPl07l8ScONNGuSQTQzUqAYkgATA3Rk= github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k= github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo= -github.com/openziti/edge v0.24.374 h1:L1Z3EDrEOHxOj5hip1rTFJAlLuoB7lXKVdb3Jbp+URI= -github.com/openziti/edge v0.24.374/go.mod h1:bPFyx5/N3acmNVODDkGrTyGxYLviO3I52j0Owj8MQvs= +github.com/openziti/edge v0.24.381 h1:8Uklh0w9+EFMhBkzDC7kFm0c09NAZbUHuLuWZekZY0M= +github.com/openziti/edge v0.24.381/go.mod h1:sFJbZLfBU2kFsc70LkzUW4eizZye9ejVMOtu8iI8pq8= github.com/openziti/edge-api v0.25.31 h1:KiM4pQVIqy/0CN/FW2AgoN7PcejB+y8FdgjN86Jn83Q= github.com/openziti/edge-api v0.25.31/go.mod h1:7fyXLqNcyC5IG29GuI8danhhppAaxRV6HiCLwN1Kk64= -github.com/openziti/fabric v0.23.52 h1:8F4jt00RDrZJz6YiKliJ8UGnknE3jSuWwxsK3641ehE= -github.com/openziti/fabric v0.23.52/go.mod h1:wLYKhlnhthLR7FBqfGlfdCZ0hbQCcSnr5b2wpjA4/vM= -github.com/openziti/foundation/v2 v2.0.28 h1:AAdHhtUj1tCIXollSpbDlKwPKRasNAgADpTZAF1WCOQ= -github.com/openziti/foundation/v2 v2.0.28/go.mod h1:psKxxQw/zRo5+oKN7AR+MKYaeR3mbBPhb65qq8rqB0U= -github.com/openziti/identity v1.0.59 h1:YShXqxa9nTbCnPtIAji10hx7BG1nQukg4ddUJExNXa8= -github.com/openziti/identity v1.0.59/go.mod h1:9vQjDHH2Z3kFmkwmHsVKfI9EdcXjUiwAiR8Sc6Qzmbk= +github.com/openziti/fabric v0.24.2 h1:fb7fE/d3it6OrwhJqfr0RKQ41VUV9VKFsOOl98zdoRY= +github.com/openziti/fabric v0.24.2/go.mod h1:rXhb73v5rgoUV1AbRDXF8gAcbualabJU9YyLMkiB0yw= +github.com/openziti/foundation/v2 v2.0.29 h1:E63p5/esqOJ/OSMePR3fKYHb3Wq2BR4PLkDFynESij8= +github.com/openziti/foundation/v2 v2.0.29/go.mod h1:MpXSCSn4MABvtIXzfTBFqhK5pNsNXHWnR8xxVrfxn0g= +github.com/openziti/identity v1.0.60 h1:6gvBXY9J6F7SbuksdxsUA1t1WmtsFfY61Oqm/00ijGU= +github.com/openziti/identity v1.0.60/go.mod h1:pUfQ1Rf6TJvpBULXKPAO4014Qd6g+uf6V/vqjUscipU= github.com/openziti/jwks v1.0.3 h1:hf8wkb+Cg4nH/HM0KROFd7u+C3DkRVcFZJ7tDV+4icc= github.com/openziti/jwks v1.0.3/go.mod h1:t4xxq8vlXGsPn29kiQVnZBBDDnEoOFqtJoHibkJunQQ= -github.com/openziti/metrics v1.2.30 h1:0ZV9UWPupcBvHigzET1wf47idrTflYSHInNgDtZqkIQ= -github.com/openziti/metrics v1.2.30/go.mod h1:8xSr4Rl0527Lyp5IKvUYwPNObIFkO8AS3nO2RjvDPSQ= -github.com/openziti/runzmd v1.0.28 h1:8VNgENRAm1pfp0YoJWYoW6uBtyMD6ccVTsC24kx2gpk= -github.com/openziti/runzmd v1.0.28/go.mod h1:4r4uNOK34lKbilrV7yaiDiPwRGIvj1XQSl6E6U8NmAw= -github.com/openziti/sdk-golang v0.20.87 h1:hhJd0/msZf/2vC15xXZ4xF3zbR+Bmx1gmgM4K0l4JxI= -github.com/openziti/sdk-golang v0.20.87/go.mod h1:gszOnLHB9RAuAw5F86uI8fIYNdh3d6+KRHo5zP+uzTU= +github.com/openziti/metrics v1.2.31 h1:nEO9FAqCnpfuvxGYfy9/W46p2SaEcZ6vlRyz4fcipoY= +github.com/openziti/metrics v1.2.31/go.mod h1:SU2w3WW36O+ocVy+ka2UHA0cweTg3T8CQiqz4ZT4Umc= +github.com/openziti/runzmd v1.0.29 h1:skS9Ea8TIYZ28V4yEz3KoWafnto4RAOwv8M2Z4bM8Wo= +github.com/openziti/runzmd v1.0.29/go.mod h1:rAvUIRGlIWYsHtWRX7lbV8LZPUjsifjZd72xUEfEuTw= +github.com/openziti/sdk-golang v0.20.90 h1:QXWa1Ti1Sky9D2uv3kAxmybwicZLJH6hgyDpXkdZcYc= +github.com/openziti/sdk-golang v0.20.90/go.mod h1:IorK7wik0unGAGBuYjdb9ZPFX7ENACtxFpWuTBPOT9Q= github.com/openziti/secretstream v0.1.10 h1:aLheoP6vVAv96mItwkXxWr9Ym0tTooJ5o9H1j2fAh04= github.com/openziti/secretstream v0.1.10/go.mod h1:HrS6P9G0jjHNHuKESMaybNdxBHjD1b0SzxSi0rDzshY= -github.com/openziti/storage v0.2.11 h1:Ws23any7NtbEKQroFJt6DJmeEFGMPjZqjAK2/Re9LIE= -github.com/openziti/storage v0.2.11/go.mod h1:M46XIxPYwTDTgaamI6o9cyEJkYvUYfhJjwvZtQu4tUQ= -github.com/openziti/transport/v2 v2.0.97 h1:BgsxDYdyzBf6sIIicT6X7WV1S2HMXQA1upmo5UFNYfU= -github.com/openziti/transport/v2 v2.0.97/go.mod h1:zXB5jNtmTIe3gMCgLuk2RUEsvc8ysVLExnfrRdSg11M= +github.com/openziti/storage v0.2.12 h1:ghQkt3SCLwRuiTeRLOUWgNL69XQNp9Gx8K3eVw0QTQY= +github.com/openziti/storage v0.2.12/go.mod h1:RxWIe9FyQg9LZQFZ4FuUROf0lhnfUW2XeWfTbHAMGeY= +github.com/openziti/transport/v2 v2.0.99 h1:+/DYNzaUrzSSaoKEBNFumXJsXMDEUNiWbWZfX48Z2vc= +github.com/openziti/transport/v2 v2.0.99/go.mod h1:bV9XKtxnmqW8crReZB2z+cJhSNLl6EsyoouTkyUY8mk= github.com/openziti/x509-claims v1.0.3 h1:HNdQ8Nf1agB3lBs1gahcO6zfkeS4S5xoQ2/PkY4HRX0= github.com/openziti/x509-claims v1.0.3/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE= github.com/openziti/xweb/v2 v2.1.0 h1:Xhh3C2pZkq/Prr65V+SfFSibLDYteoc4f62KQCcTZF4= github.com/openziti/xweb/v2 v2.1.0/go.mod h1:wPkjm5y45RYCV8AafjcAXP/ZM4DBOofXhRwSGgjF8w8= -github.com/openziti/ziti-db-explorer v1.1.1 h1:G0eoTby+aIjjt5TxEfR+FMI2CWd4RvZFjzaIMX2lEBw= -github.com/openziti/ziti-db-explorer v1.1.1/go.mod h1:h76h7Tsb+khb0v+CqYKL6ifUfJbUMjGBFU2IvupfBE4= +github.com/openziti/ziti-db-explorer v1.1.3 h1:9JER16MJzagtYPdGEhgDcw2p/BXNCVbf9IgA/sMB52w= +github.com/openziti/ziti-db-explorer v1.1.3/go.mod h1:pMIMNJoTRSTbkO2e7cZWiBokA3jMdeiGAILP3QhU+v8= github.com/oracle/oci-go-sdk v24.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= github.com/orcaman/concurrent-map/v2 v2.0.1 h1:jOJ5Pg2w1oeB6PeDurIYf6k9PQ+aTITr/6lP/L/zp6c= github.com/orcaman/concurrent-map/v2 v2.0.1/go.mod h1:9Eq3TG2oBe5FirmYWQfYO5iH1q0Jv47PLaNK++uCdOM= @@ -927,8 +927,9 @@ github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cb github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 h1:3SNcvBmEPE1YlB1JpVZouslJpI3GBNoiqW7+wb0Rz7w= github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125/go.mod h1:M8agBzgqHIhgj7wEn9/0hJUZcrvt9VY+Ln+S1I5Mha0= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= @@ -973,8 +974,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zitadel/oidc/v2 v2.6.4 h1:bruA+KOFHcGpxr++WgtvR82ZlH54kKituu5xE4wpF7o= -github.com/zitadel/oidc/v2 v2.6.4/go.mod h1:owrsdzRqGvIZjBCY9LY1ZUYJ0mRUbGkQpZ3OskXL4wM= +github.com/zitadel/oidc/v2 v2.7.0 h1:IGX4EDk6tegTjUSsZDWeTfLseFU0BdJ/Glf1tgys2lU= +github.com/zitadel/oidc/v2 v2.7.0/go.mod h1:zkUkVJS0sDVy9m0UA9RgO3f8i/C0rtjvXU36UJj7T+0= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= @@ -1054,8 +1055,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230807204917-050eac23e9de h1:l5Za6utMv/HsBWWqzt4S8X17j+kt1uVETUX5UFhn2rE= -golang.org/x/exp v0.0.0-20230807204917-050eac23e9de/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U= +golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1162,8 +1163,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= -golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= +golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= +golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/version b/version index eec15f902..f7c6c31b6 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.29 +0.30 diff --git a/zititest/go.mod b/zititest/go.mod index 13fd3e452..984b6bb20 100644 --- a/zititest/go.mod +++ b/zititest/go.mod @@ -9,15 +9,15 @@ require ( github.com/Jeffail/gabs/v2 v2.7.0 github.com/google/uuid v1.3.0 github.com/michaelquigley/pfxlog v0.6.10 - github.com/openziti/channel/v2 v2.0.89 - github.com/openziti/edge v0.24.374 + github.com/openziti/channel/v2 v2.0.91 + github.com/openziti/edge v0.24.381 github.com/openziti/fablab v0.5.5 - github.com/openziti/fabric v0.23.52 - github.com/openziti/foundation/v2 v2.0.28 - github.com/openziti/identity v1.0.59 - github.com/openziti/sdk-golang v0.20.87 - github.com/openziti/storage v0.2.11 - github.com/openziti/transport/v2 v2.0.97 + github.com/openziti/fabric v0.24.2 + github.com/openziti/foundation/v2 v2.0.29 + github.com/openziti/identity v1.0.60 + github.com/openziti/sdk-golang v0.20.90 + github.com/openziti/storage v0.2.12 + github.com/openziti/transport/v2 v2.0.99 github.com/openziti/ziti v0.28.3 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 @@ -128,12 +128,12 @@ require ( github.com/openziti/agent v1.0.15 // indirect github.com/openziti/edge-api v0.25.31 // indirect github.com/openziti/jwks v1.0.3 // indirect - github.com/openziti/metrics v1.2.30 // indirect - github.com/openziti/runzmd v1.0.28 // indirect + github.com/openziti/metrics v1.2.31 // indirect + github.com/openziti/runzmd v1.0.29 // indirect github.com/openziti/secretstream v0.1.10 // indirect github.com/openziti/x509-claims v1.0.3 // indirect github.com/openziti/xweb/v2 v2.1.0 // indirect - github.com/openziti/ziti-db-explorer v1.1.1 // indirect + github.com/openziti/ziti-db-explorer v1.1.3 // indirect github.com/orcaman/concurrent-map/v2 v2.0.1 // indirect github.com/parallaxsecond/parsec-client-go v0.0.0-20221025095442-f0a77d263cf9 // indirect github.com/pelletier/go-toml v1.9.4 // indirect @@ -159,7 +159,7 @@ require ( github.com/spf13/viper v1.10.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 // indirect - github.com/tklauser/go-sysconf v0.3.11 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect @@ -167,17 +167,17 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect - github.com/zitadel/oidc/v2 v2.6.4 // indirect + github.com/zitadel/oidc/v2 v2.7.0 // indirect go.mongodb.org/mongo-driver v1.12.1 // indirect go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect go.opentelemetry.io/otel v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/crypto v0.12.0 // indirect - golang.org/x/exp v0.0.0-20230807204917-050eac23e9de // indirect + golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect golang.org/x/image v0.11.0 // indirect golang.org/x/mod v0.11.0 // indirect - golang.org/x/oauth2 v0.9.0 // indirect + golang.org/x/oauth2 v0.10.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/term v0.11.0 // indirect diff --git a/zititest/go.sum b/zititest/go.sum index 47c1d847e..038886865 100644 --- a/zititest/go.sum +++ b/zititest/go.sum @@ -649,40 +649,40 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openziti/agent v1.0.15 h1:NW4egpS3Mw1RQBZWfUEvrmBh9kn/SU/dU5fndsyyhZ4= github.com/openziti/agent v1.0.15/go.mod h1:zfm53+PVWoGFzjGGgQdKby5749G6VRYHe+eQJmoVKy4= -github.com/openziti/channel/v2 v2.0.89 h1:L6Efndhsb0YgvD5LkU6QAB6si2VP4h0Kn0BmY2iBfjQ= -github.com/openziti/channel/v2 v2.0.89/go.mod h1:O7wkSjV7CuebQQKLHYUL/wPL+8RuZkGQDzd1L7/+8qk= -github.com/openziti/edge v0.24.374 h1:L1Z3EDrEOHxOj5hip1rTFJAlLuoB7lXKVdb3Jbp+URI= -github.com/openziti/edge v0.24.374/go.mod h1:bPFyx5/N3acmNVODDkGrTyGxYLviO3I52j0Owj8MQvs= +github.com/openziti/channel/v2 v2.0.91 h1:HKD7uniGOfiQfbzaP1AJ0JGvls7oejC+fMj6gLJOlW8= +github.com/openziti/channel/v2 v2.0.91/go.mod h1:2uJzEV3pX4soPPl07l8ScONNGuSQTQzUqAYkgATA3Rk= +github.com/openziti/edge v0.24.381 h1:8Uklh0w9+EFMhBkzDC7kFm0c09NAZbUHuLuWZekZY0M= +github.com/openziti/edge v0.24.381/go.mod h1:sFJbZLfBU2kFsc70LkzUW4eizZye9ejVMOtu8iI8pq8= github.com/openziti/edge-api v0.25.31 h1:KiM4pQVIqy/0CN/FW2AgoN7PcejB+y8FdgjN86Jn83Q= github.com/openziti/edge-api v0.25.31/go.mod h1:7fyXLqNcyC5IG29GuI8danhhppAaxRV6HiCLwN1Kk64= github.com/openziti/fablab v0.5.5 h1:wz5rkuGhdDbmNPXC8XtsyHhWk6WJtxCgfhXt5XVWXmY= github.com/openziti/fablab v0.5.5/go.mod h1:xkvaXX6C+bGHH5R4G8/vkz1pbBlwS1EzghF37wcNetM= -github.com/openziti/fabric v0.23.52 h1:8F4jt00RDrZJz6YiKliJ8UGnknE3jSuWwxsK3641ehE= -github.com/openziti/fabric v0.23.52/go.mod h1:wLYKhlnhthLR7FBqfGlfdCZ0hbQCcSnr5b2wpjA4/vM= -github.com/openziti/foundation/v2 v2.0.28 h1:AAdHhtUj1tCIXollSpbDlKwPKRasNAgADpTZAF1WCOQ= -github.com/openziti/foundation/v2 v2.0.28/go.mod h1:psKxxQw/zRo5+oKN7AR+MKYaeR3mbBPhb65qq8rqB0U= -github.com/openziti/identity v1.0.59 h1:YShXqxa9nTbCnPtIAji10hx7BG1nQukg4ddUJExNXa8= -github.com/openziti/identity v1.0.59/go.mod h1:9vQjDHH2Z3kFmkwmHsVKfI9EdcXjUiwAiR8Sc6Qzmbk= +github.com/openziti/fabric v0.24.2 h1:fb7fE/d3it6OrwhJqfr0RKQ41VUV9VKFsOOl98zdoRY= +github.com/openziti/fabric v0.24.2/go.mod h1:rXhb73v5rgoUV1AbRDXF8gAcbualabJU9YyLMkiB0yw= +github.com/openziti/foundation/v2 v2.0.29 h1:E63p5/esqOJ/OSMePR3fKYHb3Wq2BR4PLkDFynESij8= +github.com/openziti/foundation/v2 v2.0.29/go.mod h1:MpXSCSn4MABvtIXzfTBFqhK5pNsNXHWnR8xxVrfxn0g= +github.com/openziti/identity v1.0.60 h1:6gvBXY9J6F7SbuksdxsUA1t1WmtsFfY61Oqm/00ijGU= +github.com/openziti/identity v1.0.60/go.mod h1:pUfQ1Rf6TJvpBULXKPAO4014Qd6g+uf6V/vqjUscipU= github.com/openziti/jwks v1.0.3 h1:hf8wkb+Cg4nH/HM0KROFd7u+C3DkRVcFZJ7tDV+4icc= github.com/openziti/jwks v1.0.3/go.mod h1:t4xxq8vlXGsPn29kiQVnZBBDDnEoOFqtJoHibkJunQQ= -github.com/openziti/metrics v1.2.30 h1:0ZV9UWPupcBvHigzET1wf47idrTflYSHInNgDtZqkIQ= -github.com/openziti/metrics v1.2.30/go.mod h1:8xSr4Rl0527Lyp5IKvUYwPNObIFkO8AS3nO2RjvDPSQ= -github.com/openziti/runzmd v1.0.28 h1:8VNgENRAm1pfp0YoJWYoW6uBtyMD6ccVTsC24kx2gpk= -github.com/openziti/runzmd v1.0.28/go.mod h1:4r4uNOK34lKbilrV7yaiDiPwRGIvj1XQSl6E6U8NmAw= -github.com/openziti/sdk-golang v0.20.87 h1:hhJd0/msZf/2vC15xXZ4xF3zbR+Bmx1gmgM4K0l4JxI= -github.com/openziti/sdk-golang v0.20.87/go.mod h1:gszOnLHB9RAuAw5F86uI8fIYNdh3d6+KRHo5zP+uzTU= +github.com/openziti/metrics v1.2.31 h1:nEO9FAqCnpfuvxGYfy9/W46p2SaEcZ6vlRyz4fcipoY= +github.com/openziti/metrics v1.2.31/go.mod h1:SU2w3WW36O+ocVy+ka2UHA0cweTg3T8CQiqz4ZT4Umc= +github.com/openziti/runzmd v1.0.29 h1:skS9Ea8TIYZ28V4yEz3KoWafnto4RAOwv8M2Z4bM8Wo= +github.com/openziti/runzmd v1.0.29/go.mod h1:rAvUIRGlIWYsHtWRX7lbV8LZPUjsifjZd72xUEfEuTw= +github.com/openziti/sdk-golang v0.20.90 h1:QXWa1Ti1Sky9D2uv3kAxmybwicZLJH6hgyDpXkdZcYc= +github.com/openziti/sdk-golang v0.20.90/go.mod h1:IorK7wik0unGAGBuYjdb9ZPFX7ENACtxFpWuTBPOT9Q= github.com/openziti/secretstream v0.1.10 h1:aLheoP6vVAv96mItwkXxWr9Ym0tTooJ5o9H1j2fAh04= github.com/openziti/secretstream v0.1.10/go.mod h1:HrS6P9G0jjHNHuKESMaybNdxBHjD1b0SzxSi0rDzshY= -github.com/openziti/storage v0.2.11 h1:Ws23any7NtbEKQroFJt6DJmeEFGMPjZqjAK2/Re9LIE= -github.com/openziti/storage v0.2.11/go.mod h1:M46XIxPYwTDTgaamI6o9cyEJkYvUYfhJjwvZtQu4tUQ= -github.com/openziti/transport/v2 v2.0.97 h1:BgsxDYdyzBf6sIIicT6X7WV1S2HMXQA1upmo5UFNYfU= -github.com/openziti/transport/v2 v2.0.97/go.mod h1:zXB5jNtmTIe3gMCgLuk2RUEsvc8ysVLExnfrRdSg11M= +github.com/openziti/storage v0.2.12 h1:ghQkt3SCLwRuiTeRLOUWgNL69XQNp9Gx8K3eVw0QTQY= +github.com/openziti/storage v0.2.12/go.mod h1:RxWIe9FyQg9LZQFZ4FuUROf0lhnfUW2XeWfTbHAMGeY= +github.com/openziti/transport/v2 v2.0.99 h1:+/DYNzaUrzSSaoKEBNFumXJsXMDEUNiWbWZfX48Z2vc= +github.com/openziti/transport/v2 v2.0.99/go.mod h1:bV9XKtxnmqW8crReZB2z+cJhSNLl6EsyoouTkyUY8mk= github.com/openziti/x509-claims v1.0.3 h1:HNdQ8Nf1agB3lBs1gahcO6zfkeS4S5xoQ2/PkY4HRX0= github.com/openziti/x509-claims v1.0.3/go.mod h1:Z0WIpBm6c4ecrpRKrou6Gk2wrLWxJO/+tuUwKh8VewE= github.com/openziti/xweb/v2 v2.1.0 h1:Xhh3C2pZkq/Prr65V+SfFSibLDYteoc4f62KQCcTZF4= github.com/openziti/xweb/v2 v2.1.0/go.mod h1:wPkjm5y45RYCV8AafjcAXP/ZM4DBOofXhRwSGgjF8w8= -github.com/openziti/ziti-db-explorer v1.1.1 h1:G0eoTby+aIjjt5TxEfR+FMI2CWd4RvZFjzaIMX2lEBw= -github.com/openziti/ziti-db-explorer v1.1.1/go.mod h1:h76h7Tsb+khb0v+CqYKL6ifUfJbUMjGBFU2IvupfBE4= +github.com/openziti/ziti-db-explorer v1.1.3 h1:9JER16MJzagtYPdGEhgDcw2p/BXNCVbf9IgA/sMB52w= +github.com/openziti/ziti-db-explorer v1.1.3/go.mod h1:pMIMNJoTRSTbkO2e7cZWiBokA3jMdeiGAILP3QhU+v8= github.com/oracle/oci-go-sdk v24.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= github.com/orcaman/concurrent-map/v2 v2.0.1 h1:jOJ5Pg2w1oeB6PeDurIYf6k9PQ+aTITr/6lP/L/zp6c= github.com/orcaman/concurrent-map/v2 v2.0.1/go.mod h1:9Eq3TG2oBe5FirmYWQfYO5iH1q0Jv47PLaNK++uCdOM= @@ -830,8 +830,9 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 h1:3SNcvBmEPE1YlB1JpVZouslJpI3GBNoiqW7+wb0Rz7w= github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125/go.mod h1:M8agBzgqHIhgj7wEn9/0hJUZcrvt9VY+Ln+S1I5Mha0= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= @@ -870,8 +871,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -github.com/zitadel/oidc/v2 v2.6.4 h1:bruA+KOFHcGpxr++WgtvR82ZlH54kKituu5xE4wpF7o= -github.com/zitadel/oidc/v2 v2.6.4/go.mod h1:owrsdzRqGvIZjBCY9LY1ZUYJ0mRUbGkQpZ3OskXL4wM= +github.com/zitadel/oidc/v2 v2.7.0 h1:IGX4EDk6tegTjUSsZDWeTfLseFU0BdJ/Glf1tgys2lU= +github.com/zitadel/oidc/v2 v2.7.0/go.mod h1:zkUkVJS0sDVy9m0UA9RgO3f8i/C0rtjvXU36UJj7T+0= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= @@ -938,8 +939,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230807204917-050eac23e9de h1:l5Za6utMv/HsBWWqzt4S8X17j+kt1uVETUX5UFhn2rE= -golang.org/x/exp v0.0.0-20230807204917-050eac23e9de/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U= +golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1040,8 +1041,8 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= -golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= +golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= +golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 5ec465f0ea4e85bf6706f7908354d95de2582b2d Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Wed, 9 Aug 2023 15:44:23 -0400 Subject: [PATCH 28/29] Fix enrollment listing. Fixes #1199 --- CHANGELOG.md | 34 +++++++++++++++++++++++++++++++--- ziti/cmd/edge/list.go | 2 +- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c50a53b45..d469b7ace 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -132,9 +132,37 @@ The back-off policies have the following attributes: * Default: 1.5 for healthy, 100 for unhealthy ## Component Updates and Bug Fixes -* github.com/openziti/ziti: [v0.29.0 -> v0.29.1](https://github.com/openziti/ziti/compare/v0.29.0...v0.29.1) - * [Issue #1212](https://github.com/openziti/ziti/issues/1212) - Fixed getZiti function on Mac/ZSH - * [Issue #1220](https://github.com/openziti/ziti/issues/1220) - Fixed getZiti function not respecting user input for custom path +* github.com/openziti/agent: [v1.0.14 -> v1.0.15](https://github.com/openziti/agent/compare/v1.0.14...v1.0.15) +* github.com/openziti/channel/v2: [v2.0.84 -> v2.0.91](https://github.com/openziti/channel/compare/v2.0.84...v2.0.91) + * [Issue #108](https://github.com/openziti/channel/issues/108) - Reconnecting underlay not returning headers from hello message + +* github.com/openziti/edge: [v0.24.364 -> v0.24.381](https://github.com/openziti/edge/compare/v0.24.364...v0.24.381) + * [Issue #1548](https://github.com/openziti/edge/issues/1548) - Panic in edge@v0.24.326/controller/sync_strats/sync_instant.go:194 + +* github.com/openziti/edge-api: [v0.25.30 -> v0.25.31](https://github.com/openziti/edge-api/compare/v0.25.30...v0.25.31) +* github.com/openziti/fabric: [v0.23.45 -> v0.24.2](https://github.com/openziti/fabric/compare/v0.23.45...v0.24.2) + * [Issue #766](https://github.com/openziti/fabric/issues/766) - Lookup of terminators with same instance id isn't filtering by instance id + * [Issue #692](https://github.com/openziti/fabric/issues/692) - Add ability to control link formation between devices more granularly + * [Issue #749](https://github.com/openziti/fabric/issues/749) - Move link control to router + * [Issue #343](https://github.com/openziti/fabric/issues/343) - Link state Failed on startup + +* github.com/openziti/foundation/v2: [v2.0.28 -> v2.0.29](https://github.com/openziti/foundation/compare/v2.0.28...v2.0.29) +* github.com/openziti/identity: [v1.0.59 -> v1.0.60](https://github.com/openziti/identity/compare/v1.0.59...v1.0.60) +* github.com/openziti/runzmd: [v1.0.28 -> v1.0.29](https://github.com/openziti/runzmd/compare/v1.0.28...v1.0.29) +* github.com/openziti/sdk-golang: [v0.20.78 -> v0.20.90](https://github.com/openziti/sdk-golang/compare/v0.20.78...v0.20.90) +* github.com/openziti/storage: [v0.2.11 -> v0.2.12](https://github.com/openziti/storage/compare/v0.2.11...v0.2.12) +* github.com/openziti/transport/v2: [v2.0.93 -> v2.0.99](https://github.com/openziti/transport/compare/v2.0.93...v2.0.99) +* github.com/openziti/xweb/v2: [v2.0.2 -> v2.1.0](https://github.com/openziti/xweb/compare/v2.0.2...v2.1.0) +* github.com/openziti/ziti-db-explorer: [v1.1.1 -> v1.1.3](https://github.com/openziti/ziti-db-explorer/compare/v1.1.1...v1.1.3) + * [Issue #4](https://github.com/openziti/ziti-db-explorer/issues/4) - db explore timeout error is uninformative + +* github.com/openziti/metrics: [v1.2.30 -> v1.2.31](https://github.com/openziti/metrics/compare/v1.2.30...v1.2.31) +* github.com/openziti/ziti: [v0.29.0 -> v0.30.0](https://github.com/openziti/ziti/compare/v0.29.0...v0.30.0) + * [Issue #1199](https://github.com/openziti/ziti/issues/1199) - ziti edge list enrollments - CLI gets 404 + * [Issue #1135](https://github.com/openziti/ziti/issues/1135) - Edge Router: Support multiple protocols on the same listener port + * [Issue #65](https://github.com/openziti/ziti/issues/65) - Add ECDSA support to PKI subcmd + * [Issue #1212](https://github.com/openziti/ziti/issues/1212) - getZiti fails on Mac OS + * [Issue #1220](https://github.com/openziti/ziti/issues/1220) - Fixed getZiti function not respecting user input for custom path # Release 0.29.0 diff --git a/ziti/cmd/edge/list.go b/ziti/cmd/edge/list.go index d411cf955..fbba3bf18 100644 --- a/ziti/cmd/edge/list.go +++ b/ziti/cmd/edge/list.go @@ -684,7 +684,7 @@ func outputEnrollments(o *api.Options, children []*gabs.Container, pagingInfo *a } func runListEnrollments(o *api.Options) error { - children, pagingInfo, err := listEntitiesWithOptions("ext-jwt-signers", o) + children, pagingInfo, err := listEntitiesWithOptions("enrollments", o) if err != nil { return err } From 289394ff3e1127621cb24045f9f7f6c79866d0d9 Mon Sep 17 00:00:00 2001 From: Eugene K Date: Thu, 10 Aug 2023 10:24:01 -0400 Subject: [PATCH 29/29] update CHANGELOG with single port feature --- CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d469b7ace..721de7f37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## What's New * Link management is now delegated to routers +* Controller and routers can operate with a single listening port ## Link Management Updates @@ -131,6 +132,35 @@ The back-off policies have the following attributes: * Max value: 100 * Default: 1.5 for healthy, 100 for unhealthy + +## Single Sort Changes +Ziti Controller and Routers can operate with a single open port. In order to implement this feature we use +ALPN ([Application Layer Protocol Negotiation](https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation)) +TLS extension. It allows TLS client to request and TLS server to select appropriate application protocol handler during +TLS handshake. + +### Protocol Details + +The following protocol identifiers are defined: + +| id | purpose | +| --------- | ------- | +| ziti-ctrl | Control plane connections | +| ziti-link | Fabric link connections | +| ziti-edge | Client SDK connection to Edge Routers | + +Standard HTTP protocol identifiers (`h2`, `http/1.1`) are used for Controller REST API and Websocket listeners. + +### Backward Compatibility + +This feature is designed to be backward compatible with SDK clients: older client will still be able to connect without +requesting `ziti-edge` protocol. + +**Breaking** + +Older routers won't be able to establish control channel or fabric links with updated network. +However, newer Edge Routers should be able to join older network in some circumstances -- only outbound links from new Routers would work. + ## Component Updates and Bug Fixes * github.com/openziti/agent: [v1.0.14 -> v1.0.15](https://github.com/openziti/agent/compare/v1.0.14...v1.0.15) * github.com/openziti/channel/v2: [v2.0.84 -> v2.0.91](https://github.com/openziti/channel/compare/v2.0.84...v2.0.91)