Socat and Ncat
I needed to determine whether
User
Datagram Protocol (UDP) datagrams were being transmitted through a firewall
on specific ports. I had a Windows system behind the firewall and a
Linux system on the outside of the firewall. I intended to use
Ncat on both systems. I installed
Nmap on the Windows system, since it provides
the Ncat utility. But when I tried to install Ncat on the Linux system,
I
encountered problems, so I installed
socat, instead, since it
provides similar capabilities.
Since I needed to test whether UDP datagrams would reach the Windows
system on port 27900, I issued the command ncat -u 27900 -l
to have ncat listen (the "-l" argument) on UDP port 27900 (the -u 27900
argument). I then issued the command socat - udp-sendto:192.168.0.3:27900
on the Linux system. The - udp-sendto:192.168.0.3
allowed me to send data from the system socat was running on to
the the destination address 192.168.0.3. I was then able to type text,
e.g. the words "a test" on the Linux system. I saw them appear on the Windows
system indicating the firewall rule was functioning as needed.
Linux Sending System
$ socat - udp-sendto:192.168.2.3:27900
a test
Windows Listening System
C:\Program Files\Network\Nmap>ncat -u 27900 -l
a test
I then terminated the socat program on the Linux system with
Ctrl-D and the ncat program on the Windows system with
Ctrl-C.
References:
-
Nmap
-
socat
dest-unreach.org
-
socat - Multipurpose relay (SOcket CAT)
Linux Man Pages Manual
Documentation for Linux / Solaris / UNIX / BSD
[/network/tools/scanning/socat]
permanent link
Ncat and Glibc
I wanted to install
Ncat on a CentOS
Linux system to test firewall rules. I intended to run Ncat on a Windows
system behind the firewall to listen for UDP connections while using
Ncat on the Linux system outside the firewall to send data to the Windows
system through the firewall. I downloaded the Windows version of
Nmap, which also provides the command line
Ncat tool. I had no problems installing and running it on the Windows system.
However, when I downloaded the Linux RPM for Ncat from the Nmap site and
tried to install it, I encountered problems.
# rpm --install ncat-4.85BETA7-1.x86_64.rpm
error: Failed dependencies:
libc.so.6(GLIBC_2.7)(64bit) is needed by ncat-4.85BETA7-1.x86_64
Yet, when I checked the system for the presence of libc.so.6,
I found it was present.
# locate libc.so
/lib/libc.so.6
/lib/i686/nosegneg/libc.so.6
/lib64/libc.so.6
/usr/lib/libc.so
/usr/lib/i386-redhat-linux4E/lib/libc.so
/usr/lib/x86_64-redhat-linux4E/lib64/libc.so
/usr/lib64/libc.so
I checked to see what package provided the file.
# rpm -qf /lib/libc.so.6
glibc-2.5-24
# rpm -qf /lib64/libc.so.6
glibc-2.5-24
When I checked the package, there appeared to be two glibc-2.5-24 packages
present, since when I ran the command rpm -qi glibc-2.5-24,
I saw the package listed twice, but with different sizes
# rpm -qi glibc-2.5-24
Name : glibc Relocations: (not relocatable)
Version : 2.5 Vendor: CentOS
Release : 24 Build Date: Fri 23 May 2008 10:40:42 PM EDT
Install Date: Tue 29 Jul 2008 10:03:15 AM EDT Build Host: builder15.centos.org
Group : System Environment/Libraries Source RPM: glibc-2.5-24.src.rpm
Size : 11590290 License: LGPL
Signature : DSA/SHA1, Sun 15 Jun 2008 09:51:20 AM EDT, Key ID a8a447dce8562897
Summary : The GNU libc libraries.
Description :
The glibc package contains standard libraries which are used by
multiple programs on the system. In order to save disk space and
memory, as well as to make upgrading easier, common system code is
kept in one place and shared between programs. This particular package
contains the most important sets of shared libraries: the standard C
library and the standard math library. Without these two libraries, a
Linux system will not function.
Name : glibc Relocations: (not relocatable)
Version : 2.5 Vendor: CentOS
Release : 24 Build Date: Fri 23 May 2008 11:12:28 PM EDT
Install Date: Tue 29 Jul 2008 10:03:26 AM EDT Build Host: builder15.centos.org
Group : System Environment/Libraries Source RPM: glibc-2.5-24.src.rpm
Size : 12579066 License: LGPL
Signature : DSA/SHA1, Sun 15 Jun 2008 09:51:20 AM EDT, Key ID a8a447dce8562897
Summary : The GNU libc libraries.
Description :
The glibc package contains standard libraries which are used by
multiple programs on the system. In order to save disk space and
memory, as well as to make upgrading easier, common system code is
kept in one place and shared between programs. This particular package
contains the most important sets of shared libraries: the standard C
library and the standard math library. Without these two libraries, a
Linux system will not function.
I tried updating the package.
# yum upgrade glibc
Loading "priorities" plugin
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* rpmforge: fr2.rpmfind.net
* base: mirror.anl.gov
* updates: ftp.lug.udel.edu
* addons: centos.aol.com
* extras: ftp.lug.udel.edu
338 packages excluded due to repository priority protections
Setting up Upgrade Process
Resolving Dependencies
--> Running transaction check
---> Package glibc.i686 0:2.5-34 set to be updated
--> Processing Dependency: glibc-common = 2.5-34 for package: glibc
--> Processing Dependency: glibc = 2.5-24 for package: glibc-devel
--> Processing Dependency: glibc = 2.5-24 for package: glibc-devel
--> Processing Dependency: glibc = 2.5-24 for package: glibc-headers
---> Package glibc.x86_64 0:2.5-34 set to be updated
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.5-34 set to be updated
---> Package glibc-common.x86_64 0:2.5-34 set to be updated
---> Package glibc-devel.x86_64 0:2.5-34 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Updating:
glibc x86_64 2.5-34 base 4.7 M
glibc i686 2.5-34 base 5.2 M
glibc-common x86_64 2.5-34 base 16 M
Updating for dependencies:
glibc-devel x86_64 2.5-34 base 2.4 M
glibc-headers x86_64 2.5-34 base 589 k
Transaction Summary
=============================================================================
Install 0 Package(s)
Update 5 Package(s)
Remove 0 Package(s)
Total download size: 29 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): glibc-devel-2.5-34 100% |=========================| 2.4 MB 00:04
(2/5): glibc-common-2.5-3 100% |=========================| 16 MB 00:32
(3/5): glibc-headers-2.5- 100% |=========================| 589 kB 00:01
(4/5): glibc-2.5-34.i686. 100% |=========================| 5.2 MB 00:09
(5/5): glibc-2.5-34.x86_6 100% |=========================| 4.7 MB 00:08
Running rpm_check_debug
ERROR with rpm_check_debug vs depsolve:
Package glibc-devel needs glibc = 2.5-24, this is not available.
Package glibc-devel needs glibc = 2.5-24, this is not available.
Package glibc-devel needs glibc-headers = 2.5-24, this is not available.
Package glibc-devel needs glibc-headers = 2.5-24, this is not available.
Complete!
When I ran rpm -qi glib afterwards, I saw version 2.5-24 still
listed. I tried yum update glibc as well, though I didn't
expect the results to be different; they weren't. I then checked for
glibc files in the yum cache. There appeared to be both 32-bit and 64-bit
versions present.
# ls /var/cache/yum/base/packages/glibc*
/var/cache/yum/base/packages/glibc-2.5-24.i686.rpm
/var/cache/yum/base/packages/glibc-2.5-24.x86_64.rpm
/var/cache/yum/base/packages/glibc-2.5-34.i686.rpm
/var/cache/yum/base/packages/glibc-2.5-34.x86_64.rpm
/var/cache/yum/base/packages/glibc-common-2.5-24.x86_64.rpm
/var/cache/yum/base/packages/glibc-common-2.5-34.x86_64.rpm
/var/cache/yum/base/packages/glibc-devel-2.5-24.i386.rpm
/var/cache/yum/base/packages/glibc-devel-2.5-24.x86_64.rpm
/var/cache/yum/base/packages/glibc-devel-2.5-34.x86_64.rpm
/var/cache/yum/base/packages/glibc-headers-2.5-24.x86_64.rpm
/var/cache/yum/base/packages/glibc-headers-2.5-34.x86_64.rpm
I removed all of them from the yum cache with rm -f
/var/cache/yum/base/packages/glibc*. When I tried
yum update glibc again, however, the results
were the same.
I checked the arch of the installed glibc packages.
# rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n'|grep glibc
glibc-devel-2.5-24.x86_64
compat-glibc-headers-2.3.4-2.26.x86_64
compat-glibc-2.3.4-2.26.i386
glibc-devel-2.5-24.i386
compat-glibc-2.3.4-2.26.x86_64
glibc-2.5-24.x86_64
glibc-2.5-24.i686
glibc-common-2.5-24.x86_64
glibc-headers-2.5-24.x86_64
I did have 32-bit and 64-bit versions installed. I decided to try
listing all of the glibc packages for the yum update command.
That worked much better.
# yum update glibc glibc-common glibc-devel glibc-headers
Loading "priorities" plugin
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* rpmforge: fr2.rpmfind.net
* base: mirrors.rit.edu
* updates: ftp.lug.udel.edu
* addons: ftp.lug.udel.edu
* extras: ftp.lug.udel.edu
338 packages excluded due to repository priority protections
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package glibc.x86_64 0:2.5-34 set to be updated
---> Package glibc-headers.x86_64 0:2.5-34 set to be updated
---> Package glibc-devel.i386 0:2.5-34 set to be updated
---> Package glibc-common.x86_64 0:2.5-34 set to be updated
---> Package glibc-devel.x86_64 0:2.5-34 set to be updated
---> Package glibc.i686 0:2.5-34 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Updating:
glibc x86_64 2.5-34 base 4.7 M
glibc i686 2.5-34 base 5.2 M
glibc-common x86_64 2.5-34 base 16 M
glibc-devel i386 2.5-34 base 2.0 M
glibc-devel x86_64 2.5-34 base 2.4 M
glibc-headers x86_64 2.5-34 base 589 k
Transaction Summary
=============================================================================
Install 0 Package(s)
Update 6 Package(s)
Remove 0 Package(s)
Total download size: 31 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): glibc-devel-2.5-34 100% |=========================| 2.0 MB 00:03
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : glibc-common ####################### [ 1/12]
Updating : glibc ####################### [ 2/12]
Updating : glibc ####################### [ 3/12]
warning: /etc/ld.so.conf created as /etc/ld.so.conf.rpmnew
warning: /etc/localtime created as /etc/localtime.rpmnew
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
Updating : glibc-headers ####################### [ 4/12]
Updating : glibc-devel ####################### [ 5/12]
Updating : glibc-devel ####################### [ 6/12]
Cleanup : glibc ####################### [ 7/12]
Cleanup : glibc-headers ####################### [ 8/12]
Cleanup : glibc-devel ####################### [ 9/12]
Cleanup : glibc-common ####################### [10/12]
Cleanup : glibc-devel ####################### [11/12]
Cleanup : glibc ####################### [12/12]
Updated: glibc.x86_64 0:2.5-34 glibc.i686 0:2.5-34 glibc-common.x86_64 0:2.5-34 glibc-devel.i386 0:2.5-34 glibc-devel.x86_64 0:2.5-34 glibc-headers.x86_64 0:2.5-34
Complete!
I then checked the architecture for the installed packages again:
# rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n'|grep glibc
glibc-devel-2.5-34.i386
glibc-2.5-34.x86_64
compat-glibc-headers-2.3.4-2.26.x86_64
compat-glibc-2.3.4-2.26.i386
glibc-headers-2.5-34.x86_64
glibc-common-2.5-34.x86_64
compat-glibc-2.3.4-2.26.x86_64
glibc-devel-2.5-34.x86_64
glibc-2.5-34.i686
But when I tried to install ncat again, I got the same error as before.
# rpm --install ncat-4.85BETA7-1.x86_64.rpm
error: Failed dependencies:
libc.so.6(GLIBC_2.7)(64bit) is needed by ncat-4.85BETA7-1.x86_64
When I checked on what was required for the ncat package,
I saw the following:
# rpm --requires -qp ncat-4.85BETA7-1.x86_64.rpm
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libc.so.6(GLIBC_2.7)(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)
I then tried installing the 32-bit version of ncat, but that
attempt failed as well.
# rpm --install ncat-4.85BETA7-1.i386.rpm
error: Failed dependencies:
libc.so.6(GLIBC_2.7) is needed by ncat-4.85BETA7-1.i386
Since I had already expended far more time than I anticipated in trying
to install netcat, I decided to try an alternative program with
similar capabilities,
socat, instead. I didn't have any problems installing it.
# yum install socat
Loading "priorities" plugin
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* rpmforge: fr2.rpmfind.net
* base: mirrors.rit.edu
* updates: ftp.lug.udel.edu
* addons: centos.aol.com
* extras: ftp.lug.udel.edu
338 packages excluded due to repository priority protections
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package socat.x86_64 0:1.7.1.0-1.el5.rf set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
socat x86_64 1.7.1.0-1.el5.rf rpmforge 398 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 398 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): socat-1.7.1.0-1.el 100% |=========================| 398 kB 00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: socat ######################### [1/1]
Installed: socat.x86_64 0:1.7.1.0-1.el5.rf
Complete!
References:
-
Nmap
-
Ncat
MP: Weblog
-
Re: [rhelv5-list] Updating RHEL5.2 causes yum to loop infinitely...
The Mail Archive
-
Socat
Top 100 Nework Security Tools
-
socat - Multipurpose relay
dest-unreach.org
[/network/tools/scanning/nmap]
permanent link