Firewall Service
Firewall Service
In Linux kernel there is (net filter) that is firewall functionality to manage it we use
firewalld and it is the default management interface.
To work with firewalld there is interfaces and each interface is mapped to zone
(private, public, home, DMZ)
We need to connect services to zones
To manage our firewalld setting we use two tools: firewall-config (GUI) and
firewall-cmd (CMD)
Using firewalld:
Package: firewalld
Firewall-zones:
Firewalls can be used to separate networks into different zones based on the level
of trust the user has. Each zone connected to a physical NIC from the Network
Manager Service.
Drop: Any incoming network packets are dropped, there is no reply (No ICMP
Notification). Only outgoing network connections are possible.
Block: Any incoming network connections are rejected with an icmp-host-
prohibited message for IPv4 and icmp6-adm-prohibited for IPv6. Only outgoing
network connections are possible.
Public: It is the default zone, for use in public areas. You do not trust the other
computers on the network to not harm your computer. Only selected incoming
connections are accepted.
External: For use on external networks with masquerading enabled especially for
routers. You do not trust the other computers on the network to not harm your
computer. Only selected incoming connections are accepted.
DMZ: For computers in your demilitarized zone that are publicly-accessible with
limited access to your internal network. Only selected incoming connections are
accepted. decided to place on the devices and traffic within that network.
Internal: For use on internal networks. You mostly trust the other computers on
the networks to not harm your computer. Only selected incoming connections are
accepted.
Note: the zone can have multiple interfaces because the zone is logical, but the
interface is physical.
[root@server ~]#firewall-cmd --get-services ==> to get the actual services that the
server is using either allowed or denied
[root@server ~]# firewall-cmd --get-icmptypes ==> ICMP protocol options
[root@server ~]#firewall-cmd set-default-zone (name of default zone) ==> to set
the default zone.
[root@srv1 ~]# firewall-cmd --add-interface=ens37 ==> add interface
[root@srv1 ~]# firewall-cmd --zone=internal --add-interface=ens37 –permanent
==> add interface to zone
[root@srv1 ~]# firewall-cmd --zone=internal --list-all
Note: we cannot change the configuration in this directory, we have to get copy of
the service and change it in the location /etc/firewalld/services/ directory.
Note: if we did not specify the zone it will take the default zone.
Note: everything that done with firewalld is not permanent, to make it permanent
we must do the following:
Removing rule:
[root@srv1 ~]# firewall-cmd --zone=public --remove-rich-rule='rule family=ipv4
source address=192.168.11.0/24 reject' --permanent
[root@srv1 ~]# firewall-cmd --reload