Home/Templates/Catch attackers at work on a server
Catch attackers at work on a server
Falco on plain Linux hosts, alerting on web shells, credential theft, and new programs in system folders.
Ansible
Why bother
A server outside a Kubernetes cluster is attacked the same way as a pod inside one. A web server starts a shell. A stolen tool reads cloud credentials, or a download tool asks the metadata service for the instance's keys. A program lands in /usr/bin. Falco watches system calls and alerts on each as it happens.
On a test cloud host, curl the metadata service address. The instance credentials alert reaches syslog within seconds.
How it works
Set it up
Pick your platform, then open the level you want. Each level is complete on its own. Read the comments in the files as you go. Anything with a real consequence is explained on the line where it happens.
Ansible. Falco with the modern eBPF driver, rules in /etc/falco/rules.d
What you need first
- An inventory, and an account you can become root with.
- A kernel with BTF for the modern eBPF driver, which current distribution kernels have. Standard can use the kernel module driver instead.
- The Falco .deb or .rpm URL from download.falco.org/packages, and its SHA-256.
What it creates
- Falco, installed without prompts, with the modern eBPF driver and automatic rules updates off
- Rules for a shell started by a network service, cloud credentials read by an unexpected program, and instance credentials fetched by a download tool
- JSON alerts to syslog
- A rule for new files in system binary folders, tunable lists, your own rules, a minimum priority, and a dry run of every rule before restart (Standard)
See the four alerts this creates
The code
Quick startReady
falco_package_url: ""playbook.yml, line 28falco_package_sha256: ""playbook.yml, line 29
ansible all -i inventory.ini -m ping
Proves Ansible can reach every machine before anything changes.ansible-playbook -i inventory.ini playbook.yml --check --diff
Shows each change it would make, line by line. Changes nothing.ansible-playbook -i inventory.ini playbook.yml
Makes the change.ansible-playbook -i inventory.ini playbook.yml
Run it once more. The recap should end with changed=0.
No inventory yet? A one-machine inventory.ini:
[all] web-01 ansible_host=10.0.0.11 ansible_user=ubuntu
Syntax passedAnsible lint passed
Last run 2026-10-02.
Open playbook.yml as plain text
StandardReady
ansible all -i inventory.ini -m ping
Proves Ansible can reach every machine before anything changes.ansible-playbook -i inventory.ini site.yml --check --diff
Shows each change it would make, line by line. Changes nothing.ansible-playbook -i inventory.ini site.yml
Makes the change.ansible-playbook -i inventory.ini site.yml
Run it once more. The recap should end with changed=0.
No inventory yet? A one-machine inventory.ini:
[all] web-01 ansible_host=10.0.0.11 ansible_user=ubuntu
Syntax passedAnsible lint passed
Last run 2026-10-02.
Open main.yml as plain text
Open main.yml as plain text
Open main.yml as plain text
Open main.yml as plain text
Open 50-iac-host.yaml.j2 as plain text
Open site.yml as plain text
HardenedReady
ansible all -i inventory.ini -m ping
Proves Ansible can reach every machine before anything changes.ansible-playbook -i inventory.ini site.yml --check --diff
Shows each change it would make, line by line. Changes nothing.ansible-playbook -i inventory.ini site.yml
Makes the change.ansible-playbook -i inventory.ini site.yml
Run it once more. The recap should end with changed=0.
No inventory yet? A one-machine inventory.ini:
[all] web-01 ansible_host=10.0.0.11 ansible_user=ubuntu
Syntax passedAnsible lint passed
Last run 2026-10-02.
Open guard.yml as plain text
Open settings.yml as plain text
Open site.yml as plain text
How to check it worked
curl -s http://169.254.169.254/ on a test cloud host, then journalctl -t falco shows the instance credentials alert.
A rule that does not compile stops Falco from starting, which ends detection on that host. Standard checks the new rules file with Falco before it replaces the old one, and loads everything with falco --dry-run before a restart. A bad rule fails the run, and the old file stays in place.
The allow lists are where rules go quiet. Keep them short, and review every addition like a firewall change.
How to undo it
Remove the falco package. Alerts already forwarded stay in the SIEM.
What it costs
Nothing to license. A few percent of CPU on busy hosts, depending on the rules loaded.
Good to know
- These are the Kubernetes template's ideas for servers outside a cluster. The same Falco default rules load underneath.
- Automatic rules updates are off, so the rules running are the ones reviewed. Update Falco's package on purpose to get new defaults.