Tier 3: Get Alerted
Find out within minutes when someone tries to abuse the node.
Goal: if someone tries to abuse the node, you know about it within minutes, not weeks.
Tier 2 blocks attempts silently. This tier makes them loud. With Tier 2 in place, any alert from this tier, apart from the expected events listed in 3.1, is a strong sign that someone has broken into the node process. Treat it as an incident.
3.1 Log every program start by the node user
Install the Linux audit system:
sudo apt install auditd # Debian/Ubuntu (already installed on RHEL)
sudo systemctl enable --now auditdCreate the rule file (replace sonic if your user is named differently):
SONIC_UID=$(id -u sonic)
sudo tee /etc/audit/rules.d/sonic.rules > /dev/null <<EOF
# Any attempt by the node user to start a program (successful or blocked)
-a always,exit -F arch=b64 -S execve,execveat -F uid=$SONIC_UID -k sonic_exec
# The same through the 32-bit interface, which attackers use to slip past 64-bit-only rules
-a always,exit -F arch=b32 -S execve,execveat -F uid=$SONIC_UID -k sonic_exec
# Any change to the node binary or its config
-w /usr/local/bin/sonicd -p wa -k sonic_tamper
-w /etc/sonic -p wa -k sonic_tamper
EOF
sudo augenrules --loadAdjust the paths in the last two lines to your binary and config folder.
Validators: also watch the keystore, which shouldn't change once the signing key is in place. Add this line to /etc/audit/rules.d/sonic.rules (with your data folder) and run sudo augenrules --load again:
The /etc/sonic line already covers a password file there (Validator Node step 9). If you use an encrypted credential instead, add -w /etc/credstore.encrypted -p wa -k sonic_tamper too.
To see events:
Expected events (not alarms, but check that each one matches something you did):
One
sonic_execevent each time the service starts: that's the node itself starting.sonic_execevents when an admin runs a tool as the node user, e.g.sudo -u sonic sonictool ...for database maintenance. Write these down when you do them, so whoever reads the alert knows.sonic_tamperevents when you upgrade the node or change its config.
Anything else is an alarm: in particular any event showing /bin/sh, bash, curl, wget, python or res=no/EACCES (a blocked attempt).
3.2 Log blocked attempts to reach your private network
The block from Tier 2B drops traffic silently. This adds a matching firewall rule that also writes a log line for every blocked attempt.
Create the rules file:
Load it now and on every boot, using a small service so it doesn't interfere with ufw/firewalld:
To see blocked attempts:
3.3 Send alerts somewhere a human will see them
Logs on the server aren't enough. An attacker with enough access can delete them, and nobody reads them anyway. Pick one:
If you already have central logging (Loki, Elastic, Datadog, Splunk, CloudWatch, ...): forward the journal and
/var/log/audit/audit.log, and create alerts for:audit key
sonic_exec(other than the normal one-per-start event)audit key
sonic_tamperkernel log lines containing
SONIC-PIVOTthe node service stopping unexpectedly
If you don't, start simple: Appendix C has a script that posts new events to a Slack channel every 5 minutes. Then plan proper central logging.
3.4 Know what to do when an alert fires
Write this down now, and agree on who does what:
Isolate. Cut the server off from your internal network (cloud security group / switch port), but don't power it off.
Preserve evidence. Take a disk snapshot (and a memory snapshot if your platform supports it). Copy logs off the machine.
Find the entry point. Check your RPC proxy logs (Tier 4) for the requests just before the alert: source IP, client identity, method, request body.
Rotate everything the server could have touched: API keys, tokens, any credentials on or used by that machine.
Rebuild, don't clean. Reinstall the server from a known-good image and re-sync or restore the data folder from a trusted copy.
Tell the Sonic team at [email protected], so other operators can be warned.
Validators: assume the signing key is stolen. Someone with a copy can sign in your validator's name, and if they sign while your node does, that's double-signing. Change the steps above like this:
Stop the validator right after step 1, and make sure it can't start again:
sudo systemctl disable --now sonic.Tell the Sonic team at once, not at step 6, and follow their advice on the signing key.
Never run the old and the new server at the same time. In step 5, start the rebuilt validator only once the old one is stopped for good, and don't start it with a key that may be stolen until you've talked to the Sonic team.
The node may warn you first. A validator can stop itself when it receives a recent event signed with its key that it didn't create. Look for it in the log:
duplicating instance means another node is signing with your key: a forgotten second copy of your own validator (stop it), or a stolen key (an incident). After that, the node refuses to start with Node isn't allowed to start due to a previous error, until someone deletes the errlock file the message names. Don't delete it until you know which of the two it was.
✅ Tier 3 checklist
Last updated

