Skip to Content.
Sympa Menu

baslinux - Re: [BL] Network Clients and Servers: Redundancy

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: Lee Forrest <lforrestster AT gmail.com>
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] Network Clients and Servers: Redundancy
  • Date: Thu, 11 Jan 2007 14:28:40 +0000

On Thu, Jan 11, 2007 at 01:21:45PM -0600, James Miller wrote:
> On Wed, Jan 10, 2007 at 09:29:16PM +0000, Lee Forrest wrote:
> > We all have this nifty tcp tool called netcat (nc). About 19K
> > for the standalone utility that needs only libc. It will make
> > any kind of TCP/UDP connection and pass anything you want to the
> > other end of the connection. And accept anything you want.
> >
> > Yet each and every client and server we have:
> > http/ftp/smtp/pop/irc/dns/irc/nntp...has the same basic code
> > built into it. Usually a much less efficient, and therefore
> > larger, version. This is a wasteful redundancy and a potential
> > security problem: Having just one discrete and tiny utility to
> > do the job makes monitoring and filtering your connections much
> > simpler. It certainly makes configuration and trouble-shooting
> > simpler.
>
> Ok. It's high time I got meself edumacated about this netcat thing. I
> recently began
> discovering how to use scp and had been thinking this is the best way to
> transfer things to
> and from my fileserver from out on the wider 'net. But maybe netcat would
> work even better?

Faster. Simpler. Smaller. But you have to tell it what to do with a script.

> The first thing I need to know is whether it does or needs any form of
> authentication. Does
> it run by default without? I.e., you just specify matching ports on client
> and host, make
> sure your firewall won't interfere, then initiate the transfer by IP?

Yep. If you wanted to send a file to IP B port C, from IP A, then
you could do it like this:

IP B would run:

nc -l -p C

and IP A would then run:

nc -w 3 B C < file.gz

See Steven's 'send' and 'receive' scripts in BL3/user/sbin for more
sophisticated
versions of the above.

> If it doesn't do
> authentication, it could certainly be piped through ssh, correct?

Don't know. Probably. I don't see the need for the ssh tunnel,
though. It will do authentication of you want. It will do
anything the script that calls it wants. Here's my version of
Steven's off-the-cuff script for listing the files in a directory
on an FTP server. If basic auth was required, then you'd put a
real username and password in the script:

#!/bin/sh

#ftpls.sh

server="$1"
dir="$2"

if test "$dir" = ""
then dir="/"
fi

(echo user anonymous
echo pass xxxxx
echo stat "$dir"
echo quit) | nc "$server" 21 | less

#On the commandline, server address is the first argument,
#and the directory you want to examine is the second,
#seperated by at least one space. Ex: /pub/roses
#No dir argument and the top dir is selected.

> But then what would be the advantage over scp? I did look at
> the manpage, btw, but input from users who deploy it in the
> real world would help me disambiguate things.

You need the manual (1300 lines), which is the README found in
the source package. If you want to test nc and get the manual,
I'll nc it to you. Let me know with a private mail when you want
to do it, and I'll let you know if that's a good time. Assuming
your IP is dynamic, then you'd send me a mail at the appointed
time. Better to use a port number over 1000.

Lee

--
BasicLinux: Small is Beautiful
http://www.basiclinux.com.ru





Archive powered by MHonArc 2.6.24.

Top of Page