I use this script to set up my firewall. I expected to have ssh access from only one IP but that is not the case after testing. What is missing?
#!/bin/bash
#
# Reset to initial install of firewalld
#
rm -f /etc/firewalld/zones/*
firewall-cmd --complete-reload
firewall-cmd --runtime-to-permanent
firewall-cmd --reload
#
# Create / Setup custom zone
#
firewall-cmd --new-zone calzone --permanent
firewall-cmd --reload
firewall-cmd --zone=calzone --add-service={ssh,dhcpv6-client}
firewall-cmd --zone=calzone --add-source=10.0.0.177
firewall-cmd --change-interface enp1s0 --zone calzone --permanent
firewall-cmd --runtime-to-permanent
firewall-cmd --reload
When I run: firewall-cmd --get-active-zones I get the following
calzone
interfaces: enp1s0
sources: 10.0.0.177
It was my understanding that setting the interface would direct all traffic from that interface to that zone first and since there are entries in the sources the traffic would be limited to those IPs. Thanx in advance.
In response to Nasir's comment this command firewall-cmd --list-all-zones | sed -n '/calzone/,/rich/p' produces:
calzone (active)
target: default
icmp-block-inversion: no
interfaces: enp1s0
sources: 10.0.0.177
services: dhcpv6-client ssh
ports:
protocols:
forward: no
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
I also restarted the deamon firewalld and could ssh from 10.0.0.188 I expected access only from 10.0.0.177