Service users and database boundaries
Quick answer
Give each service only the identity, files, network access and database privileges required for its task. Isolation reduces the impact of a failure or compromise.
The operating-system service account and database role are separate identities. Restrict each to the resources it needs; a service allowed to read its configuration need not be allowed to modify database schemas. Verify both expected access and expected denial in an isolated fixture.
Prepare the practice environment
Run python3 lab-fixtures/servers/setup.py from the extracted root as an ordinary user. Enter the printed fresh private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. Only local loopback services and private files are used. Optional examples require an authorized snapshot VM. Never expose a lab listener publicly or modify system services. Review the lab guide.
How it works
A web proxy, application and database have different responsibilities. A database usually does not need public exposure; use loopback or an authorized private network, firewall restrictions and database authentication. A runtime account should not own deployment configuration unless necessary. Grant the application database role only its needed operations; migration privileges can be separated. Store secrets outside the document root using a suitable restricted secret mechanism; avoid logging connection strings. A non-root identity does not by itself prove isolation. Check listening addresses, user identity, directory traversal permissions and application-level grants. The fixture uses fictional service and permission tables plus a regular file with no real secrets.
Try the examples
awk 'NR>1 && $3=="public" {print $1}' topology.txtOnly the proxy is intended to be public in this topology. In a VM, compare with ss -ltn and firewall policy; bind address is not proof of Internet reachability.
Expected stdout:
proxyThe modeled application role does not have schema administration. Actual grants must be checked with the database-specific tool.
Expected stdout:
SELECTINSERTOnly the owner has read and write bits. Parent directories, ACLs and identity still matter. The file contains no credentials.
Expected stdout:
600Common mistakes
Do not run the entire application as root or grant database administrator permissions for routine requests. A private IP is not a substitute for authentication.
Practice
Extend the fictional topology with a worker service. Specify which identity, file access and database operations it needs, and explain why it should not have a public listener.
Related references
Study: ss, id. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Service users and database boundaries — Knowledge Check
Apply hosting and deployment concepts to synthetic fixtures and VM-only scenarios.
Which role needs public access in this model?
A report service needs to read reports but never change them. Which database grant follows least privilege?
Where should private credentials reside?
A database binds only to loopback. What authentication policy remains appropriate?