SECURITY.md
CrumbZeros TTYD + BashPanda + Crumbmissions
Version: 1.0
Status: RC0
Date: 2026â02â21
1. Scope
This document describes the security model for:
- CrumbZeros TTYD deployment (
check.sh,test.sh,make.sh) - BashPanda lessons (currently: Lesson 1 â âProtect your directoryâ)
- Crumbmissions server-side structure
kruemelNuser isolation on the Crumbforest server
It is written for:
- Local admins / operators
- NGOs / educators considering a fork
- Anyone reviewing the risk profile of TTYDâbased shell access for children (âKrĂźmelâ).
2. Security Objectives
- Child safety first
- No uncontrolled shell access from home or untrusted networks.
-
TTYD is only available in supervised, onâsite learning contexts.
-
Containment of damage
-
A compromised
kruemelNsession must not compromise:- the host OS,
- other krĂźmel accounts,
- other services on the machine.
-
Minimal exposed surface
- Publicly reachable services are strictly limited (HTTPS reverse proxy only).
-
TTYD itself does not listen on public interfaces.
-
Transparent, reproducible security
- All security measures are implemented as scripts in the repo.
-
check.sh,test.sh,make.shandsecurity_check.shdocument the effective state. -
Conscious risk (âPasskanteâ)
- TTYD is explicitly treated as a âhighâvalue targetâ.
- The project does not pretend there is zero risk; instead it documents:
- what is mitigated,
- what remains as intentional, supervised risk.
3. HighâLevel Architecture
- Users
kruemel1,kruemel2, ⌠(number configurable viaNUM_KRUEMEL).-
All in group
crumbforest. -
User isolation
- Home directories:
/home/kruemelN - Permissions:
700(owner only). - Dedicated practice directory:
/home/kruemelN/mein_verzeichnis(700). -
Welcome + training files with restrictive perms (
600). -
TTYD
- One systemd service per user:
ttyd-kruemelN.service. - Each binds to a local port (e.g. 7681â7685) on
127.0.0.1. su -l kruemelNused to enter the user shell.-
Additional TTYD credential (
--credential user:password) per service. -
Reverse proxy
- Nginx vhost:
ttyd.crumbforest.com. - HTTPS with Letâs Encrypt certificates.
- One
location /kruemelNblock per user. -
auth_basicwith per-user.htpasswd-kruemelN. -
Security tooling
check.shâ current state (âWas ist im Wald?â).test.shâ feature validation (âWas soll neu?â).make.shâ deployment (âwuuuhuuu!â).-
security_check.shâ firewall, port bindings, fail2ban, SSL, auth. -
AI / RAG
- Ollama + Qdrant run locally for Crumbforest AI use.
- Access is via dedicated applications / browser workflows, not via TTYD.
4. Threat Model & Assumptions
4.1 InâScope Threats
- A krĂźmel (or someone sitting at a krĂźmel workstation) tries to:
- access another krĂźmelâs files,
- escalate privileges on the host,
- break out of their shell environment,
-
access TTYD without credentials via the public URL.
-
Automated attacks from the internet:
- Bots scanning
ttyd.crumbforest.com, - bruteâforce attempts on HTTP Basic Auth,
- misuse of open ports if misconfigured.
4.2 OutâofâScope / Assumptions
- The physical environment is supervised:
- children are onâsite, in the container / classroom,
-
at least one adult crew member is present.
-
The host OS is properly maintained by admins:
- regular security updates,
- restricted
sudo/ root access, -
no additional, unknown services opened to the internet.
-
This is not a multiâtenant, hostile cloud environment.
It is a pedagogical lab with strict network rules and physical control.
5. Security Controls
5.1 Network & Firewall
ufw(Uncomplicated Firewall) enabled:- Only necessary ports open (80/443, SSH as configured).
-
TTYD ports (7681â7685 by default) must not be opened in UFW.
-
TTYD services bind to
127.0.0.1only
â No direct external access to TTYD, only via nginx reverse proxy. -
HTTPS enforced:
- HTTP (
:80) redirects to HTTPS (:443). - TLS certificates managed by Letâs Encrypt.
5.2 Authentication & Access Control
- HTTP Basic Auth (nginx)
- Each
/kruemelNlocation is protected byauth_basic. -
Credentials stored in perâuser
.htpasswd-kruemelNfiles under/etc/nginx/auth. -
TTYD credentials
- Each TTYD service is configured with
--credential user:password. -
Ensures TTYD itself requires authentication even if nginx is misconfigured.
-
System accounts
kruemelNsystem users with individual home directories.- No
sudorights for krĂźmel accounts. -
Group
crumbforestused for pedagogical sharing patterns, not privilege escalation. -
Directory permissions
- Home directories:
700(only owner can access). - Practice directory
mein_verzeichnis:700. - Sensitive files (like
willkommen.txt, future configs):600.
5.3 Process Isolation
- One systemd service per TTYD instance:
- Service restarts automatically on failure.
-
Clear audit trail via
journalctl -u ttyd-kruemelN. -
Shell runs under the
kruemelNuser context: - No shared shell between users.
- If one account is misused, impact is limited to that account.
5.4 Logging & Monitoring
- Nginx access and error logs for:
- login attempts,
-
unusual patterns or high volume.
-
Systemd logs for TTYD services.
-
security_check.sh: - Verifies firewall status, port bindings, fail2ban, certificate validity,
- Detects insecure configurations (e.g. TTYD bound to
0.0.0.0, missing auth).
Operators are encouraged to:
- Run
./check.shand./security_check.shregularly. - Set up cron or external monitoring where possible.
5.5 Bruteforce Protection
fail2banrecommended and supported:sshdjail for SSH bruteâforce.- nginx / httpâauth jail for repeated login failures.
If fail2ban is not installed or not running, security_check.sh will warn.
6. Conscious Risks (âPasskanteâ)
TTYD in the browser is intentionally treated as a Passkante:
A boundary where learning value and technical risk meet,
and where errors become teaching moments â not silent failures.
We deliberately do not pretend that webâbased shells are riskâfree.
Instead we:
- restrict usage to supervised onâsite sessions,
- restrict user privileges (no
sudo), - restrict network exposure (local bind + firewall + proxy),
- document the risks clearly.
6.1 Known Risks
- If nginx and firewall are misconfigured, a TTYD port could be exposed.
- If krĂźmel credentials are reâused elsewhere, attackers might try them on other systems.
- If
NUM_KRUEMELand service definitions drift apart, some users may have accounts but no UI access (or vice versa).
6.2 Not Supported / Must Not Be Done
The Crumbforest / CrumbZeros design explicitly forbids:
- Exposing TTYD directly to the internet on
0.0.0.0. - Granting krĂźmel users
sudoprivileges or access to sensitive system files. - Using this deployment as a generic âshell providerâ for the public.
- Running this stack in an unsupervised, homeâuse setting for children.
These limitations are part of the ethical and pedagogical core of the project.
7. Operational Practices
Recommended ops checklist:
- Before first deployment
- Review and adjust
NUM_KRUEMELand port ranges. - Ensure
ufwis active and defaultâdeny for incoming connections. - Install
fail2banand enable at leastsshdand nginx auth jails. -
Obtain valid TLS certificates for
ttyd.crumbforest.com. -
Deployment
- Run
sudo ./check.shto see the current state. - Run
sudo ./test.shto validate prerequisites. - Run
sudo ./make.shto deploy. -
Run
sudo ./security_check.shto confirm secure state. -
After deployment
- Change or rotate initial passwords stored in
passwords.txt. - Test access via browser and via
curl(expect 401 without credentials). -
Verify that krĂźmel can only see their own home directories.
-
Ongoing
- Apply OS security updates regularly.
- Renew TLS certificates (Letâs Encrypt autoârenew or manual).
- Monitor logs for anomalies (nginx, TTYD, fail2ban).
- Periodically reârun
security_check.sh.
8. For Forks and NGOs
If you fork this repository for another context (school, NGO, maker space):
- Keep the structure, adapt the names.
-
You can rename
kruemelusers, but keep:- perâuser system accounts,
- 700 home directories,
- perâuser TTYD instances and credentials.
-
Keep the boundary conditions.
- Onâsite, supervised use only.
- No dualâuse as âpublic shellâ service.
-
No escalation to security / surveillance tooling.
-
Document your own adaptations.
- If you relax or change any security controls,
clearly document:- why you did it,
- what risks you accept,
- who is responsible.
9. Reporting & Contact
This project is operated in the spirit of:
âPräzision Ăźber Geschwindigkeit.
Verstehen Ăźber QuickâFix.
Atmen vor AusfĂźhren.â
If you discover a security issue or have improvements:
- Open an issue in the repository (if appropriate), or
- Contact the maintainer / crew via the channels provided in the main README.
When reporting, please include:
- Steps to reproduce,
- Affected components (TTYD, nginx, scripts, etc.),
- Any logs or configurations that help to understand the issue.
10. Summary
- TTYD is intentionally used as a learning boundary, not a generic remote shell.
- The design focuses on local, supervised, offlineâfirst education.
- Security is implemented via:
- network isolation (127.0.0.1, UFW),
- multiple auth layers (nginx + TTYD),
- OS user isolation (perâuser accounts, 700 perms),
- logging, monitoring and scripted checks.
Security here is not a marketing claim;
it is a living practice that grows with the forest.
wuuuhuuu đźđ˛