A web server should accept HTTP/HTTPS from anywhere but SSH only from the office. Configure the firewall.
BeginnerScenarioNetworking, SSH and remote access
Answer
Situation read → Host firewall with an allowlist for SSH.
What I'd do → firewalld:
sudo firewall-cmd --permanent --add-service={http,https}
sudo firewall-cmd --permanent --remove-service=ssh
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.0/24" service name="ssh" accept'
sudo firewall-cmd --reload && sudo firewall-cmd --list-all
ufw: ufw allow 80,443/tcp && ufw allow from 203.0.113.0/24 to any port 22 proto tcp && ufw enable.
Why → Narrow SSH exposure removes most brute-force noise.
Interview tip → In the cloud, do the same in the security group and keep the host firewall as a second layer.
More on Networking, SSH and remote access
A key belonging to a departed engineer may be in `authorized_keys` on 300 servers. How do you rotate SSH keys across the fleet?IntermediateYou need to reach a database on a private subnet from your laptop through a bastion. How?BeginnerYour security team wants SSH hardened on all servers. What changes do you make?BeginnerA new server needs a static IP, gateway and DNS on RHEL 9. How do you configure it persistently?BeginnerYou're changing the network config of a remote server over SSH and could lose access. How do you protect yourself?IntermediateYour app servers need to reach the internet for updates but must not be reachable from it. How do you set it up on a Linux gateway?Intermediate