Skip to content

Access controls

Tinyauth supports basic access controls with either Docker labels or environment variables. These labels (or environment variables) can restrict or allow access to applications.

To enable access controls, add the following volume to the Tinyauth container:

services:
tinyauth:
volumes:
- /var/run/docker.sock:/var/run/docker.sock

Restart Tinyauth after setting the volume.

Access control labels follow this structure:

tinyauth.apps.[app].[key]: [value]

Similarly environment variables follow this structure:

Terminal window
TINYAUTH_APPS_[APP]_[KEY]=[VALUE]

Where [app] is the name of the app to protect. This app ID must be unique for each protected app.

Tinyauth uses the app ID in labels (or environment variables) and the request subdomain to match the configuration with the app. For example, a request to app1.example.com triggers Tinyauth to search for containers with the tinyauth.apps.app1.foo: bar label or the TINYAUTH_APPS_APP1_FOO=bar environment variable. To use the domain instead, add the following label:

tinyauth.apps.myapp.config.domain: myapp.example.com

Or the following environment variable:

Terminal window
TINYAUTH_APPS_MYAPP_CONFIG_DOMAIN=myapp.example.com

Tinyauth will now use the domain to match the configuration instead of the app ID.

Going forward, the guide will use the labels format but everything mentioned also applies to environment variables.

To restrict access to specific users, use the users.allow label:

tinyauth.apps.myapp.users.allow: user1

Only user1 will be able to access the app. To block specific users, use the users.block label:

tinyauth.apps.myapp.users.block: user2

To restrict access to specific OAuth users, use the oauth.whitelist label:

tinyauth.apps.myapp.oauth.whitelist: [email protected]

Only [email protected] will be able to access the app.

To skip authentication for specific paths, use the path.allow label:

tinyauth.apps.myapp.path.allow: ^\/api

To block access to specific paths, use the path.block label:

tinyauth.apps.myapp.path.block: ^\/admin

To allow access based on IP addresses or CIDRs, use the ip.allow label:

tinyauth.apps.myapp.ip.allow: 10.10.5.5,10.10.10.0/24

To block specific IPs or subnets, use the ip.block label:

tinyauth.apps.myapp.ip.block: 192.168.1.1,192.168.0.0/16

To disable authentication for specific IPs or subnets, use the ip.bypass label:

tinyauth.apps.myapp.ip.bypass: 10.10.5.5,10.10.10.0/24

Some OIDC servers, like Pocket ID, support user groups in the OIDC response. To use groups, ensure the groups scope is included in the OAuth provider configuration. Then, add the oauth.groups label:

tinyauth.apps.myapp.oauth.groups: admin

Only users in the admin group will be allowed to access the app.

Tinyauth also supports fetching the user’s groups from the LDAP server and using them for access control. To use LDAP groups, add the ldap.groups label:

tinyauth.apps.myapp.ldap.groups: admin

Only users in the admin group will be allowed to access the app.