CTL-007 · human
Black-Holing Domains in Linux Hosts File
Use /etc/hosts to stop selected domains from resolving.
TechnicalEffort LowEffectiveness Low
On Linux, entries in /etc/hosts override DNS. Mapping a domain to 127.0.0.1 prevents access from that host. Root users can undo it, so deploy via configuration management and watch for edits with auditd or file integrity tools. Use central DNS controls for anything beyond a handful of domains.
Put it in place
- 01Push entries through Ansible, Puppet or similar.
- 02Add an auditd rule to watch /etc/hosts.
- 03Alert on unexpected edits.
- 04Use central filtering for larger blocklists.