Mailing List Archive

To ask a familiar question: auto-login of console connections
Hi there. I know this question has been asked before in numerous
forms, and there is some information in the mailing list archives et
al regarding perl and expect scripts using telnet and/or ssh, etc etc.

But, to pose my thoughts and questions; I have a conserver host
connecting to a variety of serial consoles through a Cisco access
server. I could use ssh to get encrypted communications, but it's a
private network locally, so I'm not worried about that. That means I
can just use conserver to open the [telnet] connection directly,
which is nice. When the TCP connection gets opened, the Cisco is
configured to request a username and password log in. I know that I
could use initcmd with an expect script, or the like, to do this.
But, I can't tell from the documentation what happens *after* the
initcmd runs. Is it possible to run the initcmd, then drop back to
having conserver manage the connection directly? I'm assuming not,
because I would have to "share" the fd's with the initcmd to be able
to reuse them when the command exited.

Is there a way to run a command, or some sort of built-in expect-
like logic, to process a log-in on a "type host" connection, without
having to have another [two] processes running to continue to manage
the connection?

Thanks...

- Chris
_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users
Re: To ask a familiar question: auto-login of console connections [ In reply to ]
Hi,

On Sun, Nov 18, 2007 at 12:20:35PM -0500, Chris Ross wrote:
> Is there a way to run a command, or some sort of built-in expect-
> like logic, to process a log-in on a "type host" connection, without
> having to have another [two] processes running to continue to manage
> the connection?

I don't think so.
If you're worried about forking I'd suggest using Net::Telnet and Expect
in a perl script.

_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users
Re: To ask a familiar question: auto-login of console connections [ In reply to ]
On Sun, Nov 18, 2007 at 12:20:35PM -0500, Chris Ross wrote:
> configured to request a username and password log in. I know that I
> could use initcmd with an expect script, or the like, to do this.
> But, I can't tell from the documentation what happens *after* the
> initcmd runs. Is it possible to run the initcmd, then drop back to
> having conserver manage the connection directly? I'm assuming not,
> because I would have to "share" the fd's with the initcmd to be able
> to reuse them when the command exited.

that's exactly what will happen if you add the initcmd stuff to your
console definition (or what it inherits). it works for all types of
consoles. conserver will make the initial tcp connection, then fork off
the initcmd (pointing it's stdin/stdout to that file descriptor) and then
continue to do it's normal stuff when it exists.

Bryan
_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users
Re: To ask a familiar question: auto-login of console connections [ In reply to ]
On Nov 18, 2007, at 16:03, Bryan Stansell wrote:
> that's exactly what will happen if you add the initcmd stuff to your
> console definition (or what it inherits). it works for all types of
> consoles. conserver will make the initial tcp connection, then
> fork off
> the initcmd (pointing it's stdin/stdout to that file descriptor)
> and then
> continue to do it's normal stuff when it exists.

(I assume you mean "exits")

Excellent. That's what I was hoping for. So, I have have an
external process manage the login, then exit, and conserver will run
it from there.

Thanks!

- Chris

_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users
Re: To ask a familiar question: auto-login of console connections [ In reply to ]
On Nov 18, 2007, at 16:03, Bryan Stansell wrote:
> that's exactly what will happen if you add the initcmd stuff to your
> console definition (or what it inherits). it works for all types of
> consoles. conserver will make the initial tcp connection, then
> fork off
> the initcmd (pointing it's stdin/stdout to that file descriptor)
> and then
> continue to do it's normal stuff when it exits.

Alright. I've finally gotten a couple hours to work on this. I
started
by working with perl's Expect.pm, but since I'm not all that familiar
with it, I eventually gave up because I couldn't get it to work. It
would
work alright if I used Expect->spawn("telnet A.B.C.D NN"), but I never
could get it to work with STDIN and STDOUT, the way it should work when
run as an initcmd.

So, I dropped back to plain boring perl. I'm just reading lines from
STDIN, and when I see the prompts I want, I'm printing things to STDOUT.
However, it doesn't seem to be working. As far as I can tell, the
things I print to STDOUT aren't getting passed across the socket (in
this case, a connection "type host")

Do you have any suggestions of useful ways to get debugging
information
out of the conserver process about the I/O of the initcmd, et al?

Thanks...

- Chris

_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users
Re: To ask a familiar question: auto-login of console connections [ In reply to ]
On Dec 2, 2007, at 22:25, Chris Ross wrote:
> So, I dropped back to plain boring perl. I'm just reading
> lines from STDIN, and when I see the prompts I want, I'm
> printing things to STDOUT. However, it doesn't seem to be
> working. As far as I can tell, the things I print to STDOUT
> aren't getting passed across the socket (in this case, a
> connection "type host")

Okay. I'm not totally sure what happened. I think it was
a buffering problem. I think I was buffering the output, and
it wasn't getting sent. I tripped across fixing it, and
now have it working using select, sysread, and syswrite.

Someday, I may get back to trying to use Expect to do it
in what is likely a more "right way," but.

Thanks for the pointer that it could be done!

- Chris

_______________________________________________
users mailing list
users@conserver.com
https://www.conserver.com/mailman/listinfo/users