File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9393 printf ' %s' " ${name} " > " ${config_home} /openshell/active_gateway"
9494}
9595
96+ e2e_toml_string () {
97+ local value=" $1 "
98+ value=" ${value// \\ / \\\\ } "
99+ value=" ${value// \" / \\\" } "
100+ printf ' "%s"' " ${value} "
101+ }
102+
103+ e2e_generate_gateway_jwt () {
104+ local jwt_dir=$1
105+
106+ mkdir -p " ${jwt_dir} "
107+ (
108+ umask 077
109+ openssl genpkey -algorithm Ed25519 -out " ${jwt_dir} /signing.pem" > /dev/null 2>&1
110+ )
111+ openssl pkey -in " ${jwt_dir} /signing.pem" -pubout -out " ${jwt_dir} /public.pem" > /dev/null 2>&1
112+ openssl rand -hex 16 > " ${jwt_dir} /kid"
113+ }
114+
115+ e2e_write_gateway_jwt_config () {
116+ local jwt_dir=$1
117+ local gateway_id=$2
118+
119+ printf ' [openshell.gateway.gateway_jwt]\n'
120+ printf ' signing_key_path = %s\n' " $( e2e_toml_string " ${jwt_dir} /signing.pem" ) "
121+ printf ' public_key_path = %s\n' " $( e2e_toml_string " ${jwt_dir} /public.pem" ) "
122+ printf ' kid_path = %s\n' " $( e2e_toml_string " ${jwt_dir} /kid" ) "
123+ printf ' gateway_id = %s\n' " $( e2e_toml_string " ${gateway_id} " ) "
124+ printf ' ttl_secs = 86400\n\n'
125+ }
126+
96127e2e_build_gateway_binaries () {
97128 local root=$1
98129 local target_var=$2
@@ -176,4 +207,3 @@ e2e_print_gateway_log_on_failure() {
176207 echo " === end gateway log ==="
177208 fi
178209}
179-
Original file line number Diff line number Diff line change @@ -391,6 +391,7 @@ e2e_generate_pki "${GATEWAY_BIN}" "${PKI_DIR}"
391391HOST_PORT=$( e2e_pick_port)
392392STATE_DIR=" ${WORKDIR} /state"
393393mkdir -p " ${STATE_DIR} "
394+ JWT_DIR=" ${STATE_DIR} /jwt"
394395
395396GATEWAY_ENDPOINT=" https://host.openshell.internal:${HOST_PORT} "
396397E2E_NAMESPACE=" e2e-docker-$$ -${HOST_PORT} "
410411fi
411412
412413echo " Starting openshell-gateway on port ${HOST_PORT} (namespace: ${E2E_NAMESPACE} )..."
414+ e2e_generate_gateway_jwt " ${JWT_DIR} "
413415
414416# Driver-specific options moved from CLI flags into a TOML config table
415417# (commit 560550d2). Synthesize a minimal config here and pass --config.
@@ -428,6 +430,7 @@ GATEWAY_CONFIG="${STATE_DIR}/gateway.toml"
428430{
429431 printf ' [openshell]\nversion = 1\n\n'
430432 printf ' [openshell.gateway]\nlog_level = "info"\n\n'
433+ e2e_write_gateway_jwt_config " ${JWT_DIR} " " openshell-e2e-docker-${HOST_PORT} "
431434 printf ' [openshell.drivers.docker]\n'
432435 printf ' sandbox_namespace = %s\n' " $( toml_string " ${E2E_NAMESPACE} " ) "
433436 printf ' network_name = %s\n' " $( toml_string " ${DOCKER_NETWORK_NAME} " ) "
Original file line number Diff line number Diff line change @@ -335,6 +335,7 @@ HOST_PORT=$(e2e_pick_port)
335335HEALTH_PORT=$( e2e_pick_port)
336336STATE_DIR=" ${WORKDIR} /state"
337337mkdir -p " ${STATE_DIR} "
338+ JWT_DIR=" ${STATE_DIR} /jwt"
338339
339340E2E_NAMESPACE=" e2e-podman-$$ -${HOST_PORT} "
340341PODMAN_NETWORK_NAME=" ${E2E_NAMESPACE} "
@@ -346,6 +347,7 @@ export OPENSHELL_E2E_NETWORK_NAME="${PODMAN_NETWORK_NAME}"
346347export OPENSHELL_E2E_SANDBOX_NAMESPACE=" ${E2E_NAMESPACE} "
347348
348349echo " Starting openshell-gateway on port ${HOST_PORT} (namespace: ${E2E_NAMESPACE} )..."
350+ e2e_generate_gateway_jwt " ${JWT_DIR} "
349351
350352# Driver-specific options moved from CLI flags into a TOML config table
351353# (commit 560550d2). Synthesize a minimal config here and pass --config.
@@ -370,6 +372,7 @@ GATEWAY_CONFIG="${STATE_DIR}/gateway.toml"
370372# (CLI > TOML in the merge precedence) so the test can use an ephemeral port.
371373cp " ${ROOT} /deploy/rpm/gateway.toml.default" " ${GATEWAY_CONFIG} "
372374{
375+ e2e_write_gateway_jwt_config " ${JWT_DIR} " " openshell-e2e-podman-${HOST_PORT} "
373376 printf ' \n[openshell.drivers.podman]\n'
374377 # The Podman driver scopes isolation by network rather than namespace.
375378 printf ' network_name = %s\n' " $( toml_string " ${PODMAN_NETWORK_NAME} " ) "
You can’t perform that action at this time.
0 commit comments