| examples | ||
| public | ||
| src | ||
| sudoers | ||
| .gitignore | ||
| config.example.php | ||
| LICENSE | ||
| README.md | ||
tinyauth-web
A small PHP web interface for managing a tinyauth install that runs under systemd. From the browser you can:
- edit the tinyauth env file (add, change, and delete variables),
- start, stop, restart, and check the tinyauth service,
- create OIDC clients and forward-auth app rules without looking up variable names,
- log in with tinyauth itself, and limit access to one group.
No database is needed, and it runs on any PHP 8.1+ setup with nginx or Apache. It doesn't need the curl extension.
Read this first
tinyauth-web is not an installer. It does not install or set up tinyauth. It only works once tinyauth is already running under systemd, with its own env file and an HTTPS URL. It also depends on tinyauth for login: you must already know enough to create an OIDC client in tinyauth, because the dashboard needs one to sign you in. If tinyauth isn't working yet, fix that first.
About this project
This was built with the help of an AI model. A person designed it, chose its features, tested it against tinyauth v5.2.0, and reviewed the basics of the code. The author is not a PHP expert, so review it carefully before running it anywhere important.
This is an unofficial companion tool and is not affiliated with tinyauth. Tinyauth is a separate project.
Features
- Login through tinyauth (OIDC). The first person to log in picks the group allowed to use the tool. Everyone else sees an access-denied page.
- Safe env editing. Each save makes a timestamped backup first. Secret values are masked and never shown; leave a secret blank to keep it.
- Core settings. Install-level variables (addresses, URLs, cookies, LDAP connection, keys, database, logs) sit in a closed section, so the page stays clean. You can change the list of core keys in
config.php. - Paste many variables at once. Paste
KEY=VALUElines, review them in a popup, choose Keep or Update for anything that already exists, then apply. A single bad line stops the whole paste, and the popup says why. - Guided forms. Create an OIDC client (with a generated secret if you want one) or an app ACL in a few fields.
- Help everywhere. Each common key and form field has a ? tooltip with a plain-language explanation, an expert one, and an example. A full key reference lists every setting tinyauth accepts.
- Service control. Start, stop, restart, and status, through a narrow sudo rule that allows only those four commands on the tinyauth unit.
- Permission checks. A panel shows what's missing (sudo rules, file permissions), so setup problems are easy to spot.
- Light and dark themes.
Layout
| Path | Purpose |
|---|---|
public/ |
The web root. Only this directory should be served. |
src/ |
Shared code. Not served. |
config.example.php |
Template. Copy it to config.php and edit. |
sudoers/tinyauth-web.sudoers |
Sudo rule for the web user. |
examples/nginx/ |
nginx examples for a subdomain or a subpath. |
data/ |
Created at runtime: settings and backups. Not served. |
Requirements
- PHP 8.1 or newer, with PHP-FPM
- A web server (nginx examples are included)
- tinyauth v5.2.0 or later, running under systemd, with an HTTPS public URL
- Sudo, for the service controls
Installation
-
Register an OIDC client in tinyauth. Add a client to the tinyauth env file. The client ID and secret must match
config.phpin step 2:Add these lines to the tinyauth env file:
TINYAUTH_OIDC_CLIENTS_TINYAUTHWEB_CLIENTID=tinyauth-web TINYAUTH_OIDC_CLIENTS_TINYAUTHWEB_CLIENTSECRET=<a long random secret> TINYAUTH_OIDC_CLIENTS_TINYAUTHWEB_NAME=tinyauth-web TINYAUTH_OIDC_CLIENTS_TINYAUTHWEB_TRUSTEDREDIRECTURIS=https://tinyauth-web.example.com/callback.phpRestart tinyauth afterwards. You can also add the client from the tool's New OIDC client form once it's running.
-
Create
config.phpfrom the template:cp config.example.php config.phpEdit
tinyauth_url,client_id,client_secret,redirect_uri,env_file, andservice. Theredirect_urimust match the trusted redirect URI from step 1 exactly, includinghttps://. -
Point the web server at
public/. Use HTTPS. Seeexamples/nginx/for complete server blocks. -
Install the sudo rule (as root). The second command checks the file for syntax errors:
install -m 0440 sudoers/tinyauth-web.sudoers /etc/sudoers.d/tinyauth-web visudo -cf /etc/sudoers.d/tinyauth-webCheck that the systemctl path in the file matches
command -v systemctl. -
Let the web user edit the env file. Keep the file owned by root, and make it writable by the web group only:
chgrp www-data /etc/tinyauth/tinyauth.env chmod 660 /etc/tinyauth/tinyauth.env -
Set the directory and file permissions (as root). PHP runs as
www-data, so it must be able to read the code and config and writedata/. Createdata/yourself, because the checkout is usually owned by your own user:install -d -o www-data -g www-data -m 0750 /path/to/tinyauth-web/data chown root:www-data /path/to/tinyauth-web/config.php chmod 640 /path/to/tinyauth-web/config.phpconfig.phpholds the client secret, so it must not be readable by everyone. -
Open the page, log in, and choose the access group. Check the Permission checks panel. Every row should show ✔.
Using the tool
- Config. Core settings are closed by default. Other settings are listed below them, and the add row at the bottom creates new variables. The key reference lists every setting tinyauth accepts.
- New OIDC client. Enter a name and the tool writes the
TINYAUTH_OIDC_CLIENTS_<NAME>_*variables. Leave the secret blank to generate one. A generated secret is shown once, so copy it then. - New app ACL. For apps behind forward auth, enter the app's name and domain, plus any users or groups allowed in.
- Paste multiple variables. Paste
KEY=VALUElines (blank lines and#comments are ignored), click Review, choose Keep or Update for anything that already exists, then Apply. Nothing is written before you apply. - Local users. The tool doesn't create passwords, because tinyauth hashes them. On the server, run
tinyauth user create --interactive, copy the printedusername:hashline, and add it toTINYAUTH_AUTH_USERS(comma-separated). Then restart tinyauth. - Blank values. Blank variables are allowed, but the page warns about them, since they can break tinyauth.
Restart the tinyauth service after any change. The page reminds you of this.
Configuration notes
- Groups. Access is decided by the
groupsclaim in the OIDC userinfo response. If your tinyauth sends groups under another name, changegroups_claiminconfig.php. - Core keys. To change which settings appear in the Core section, edit
core_keysinconfig.php. Patterns support*. Leaving the setting out uses the built-in list. - Clearing a secret. The web form won't clear a secret, to avoid accidental wipes. Edit the env file directly to clear one.
- Changing the access group. Use Change access group on the page. Only current group members can do this.
Security notes
- Serve only
public/.config.php,src/, anddata/must not be reachable over HTTP. The nginx examples do this. - Use HTTPS. Secure cookies are only sent over HTTPS.
- Keep
config.phpand the env file readable only by the owner andwww-data. - The sudo rule allows only
status,start,stop, andrestartfor one unit. Don't widen it. - Form posts are protected with a per-session token (CSRF).
- Secrets are masked in the page, but they are still written to the env file and to backups in
data/backups/. Protect that directory.
Testing
The project has no automated tests yet. The checks run during development:
- PHP syntax checks on every file (
php -l) - login, config editing, paste review, and service actions run against tinyauth v5.2.0, locally and under
www-data
Contributions with tests are welcome.
Contributing
This project is shared as-is and is not actively maintained. Issues and pull requests may not be reviewed. You are welcome to fork it and adapt it to your own setup.
Licence
Beerware (Revision 42). See LICENSE. Do what you like with it. If you find it useful and we meet, buy the author a beer.