4.1.7 Ensure firewalld services and ports are configured

Information

Services and ports can be accepted, explicitly rejected, or dropped by a zone.

For every zone, you can set a default behavior that handles incoming traffic that is not further specified. Such behavior is defined by setting the target of the zone. There are three options - ACCEPT REJECT and DROP

- ACCEPT - you accept all incoming packets except those disabled by a specific rule.
- REJECT - you disable all incoming packets except those that you have allowed in specific rules and the source machine is informed about the rejection.
- DROP - you disable all incoming packets except those that you have allowed in specific rules and no information sent to the source machine.

Note: The target may also be set to a fourth option, default The default target provides a convenient way to implement a "deny by default, allow by exception" policy within a firewalld zone, while still allowing essential ICMP traffic.

To reduce the attack surface of a system, all services and ports should be blocked unless required

NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance.

Solution

Run the following command to remove an unnecessary service:

# firewall-cmd --remove-service=<service>

Example :

# firewall-cmd --remove-service=cockpit

Run the following command to remove an unnecessary port:

# firewall-cmd --remove-port=<port-number>/<port-type>

Example :

# firewall-cmd --remove-port=25/tcp

Run the following command to make new settings persistent:

# firewall-cmd --runtime-to-permanent

See Also

https://workbench.cisecurity.org/benchmarks/24164

Item Details

Category: SECURITY ASSESSMENT AND AUTHORIZATION, SYSTEM AND COMMUNICATIONS PROTECTION

References: 800-53|CA-9, 800-53|SC-7, 800-53|SC-7(5), CSCv7|9.4

Plugin: Unix

Control ID: 032412a19ac54ab0e2b9f5ac2849bdfa95280455475537629406ba8f88041810