Don't Refresh Every Group Member: A Firewall Lockout Postmortem
A script that mirrored the firewall's own 'refresh every group member' logic broke the root account's SSH access, because the config file didn't match what was on disk.

Key Architectural Takeaways
- Looping over every member of a group included root, whose SSH key existed only on disk, never in the config file.
- The firewall itself, DHCP, routing and rules were unaffected; the damage was limited to one account's access.
- Fix it through the product's own config path (the GUI), not the filesystem, so it survives the next reload.
The task
We needed to restore a service account's administrator privileges on the firewall. The firewall's own web interface does this by changing group membership and then refreshing every affected user.
What went wrong
Our script copied that behavior: add the account to the group, then refresh every member of the group. One member was root. The refresh rewrites each user's SSH keys and password hash from what the firewall's configuration file records. Root's key had been added directly on disk during the original setup and was never recorded in the configuration. The refresh found nothing to write, and deleted the key.
What was still fine
- The firewall was healthy: routing, rules and DHCP unaffected.
- The configuration file was never overwritten, because the script stopped on an unrelated warning before saving, and a pre-change copy existed.
- The service account's own access still worked, and it was the one we used to check all of this, read-only.
Why we stopped
With root's keys gone and no other privileged path, the only options were improvised privilege escalation on a live firewall, or physical access. We stopped and wrote it up instead of searching for a clever way around our own mistake.
The resolution
The owner was still logged in to the web interface as the real administrator. Using the product's normal user-management screens, the account's group membership and password were set the supported way, and persisted to the configuration. Later, the SSH keys were added back through that same screen. Doing it through the configuration means the next reload regenerates them, where a hand edit of the key file would have been wiped again.
Lessons
- Scope configuration-sync operations to the one account you are changing.
- The configuration file is the source of truth, and the filesystem is regenerated from it.
- We left password login enabled on that one host as a recovery backstop, a conscious exception to our key-only rule, because it is the machine we have the least convenient way to reach in person.