# 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 1. **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= TINYAUTH_OIDC_CLIENTS_TINYAUTHWEB_NAME=tinyauth-web TINYAUTH_OIDC_CLIENTS_TINYAUTHWEB_TRUSTEDREDIRECTURIS=https://tinyauth-web.example.com/callback.php ``` Then restart tinyauth. Use the same client secret in `config.php`. 2. **Copy the app** to the server, then: ``` cp config.example.php config.php ``` Edit `config.php`: `tinyauth_url`, `client_id`, `client_secret`, `redirect_uri`, `env_file`, and `service`. 3. **Point the web server at `public/`.** Use HTTPS. The app sets secure cookies only over HTTPS. 4. **Sudo rule** (as root): ``` install -m 0440 sudoers/tinyauth-web.sudoers /etc/sudoers.d/tinyauth-web visudo -cf /etc/sudoers.d/tinyauth-web ``` Check that the systemctl path matches `command -v systemctl`. 5. **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.env ``` Make sure the `data/` directory is writable by `www-data`, and that it is not inside the web root. 6. 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 `groups` claim of the OIDC userinfo response. If your tinyauth uses a different claim, set `groups_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.