How to find the list of services supported by firewalld?
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
- Firewalld
Issue
- How to validate which services are supported by Firewalld in RHEL 7, 8, and 9?
Resolution
In RHEL firewalld is dynamic firewall manager that supports various services. you can list the services supported by firewalld using the following commands:
- The following command will display a list of all available predefined services that firewalld recognizes.
# firewall-cmd --get-services
RH-Satellite-6 RH-Satellite-6-capsule amanda-client amanda-k5-client amqp amqps apcupsd audit bacula bacula-client bgp bitcoin bitcoin-rpc bitcoin-testnet bitcoin-testnet-rpc ceph ceph-mon cfengine condor-collector ctdb dhcp dhcpv6 dhcpv6-client distcc dns docker-registry docker-swarm dropbox-lansync elasticsearch etcd-client etcd-server finger freeipa-ldap freeipa-ldaps freeipa-replication freeipa-trust ftp ganglia-client ganglia-master git gre high-availability http https imap imaps ipp ipp-client ipsec irc ircs iscsi-target isns jenkins kadmin kerberos kibana klogin kpasswd kprop kshell ldap ldaps libvirt libvirt-tls lightning-network llmnr managesieve matrix mdns minidlna mongodb mosh mountd mqtt mqtt-tls ms-wbt mssql murmur mysql nfs nfs3 nmea-0183 nrpe ntp nut openvpn ovirt-imageio ovirt-storageconsole ovirt-vmconsole plex pmcd pmproxy pmwebapi pmwebapis pop3 pop3s postgresql privoxy proxy-dhcp ptp pulseaudio puppetmaster quassel radius redis rpc-bind rsh rsyncd rtsp salt-master samba samba-client samba-dc sane sip sips slp smtp smtp-submission smtps snmp snmptrap spideroak-lansync squid ssh
#
- Run the following command to get detailed information about a specific service:
# firewall-cmd --info-service=samba
samba
ports: 137/udp 138/udp 139/tcp 445/tcp
protocols:
source-ports:
modules: netbios-ns
destination:
#
The above command will show details about the specified service, including the ports and protocols associated with it.
- The following command will check if a specific service is allowed through the firewall. It return yes if the service is allowed, and no if it is not.
# firewall-cmd --query-service=ssh
yes
#
- To add a service to the firewall rules run the following command This will immediately add the service to the runtime configuration. If you want to make the change permanent, you'll need to use the --permanent option as well.
# firewall-cmd --add-service=samba
success
#
Note : Remember to reload the firewall rules after making changes for them to take effect:
# firewall-cmd --reload
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments