Subject: Reinventing the wheel? - Virtual Users

From: Adrian Carter <[email-masked]>
Date: Tue, 13 May 1997 10:22:59 +1000

G'Day all,
	Recently I had a requirement for an FTPd that could do 'virtual' servers,
including the ability to log in as the same name on two different domains
on the same machine, basically, virtual users in virtual ftpd.

	I downloaded the wu-ftpd-2.4.2-beta-13 and noticed it had been patched for
virtual Anon users, but not 'real' users. So I have preceeded to hobble
together some patches to do this.

	Heres the question. Have I just re-invented the wheel? If so, where can I
get some real written C code for it (Im a perl programmer, and know
rudimentary  C, so the code isnt exactly kosher)? If I havent reinvented
the wheel, can someone out there give me a hand making it 'kosher'?

Thanks for any help you can offer

Adrian Carter
Sys Admin
The Asia Pacific Internet Co.
--
* All Opinions Expressed are that of my Own, and in no way reflect the	*
* that of The Asia Pacific Internet Company Pty. Ltd.				*
****************************************************************************
*Adrian Carter                                	    Email: [email-masked]	*
*Systems Administrator	 	              URL: http://www.apic.net/	*
*The Asia Pacific Internet Company Pty Ltd	Autoresp: [email-masked]	*
*        Internet Access, Web Housing, Mailing List Management		*
*           Phone: (+612) 9419-5333   Fax: (+612) 9419-5155			*
****************************************************************************

---

From: Kent Landfield <[email-masked]>
Date: Mon, 12 May 1997 21:46:57 -0500 (CDT)

# Recently I had a requirement for an FTPd that could do 'virtual' servers,
# including the ability to log in as the same name on two different domains
# on the same machine, basically, virtual users in virtual ftpd.

Now I'm confused. Real system users should be able to login to the virtual 
site using a real account. That would give them access to both.  If you need 
to you could setup real accounts that you could not login with via telnet. 
Then the ftp would work as you want. (I think.) If so, you can do that.

# I downloaded the wu-ftpd-2.4.2-beta-13 and noticed it had been patched for
# virtual Anon users, but not 'real' users. So I have preceeded to hobble
# together some patches to do this.
# 
# Heres the question. Have I just re-invented the wheel? If so, where can I
# get some real written C code for it (Im a perl programmer, and know
# rudimentary  C, so the code isnt exactly kosher)? If I havent reinvented
# the wheel, can someone out there give me a hand making it 'kosher'?

I'm still confused. Are you looking to setup three classes of users ? 

    o Normal system users with full system access ?
    o FTP-only users restricted to a section of the disk alotted for a specific
      virtual domain that is different from the anonymous users ?
    o Anonymous users with access to the virtual servers anonymous ftp area ?

-- 
Kent Landfield                        Phone: 1-817-545-2502             
The Landfield Group                   FAX:   1-817-545-7650             
Email: [email-masked]             http://www.landfield.com/
Please send comp.sources.misc related mail to [email-masked].
Search the Usenet Hypertext FAQ Archive at http://www.faqs.org/faqs/

---

From: Adrian Carter <[email-masked]>
Date: Tue, 13 May 1997 13:17:20 +1000

>Then the ftp would work as you want. (I think.) If so, you can do that.

Indeed. Let me lead you all down the great scary garden path that I call my
thoughts =)

Scenario:
I have 2 clients that both decide to host a virtual server on my system,
called a.com and b.com, and I am isp.com.

a.com decides they want to put in a vftp server, to allow people to ftp to
ftp.a.com and login as anon, and have a different root to if they ftp'ed to
ftp.isp.com. Easy enough, download the academ patches, and setup a virtual
x.x.x.x line in ftpaccess.

b.com are a web hosting service, on-selling space on their current v.server
to other users. They want to have the ability to sell
http://www.b.com/some_user and have that some_user ftp to ftp.b.com and log
in as the real user some_user in order to upload their pages. Now, isp.com
already has an account called some_user, so the b.com user cant login to
ftp.b.com as some_user, as that would confilct with the isp.com account.

What I have done is patched wu-ftpd so that it does a lookup on the
sin_addr and then refrences a hash table of FAKENAME = REALNAME
combinations. THen, from that point on, the ftpd uses FAKENAME in all
references, yet at system level, the permissions are that of REALNAME.

This means that a user can login to ftp.b.com as some_user and another user
can login to ftp.isp.com as some_user, yet they are DIFFERENT users.

If you have ever looked at the Qualcom Popper 2.2 Virtual patches, my wu
patches work essentially the same.

This means that you can have the same user name used for FTP/POP/WWW across
several virtual domains, each one being a DIFFERENT user.

Still dont get me? Im confused now... Told you it was a scary path =)

does anyone get what I mean? =)

Regards

Adrian

--
*************************************************************************
*Adrian Carter                                	Email: [email-masked]	*
*Systems Administrator	 	              URL: http://www.apic.net/	*
*The Asia Pacific Internet Company Pty Ltd	Autoresp: [email-masked]	*
*  All programmers are playwrights and all computers are lousy actors.  *
*           Phone: (+612) 9419-5333   Fax: (+612) 9419-5155			*
*************************************************************************

---

From: Alain Magloire <[email-masked]>
Date: Mon, 12 May 1997 23:28:45 -0400 (EDT)

> Now I'm confused.

8-)
Yes, I know what you mean.
Lets define VIRTUAL to be: restrict someone access to part of 
the file system. Or the ability to show only a certain 
"view" of the file system.

In many cases that's what I(we) meant by saying virtual(virtual ftp)

In HTTP, it's more obvious, When access a certain IP(HTTP/0.9)
or hostname(HTTP/1.0 and 1.1) the server will get the files
inside a certain DocumentROOT as define by the config file.

There is no real use in having ftpd doing virtual hosting for real users.
Real users do not go through chroot(). So all the file system
is "visible".

In most cases, when we say Virtual for real users, we meant
guest accounts, that can be restricted (chroot()) to a certain area
of the file system, so only certain files can be view.

For "Real Virtual Hosting" i.e virtual for rlogin/telnet/ftp etc..
then we're talking about Virtual Machine. You'll have a context
switch depending on how you loggin. Mr Landfield idea about
"Virtual Inetd" is probably a step in this direction. 
How hard could it be to do ?
The real challenge is more to make old stubburn sysadmin(including me :-)
accept a new syntax and yet a new way of thinking.

> I'm still confused. Are you looking to setup three classes of users ? 
...
>   o FTP-only users restricted to a section of the disk alotted for a specific

I'd say the original poster meant this one, unless he's as confuse as
the rest of us :-)

-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!