"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, tag@lists.linuxgazette.net
LinuxCare, http://www.linuxcare.com/


(?) Telnet gives: "Connection closed by foreign host..."

From Martin Osvaldo Mauri on Wed, 13 Oct 1999

Dear James:

I've had a problem with Red Hat 6.0 while trying to telnet from one machine to another. All the configurationfiles seems to be OK, but when I telnet, it gives me the message "connection closed by foreign host..."

Any suggestion? best regards,

Martin O. Mauri

(!) What does the syslog (/var/log/messages) say on the server?
This message indicates that the remote system is disconnecting you. Probably the remote system is enforcing some security or access policy, or you're missing a file (such as the /usr/sbin/in.telnetd program).
I'd look at the /etc/hosts.allow and /etc/hosts.deny files. I'd also look at the /etc/inetd.conf file.
In /etc/hosts.allow and hosts.deny there might be a set of rules specifying a list of services (such as in.telnetd). Each of these services can be associated with a list of host/domain and network address patterns. Entries in the hosts.allow are allowed to access the specified services while entries in the hosts.deny are disconnected (as you described). All attempts to access any service are logged.
There are two groups of network services for which access can be controlled through these two hosts files: those that are dynamically launched through the 'inetd' dispatcher (any lines that refer to /usr/sbin/tcpd), and any "standalone" services which are linked to the "libwrap" libraries (such as the portmapper daemon that's shipped with most Linux distributions).
At a guess I'd say that your problem is not related to entries in /etc/hosts.allow and /etc/hosts.deny. Most Linux distributions ship with those as empty files; they're just placeholders with comments.
It's more likely that you're actually missing your /usr/sbin/in.telnetd. This should show up in your logs as a message like: "unable to execute"
If that's the case: mount up your CD (on the server), change to the RPMS directory and type a command like:
rpm -Uvh telnet*.rpm
... that should install the telnet server and client. Red Hat 5.2 used to put those both in a single package. I don't remember if RH 6.0 split those into separate packages or not.
While you're thinking about this you should consider avoiding telnet, rsh, and other insecure protocols. They are not appropriate for use over untrusted networks. The telnet protocol transmits all information as "plain" text. This means that your passwords can be "sniffed" as you type them into your login and 'su' prompts.
We won't even get into the many problems posed by rsh/rlogin. Suffice it to say that these suffer from a very weak authentication model in addition to being "sniffable."
So, you may want to install a set of cryptographically secure tools for your remote access needs. 'ssh' is a secure (cryptographically enabled) program that works like rsh and rlogin. It's the most popular tool for this sort of work. There are also tools like STEL (secure telnet) and ssltelnet.
Most of these are freely available. ssh version 2 is only free for some forms of "personal use" while the older ssh version 1.2 is free for a broader interpretation of "personal use." STEL was developed by the Italian CERT (computer emergency response team) and is ...
I've talked about the many free cryptography tools available for Linux in a previous column (The Answer Guy 35: FS Security using Linux http://linuxgazette.net/issue35/tag/crypto.html)
I hope most of those links are still valid. Meanwhile let me assure you that the most useful site on the Internet for getting free crypto packages is still: Replay Associates (http://www.replay.com).

[ Replay Associates has moved to http://www.zedz.net/. Apparently ReplayTV really wanted the name they had :) -- Heather ]

They currently have one of my favorite Latin quotes on their web page:
"Quis custodiet ipsos custodes?"
Hope that helps.


Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 48 December 1999
HTML transformation by Heather Stern of Starshine Technical Services, http://www.starshine.org/


[ Answer Guy Current Index ] [ Index of Past Answers ] greetings 1 2 3 5
5 6 7 8 9
10 11 12 13 14 15 16 17 18
19 20 21 22 23 24 25 26 27
28 29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54
55 56 57


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Linux Gazette FAQ ] [ Next Section ]