[P1] SSH root login — harden with dedicated keypair and from= restriction #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
inventory.ymlusesansible_user: rootwith a shared personal key (id_rsa). UniFi OS only exposes root over SSH so the user cannot be changed, but the key exposure can be significantly hardened.Steps
1. Generate a dedicated keypair just for this automation:
2. Restrict the key in
/root/.ssh/authorized_keyson the UDMP:Replace
192.168.1.Xwith your Ansible machine LAN IP. Key is useless from any other source IP.3. Update
inventory.yml:4. Update
playbooks/config-nextdns.yml:Add
become: false— already root, escalation behaves unexpectedly on UniFi OS.Files:
inventory.yml,playbooks/config-nextdns.yml