mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-30 07:33:59 +08:00
fix(gateway): configure local dev auth (#1575)
This makes it so you can run the dev gateway and sandbox with: ``` mise run gateway # in another shell mise run sandbox ``` Signed-off-by: Kris Hicks <khicks@nvidia.com>
This commit is contained in:
@@ -127,6 +127,14 @@ echo "Building openshell-gateway..."
|
||||
cargo build ${CARGO_BUILD_JOBS_ARG[@]+"${CARGO_BUILD_JOBS_ARG[@]}"} \
|
||||
-p openshell-server --bin openshell-gateway
|
||||
|
||||
TLS_DIR="${STATE_DIR}/tls"
|
||||
echo "Generating local gateway credentials..."
|
||||
"${GATEWAY_BIN}" generate-certs \
|
||||
--output-dir "${TLS_DIR}" \
|
||||
--server-san "127.0.0.1" \
|
||||
--server-san "localhost" \
|
||||
--server-san "host.openshell.internal"
|
||||
|
||||
echo "Building openshell-sandbox for ${SUPERVISOR_TARGET}..."
|
||||
if [[ "${HOST_OS}" == "Linux" && "${HOST_ARCH}" == "${DAEMON_ARCH}" ]]; then
|
||||
# Native Linux build — no cross-toolchain required.
|
||||
@@ -165,6 +173,16 @@ version = 1
|
||||
compute_drivers = ["docker"]
|
||||
disable_tls = true
|
||||
|
||||
[openshell.gateway.auth]
|
||||
allow_unauthenticated_users = true
|
||||
|
||||
[openshell.gateway.gateway_jwt]
|
||||
signing_key_path = "${TLS_DIR}/jwt/signing.pem"
|
||||
public_key_path = "${TLS_DIR}/jwt/public.pem"
|
||||
kid_path = "${TLS_DIR}/jwt/kid"
|
||||
gateway_id = "${GATEWAY_NAME}"
|
||||
ttl_secs = 3600
|
||||
|
||||
[openshell.drivers.docker]
|
||||
default_image = "${SANDBOX_IMAGE}"
|
||||
image_pull_policy = "${SANDBOX_IMAGE_PULL_POLICY}"
|
||||
|
||||
@@ -307,6 +307,14 @@ if [ "$(uname -s)" = "Darwin" ]; then
|
||||
"${DRIVER_DIR}/openshell-driver-vm"
|
||||
fi
|
||||
|
||||
TLS_DIR="${STATE_DIR}/tls"
|
||||
echo "==> Generating local gateway credentials"
|
||||
"${GATEWAY_BIN}" generate-certs \
|
||||
--output-dir "${TLS_DIR}" \
|
||||
--server-san "127.0.0.1" \
|
||||
--server-san "localhost" \
|
||||
--server-san "host.openshell.internal"
|
||||
|
||||
mkdir -p "${STATE_DIR}"
|
||||
mkdir -p "${VM_DRIVER_STATE_DIR}"
|
||||
chmod 700 "${VM_DRIVER_STATE_DIR}"
|
||||
@@ -319,6 +327,16 @@ version = 1
|
||||
compute_drivers = ["vm"]
|
||||
disable_tls = ${DISABLE_TLS}
|
||||
|
||||
[openshell.gateway.auth]
|
||||
allow_unauthenticated_users = true
|
||||
|
||||
[openshell.gateway.gateway_jwt]
|
||||
signing_key_path = "${TLS_DIR}/jwt/signing.pem"
|
||||
public_key_path = "${TLS_DIR}/jwt/public.pem"
|
||||
kid_path = "${TLS_DIR}/jwt/kid"
|
||||
gateway_id = "${GATEWAY_NAME}"
|
||||
ttl_secs = 3600
|
||||
|
||||
[openshell.drivers.vm]
|
||||
default_image = "${SANDBOX_IMAGE}"
|
||||
bootstrap_image = "${VM_BOOTSTRAP_IMAGE}"
|
||||
|
||||
@@ -291,6 +291,14 @@ if [[ ! -x "${GATEWAY_BIN}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TLS_DIR="${STATE_DIR}/tls"
|
||||
echo "Generating local gateway credentials..."
|
||||
"${GATEWAY_BIN}" generate-certs \
|
||||
--output-dir "${TLS_DIR}" \
|
||||
--server-san "127.0.0.1" \
|
||||
--server-san "localhost" \
|
||||
--server-san "host.openshell.internal"
|
||||
|
||||
mkdir -p "${STATE_DIR}"
|
||||
CONFIG_PATH="${STATE_DIR}/gateway.toml"
|
||||
cat >"${CONFIG_PATH}" <<EOF
|
||||
@@ -301,6 +309,16 @@ version = 1
|
||||
compute_drivers = ["${DRIVER}"]
|
||||
default_image = "${SANDBOX_IMAGE}"
|
||||
disable_tls = true
|
||||
|
||||
[openshell.gateway.auth]
|
||||
allow_unauthenticated_users = true
|
||||
|
||||
[openshell.gateway.gateway_jwt]
|
||||
signing_key_path = "${TLS_DIR}/jwt/signing.pem"
|
||||
public_key_path = "${TLS_DIR}/jwt/public.pem"
|
||||
kid_path = "${TLS_DIR}/jwt/kid"
|
||||
gateway_id = "${GATEWAY_NAME}"
|
||||
ttl_secs = 3600
|
||||
EOF
|
||||
|
||||
case "${DRIVER}" in
|
||||
|
||||
Reference in New Issue
Block a user