Skip to main content

UI Gateway Check

The Ilum UI serves the web interfaces of the modules (Airflow, Grafana, Jupyter, MLflow and others) through its Nginx gateway under /external/<module>/. With the gateway check on, Nginx asks ilum-core before it passes a request to a module (auth_request to GET /api/dev/reactive/auth/check?module=<module>). The request reaches the module only when it carries a valid Ilum session or API token and the user holds the module's permission.

Without the check, module routes are open to anyone who reaches the UI, and the module's own sign-in is the only protection. The check is off by default and on in governed mode.

How it works​

  • Session cookie. ilum-core sets the HTTP-only cookie ilum_session on sign-in and token refresh, and the UI asks for it again when it starts with a stored session. For an internal or LDAP session the cookie holds a short token signed by ilum-core with the lifetime of the access token. For an OAuth2 session it holds the identity provider's ID token and is renewed with it. Sign-out removes the cookie. Module pages open in frames and new tabs, which never carry the UI's Authorization header, so the gateway relies on this cookie. The cookie is Secure when the browser reached Ilum over HTTPS (see HTTPS).
  • Check. ilum-core takes the session cookie first, then an Ilum bearer token in Authorization, then an API token in X-API-KEY, and answers 200, 401 or 403 with no body. The cookie is accepted on this check only: the Ilum API still requires the Authorization header.
  • Outcome. On 200 the request goes to the module. On 401 (no valid session or token) a page the browser opens is redirected to the Ilum sign-in page, and any other request (a module's API call, git, curl) gets 401. On 403 (no permission) the gateway shows its 403 Forbidden page.
  • Only the request headers go to ilum-core, never the body, so uploads and WebSocket connections pass unchanged once the check succeeds.
  • The ilum_session cookie is removed from every request the gateway passes to a module, so module servers never see an Ilum credential the browser did not send them on purpose.
Earlier releases

Earlier releases could gate module routes with access_* cookies (ilum-ui.nginx.config.http_cookie). These cookies carried no signature, so any client could set them. They are no longer set or read. http_cookie.enabled: true now turns on the gateway check, and a module key set to false (for example http_cookie.gitea.enabled) keeps that module unchecked.

Enabling the check​

ilum-ui:
nginx:
config:
gatewayAuth:
enabled: true

The check needs the UI and ilum-core of the same release: older UI versions do not ask for the session cookie when they start with a stored session.

Permissions per module​

RouteModule namePermission
/external/jupyter/jupyterNOTEBOOK_READ
/external/jupyterhub/jupyterhubNOTEBOOK_READ
/external/gitea/giteaGITEA_READ
/external/airflow/airflowAIRFLOW_READ
/external/grafana/grafanaGRAFANA_READ
/external/prometheus/prometheusGRAFANA_READ
/external/n8n/n8nN8N_READ
/external/superset/supersetSUPERSET_READ
/external/history-server/ (and the history servers of workspaces)history-serverHISTORYSERVER_READ
/external/minio/, /external/object-storage/, /rustfs/console/, /rustfs/api/object-storageOBJECT_STORAGE_READ or MINIO_READ
/external/mlflow/mlflowMLFLOW_READ
/external/kestra/kestraKESTRA_READ
/external/mageai/mageaiMAGE_READ
/external/nifi/nifiNIFI_READ
/external/streamlit/streamlitSTREAMLIT_READ
/external/pipeline-studio/pipeline-studioPIPELINESTUDIO_READ
/external/langfuse/langfuseLANGFUSE_READ
/external/openmetadata/openmetadataOPENMETADATA_READ
/external/clickhouse/clickhouseSQL_EXECUTE
/external/ranger/rangerUSER_EDIT_ACCESS

Two routes are not checked: /external/hydra/ is the OAuth2 sign-in itself, and /external/api/ (the module management API) checks the same Ilum bearer token itself and requires MODULE_READ or MODULE_EDIT. The Spark UI of running jobs (/sparkui/) is checked per job, see Spark UI of running jobs.

Permissions come from the user's roles, groups and own permissions, as everywhere in Ilum (see Authorization). A disabled user has none.

Spark UI of running jobs​

The Open Spark UI action of a running job on a Kubernetes cluster opens the Spark UI of the job's driver through the gateway at /sparkui/<prefix>/<job id>/<hash>/<port>/<namespace>/proxy/<application id>/. The Spark UI shows the job's configuration and environment, so with the gateway check on, Nginx asks ilum-core about each request (GET /api/dev/reactive/auth/check/spark-ui, with the driver address Nginx read from the path). The route opens when:

  • the user holds JOB_READ, and
  • the user owns the job (submitted it, or owns its schedule or service group), or the job's cluster admits the user to start Spark work on it: a group of the user is on the cluster's submitGroups, the user holds CLUSTER_ACCESS_MANAGE, or the list is empty while security.clusterAccess.unrestrictedWhenEmpty is on (see Cluster Access Lists). This is the rule of job submission, so in governed mode an empty list admits administrators only.

The address must be the job's own driver: the namespace of the job's cluster, and a Kubernetes Service named after the job that selects the job's driver and serves the Spark UI on that port. Any other address is refused with 403, so the gateway opens no other service through this route. Every part of the address must be a DNS label; other paths do not reach the route. Allowed answers are cached like those of the module routes.

Finished jobs open in the Spark History Server, which is checked as the module history-server. Without the gateway check the route is open, as in earlier releases.

The Spark UI can also kill a job's jobs and stages, which would let everyone who may open it stop another user's work. In governed mode ilum-core starts every job with spark.ui.killEnabled=false, so the Spark UI has no kill links and refuses kill requests; jobs are stopped through Ilum, which checks the user's permissions. See Spark UI kill links.

Modules with their own sign-in​

JupyterHub, Ranger, and the modules that sign in through the Ilum OAuth provider (Grafana, Airflow, Superset) ask for their own sign-in after the check. Browsers carry the session cookie through these flows, so they keep working unchanged.

Clients that call a module through the gateway without a browser session are refused with 401: git over HTTP to Gitea, MLflow tracking clients, scripts that call the Airflow REST API with the module's own credentials. Such clients can send an Ilum API token with the module's permission in X-API-KEY, call the module inside the cluster, or the module can be left unchecked:

ilum-ui:
nginx:
config:
gatewayAuth:
exclude: [gitea]

The module's own sign-in still applies to an excluded module.

Caching​

The gateway keeps an allowed answer of ilum-core for cacheSeconds (10 by default) per module and credential, so a page that loads many files asks ilum-core once. Refusals are not kept: a new sign-in or a new permission counts at once. A removed permission or a disabled user still opens a module for at most cacheSeconds. The cache keys hold session tokens, so the cache lives on a memory volume of the UI pod. Set cacheSeconds: 0 to ask ilum-core on every request.

Sign-out removes the session cookie from the browser. The token itself stays valid until it expires, as it does for the Ilum API.

HTTPS​

ilum-core marks the session cookie Secure when the request came over HTTPS: on a TLS connection to ilum-core, or behind an ingress that terminates TLS and sends X-Forwarded-Proto: https (the gateway passes the header on). Sign-in, token refresh, the session renewal of the UI and sign-out follow this rule. Over plain HTTP the cookie stays without Secure, because the browser would not send it back.

Behind a proxy that terminates TLS but sends no X-Forwarded-Proto, mark the cookie Secure on every response:

ilum-core:
security:
sessionCookie:
alwaysSecure: true

With this setting the UI must be served over HTTPS only: over plain HTTP the browser drops the cookie and every module route asks for the sign-in again.

Ranger admin UI​

With Apache Ranger on, the gateway serves the Ranger admin UI at /external/ranger/. The route is always checked, also with gatewayAuth.enabled: false, and requires USER_EDIT_ACCESS, the permission that edits roles, groups and permissions in Ilum. Ranger then asks for its own sign-in.

Ranger serves its UI and REST API under /external/ranger (ranger.contextName in ilum-ranger.admin.siteProperties), so the gateway passes the path unchanged. Clients inside the cluster use http://ilum-ranger:6080/external/ranger; see Apache Ranger.

Object storage on Ceph RGW​

When the platform storage is Ceph RGW (rookCeph.enabled, or rookCeph as the active object-storage provider), the gateway has no /external/object-storage/ and no /external/minio/ route. RGW ships no console, and these routes would expose its S3 API through the UI.

Custom Nginx configuration​

A location added with ilum-ui.nginx.config.extraLocation is not checked unless it asks for the check itself, with a module name from the table above:

location /external/my-tool/ {
auth_request /_ilum/gateway-auth/grafana;
proxy_set_header Cookie $ilum_gateway_upstream_cookie;
proxy_pass http://my-tool:8080/;
}

An unknown module name is refused with 403. A server block of its own (nginx.config.default: false with nginx.config.custom) can no longer use the $access_* variables of earlier releases: Nginx does not start with them.

Configuration​

NameDescriptionDefault
ilum-ui.nginx.config.gatewayAuth.enabledCheck every module route with ilum-corefalse (true in governed mode)
ilum-ui.nginx.config.gatewayAuth.excludeModule names left unchecked[]
ilum-ui.nginx.config.gatewayAuth.cacheSecondsSeconds an allowed answer is kept per module and credential; 0 keeps none10
ilum-ui.nginx.config.http_cookie.enabledSwitch of earlier releases; true turns on the checkfalse
ilum-core.security.sessionCookie.alwaysSecureMark the session cookie Secure also when the request does not say it came over HTTPSfalse

Troubleshooting​

  • A module page goes to the sign-in page although the user is signed in: the browser has no ilum_session cookie. Sign out and in again. With OAuth2, an ID token longer than 4000 characters does not fit in a cookie: ilum-core logs Gateway session cookie not set. Fewer claims in the ID token (for example fewer groups) fix it.
  • Refusals in the ilum-core log: Gateway refused <path> to <user>: module <module> needs <permission> for 403, and Gateway refused <path>: no valid Ilum session or token for module <module> for 401. A refused Spark UI logs the reason, for example neither the job's owner nor admitted to cluster <cluster>.
  • The Spark UI answers 403 for the user's own job: the session cookie was set by an earlier release and carries no user id. Reload the UI or sign in again.
  • Module routes ask for the sign-in again on every page over HTTPS: check that the ingress sends X-Forwarded-Proto: https, or set alwaysSecure. Over plain HTTP, alwaysSecure must stay off.
  • Every module answers 500: the UI pod cannot reach ilum-core, so the check fails and the gateway refuses.