You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Sean Neeley <se...@producepro.com> on 2015/01/09 17:30:19 UTC

A web based terminal emulator as an Apache module?

I'm trying to determine if it is plausible to build an apache module for a
web based terminal emulator.  I would be borrowing some of the code from
the ShellInaBox project:
https://code.google.com/p/shellinabox/
The code uses openpty() to create a new process operating in a pseudo-tty.
The apache module would have to pass keyboard and display information back
and forth from the client browser to the pseudo-tty in the module.

It seems like with the pre-fork mpm, I cannot guarantee that the ajax POST
requests will make it to the same module instance each time.  Are modules
stateless?  Is it possible to share the pseudo-tty and hashmaps keeping
session information across all instances of my module?  Or is there
anything that can be added to the POST request to guarantee that it goes to
a specific module instance?

Thanks for the help.

- Sean

Re: A web based terminal emulator as an Apache module?

Posted by Sean Neeley <se...@producepro.com>.
This is similar to what I need to build.  Do you happen to know if it the
ssh part is open source and if it was implemented using an apache module?

On Fri, Jan 9, 2015 at 11:42 AM, Vikram Tiwari <vi...@gmail.com>
wrote:

> One example is Google's implementation of SSH client to login into their
> Google Cloud's Compute instances. It uses GA based cookies for the
> authentication.
>
> Thanks and Regards!
> ____________
> Vikram Tiwari <https://google.com/+VikramTiwari>
>
> On Fri, Jan 9, 2015 at 11:07 PM, Joe Lewis <jl...@silverhawk.net> wrote:
>
> > Here is a good example thread :
> >
> >
> >
> http://grokbase.com/t/apache/modules-dev/11bp9bhxr5/basic-example-shared-memory-code
> >
> > On Fri, Jan 9, 2015 at 10:35 AM, Joe Lewis <jl...@silverhawk.net>
> wrote:
> >
> > > It is definitely possible to share information - see the apr_shm_*
> > > functions (or check the history on this list for shared memory).  Eash
> > POST
> > > request is considered a separate event, and is processed as such, which
> > > means there is no state in the protocol itself (there is when you add
> > HTTP
> > > headers into the mix, such as "cookies").
> > >
> > > For what you are trying to do - I'd simply assume it's stateless, and
> > > design any modules to utilize shared memory.
> > >
> > > Joe
> > >
> > > On Fri, Jan 9, 2015 at 9:30 AM, Sean Neeley <
> sean.neeley@producepro.com>
> > > wrote:
> > >
> > >> I'm trying to determine if it is plausible to build an apache module
> > for a
> > >> web based terminal emulator.  I would be borrowing some of the code
> from
> > >> the ShellInaBox project:
> > >> https://code.google.com/p/shellinabox/
> > >> The code uses openpty() to create a new process operating in a
> > pseudo-tty.
> > >> The apache module would have to pass keyboard and display information
> > back
> > >> and forth from the client browser to the pseudo-tty in the module.
> > >>
> > >> It seems like with the pre-fork mpm, I cannot guarantee that the ajax
> > POST
> > >> requests will make it to the same module instance each time.  Are
> > modules
> > >> stateless?  Is it possible to share the pseudo-tty and hashmaps
> keeping
> > >> session information across all instances of my module?  Or is there
> > >> anything that can be added to the POST request to guarantee that it
> goes
> > >> to
> > >> a specific module instance?
> > >>
> > >> Thanks for the help.
> > >>
> > >> - Sean
> > >>
> > >
> > >
> >
>



-- 

*Sean NeeleyProduce Pro Software*
Senior Developer
630-395-9600 x738
www.producepro.com
sean.neeley@producepro.com

*DON'T FORGET: User Group 2015 is coming up!*
April 23-24, Chicago, IL
More info
<http://us1.campaign-archive2.com/?u=03d05fe9312dd260a5b6baa07&id=ce9ea400c6&e=c6a454ec76>
 ::
 Register online <http://goo.gl/forms/8lw4mdDCA8>

Re: A web based terminal emulator as an Apache module?

Posted by Vikram Tiwari <vi...@gmail.com>.
One example is Google's implementation of SSH client to login into their
Google Cloud's Compute instances. It uses GA based cookies for the
authentication.

Thanks and Regards!
____________
Vikram Tiwari <https://google.com/+VikramTiwari>

On Fri, Jan 9, 2015 at 11:07 PM, Joe Lewis <jl...@silverhawk.net> wrote:

> Here is a good example thread :
>
>
> http://grokbase.com/t/apache/modules-dev/11bp9bhxr5/basic-example-shared-memory-code
>
> On Fri, Jan 9, 2015 at 10:35 AM, Joe Lewis <jl...@silverhawk.net> wrote:
>
> > It is definitely possible to share information - see the apr_shm_*
> > functions (or check the history on this list for shared memory).  Eash
> POST
> > request is considered a separate event, and is processed as such, which
> > means there is no state in the protocol itself (there is when you add
> HTTP
> > headers into the mix, such as "cookies").
> >
> > For what you are trying to do - I'd simply assume it's stateless, and
> > design any modules to utilize shared memory.
> >
> > Joe
> >
> > On Fri, Jan 9, 2015 at 9:30 AM, Sean Neeley <se...@producepro.com>
> > wrote:
> >
> >> I'm trying to determine if it is plausible to build an apache module
> for a
> >> web based terminal emulator.  I would be borrowing some of the code from
> >> the ShellInaBox project:
> >> https://code.google.com/p/shellinabox/
> >> The code uses openpty() to create a new process operating in a
> pseudo-tty.
> >> The apache module would have to pass keyboard and display information
> back
> >> and forth from the client browser to the pseudo-tty in the module.
> >>
> >> It seems like with the pre-fork mpm, I cannot guarantee that the ajax
> POST
> >> requests will make it to the same module instance each time.  Are
> modules
> >> stateless?  Is it possible to share the pseudo-tty and hashmaps keeping
> >> session information across all instances of my module?  Or is there
> >> anything that can be added to the POST request to guarantee that it goes
> >> to
> >> a specific module instance?
> >>
> >> Thanks for the help.
> >>
> >> - Sean
> >>
> >
> >
>

Re: A web based terminal emulator as an Apache module?

Posted by Sean Neeley <se...@producepro.com>.
That is a good example showing how to share a simple counter value between
processes.  But how would you go about sharing a file descriptor between
processes within an apache module?  Am I right that if you store the file
descriptor in the shared memory pool, that file descriptor value would not
mean the same thing if a different process from the one that created it,
tried to use it?

On Fri, Jan 9, 2015 at 11:37 AM, Joe Lewis <jl...@silverhawk.net> wrote:

> Here is a good example thread :
>
>
> http://grokbase.com/t/apache/modules-dev/11bp9bhxr5/basic-example-shared-memory-code
>
> On Fri, Jan 9, 2015 at 10:35 AM, Joe Lewis <jl...@silverhawk.net> wrote:
>
> > It is definitely possible to share information - see the apr_shm_*
> > functions (or check the history on this list for shared memory).  Eash
> POST
> > request is considered a separate event, and is processed as such, which
> > means there is no state in the protocol itself (there is when you add
> HTTP
> > headers into the mix, such as "cookies").
> >
> > For what you are trying to do - I'd simply assume it's stateless, and
> > design any modules to utilize shared memory.
> >
> > Joe
> >
> > On Fri, Jan 9, 2015 at 9:30 AM, Sean Neeley <se...@producepro.com>
> > wrote:
> >
> >> I'm trying to determine if it is plausible to build an apache module
> for a
> >> web based terminal emulator.  I would be borrowing some of the code from
> >> the ShellInaBox project:
> >> https://code.google.com/p/shellinabox/
> >> The code uses openpty() to create a new process operating in a
> pseudo-tty.
> >> The apache module would have to pass keyboard and display information
> back
> >> and forth from the client browser to the pseudo-tty in the module.
> >>
> >> It seems like with the pre-fork mpm, I cannot guarantee that the ajax
> POST
> >> requests will make it to the same module instance each time.  Are
> modules
> >> stateless?  Is it possible to share the pseudo-tty and hashmaps keeping
> >> session information across all instances of my module?  Or is there
> >> anything that can be added to the POST request to guarantee that it goes
> >> to
> >> a specific module instance?
> >>
> >> Thanks for the help.
> >>
> >> - Sean
> >>
> >
> >
>



-- 

*Sean NeeleyProduce Pro Software*
Senior Developer
630-395-9600 x738
www.producepro.com
sean.neeley@producepro.com

*DON'T FORGET: User Group 2015 is coming up!*
April 23-24, Chicago, IL
More info
<http://us1.campaign-archive2.com/?u=03d05fe9312dd260a5b6baa07&id=ce9ea400c6&e=c6a454ec76>
 ::
 Register online <http://goo.gl/forms/8lw4mdDCA8>

Re: A web based terminal emulator as an Apache module?

Posted by Joe Lewis <jl...@silverhawk.net>.
Here is a good example thread :

http://grokbase.com/t/apache/modules-dev/11bp9bhxr5/basic-example-shared-memory-code

On Fri, Jan 9, 2015 at 10:35 AM, Joe Lewis <jl...@silverhawk.net> wrote:

> It is definitely possible to share information - see the apr_shm_*
> functions (or check the history on this list for shared memory).  Eash POST
> request is considered a separate event, and is processed as such, which
> means there is no state in the protocol itself (there is when you add HTTP
> headers into the mix, such as "cookies").
>
> For what you are trying to do - I'd simply assume it's stateless, and
> design any modules to utilize shared memory.
>
> Joe
>
> On Fri, Jan 9, 2015 at 9:30 AM, Sean Neeley <se...@producepro.com>
> wrote:
>
>> I'm trying to determine if it is plausible to build an apache module for a
>> web based terminal emulator.  I would be borrowing some of the code from
>> the ShellInaBox project:
>> https://code.google.com/p/shellinabox/
>> The code uses openpty() to create a new process operating in a pseudo-tty.
>> The apache module would have to pass keyboard and display information back
>> and forth from the client browser to the pseudo-tty in the module.
>>
>> It seems like with the pre-fork mpm, I cannot guarantee that the ajax POST
>> requests will make it to the same module instance each time.  Are modules
>> stateless?  Is it possible to share the pseudo-tty and hashmaps keeping
>> session information across all instances of my module?  Or is there
>> anything that can be added to the POST request to guarantee that it goes
>> to
>> a specific module instance?
>>
>> Thanks for the help.
>>
>> - Sean
>>
>
>

Re: A web based terminal emulator as an Apache module?

Posted by Joe Lewis <jl...@silverhawk.net>.
It is definitely possible to share information - see the apr_shm_*
functions (or check the history on this list for shared memory).  Eash POST
request is considered a separate event, and is processed as such, which
means there is no state in the protocol itself (there is when you add HTTP
headers into the mix, such as "cookies").

For what you are trying to do - I'd simply assume it's stateless, and
design any modules to utilize shared memory.

Joe

On Fri, Jan 9, 2015 at 9:30 AM, Sean Neeley <se...@producepro.com>
wrote:

> I'm trying to determine if it is plausible to build an apache module for a
> web based terminal emulator.  I would be borrowing some of the code from
> the ShellInaBox project:
> https://code.google.com/p/shellinabox/
> The code uses openpty() to create a new process operating in a pseudo-tty.
> The apache module would have to pass keyboard and display information back
> and forth from the client browser to the pseudo-tty in the module.
>
> It seems like with the pre-fork mpm, I cannot guarantee that the ajax POST
> requests will make it to the same module instance each time.  Are modules
> stateless?  Is it possible to share the pseudo-tty and hashmaps keeping
> session information across all instances of my module?  Or is there
> anything that can be added to the POST request to guarantee that it goes to
> a specific module instance?
>
> Thanks for the help.
>
> - Sean
>