cgi relay for python cgi script

A

Amir Michail

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
 
A

Amir Michail

Fredrik said:

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
 
F

Fredrik Lundh

Amir said:
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>
 
A

Amir Michail

Fredrik said:
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
 
S

Steve Holden

Amir said:
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
 
P

Paul Rubin

Amir Michail said:
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.
 
M

Michael Ekstrand

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 (e-mail address removed) /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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top