Bug 490242 - telnetd exits after accepting connection when local hostname is not in dns
Summary: telnetd exits after accepting connection when local hostname is not in dns
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: telnet
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Adam Tkac
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-03-14 00:13 UTC by Bill Fenner
Modified: 2013-04-30 23:42 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-02 14:53:32 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
netkit-telnet-0.17-reallynodns.patch (2.57 KB, patch)
2009-03-14 00:13 UTC, Bill Fenner
no flags Details | Diff

Description Bill Fenner 2009-03-14 00:13:00 UTC
Created attachment 335181 [details]
netkit-telnet-0.17-reallynodns.patch

Description of problem:
telnetd exits, closing the incoming connection, when the local host name is not in the DNS.

Version-Release number of selected component (if applicable):
telnet-server-1:0.17-43.fc10.x86_64

How reproducible:
Always

Steps to Reproduce:
1. yum install telnet-server
2. vi /etc/xinetd.d/telnet and set disabled=no
3. chkconfig telnet restart
4. sudo hostname this-host-is-not-in-dns
5. telnet localhost
  
Actual results:
Connected to localhost.
Escape character is '^]'.
getaddrinfo: localhost Name or service not known
Connection closed by foreign host.

Expected results:
I expected to get a login prompt.


Additional info:

This problem was introduced by netkit-telnet-0.17-ipv6.patch, and is somewhat mitigated by netkit-telnet-0.17-nodns.patch.  The original netkit-telnet code simply ignores any kind of host lookup failure when trying to canonify the local hostname; the ipv6 patch switches to using getaddrinfo but does not actually use the results other than to exit with an error when the name server is unreachable or the host does not exist.  The nodns patch modifies the ipv6 patch to accept the case where the name server is unreachable but still exits if the host does not exist.  It retains the ipv6 patch's behavior of not canonifying the hostname.

In most modern configurations, the hostname is already canonical, so this code is extraneous.  In addition, the local hostname itself is very rarely used, whether it's canonical or not.  The name is used in auth_encrypt_init(), which appears to stash it in a global variable and never used again, and is used to substitute for \h or \n in /etc/issue.net.

I've attached a patch, netkit-telnet-0.17-reallynodns.patch, which:
1) Adds an argument, -N, to telnetd, to suppress this lookup, for an environment where, e.g., you don't care whether the name is fully canonical and you don't want to pay for the DNS resolution even if everything is OK; and
2) Restores the behavior of canonifying the hostname (e.g., bs23 -> bs23.aristanetworks.com) if -N is not specified (but continuing on with the gethostname() result if the lookup fails for any reason, as the original netkit code did).

Since it overlaps with both -ipv6.patch and -nodns.patch, I'd be happy to generate a new version that replaces one or both of those patch files instead of repeatedly patching the same set of lines.

Comment 1 Bill Fenner 2009-03-14 00:19:36 UTC
Forgot to demonstrate that the current version does not canonify the hostname. Here is what \h and \n are set to when running telnet-server-1:0.17-42.fc9.x86_64:


~/src/telnet-f11 @bs23> sudo hostname bs23
~/src/telnet-f11 @bs23> telnet localhost
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Fedora release 10 (Cambridge)
Kernel 2.6.28-0.116026.2006.Arora.fc10.x86_64 on an x86_64 (25)

My hostname is bs23
My name is bs23
login: 

After installing my patched version:

~/src/telnet-f11 @bs23> sudo rpm -U /RPMS/telnet-server.x86_64.rpm
~/src/telnet-f11 @bs23> telnet localhost
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Fedora release 10 (Cambridge)
Kernel 2.6.28-0.116026.2006.Arora.fc10.x86_64 on an x86_64 (25)

My hostname is bs23.aristanetworks.com
My name is bs23.aristanetworks.com
login:

Comment 2 Bug Zapper 2009-06-10 03:37:08 UTC
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Bug Zapper 2009-07-14 15:00:40 UTC
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 4 Bill Fenner 2009-07-14 15:11:15 UTC
Sorry for mis-filling the version field.  This applies to F10 (I tested against telnet-server-1:0.17-43.fc10.x86_64) and at the time of reporting I downloaded the srpm that was going into F11, and tested that on F10 and the behavior is the same.

Comment 5 Adam Tkac 2009-09-02 14:53:32 UTC
Thanks for the patch and detailed inspection about the problem.

Fixed in telnet-0.17-45.fc12. If you would like to have this issue fixed in F11 as well please reopen this bug.

Comment 6 Agroni 2010-04-21 18:22:24 UTC
Please port this bug fix to F11.

Please keep in mind that F11 is the last Fedora to support i586 CPUs. You can install F12 on i586. This means that F11 have to exist as long as i586 class Pentium cpus exist.

Comment 7 Agroni 2010-04-21 18:27:39 UTC
(In reply to comment #6)
> Please port this bug fix to F11.
> 
> Please keep in mind that F11 is the last Fedora to support i586 CPUs. You can
> install F12 on i586. This means that F11 have to exist as long as i586 class
> Pentium cpus exist.    

I meant to say you can't install F12 on i586 class Pentium.

Comment 8 Agroni 2010-04-21 18:32:36 UTC
This problem seems to be even greater on networks with consumer grade routers where there is no local DNS.


Note You need to log in before you can comment on or make changes to this bug.