Adjust server readme

This commit is contained in:
Zebreus 2026-10-25 15:14:41 +01:00
commit e4050cbf05

View file

@ -16,48 +16,36 @@ We only keep the basic user journey working.
## What we keep working ## What we keep working
Anything that breaks the following user journey is not acceptable:
- The user can connect with the SSH key as `root`.
- The prompt: `root@khaos-im-kiez:~#`, which `~/.zshrc` sets. - The prompt: `root@khaos-im-kiez:~#`, which `~/.zshrc` sets.
- The home directory the user ends up in: `/home/root`. They cannot change where it is, and they cannot delete it. - The home directory the user ends up in: `/home/root`. They cannot change where it is, and they cannot delete it.
- `cat README`, `cat README.en`, `cat CODE_OF_CONDUCT` and `cat CODE_OF_CONDUCT.en` always work. The four files - `cat README`, `cat README.en`, `cat CODE_OF_CONDUCT` and `cat CODE_OF_CONDUCT.en` always work. The four files
are always there and always regular text files. are always there and always regular text files.
- The website can log in: the key it uses is in `~/.ssh/authorized_keys`. That key gets access to the `root` user
only, never to the Administrator account.
Modifying the four files is allowed; the next cleanup undoes it. Deleting them is not possible: the home directory So in summary running `ssh root@nowhere.wirs.ing cat README` must always succeed and display the contents of the file.
and the files that have to stay in it belong to the administrators, so the user cannot remove them. The files the
user creates are their own; they may change and delete them.
The user may add keys of their own to `authorized_keys`; they stay. The key of the website is put back, so that the Anything thats not specified above (like the content of README for example) is NOT part of the user journey.
site keeps working.
## What we do not keep working ## What we do not keep working
Everything else. If the user breaks the shell, the packages, the disk or the connection, we fix that by hand or As long as the user story above does not break, we do not guarantee the functionality of anything else on the server. However the cleanup task should still try to best-effort restore everything to a working condition.
throw the box away. The cleanup does not try.
Two things that the user cannot break: the entry in `/etc/passwd` with the home directory and the shell, because ## The cleanup task
`/etc` is read-only for them, and the host keys in `/etc/ssh`, which the website pins. The sshd runs as SYSTEM, so
the user cannot restart it with a different key either.
## The cleanup The scheduled task `KiK restore shell files` runs every 30 minutes and at every startup, as SYSTEM. The user cannot stop it. Cleanup has two jobs:
The scheduled task `KiK restore shell files` runs every 30 minutes and at every startup, as SYSTEM. The user cannot 1. Act as a secondary safeguard to restore the essential files for the user journey above.
stop it: the task, its script and the copies it restores from are readable and writable only by SYSTEM and the 2. Revert any other mockery the user did that might affect the system.
administrators. Neither the setup nor the cleanup ever runs as the `root` user.
It creates `/home/root` if it is gone, and puts the copies from `C:\ProgramData\kik-restore\files` back into the The second job should also be able to restore a new server to the expected state.
home directory: the shell configuration, the keys and the four text files. Anything that is not a regular file is
replaced, so that the files cannot become anything but text. It also sets the permissions of the home directory and
of those files, so that the user cannot delete them.
## Installing the cleanup on the server ## Installing the cleanup on the server
To deploy the cleanup task an the server, run:
server/scripts/deploy.sh server/scripts/deploy.sh
The script logs in as `Administrator` - whose shell is a Windows one - copies the scripts and the resources to the The script logs in as `Administrator` - whose shell is a Windows one - copies the scripts and the resources to the
Administrator's home directory and runs the installer there, with the personal key of the deployer. The key of the Administrator's home directory and runs the installer there.
website never gets administrator rights. `--uninstall` removes the task again.
The installer can also be run by hand, in an elevated PowerShell on the server:
powershell -ExecutionPolicy Bypass -File .\scripts\install_restore_task.ps1