Howto Secure portmap service using iptables and TCP Wrappers under Linux

https:/‮.www/‬lautturi.com
Howto Secure portmap service using iptables and TCP Wrappers under Linux

Portmap is a server that converts RPC (Remote Procedure Call) program numbers into DARPA protocol port numbers. It is used by various programs, such as NFS (Network File System) and NIS (Network Information Service), to map RPC program numbers to the appropriate port numbers.

To secure the portmap service using iptables and TCP wrappers, you can follow these steps:

  1. Configure iptables to block all incoming traffic to the portmap service. This can be done by adding the following rule to the INPUT chain:
iptables -A INPUT -p tcp --dport 111 -j DROP

This will block all incoming traffic to the portmap service on TCP port 111.

  1. Configure TCP wrappers to allow only specific hosts to access the portmap service. To do this, add the following lines to the /etc/hosts.allow file:
portmap: 192.168.1.10
portmap: 192.168.1.11

This will allow only the hosts with IP addresses 192.168.1.10 and 192.168.1.11 to access the portmap service.

  1. Add a default deny rule to the /etc/hosts.deny file to block all other incoming traffic to the portmap service:
portmap: ALL

This will block all other incoming traffic to the portmap service, except for the hosts specified in the /etc/hosts.allow file.

By following these steps, you can secure the portmap service and prevent unauthorized access. It's important to note that you should carefully consider the hosts that you allow to access the portmap service, as it can potentially expose sensitive information about your system.

Created Time:2017-10-29 22:08:46  Author:lautturi