Secure mode (HTTPS + mTLS)¶
The default is plain HTTP (no cert files required, easiest for local dev). Do this before running the Python experiment script to enable HTTPS between the browser and the UI server, and mTLS between the UI server and the backend:
Generate TLS certificates once:
weightslab se
Certificates are placed in
~/.weightslab-certs(or$WEIGHTSLAB_CERTS_DIR). Follow the printed instructions to exportWEIGHTSLAB_CERTS_DIRglobally.Start the UI in secure mode:
weightslab start --certs
--certsreads$WEIGHTSLAB_CERTS_DIR(single source of truth) and:Serves HTTPS using
ui-server.crt/ui-server.keyPresents
ui-client.crt/ui-client.keyto the backend (mTLS)Expects the backend CA at
ca.crt
- Configure the backend to require mTLS::
- Should be automatic if certs have been created to default directory “~/.weightslab-certs”.
export GRPC_TLS_ENABLED=1 export GRPC_TLS_REQUIRE_CLIENT_AUTH=1 export WEIGHTSLAB_CERTS_DIR=~/.weightslab-certs
Certificate files (all in $WEIGHTSLAB_CERTS_DIR)¶
File |
Purpose |
|---|---|
|
CA certificate (trusted by all parties) |
|
UI server TLS cert (browser to server) |
|
UI client mTLS cert (server to backend) |
|
Backend gRPC TLS cert (loaded by backend) |
|
Optional token for gRPC metadata auth |
Regenerate certificates at any time with weightslab se --force-certs.