I have private network set up on a static ip, and I have configured my router at 192.168.1.1
to forward port XX to port 22 on my local server in order to allow ssh access. I am able to ssh in just fine with this configuration, but then I go to thinking -- why am I allowed to do this? I am fairly new to firewalld, but I found out that I can type sudo firewall-cmd --list-all-zones
, in order to see the various ports and services I have open in each of the zones.
However, to my dismay, even after removing the ssh service from all zones, and removing port 22 completely, I am still able to ssh to my local server over the internet by typing ssh -p XX paul@xxx.xxx.xx.xxx
.
I tried googling "how to completely disable ssh access using firewalld", but all of the results are referring to blocking the service except one or a few specific IPs. In order to test the security of my network, I want to be able to completely disallow ssh access to mny server. But given that port 22 and the ssh service are completely abset from my firewalld config, how come the firewall isn't working? Why am I still able to ssh in?
EDIT: here is the output when I type sudo firewall-cmd --list-all-zones
:
block
target: %%REJECT%%
icmp-block-inversion: no
interfaces:
sources:
services:
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
dmz
target: default
icmp-block-inversion: no
interfaces:
sources:
services:
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
drop
target: DROP
icmp-block-inversion: no
interfaces:
sources:
services:
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
external
target: default
icmp-block-inversion: no
interfaces:
sources:
services:
ports:
protocols:
masquerade: yes
forward-ports:
source-ports:
icmp-blocks:
rich rules:
home
target: default
icmp-block-inversion: no
interfaces:
sources:
services: mdns samba-client dhcpv6-client
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
internal
target: default
icmp-block-inversion: no
interfaces:
sources:
services: mdns samba-client dhcpv6-client
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s25 wlp3s0
sources:
services:
ports: 8545/tcp 5001/tcp 33/tcp
protocols: tcp udp
masquerade: no
forward-ports:
source-ports: 5001/tcp
icmp-blocks:
rich rules:
trusted
target: ACCEPT
icmp-block-inversion: no
interfaces:
sources:
services:
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
work
target: default
icmp-block-inversion: no
interfaces:
sources:
services: dhcpv6-client
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
As you can see, the ssh
service should not be available in any of my zones. And yet it works just fine. I assume that there is some assumption that port 22 is open by default, even though it is not explicit? Or am I missing something?
-Paul