cgi relay for python cgi script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Amir  Michail

    #1

    cgi relay for python cgi script

    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

  • Fredrik Lundh

    #2
    Re: cgi relay for python cgi script

    Amir Michail wrote:
    [color=blue]
    > Is there an easy way to execute a python cgi script on a different
    > machine from the cgi server?[/color]



    </F>



    Comment

    • Amir  Michail

      #3
      Re: cgi relay for python cgi script

      Fredrik Lundh wrote:[color=blue]
      > Amir Michail wrote:
      >[color=green]
      > > Is there an easy way to execute a python cgi script on a different
      > > machine from the cgi server?[/color]
      >
      > http://www.google.com/search?q=reverse+proxy
      >
      > </F>[/color]

      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

      Comment

      • Fredrik Lundh

        #4
        Re: cgi relay for python cgi script

        Amir Michail wrote:
        [color=blue]
        > 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.[/color]

        you could of course use something like



        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>



        Comment

        • Amir  Michail

          #5
          Re: cgi relay for python cgi script

          Fredrik Lundh wrote:[color=blue]
          > Amir Michail wrote:
          >[color=green]
          > > 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.[/color]
          >
          > 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>[/color]

          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

          Comment

          • Steve Holden

            #6
            Re: cgi relay for python cgi script

            Amir Michail wrote:[color=blue]
            > Fredrik Lundh wrote:
            >[color=green]
            >>Amir Michail wrote:
            >>
            >>[color=darkred]
            >>>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
            >>>environmen t for the cgi script to run?
            >>>
            >>>I'm looking for something simple that does not require root access.[/color]
            >>
            >>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>[/color]
            >
            >
            > 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
            >[/color]
            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/

            Comment

            • Paul Rubin

              #7
              Re: cgi relay for python cgi script

              "Amir Michail" <amichail@gmail .com> writes:[color=blue]
              > Is there an easy way to execute a python cgi script on a different
              > machine from the cgi server?[/color]

              What exactly do you mean by that? You can set a form target to
              another machine, if that's what you mean.

              Comment

              • Michael Ekstrand

                #8
                Re: cgi relay for python cgi script

                On Oct 4, 2005, at 2:35 AM, Amir Michail wrote:[color=blue]
                > 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.[/color]

                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 user@cgi.host.c om /usr/bin/env HTTP_HOST="$HTT P_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

                Comment

                Working...