File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7777 printf ' %s' " ${name} " > " ${config_home} /openshell/active_gateway"
7878}
7979
80+ e2e_toml_string () {
81+ local value=" $1 "
82+ value=" ${value// \\ / \\\\ } "
83+ value=" ${value// \" / \\\" } "
84+ printf ' "%s"' " ${value} "
85+ }
86+
87+ e2e_generate_gateway_jwt () {
88+ local jwt_dir=$1
89+
90+ mkdir -p " ${jwt_dir} "
91+ (
92+ umask 077
93+ openssl genpkey -algorithm Ed25519 -out " ${jwt_dir} /signing.pem" > /dev/null 2>&1
94+ )
95+ openssl pkey -in " ${jwt_dir} /signing.pem" -pubout -out " ${jwt_dir} /public.pem" > /dev/null 2>&1
96+ openssl rand -hex 16 > " ${jwt_dir} /kid"
97+ }
98+
99+ e2e_write_gateway_jwt_config () {
100+ local jwt_dir=$1
101+ local gateway_id=$2
102+
103+ printf ' [openshell.gateway.gateway_jwt]\n'
104+ printf ' signing_key_path = %s\n' " $( e2e_toml_string " ${jwt_dir} /signing.pem" ) "
105+ printf ' public_key_path = %s\n' " $( e2e_toml_string " ${jwt_dir} /public.pem" ) "
106+ printf ' kid_path = %s\n' " $( e2e_toml_string " ${jwt_dir} /kid" ) "
107+ printf ' gateway_id = %s\n' " $( e2e_toml_string " ${gateway_id} " ) "
108+ printf ' ttl_secs = 86400\n\n'
109+ }
110+
80111e2e_build_gateway_binaries () {
81112 local root=$1
82113 local target_var=$2
@@ -160,4 +191,3 @@ e2e_print_gateway_log_on_failure() {
160191 echo " === end gateway log ==="
161192 fi
162193}
163-
Original file line number Diff line number Diff line change @@ -429,6 +429,7 @@ cd "${ROOT}"
429429HOST_PORT=$( e2e_pick_port)
430430STATE_DIR=" ${WORKDIR} /state"
431431mkdir -p " ${STATE_DIR} "
432+ JWT_DIR=" ${STATE_DIR} /jwt"
432433
433434GATEWAY_ENDPOINT=" https://host.openshell.internal:${HOST_PORT} "
434435E2E_NAMESPACE=" e2e-docker-$$ -${HOST_PORT} "
448449fi
449450
450451echo " Starting openshell-gateway on port ${HOST_PORT} (namespace: ${E2E_NAMESPACE} )..."
452+ e2e_generate_gateway_jwt " ${JWT_DIR} "
451453
452454# Driver-specific options moved from CLI flags into a TOML config table
453455# (commit 560550d2). Synthesize a minimal config here and pass --config.
@@ -466,6 +468,7 @@ GATEWAY_CONFIG="${STATE_DIR}/gateway.toml"
466468{
467469 printf ' [openshell]\nversion = 1\n\n'
468470 printf ' [openshell.gateway]\nlog_level = "info"\n\n'
471+ e2e_write_gateway_jwt_config " ${JWT_DIR} " " openshell-e2e-docker-${HOST_PORT} "
469472 printf ' [openshell.drivers.docker]\n'
470473 printf ' sandbox_namespace = %s\n' " $( toml_string " ${E2E_NAMESPACE} " ) "
471474 printf ' network_name = %s\n' " $( toml_string " ${DOCKER_NETWORK_NAME} " ) "
Original file line number Diff line number Diff line change @@ -332,6 +332,7 @@ HOST_PORT=$(e2e_pick_port)
332332HEALTH_PORT=$( e2e_pick_port)
333333STATE_DIR=" ${WORKDIR} /state"
334334mkdir -p " ${STATE_DIR} "
335+ JWT_DIR=" ${STATE_DIR} /jwt"
335336
336337E2E_NAMESPACE=" e2e-podman-$$ -${HOST_PORT} "
337338PODMAN_NETWORK_NAME=" ${E2E_NAMESPACE} "
@@ -343,6 +344,7 @@ export OPENSHELL_E2E_NETWORK_NAME="${PODMAN_NETWORK_NAME}"
343344export OPENSHELL_E2E_SANDBOX_NAMESPACE=" ${E2E_NAMESPACE} "
344345
345346echo " Starting openshell-gateway on port ${HOST_PORT} (namespace: ${E2E_NAMESPACE} )..."
347+ e2e_generate_gateway_jwt " ${JWT_DIR} "
346348
347349# Driver-specific options moved from CLI flags into a TOML config table
348350# (commit 560550d2). Synthesize a minimal config here and pass --config.
@@ -359,6 +361,7 @@ GATEWAY_CONFIG="${STATE_DIR}/gateway.toml"
359361{
360362 printf ' [openshell]\nversion = 1\n\n'
361363 printf ' [openshell.gateway]\nlog_level = "info"\n\n'
364+ e2e_write_gateway_jwt_config " ${JWT_DIR} " " openshell-e2e-podman-${HOST_PORT} "
362365 printf ' [openshell.drivers.podman]\n'
363366 # The Podman driver scopes isolation by network rather than namespace.
364367 printf ' network_name = %s\n' " $( toml_string " ${PODMAN_NETWORK_NAME} " ) "
You can’t perform that action at this time.
0 commit comments