Docker
/Advanced
Least Privilege Principle
Definition
A core security concept dictating that a container (and the application inside it) should be granted only the absolute minimum permissions, access rights, and network capabilities necessary to perform its specific function.
Explain Like I'm New
Don't give the janitor the keys to the bank vault. If the container only needs to read a database, do not give it permission to format the hard drive or restart the server.
Real World Example
A developer runs a container using `--privileged`. This disables all security features and gives the container full god-mode over the host server. A hacker breaches the web app, uses the god-mode privileges, and deletes the host operating system. The developer violated the Least Privilege principle.
Common Use Cases
- •Hardening environments
- •Access control
Interview Questions
basic
- What does the `--privileged` flag do to a Docker container?
intermediate
- How do Linux 'Capabilities' apply to the Least Privilege principle in Docker?