Multiple ssh's running protected by tcpwrappers -- but nmap reports different results
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Multiple ssh's running protected by tcpwrappers -- but nmap reports different results
I have two Ubuntu 8.04 boxes, called BoxA and BoxB. These boxes are connected on a LAN whose network is 192.168.1.0/24. Each box runs two ssh daemons that are bound to ports 22 and 2222. On both boxes, tcpwrappers is running, and each box's /etc/hosts.allow look like:
ALL: 127.0.0.1, localhost, 192.168.1.0/24 : ALLOW
On each box, /etc/hosts.deny looks like:
All: PARANOID
ALL: ALL
From BoxA, sudo namp -A -p22,2222 localhost yields:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1.2 (protocol 2.0)
2222/tcp open tcpwrapped
Also from BoxA, sudo nmap -A -p22,2222 BoxB yields
PORT STATE SERVICE VERSION
22/tcp open tcpwrapped
2222/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1.2 (protocol 2.0)
Notice how the reported service is flipped between ssh and tcpwrapped.
Now, from BoxB, sudo nmap -A -p22,2222 localhost yeilds
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1.2 (protocol 2.0)
2222/tcp open tcpwrapped
Again from BoxB, sudo nmap -A -p22,2222 BoxA yeilds
PORT STATE SERVICE VERSION
22/tcp open tcpwrapped
2222/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1.2 (protocol 2.0)
So I observe the same flipping behaviour from each box. What I don't understand is, why does nmap report one port as tcpwrapped, and the other as ssh with a complete version number? Any does it make any difference whether the scan is local or remote?
Ideally, I'd like nmap to show both ports 22 and 2222 as tcpwrapped on both boxes. How can that be done?
Running nmap against your loopback device is generally a useless exercise.
Let's back up a moment -- in spite of what nmap says when being run from another box, have you confirmed that both sshd daemons (i.e. the one listening on tcp 22 and the one listening on tcp 2222) are indeed protected by tcp wrappers? You can check this, for example, by temporarily adding B to A's deny list. Check both daemons.
Problem solved. I had /etc/inetd.conf misconfigured on both boxes. Now they are fixed and I'm getting everything I wanted. nmap reports that the ports are open, but are tcpwrapped.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.