From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020607 Description of problem: The portmap daemon does not terminate its search of the hosts.deny table on the first match. For example, given the following lines in hosts.deny: # silently deny access to nessus scanner portmap : 192.168.1.100 # Deny access to everyone and send an email alert. portmap : ALL : \ spawn ( echo "Failed %d attempt from %h (%a) on server %H (%A)" \ | /bin/mail -s "******** TCPWRAPPER ALERT ********" root) & an email alert is still generated after receiving a connection to the portmapper from 192.168.1.100. I can verify that both rules are being processed by changing the first line to also send an email alert, in which case I would receive two email alerts per connection. I have found that if I rebuild the portmap source rpm without including the patch portmap-4.0-cleanup.patch, then this problem does not occur when using the rebuilt package. Version-Release number of selected component (if applicable): 4.0-35 How reproducible: Always Steps to Reproduce: 1. add two portmap lines in /etc/hosts.deny that match a given host, doing nothing in the first line but sending an email alert in the second line. 2. initiate a connection to the portmap daemon from the host being denied by the first line 3. check email Actual Results: I recevied an email alert resulting from the portmap connection. Expected Results: An email alert should not have been generated. Additional info: I have also tried using portmap-4.0-45 from rawhide, and the problem still exists there. I am using tcp_wrappers-7.6-18.
Created attachment 91283 [details] fixed logic in consoluting access control lists The correct behavior is achieved by reversing the logic in the good_client() function in pmap_check.c. When consoluting the access control lists using the hosts_ctl() function from libwrap.a, rather than good_client() returning 1 when getting a non-zero result from hosts_ctl, then returning zero if it gets to the end, it should return zero when it gets a zero result from hosts_ctl, then return 1 if it gets to the end. That way a client connection is refused if any of its IP, hostname, or alias is being denied in the host access control files. As the function currently exists, all three host representations must be explicitly denied for the connection to be rejected.
On second thought, this approach does not achieve the correct behavior, it just reverses it. With this patch, all three host representations (IP, hostname, aliases) must be explicitly allowed for a connection to be accepted. In any case, it would be preferable to just not apply the portmap-4.0-cleanup patch, and return to filtering connections only by IP address, as is described in the portmap documentation.
Raising priority to high since this bug results in host access control table rules being ignored, and is still present in RH9.
OK, here's what happens. portmap uses the host_ctl() function provided by the tcp_wrappers package to check the allow and deny lists, and it does the check in parts, like this: 1. It checks the IP address of the client. If access is allowed, it stop there. 2. It check the canonical hostname associated with the IP address of the client. If access is allowed, it stop there. 3. It checks each alias name associated with the IP address of the client. It stops if one of them is allowed access. 4. If it runs out of aliases, access is not allowed. As you can see, even with an IP address rule in place, subsequent checks against the name and aliases may reach the ANY rule. In order to keep the ANY rule from being hit in /etc/hosts.deny, you'll need to put the IP address and the DNS name and all DNS aliases of the client IP address in rules before the ANY rule. You can put them all in one rule as a comma-separated list.
Red Hat apologizes that these issues have not been resolved yet. We do want to make sure that no important bugs slip through the cracks. Red Hat Linux 7.3 and Red Hat Linux 9 are no longer supported by Red Hat, Inc. They are maintained by the Fedora Legacy project (http://www.fedoralegacy.org/) for security updates only. If this is a security issue, please reassign to the 'Fedora Legacy' product in bugzilla. Please note that Legacy security update support for these products will stop on December 31st, 2006. If this is not a security issue, please check if this issue is still present in a current Fedora Core release. If so, please change the product and version to match, and check the box indicating that the requested information has been provided. If you are currently still running Red Hat Linux 7.3 or 9, please note that Fedora Legacy security update support for these products will stop on December 31st, 2006. You are strongly advised to upgrade to a current Fedora Core release or Red Hat Enterprise Linux or comparable. Some information on which option may be right for you is available at http://www.redhat.com/rhel/migrate/redhatlinux/. Any bug still open against Red Hat Linux 7.3 or 9 at the end of 2006 will be closed 'CANTFIX'. Again, if this bug still exists in a current release, or is a security issue, please change the product as necessary. We thank you for your help, and apologize again that we haven't handled these issues to this point.
Red Hat Linux 7.3 and Red Hat Linux 9 are no longer supported by Red Hat, Inc. f you are currently still running Red Hat Linux 7.3 or 9, you are strongly advised to upgrade to a current Fedora Core release or Red Hat Enterprise Linux or comparable. Some information on which option may be right for you is available at http://www.redhat.com/rhel/migrate/redhatlinux/. Closing as CANTFIX.