Lesson 8 of 9 · 20m
Security Boundaries: Exposure, ACLs, TLS, and Dangerous Commands
Redis assumes a trusted network by default. Build the boundary deliberately before someone turns your cache into a remote command-and-control accident.
Redis was designed in an era of private machine rooms and trusted LANs. Its defaults assume the network is the perimeter. The modern internet does not care. Exposing an unauthenticated Redis port is not a small misconfiguration; it is historically one of the fastest ways to get a host compromised or data silently harvested.
Bind and protect like the port is hostile
bind 127.0.0.1 10.0.3.11
protected-mode yes
port 6379protected-mode is a safety rail for unauthenticated instances listening on non-loopback addresses. It is not a substitute for authentication, firewalling, or network segmentation.
Security groups, host firewalls, and private subnets should all agree: only application and operations networks can reach Redis. If the internet can reach 6379, assume compromise until proven otherwise.
Use ACLs as least privilege, not decoration
Redis 6 introduced real users and command/key permissions:
ACL SETUSER app on >'strong-random-secret' ~app:* +get +set +del +expire +incr +ping
ACL SETUSER readonly on >'another-secret' ~readonly:* +get +mget +ping
ACL LISTThe default user should not remain broad and forever-enabled on serious deployments. Separate application, operational, replication, and administrative identities where practical.
Key patterns matter. A token that can write * is effectively administrative even if it lacks CONFIG.
Disable or restrict commands that operations should not casually run
rename-command FLUSHALL ""
rename-command FLUSHDB ""
rename-command CONFIG ""
rename-command SHUTDOWN ""This is risk reduction, not security against a determined admin. ACLs are the cleaner modern mechanism. Either way, the goal is the same: make destructive irreversible actions deliberate.
TLS protects credentials and data in motion
Redis supports TLS natively in modern versions, or via a carefully operated proxy. Terminating TLS at a sidecar or load balancer means plaintext still crosses whichever hop remains. Know exactly where plaintext exists.
Certificate rotation, client verification, and cipher policy are operational work. Turning on TLS the night before an audit without load testing is how you discover the CPU cost during peak traffic.
Threat models worth writing down
Redis commonly stores sessions, rate-limit state, cached PII, job payloads, and tokens. Treat it as sensitive infrastructure even if 'it is just a cache.' Ask:
- Can a tenant's key pattern touch another tenant's data?
- Can application credentials run Lua, load modules, or inspect the keyspace?
- Are snapshots and AOF files encrypted at rest and protected off-host?
- Are backup permissions weaker or stronger than production database permissions?
- Does logs/monitoring accidentally capture command payloads?
Field notes
AUTHalone is not a user-management strategy; shared passwords spread across every service forever.- Rotate credentials as a deployable process. If rotation requires downtime, you will never rotate them.
- Do not expose Redis metrics endpoints publicly either; topology and keyspace metadata is useful reconnaissance.
- Untrusted Lua is code execution inside your data plane. Treat script write access as privileged.
- Cloud-managed Redis does not remove the need for network, ACL, backup, and exposure review — it only changes who patches the process.
Was this lesson helpful?