3.2 KiB
tinyauth-web
A small PHP web UI to edit the tinyauth environment file, and to start, stop, restart and check the tinyauth systemd service. Login goes through tinyauth itself (OIDC).
Features
- Login with tinyauth (OIDC). Only members of one chosen group may use the tool.
- First run: the first person to log in picks the allowed group from their own groups.
- Edit, add and delete variables in the env file. Secret values are never shown; leave blank to keep.
- Every save writes a backup to
data/backups/first. - Start, stop, restart and status, through a narrow sudoers rule.
- Permission checks page shows what is missing.
Layout
| Path | Purpose |
|---|---|
public/ |
Web root. Only this directory should be served. |
src/ |
Shared code (not served). |
config.example.php |
Template. Copy to config.php. |
sudoers/tinyauth-web.sudoers |
Sudo rule for the web user. |
data/ |
Created at runtime: settings and backups. |
Install
-
Register an OIDC client in tinyauth. In the tinyauth env file, add a client, for example:
TINYAUTH_OIDC_CLIENTS_TINYAUTHWEB_CLIENTID=tinyauth-web TINYAUTH_OIDC_CLIENTS_TINYAUTHWEB_CLIENTSECRET=<generate a long random secret> TINYAUTH_OIDC_CLIENTS_TINYAUTHWEB_NAME=tinyauth-web TINYAUTH_OIDC_CLIENTS_TINYAUTHWEB_TRUSTEDREDIRECTURIS=https://tinyauth-web.example.com/callback.phpThen restart tinyauth. Use the same client secret in
config.php. -
Copy the app to the server, then:
cp config.example.php config.phpEdit
config.php:tinyauth_url,client_id,client_secret,redirect_uri,env_file, andservice. -
Point the web server at
public/. Use HTTPS. The app sets secure cookies only over HTTPS. -
Sudo rule (as root):
install -m 0440 sudoers/tinyauth-web.sudoers /etc/sudoers.d/tinyauth-web visudo -cf /etc/sudoers.d/tinyauth-webCheck that the systemctl path matches
command -v systemctl. -
Let the web user edit the env file (keep the file owned by root, and only group-writable by the web user):
chgrp www-data /etc/tinyauth/tinyauth.env chmod 660 /etc/tinyauth/tinyauth.envMake sure the
data/directory is writable bywww-data, and that it is not inside the web root. -
Set file permissions (as root). PHP runs as
www-data, so it needs to read the code and config and writedata/. Pre-createdata/, 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 world-readable. -
Open the page, log in, and pick the access group. Check the Permission checks section.
Notes
- Saved changes take effect only after tinyauth is restarted. The page reminds you of this.
- The group is read from the
groupsclaim of the OIDC userinfo response. If your tinyauth uses a different claim, setgroups_claim. - To clear the access group, use Change access group on the page (only available to members of the current group).
- To clear a secret value, edit the file in a terminal. The web form doesn't clear secrets.