INF-31Required
Close admin ports to the internet
Never open SSH, RDP, database or admin ports to the internet. Reach machines through an identity-aware tunnel or a private network that needs single sign-on.
How to do it
Use a tool that checks who you are before it opens a path. Examples are AWS Systems Manager Session Manager and Google Cloud IAP. A VPN such as Tailscale or WireGuard behind single sign-on also works. Log each session. On one rented server without such a tool, allow SSH only from fixed admin addresses, as in the host firewall rule. Admin pages inside the app need the same care, as Close debug and admin doors says.
Examples
Shell example
# From a machine outside your network
nmap -Pn -p 1-65535 --open shop.example.com
How to check
A port scan from outside of every public address finds only 80 and 443 open, plus 25 on mail servers.
Sources
Related rules
- INF-29 Keep databases in private subnets in Infrastructure and environments
- INF-47 Turn on a firewall on every host in Infrastructure and environments
- APS-64 Close debug and admin doors in Application security
- INF-48 Allow SSH with keys only in Infrastructure and environments
- IOT-23 Open no listening port the product does not need in Connected devices
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/infrastructure/networking-and-dns/no-public-admin-ports">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.