Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions docs/source/administrator/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,3 +489,44 @@ proxy:
```

This would restrict the access to only two IP addresses: `111.111.111.111` and `222.222.222.222`.

(jupyterhub_subdomains)=

## Host user servers on a subdomain

You can reduce the chance of cross-origin attacks by giving each user
their own subdomain `<user>.jupyter.example.org`.
This requires setting [`subdomain_host`](schema_hub.config.JupyterHub.subdomain_host), creating a wildcard DNS record `*.jupyter.example.org`, and creating a wildcard SSL certificate.

```yaml
hub:
config:
JupyterHub:
subdomain_host: jupyter.example.org
```

If you are using a Kubernetes ingress this must include hosts
`jupyter.example.org` and `*.jupyter.example.org`.
For example:

```yaml
ingress:
enabled: true
hosts:
- jupyter.example.org
- "*.jupyter.example.org"
tls:
- hosts:
- jupyter.example.org
- "*.jupyter.example.org"
secretName: example-tls
```

where `example-tls` is the name of a Kubernetes secret containing the wildcard certificate and key.

The chart does not support the automatic creation of wildcard HTTPS certificates.
You must obtain a certificate from an external source,
for example by using an ACME client such as [cert-manager with the DNS-01 challenge](https://cert-manager.io/docs/configuration/acme/dns01/),
and ensure the certificate and key are stored in the secret.

See {ref}`jupyterhub:subdomains` in the JupyterHub documentation for more information.
3 changes: 3 additions & 0 deletions jupyterhub/templates/proxy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ spec:
{{- if .Values.debug.enabled }}
- --log-level=debug
{{- end }}
{{- if .Values.hub.config.subdomain_host }}
- --host-routing
{{- end }}
{{- range .Values.proxy.chp.extraCommandLineFlags }}
- {{ tpl . $ }}
{{- end }}
Expand Down
21 changes: 20 additions & 1 deletion jupyterhub/values.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ properties:
values, you need to use [`hub.extraConfig`](schema_hub.extraConfig)
instead.

```{admonition} Currently intended only for auth config
```{admonition} Some configuration must be set in multiple places
:class: warning
This config _currently_ (0.11.0) only influence the software in the
`hub` Pod, but some Helm chart config options such as
Expand Down Expand Up @@ -271,6 +271,25 @@ properties:
the `--values` or `-f` flag. During merging, lists are replaced while
dictionaries are updated.
```
properties:
JupyterHub:
type: object
additionalProperties: true
description: |
JupyterHub Traitlets configuration.

See {py:mod}`jupyterhub:jupyterhub.app` for the full list,
but take note of the [above warnings](schema_hub.config).
properties:
subdomain_host:
type: string
description: |
The subdomain to use for hosting singleuser servers.

This helps protect against some cross-origin attacks by giving each user
their own subdomain `<user>.jupyter.example.org`.

See {ref}`jupyterhub_subdomains`.
extraFiles: &extraFiles
type: object
additionalProperties: false
Expand Down