Skip to content

Commit 663b68a

Browse files
committed
update script to protect token
Signed-off-by: Patrice Breton <pbreton@nvidia.com>
1 parent fe8b5fb commit 663b68a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dev/mac-local-dev/run-carbide-api.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ ok "Docker is running"
6363
if docker ps --format '{{.Names}}' | grep -w "$VAULT_CONTAINER" >/dev/null; then
6464
ok "Vault container already running"
6565
[ -f "$TOKEN_FILE" ] || die "Token file missing. Remove container and retry: docker rm -f $VAULT_CONTAINER"
66+
chmod 600 "$TOKEN_FILE"
6667
else
6768
info "Starting Vault on port $VAULT_PORT..."
6869
docker rm -f "$VAULT_CONTAINER" 2>/dev/null || true
@@ -79,7 +80,7 @@ else
7980
INIT=$(docker exec "$VAULT_CONTAINER" sh -c "export VAULT_ADDR=http://127.0.0.1:8200; vault operator init -key-shares=1 -key-threshold=1 -format=json")
8081
UNSEAL_KEY=$(echo "$INIT" | jq -r ".unseal_keys_b64[0]")
8182
ROOT_TOKEN=$(echo "$INIT" | jq -r ".root_token")
82-
echo "$ROOT_TOKEN" > "$TOKEN_FILE"
83+
(umask 077 && echo "$ROOT_TOKEN" > "$TOKEN_FILE")
8384

8485
info "Configuring vault secrets..."
8586
docker exec "$VAULT_CONTAINER" sh -c "

0 commit comments

Comments
 (0)