Bare Metal Dedicated Server Network Hardening on openSUSE Leap

Use case and what you will change
This tutorial walks you through bare metal dedicated server network hardening on openSUSE Leap before you put the machine into production. You will keep SSH reachable, close anything unnecessary, verify both IPv4 and IPv6 access, and preserve a rollback path if a rule blocks you.
The sequence is straightforward: connect as root, confirm the OS, create a non-root admin, switch SSH to key-based access, enable firewalld, allow only the ports you need, test from a second terminal, and lock down root login only after the new account works. If you are choosing a server for this kind of workload, Hostperl’s dedicated server hosting is a practical fit when you need full control over firewall policy, routing, and network exposure.
This works well if you are launching a public app, moving off shared hosting, or cleaning up a server that was left too open during setup. For deeper storage planning on the same class of machine, see Dedicated Server ZFS Mirroring on Debian 12, which pairs well with the network hardening steps below.
Connect and confirm the operating system
On your local computer, connect to the server using the documented example IP first:
ssh root@203.0.113.10Replace 203.0.113.10 with the real public IP assigned to your server. If your provider gave you a non-root login by default, connect with that account instead, but keep the same IP address.
On the VPS as root, identify the operating system before you make any change:
cat /etc/os-releaseYou should see openSUSE Leap details in the output. If you are not on openSUSE Leap, stop here and use a guide written for your actual distribution. The commands below are specific to openSUSE Leap.
Create a non-root administrator before touching SSH policy
Keep the root session open. Open a second terminal so you can test the new account without locking yourself out.
On the VPS as root, create the admin user, set a password for emergency console use, and add it to the sudo-capable wheel group:
useradd -m -s /bin/bash deploy
passwd deploy
usermod -aG wheel deployNext, prepare the SSH directory and copy in your public key. Replace the example key file path with your own local public key file:
mkdir -p /home/deploy/.ssh
chmod 700 /home/deploy/.ssh
cat /root/.ssh/authorized_keys > /home/deploy/.ssh/authorized_keys
chown -R deploy:deploy /home/deploy/.ssh
chmod 600 /home/deploy/.ssh/authorized_keysIf you do not already have a root key on this server, append your local public key from your workstation with ssh-copy-id instead of manually copying files. The goal stays the same: key-based login for the new admin account.
On your local computer, open a second terminal and test the new login:
ssh deploy@203.0.113.10After you log in, confirm sudo works:
sudo -v
whoami
idYou should see deploy as the current user, and sudo should accept your password or key-backed auth. Do not disable root access yet.
Update packages and install the firewall tools
openSUSE Leap uses zypper. Update the package index and install firewalld if it is not already present.
On the VPS as root, run:
zypper refresh
zypper update -y
zypper install -y firewalldCheck the installed version and service status:
rpm -q firewalld
systemctl status firewalld --no-pagerIf the package is installed, you will see a version string. If the service is inactive, that is normal at this stage.
Enable firewalld with a safe allowlist
Before you start the firewall, decide which ports you actually need. For a typical dedicated server, that may be SSH and one application port or web service. In this tutorial, allow SSH first so you do not lose access, then add any application ports after you confirm the service is listening.
On the VPS as root, start and enable firewalld:
systemctl enable --now firewalldConfirm it is active:
firewall-cmd --stateAllow SSH on the default port before making any stricter changes:
firewall-cmd --permanent --add-service=ssh
firewall-cmd --reload
firewall-cmd --list-allYou should see ssh in the active services list. If you manage the server over a custom SSH port, add that port before you close the default one.
For a web workload, allow HTTP and HTTPS only if you are actually serving traffic:
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reloadFor an application listening on 8000, add the port directly:
firewall-cmd --permanent --add-port=8000/tcp
firewall-cmd --reloadThat order matters. Add the new allow rule first, test the service, and only then remove anything you no longer need.
Lock down SSH without cutting off your rescue path
Now that the firewall is in place, tighten SSH. openSUSE Leap commonly uses the OpenSSH daemon configuration in /etc/ssh/sshd_config. Make one change at a time and test after each change.
On the VPS as root, back up the current configuration and open the file:
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
vi /etc/ssh/sshd_configSet or confirm these lines inside the file:
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
KbdInteractiveAuthentication noSave and exit the editor.
Before reloading SSH, validate the syntax:
sshd -tNo output means the syntax is valid. If you see an error, fix it before continuing.
Reload the daemon, not a full restart, so you preserve the active session while the new config loads:
systemctl reload sshdOn your local computer, open a fresh terminal and test the new login as the non-root admin:
ssh deploy@203.0.113.10Then confirm sudo still works from that session:
sudo whoamiIf the SSH login fails, keep the original root session open and check the server-side logs before you change anything else.
Verify the active network posture
At this stage, you want three things: SSH is listening, the firewall allows only the ports you intended, and the service is reachable from the client side.
On the VPS as the non-root sudo user, inspect listening sockets:
sudo ss -tulpnLook for sshd on port 22 or your chosen SSH port. If you also exposed a web or application port, confirm it appears here too.
Check the firewall rules again:
sudo firewall-cmd --list-allFrom your local computer, test the server port directly. For SSH, you can use:
nc -vz 203.0.113.10 22If port 22 is open, the connection test should succeed. If you use a custom SSH port, replace 22 with that port number.
IPv4 and IPv6 checks on a bare metal server
Many dedicated servers ship with both IPv4 and IPv6 connectivity. If your server has IPv6 assigned, test it explicitly. Network hardening is incomplete if you secure only one stack.
On the VPS as the non-root sudo user, inspect addresses:
ip addr showThen review routes:
ip route
ip -6 routeIf you have an IPv6 address and want SSH to listen on it as well, verify that sshd is bound as expected and that your firewall allows the service on the IPv6 side too. firewalld handles IPv4 and IPv6 together when you use service rules.
For routing problems that appear before the firewall is even involved, the Hostperl article Fix Server Connectivity on Debian 12 with Routing Tests is a useful companion reference. The commands differ there, but the diagnostic logic is the same.
Optional hardening for public-facing servers
If this bare metal dedicated server will sit on the public internet, a few extra controls are worth adding.
First, keep patching on a schedule. On openSUSE Leap, use a maintenance window and update regularly:
sudo zypper refresh
sudo zypper updateSecond, review recent auth activity when you suspect failed logins or brute-force traffic:
sudo journalctl -u sshd --since "24 hours ago"
sudo journalctl -u firewalld --since "24 hours ago"Third, if you run a control panel or an application stack later, expand the firewall deliberately instead of opening broad ranges. That is the difference between a working server and one that stays manageable after the first incident.
Rollback and recovery if you lock yourself out
If SSH stops responding after a config change, do not keep guessing. Use the original root console session if it is still open, or the provider’s remote console/IPMI access if your server includes it. Hostperl’s dedicated server plans are built for these operational realities, especially when remote recovery matters more than convenience.
On the VPS as root, restore the SSH backup if needed:
cp /etc/ssh/sshd_config.bak /etc/ssh/sshd_config
sshd -t
systemctl reload sshdIf the firewall is the problem, temporarily stop it only long enough to recover access:
systemctl stop firewalldThen correct the rules, re-enable it, and test again:
systemctl start firewalld
firewall-cmd --list-allDo not leave the firewall disabled. The stopgap exists only to recover, not to stay online permanently.
Final verification and reboot check
Before you call the server ready, verify that the policy survives a reboot and that the services come back cleanly.
On the VPS as the non-root sudo user, run:
sudo systemctl status sshd --no-pager
sudo systemctl status firewalld --no-pager
sudo rebootAfter the machine comes back, reconnect from your local computer:
ssh deploy@203.0.113.10Then confirm the user, sudo rights, and firewall state:
whoami
sudo firewall-cmd --state
sudo ss -tulpnIf all three checks pass, the server is in a safer production state. SSH is restricted, only the needed ports are exposed, and you have a non-root path for ongoing administration.
If you are setting up a new production host, Hostperl can supply the right platform for this workflow with dedicated server hosting or a more controlled self-managed dedicated server.
That gives you room to harden the network properly, keep recovery options available, and run your stack without sharing resources with unrelated tenants.
FAQ
Should I disable root login immediately?
No. Keep the root session open until you have confirmed that the new admin account can log in and use sudo from a second terminal.
What port should I open first?
Open SSH first so you do not lose management access. Add application ports only after you confirm the service is listening and reachable.
Does firewalld protect both IPv4 and IPv6?
Yes, when you use service and port rules correctly. You should still test both address families if your provider has assigned IPv6.
What if sshd will not reload?
Run sshd -t to check the syntax, restore the backup if needed, and review journalctl -u sshd for the exact error.
Can I use this on another Linux distribution?
The security model is the same, but the package manager, firewall commands, and service details differ. This tutorial is written for openSUSE Leap only.
