第 8 章 Securing network services
Learn how to harden and monitor network services to protect your system against various risks. Turning off unused services helps limit exposure.
Red Hat Enterprise Linux supports many different types of network servers. Their network services can expose the system to various kinds of attacks, such as denial-of-service (DoS), distributed denial-of-service (DDoS), script vulnerability, and buffer overflow attacks.
To increase system security against attacks, it is crucial to monitor the active network services you use. For example, when a network service runs on a machine, its daemon listens for connections on network ports, which can reduce security. To limit network exposure to attacks, turn off all unused services, ports, and networking capabilities.
8.1. Securing the rpcbind service 复制链接链接已复制到粘贴板!
You can secure rpcbind by restricting access to all networks and defining specific exceptions by using firewall rules on the server.
The rpcbind service is a dynamic port-assignment daemon for remote procedure calls (RPC) services such as Network Information Service (NIS) and Network File System (NFS). Because it has weak authentication mechanisms and can assign a wide range of ports for the services it controls, it is important to secure rpcbind.
-
The
rpcbindservice is required onNFSv3servers. -
The
rpcbindservice is not required onNFSv4.
Prerequisites
-
The
rpcbindpackage is installed. -
The
firewalldpackage is installed and the service is running.
Procedure
Add firewall rules, for example:
Limit TCP connection and accept packages only from the
192.168.0.0/24host via the111port:# firewall-cmd --add-rich-rule='rule family="ipv4" port port="111" protocol="tcp" source address="192.168.0.0/24" invert="True" drop'Limit TCP connection and accept packages only from local host via the
111port:# firewall-cmd --add-rich-rule='rule family="ipv4" port port="111" protocol="tcp" source address="127.0.0.1" accept'Limit UDP connection and accept packages only from the
192.168.0.0/24host via the111port:# firewall-cmd --permanent --add-rich-rule='rule family="ipv4" port port="111" protocol="udp" source address="192.168.0.0/24" invert="True" drop'To make the firewall settings permanent, use the
--permanentoption when adding firewall rules.
Reload the firewall to apply the new rules:
# firewall-cmd --reload
Verification
List the firewall rules:
# firewall-cmd --list-rich-rule rule family="ipv4" port port="111" protocol="tcp" source address="192.168.0.0/24" invert="True" drop rule family="ipv4" port port="111" protocol="tcp" source address="127.0.0.1" accept rule family="ipv4" port port="111" protocol="udp" source address="192.168.0.0/24" invert="True" drop