cgi relay for python cgi script

Discussion in 'Python' started by Amir Michail, Oct 4, 2005.

  1. Amir  Michail

    Amir Michail Guest

    Hi,

    Is there an easy way to execute a python cgi script on a different
    machine from the cgi server?

    I could write my own server, but I was wondering if something is
    available that would allow me to use a cgi script as is without
    modification.

    Amir
     
    Amir Michail, Oct 4, 2005
    #1
    1. Advertising

  2. Fredrik Lundh, Oct 4, 2005
    #2
    1. Advertising

  3. Amir  Michail

    Amir Michail Guest

    Fredrik Lundh wrote:
    > Amir Michail wrote:
    >
    > > Is there an easy way to execute a python cgi script on a different
    > > machine from the cgi server?

    >
    > http://www.google.com/search?q=reverse proxy
    >
    > </F>


    Is there an easy way to do this without modifying the configuration of
    the cgi server and without running a cgi server on the other machine
    where the script will actually run?

    Perhaps someone wrote a simple server that provides the required
    environment for the cgi script to run?

    I'm looking for something simple that does not require root access.

    Amir
     
    Amir Michail, Oct 4, 2005
    #3
  4. Amir Michail wrote:

    > Is there an easy way to do this without modifying the configuration of
    > the cgi server and without running a cgi server on the other machine
    > where the script will actually run?
    >
    > Perhaps someone wrote a simple server that provides the required
    > environment for the cgi script to run?
    >
    > I'm looking for something simple that does not require root access.


    you could of course use something like

    http://docs.python.org/lib/module-CGIHTTPServer.html

    or some other light-weight web server, but you should probably have in mind
    that doing things like this without coordinating with your server administrators
    and security architects *before* you start tinkering can be a excellent way to
    get fired...

    </F>
     
    Fredrik Lundh, Oct 4, 2005
    #4
  5. Amir  Michail

    Amir Michail Guest

    Fredrik Lundh wrote:
    > Amir Michail wrote:
    >
    > > Is there an easy way to do this without modifying the configuration of
    > > the cgi server and without running a cgi server on the other machine
    > > where the script will actually run?
    > >
    > > Perhaps someone wrote a simple server that provides the required
    > > environment for the cgi script to run?
    > >
    > > I'm looking for something simple that does not require root access.

    >
    > you could of course use something like
    >
    > http://docs.python.org/lib/module-CGIHTTPServer.html
    >
    > or some other light-weight web server, but you should probably have in mind
    > that doing things like this without coordinating with your server administrators
    > and security architects *before* you start tinkering can be a excellent way to
    > get fired...
    >
    > </F>


    I would like to do this to improve performance by avoiding nfs. (The
    required data is not on the cgi server.)

    The advice I got was to use something like MySQL with a client/server
    architecture.

    However, I thought it would be easier to simply run the core part of
    the script off the cgi server, thereby avoiding nfs for data lookups.

    So I guess the point is that such a solution is more likely to be a
    security risk than MySQL?

    Amir
     
    Amir Michail, Oct 4, 2005
    #5
  6. Amir  Michail

    Steve Holden Guest

    Amir Michail wrote:
    > Fredrik Lundh wrote:
    >
    >>Amir Michail wrote:
    >>
    >>
    >>>Is there an easy way to do this without modifying the configuration of
    >>>the cgi server and without running a cgi server on the other machine
    >>>where the script will actually run?
    >>>
    >>>Perhaps someone wrote a simple server that provides the required
    >>>environment for the cgi script to run?
    >>>
    >>>I'm looking for something simple that does not require root access.

    >>
    >>you could of course use something like
    >>
    >> http://docs.python.org/lib/module-CGIHTTPServer.html
    >>
    >>or some other light-weight web server, but you should probably have in mind
    >>that doing things like this without coordinating with your server administrators
    >>and security architects *before* you start tinkering can be a excellent way to
    >>get fired...
    >>
    >></F>

    >
    >
    > I would like to do this to improve performance by avoiding nfs. (The
    > required data is not on the cgi server.)
    >
    > The advice I got was to use something like MySQL with a client/server
    > architecture.
    >
    > However, I thought it would be easier to simply run the core part of
    > the script off the cgi server, thereby avoiding nfs for data lookups.
    >
    > So I guess the point is that such a solution is more likely to be a
    > security risk than MySQL?
    >
    > Amir
    >

    You are hardly likely to improve performance by substituting a fairly
    high-level application like CGI or MySQL for NFS. But later you suggest
    that security is the issue rather than performance. I'm confused.

    regards
    Steve
    --
    Steve Holden +44 150 684 7255 +1 800 494 3119
    Holden Web LLC www.holdenweb.com
    PyCon TX 2006 www.python.org/pycon/
     
    Steve Holden, Oct 4, 2005
    #6
  7. Amir  Michail

    Paul Rubin Guest

    "Amir Michail" <> writes:
    > Is there an easy way to execute a python cgi script on a different
    > machine from the cgi server?


    What exactly do you mean by that? You can set a form target to
    another machine, if that's what you mean.
     
    Paul Rubin, Oct 4, 2005
    #7
  8. On Oct 4, 2005, at 2:35 AM, Amir Michail wrote:
    > Is there an easy way to execute a python cgi script on a different
    > machine from the cgi server?
    >
    > I could write my own server, but I was wondering if something is
    > available that would allow me to use a cgi script as is without
    > modification.


    What I would try: Set up an SSH account for the CGI to run as on the
    other machine, and set up a passwordless SSH public/private key pair.
    Store the private key on the web server under the account used to run
    CGI programs.

    Then write a small "stub" CGI that runs the other CGI via SSH. Not sure
    how environment variables will need to be transferred - SSH may have a
    way to set environment, or you may need a stub on both ends, or just
    build a SSH invocation that runs 'env' on the remote system. Your stub
    could be as simple as:

    #!/bin/sh
    ssh /usr/bin/env HTTP_HOST="$HTTP_HOST"
    OTHER_ENV_VARS /my/cgi/script "$@"

    Depending on your security needs, you may need to do things with
    alternate shells for the CGI user account, etc., but that can be done.
    And it will probably also need some input sanitization, etc. so you
    aren't executing arbitrary commands.

    -Michael
     
    Michael Ekstrand, Oct 4, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jinsong Liu
    Replies:
    2
    Views:
    413
    Jinsong Liu
    Sep 10, 2004
  2. Chris Thunell

    unable to relay with vb.net system.mail

    Chris Thunell, Dec 9, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    4,362
    Jeffrey Palermo [MCP]
    Dec 10, 2004
  3. =?Utf-8?B?SXJmYW4gQWtyYW0=?=

    How do I get relay server ?

    =?Utf-8?B?SXJmYW4gQWtyYW0=?=, Mar 16, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    355
    Kevin Spencer
    Mar 16, 2005
  4. T E Schmitz
    Replies:
    3
    Views:
    425
  5. Rico
    Replies:
    12
    Views:
    15,026
    slaguila
    Jun 9, 2011
Loading...

Share This Page