How can I only allow SSH from my country and block it on the firewall for everyone else?

Overview

This guide outlines the procedure for restricting SSH access to specific countries using the Juggernaut Firewall. By leveraging geolocation filtering, you can permit port 22 traffic exclusively from designated regions while blocking all other global sources.

Prerequisites

Configuration Steps

  1. Navigate to Juggernaut Firewall -> Settings -> Geolocation Settings and enter your MaxMind license key.
  2. Proceed to Juggernaut Firewall -> Settings -> Login Failure Daemon -> Country Settings.
  3. In the Allow countries to ports field, select or enter the target country/countries.
  4. Add port 22 to the Allow countries to TCP ports field.
  5. Click Update to apply the geolocation rules.
  6. Click Restart to reload the firewall and login failure daemon services.
  7. Navigate to Juggernaut Firewall -> Settings -> Firewall -> Port Settings.
  8. Remove port 22 from both the TCP in and TCP6 in fields to block unrestricted global access.
  9. Click Update to save the port configuration.
  10. Click Restart to apply the final firewall rules.

Troubleshooting & Common Issues

  • Locked Out of SSH: If you lose connectivity, verify that your IP address remains whitelisted. Use the provider's rescue console or out-of-band management interface to restore access.
  • Geolocation Mismatch: Ensure the MaxMind database is up to date. Incorrect country routing may occur if your ISP uses shared or misrouted IP blocks.
  • Rule Conflicts: Confirm that no other firewall rules explicitly allow port 22 globally, as they may override geolocation restrictions.
  • ssh, country
  • 1 A felhasználók hasznosnak találták ezt
Hasznosnak találta ezt a választ?

Kapcsolódó cikkek

Where are the configuration files for Juggernaut Firewall located?

Configuration files are located in the /etc/csf/ directory with the main firewall configuration...

Can I use Juggernaut Firewall to block Wordpress bruteforce attacks?

Yes we support blocking attacks like these very easily. See below for more information: How can...

How can I install or upgrade the extension?

We provide free installation and configuration for all our paid licenses. Open a support ticket...

How can I change the interface language of the extension?

Overview This article provides instructions on how to change the interface language within the...

How can I get detailed help about a specific setting?

Overview This article outlines how to access contextual assistance and detailed configuration...