Valkey - Hardened Redis-Compatible Cache
par Lynxroute
Valkey 9.1.3 - CIS Level 1 hardened on Ubuntu 24.04 LTS with SBOM and CIS Conformance Report
What is Valkey
Valkey is the open-source, high-performance Redis-compatible in-memory data store maintained by the Linux Foundation - forked from Redis OSS 7.2 in 2024 when Redis Inc. relicensed to BSL. It supports the full Redis API including strings, hashes, lists, sets, sorted sets, streams, pub/sub messaging, Lua scripting, transactions, geospatial commands, hyperloglog, bitmaps, and the modules ecosystem. Operators get RDB snapshots and AOF persistence to local disk, replica replication, and cluster sharding for horizontal scale. Drop-in compatible with all existing Redis clients across Java, Python, Node.js, Go, PHP, Ruby, and 100+ other languages - no application code changes required. BSD-3-Clause license - the safe vendor-neutral path forward for self-hosted Redis users.
Why self-host Valkey
Self-hosting Valkey gives you full control over your data with no external dependencies. Ideal for teams with data residency requirements, GDPR compliance needs, or organizations that cannot use managed Redis services due to cost, latency, or licensing constraints. Your cache data stays entirely within your own Azure infrastructure.
What this VM image adds
Security hardening:
- Strong random password at first boot - no default or empty password
- Binds to 127.0.0.1 only - not exposed to the network by default
- Command ACL - FLUSHALL, FLUSHDB, DEBUG and CONFIG SET/REWRITE blocked for the default user (CONFIG GET works); one command re-enables them
- maxmemory sized at first boot - 60% of RAM with allkeys-lru, so the cache evicts instead of the VM running out of memory
- CVE scan - every image is scanned for vulnerabilities with Trivy before release
- UFW firewall - default deny incoming, 6379 not opened, SSH on 22 only
- fail2ban - SSH brute-force protection
- AppArmor - mandatory access control
OS hardening (CIS Level 1):
- CIS Level 1 hardened - CIS Ubuntu 24.04 LTS Level 1 Benchmark via ansible-lockdown
- auditd - system call auditing for critical paths
- SSH hardening - PasswordAuthentication disabled, key-only access
- Kernel hardening - SYN cookies, ASLR, rp_filter, TCP BBR
- /tmp as tmpfs - nosuid, nodev, noexec
- Azure IMDS endpoints - egress rules pre-configured (169.254.169.254, 168.63.129.16)
Compliance artifacts (inside the VM):
- SBOM - CycloneDX 1.6 at /etc/lynxroute/sbom.json
- CIS Conformance Report - OpenSCAP HTML at /etc/lynxroute/cis-report.html
- Tailored CIS profile - /usr/share/doc/lynxroute/CIS_TAILORED_PROFILE.md
- RDB persistence - data survives reboots
Quick Start
- Deploy VM from Azure Marketplace (Standard_B2s or larger recommended)
- SSH: ssh -i key.pem <username>@<PUBLIC_IP> (username set during VM creation, default: azureuser)
- Check status: MOTD shows Valkey version and service state on login
- Get password: sudo cat /root/valkey-credentials.txt
- Connect locally: valkey-cli --askpass
Remote access (Valkey binds to 127.0.0.1; never open 6379 to 0.0.0.0/0):
- sudo sed -i 's/^bind 127.0.0.1 -::1/bind 0.0.0.0/' /etc/valkey/valkey.conf && sudo systemctl restart valkey (the password stays required)
- sudo ufw allow from <app-subnet> to any port 6379 proto tcp
- Network Security Group: allow inbound TCP 6379 from the same subnet only
Blocked by ACL: FLUSHALL, FLUSHDB, DEBUG, CONFIG SET/REWRITE (clients get NOPERM). Re-enable until restart with valkey-cli --askpass ACL SETUSER default +config (or +flushall, +flushdb, +debug); permanently by editing the "user default" line in /etc/valkey/valkey.conf.
Replication: outbound traffic is restricted; on the replica run sudo ufw allow out to <primary-ip> port 6379 proto tcp and set masterauth in valkey.conf.