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.
Modifying the Tinyauth Container
Section titled “Modifying the Tinyauth Container”To enable access controls, add the following volume to the Tinyauth container:
services: tinyauth: volumes: - /var/run/docker.sock:/var/run/docker.sockRestart Tinyauth after setting the volume.
Access Controls Structure
Section titled “Access Controls Structure”Access control labels follow this structure:
tinyauth.apps.[app].[key]: [value]Similarly environment variables follow this structure:
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.
Access Controls Discovery
Section titled “Access Controls Discovery”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.comOr the following environment variable:
TINYAUTH_APPS_MYAPP_CONFIG_DOMAIN=myapp.example.comTinyauth will now use the domain to match the configuration instead of the app ID.
User ACLs
Section titled “User ACLs”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: user1Only user1 will be able to access the app. To block specific users, use the users.block label:
tinyauth.apps.myapp.users.block: user2OAuth Whitelist
Section titled “OAuth Whitelist”To restrict access to specific OAuth users, use the oauth.whitelist label:
Only [email protected] will be able to access the app.
Path ACLs
Section titled “Path ACLs”To skip authentication for specific paths, use the path.allow label:
tinyauth.apps.myapp.path.allow: ^\/apiTo block access to specific paths, use the path.block label:
tinyauth.apps.myapp.path.block: ^\/adminIP-Based Access Controls
Section titled “IP-Based Access Controls”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/24To block specific IPs or subnets, use the ip.block label:
tinyauth.apps.myapp.ip.block: 192.168.1.1,192.168.0.0/16Bypassing Authentication for IPs
Section titled “Bypassing Authentication for IPs”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/24Access Controls Using OIDC Groups
Section titled “Access Controls Using OIDC Groups”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: adminOnly users in the admin group will be allowed to access the app.
Access Controls Using LDAP Groups
Section titled “Access Controls Using LDAP Groups”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: adminOnly users in the admin group will be allowed to access the app.