Information
Web servers provide the ability to host web site content.
Unless there is a local site approved requirement to run a web server service on the system, web server packages should be removed to reduce the potential attack surface.
Solution
Run the following commands to stop httpd.socket and httpd.service and remove the httpd package:
# systemctl stop httpd.socket httpd.service
# dnf remove httpd
Run the following commands to stop nginx.service and remove the nginx package:
# systemctl stop nginx.service
# dnf remove httpd nginx
- OR -
- IF - a package is installed and is required for dependencies:
- IF - the httpd package is required for dependencies:
Run the following commands to stop and mask httpd.socket and httpd.service :
# systemctl stop httpd.socket httpd.service
# systemctl mask httpd.socket httpd.service
- IF - the nginx package is required for dependencies:
Run the following commands to stop and mask nginx.service :
# systemctl stop nginx.service
# systemctl mask nginx.service
Note: Other web server packages may exist. If not required and authorized by local site policy, they should also be removed. If the package is required for a dependency, the service and socket should be stopped and masked.
Impact:
Removal of a web server's package, or changing the state of its service and/or socket, will prevent the server from hosting web services.
- IF - a web server package is required for a dependency, any related service or socket should be stopped and masked.
Note: If the remediation steps to mask a service are followed and that package is not installed on the system, the service and/or socket will still be masked. If the package is installed due to an approved requirement to host a web server, the associated service and/or socket would need to be unmasked before it could be enabled and/or started.