Skip to contentSkip to conversation

Changes to port_user

uml-devel Dan Shearer 4 participants 7 messages Jan 22, 2004 – Feb 15, 2004 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

I've done some minor work in drivers/port_user.c, including replacing the binding to INADDR_ANY with a gethostbyname(passed_ip), so you can specify which single IP to listen on. I'll post when I'm sure its ok.

Now what I'm trying to do is replace in.telnetd with something else, for the moment netcat as a simple case, or something that gives the same effect. That involves understanding the significance of port_helper and kernel/helper.c, which I don't yet.

Here's what I've noticed so far:

When port_task_proc is run for a new incoming connection (an irq raised), port_accept calls port_connection, which is over in userspace (port_user.c)

port_connection calls run_helper from kernel/helper.c, which starts in.telnetd in a new thread with clone(), supplying port-helper as the login program for telnetd but I'm not too sure what it does. telnetd behaves as if it were being run from inetd, being passed an input and an output descriptor, one connected to the UML (I don't know the mechanism for this yet) and the other to the network port.

Now, I just want raw data to go from the kernel to the port and back again. So should I:

a) just shortcircuit this by hooking the inbound and outbound descriptors up, or

b) drop netcat in instead of telnetd (which I have tried but it isn't quite working yet.)

There may be architectural reasons why I shouldn't do (a).

Comments?

Signature · 13 lines
Dan Shearer
[email protected]


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#1 lore raw
Quoted 5 lines · Dan Shearer

Now, I just want raw data to go from the kernel to the port and back again. So should I:

a) just shortcircuit this by hooking the inbound and outbound descriptors up, or

I'm starting to get it, chan_kern is the place to start to understand what happens when a read or write irq goes off. I don't think there is a short-circuit mechanism for hooking up the internal fd for a tty directly to an fd within a channel driver without breaking this design. So what if I modified port_task_proc to copy the incoming data in the appropriate direction? I'll give that a try next.

Jeff, please, what does "winch" stand for?

And also, if I submit some patches that just contain brief source comments about how things work will you accept them? I notice you don't use them much.

Signature · 13 lines
Dan Shearer
[email protected]


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#3 lore raw
In reply to Dan Shearer
Quoted 3 lines · Dan Shearer

I've done some minor work in drivers/port_user.c, including replacing the binding to INADDR_ANY with a gethostbyname(passed_ip), so you can specify which single IP to listen on.

Cool, that's needed doing for a while.

Quoted 3 lines

Now what I'm trying to do is replace in.telnetd with something else, for the moment netcat as a simple case, or something that gives the same effect.

If you want to be able to telnet to the port, then you need something which speaks telnet, hence you need telnetd.

If you can connect with something else and have terminal stuff continue to work, and replace the telnetd dependency with something that works more widely out of the box, then I'm all for it.

Quoted 2 lines

That involves understanding the significance of port_helper and kernel/helper.c, which I don't yet.

What happens is that UML runs telnetd with the port helper as its "login" program (problem - not every telnetd out there supports -L, even if it is installed, which it often isn't).

When there's a connection, UML gets a descriptor with the telnet on the other end. It needs to get telnetd talking on that to do the telnet protocol and another descriptor coming out of telnetd with actual characters that the user typed. So, it does this as follows:
it execs telnetd with stdin, stderr, stdout duped from the portal
file descriptor
telnetd also gets a unix socket on descriptor 3 port_helper gets the desired telnetd output descriptor on its
stdin/stdout
it passes this back to UML over the unix socket on descriptor 3
which it inherited from telnetd

Jeff

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw
In reply to Dan Shearer
Quoted 1 line · Dan Shearer

Jeff, please, what does "winch" stand for?

SIGWINCH.

Quoted 2 lines

And also, if I submit some patches that just contain brief source comments about how things work will you accept them?

Yup.

Jeff

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#4 lore raw
In reply to Jeff Dike

hi!

Quoted 6 lines

If you want to be able to telnet to the port, then you need something which speaks telnet, hence you need telnetd.

Quoted 3 lines

Now what I'm trying to do is replace in.telnetd with something else, for the moment netcat as a simple case, or something that gives the same effect.

mhhh - as security oriented person i would like to admit:
should such "new technology" like uml really "support" unencrypted remote logins and should it support exposing "non encrypted communication ports" to the outside world ?

telnet is ancient and IMHO it should be replaced by something more secure like ssh. sshd is installed by default on all major distro`s and it has an "inetd" mode, too.
maybe telnetd can easily be replaced sshd ?

just my 10 eurocents....

regards
roland

----- Original Message -----
From: "Jeff Dike" <[email protected]>
To: "Dan Shearer" <[email protected]>
Cc: <[email protected]>
Sent: Thursday, January 22, 2004 5:20 PM
Subject: Re: [uml-devel] Changes to port_user

Quoted 40 lines · Dan Shearer
Quoted 3 lines

I've done some minor work in drivers/port_user.c, including replacing the binding to INADDR_ANY with a gethostbyname(passed_ip), so you can specify which single IP to listen on.

Cool, that's needed doing for a while.

Quoted 3 lines

Now what I'm trying to do is replace in.telnetd with something else, for the moment netcat as a simple case, or something that gives the same effect.

If you want to be able to telnet to the port, then you need something which speaks telnet, hence you need telnetd.

If you can connect with something else and have terminal stuff continue to work, and replace the telnetd dependency with something that works more widely out of the box, then I'm all for it.

Quoted 2 lines

That involves understanding the significance of port_helper and kernel/helper.c, which I don't yet.

What happens is that UML runs telnetd with the port helper as its "login" program (problem - not every telnetd out there supports -L, even if it is installed, which it often isn't).

When there's a connection, UML gets a descriptor with the telnet on the other end. It needs to get telnetd talking on that to do the telnet protocol and another descriptor coming out of telnetd with actual characters that the user typed. So, it does this as follows:
it execs telnetd with stdin, stderr, stdout duped from the portal file descriptor
telnetd also gets a unix socket on descriptor 3
port_helper gets the desired telnetd output descriptor on its stdin/stdout
it passes this back to UML over the unix socket on descriptor 3 which it inherited from telnetd

Jeff

Quoted 10 lines

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#5 lore raw

Am So, den 15.02.2004 schrieb roland um 16:24:

Quoted 3 lines

mhhh - as security oriented person i would like to admit:
should such "new technology" like uml really "support" unencrypted remote logins and should it support exposing "non encrypted communication ports" to the outside world ?

I *am* allowed to duplicate the keys to my home or car and throw them arround like sweets on "karneval". No modern software shall keep me away from "doing the wrong thing".

Quoted 3 lines

telnet is ancient and IMHO it should be replaced by something more secure like ssh. sshd is installed by default on all major distro`s and it has an "inetd" mode, too.
maybe telnetd can easily be replaced sshd ?

In near to 100% of all cases I'll prefer ssh(d).

I dont want to be forced to do the right thing, I want to be well informed and decide on my own.

Quoted 1 line

just my 10 eurocents....

Added mine now... ;-)

#6 lore raw
Quoted 7 lines

telnet is ancient and IMHO it should be replaced by something more secure like ssh. sshd is installed by default on all major distro`s and it has an "inetd" mode, too.
maybe telnetd can easily be replaced sshd ?

In near to 100% of all cases I'll prefer ssh(d).
I dont want to be forced to do the right thing, I want to be well informed and decide on my own.

ok, so let me correct my statement:

telnet is ancient and IMHO there should be made an option to use something more secure like ssh. for good security, this option could be made the "default".

:D

regards
roland

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel