Re: Executing a .EXE CGI program

From: David Wang [Msft] (someone_at_online.microsoft.com)
Date: 10/19/04


Date: Tue, 19 Oct 2004 04:46:18 -0700


> Does anyone know if there has been a satisfactory
> workaround for this, or if Microsoft has added a
> feature in IIS to make it possible to run cgi-programs
> in IIS that DO NOT have a .EXE extension.?
> (I'm a Linux/Unix person myself, and I was pretty
> surprised to find that this was a problem in IIS.)

Hmm, I'm not sure where you got your info, but this is not a problem on IIS
nor is a work-around necessary. It has always been possible to run CGI
Programs on IIS without a .EXE extension -- in fact, I can invoke any CGI
program using any URL, extensionless or not. Since you are looking at
different OS architectures, the layers and configuration methods are not
necessarily going to be comparable, but that does not mean it is impossible
on Windows. It's not in a UI, so it isn't obvious to casual users (just
like how chmod and the rwx bits are not exactly obvious to the same casual
users). ;-)

Here are some possible solutions. None are really good general solutions,
but since you are talking about extremely proprietary and limited sort of
stuff, let me toss them out for consideration, in no particular order.

1. Write an ISAPI Filter which rewrites specific URLs without .EXE to ones
with a .EXE. The ISAPI Filter will need some knowledge of which URLs to
rewrite -- whether it is all requests to the cgi-bin files, a set list of
cgi-bin files, etc.

The URL should get past the firewall, and as long as the ISAPI Filter
rewrites the URL to become a .EXE in SF_NOTIFY_PREPROC_HEADERS, IIS will
execute the request as if it was sent that way.

2. Configure a unique scriptmap for every single CGI EXE that you want to
execute. Make sure the scriptmap extension is NOT blocked by the firewall.
Have your software reference these new URLs. For example, scriptmap .abc
extension to CGI.EXE, and the application's HTML should now reference
/foobar.abc to trigger CGI.EXE to run on the server.

3. Variation on #2. For every single CGI.EXE that you want to execute,
create a IIsWebFile metabase node for them, set a *-scriptmap on the
metabase node that points to the CGI.EXE that you want to execute. i.e.
Assuming you want the URL "/vdir/bar" to execute C:\cgi-bin\foo.exe"
cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs create
w3svc/1/root/vdir/bar IIsWebFile
cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs set
w3svc/1/root/vdir/bar/ScriptMaps "*,C:\cgi-bin\foo,1"

#1 requires no configuration changes. Everything is in the ISAPI Filter.
Problem is that the filter is not easy to write for a novice IIS user. Works
on NT4 and newer
#2 requires some configuration changes as well as application configuration.
No code necessary. Works on NT4 and newer
#3 requires a lot of configuration changes, but no application changes nor
code are necessary. It requires IIS5 or newer

I personally would give #3 a shot since it requires no code, no application
changes, and allows you to execute any given CGI EXE (or ISAPI DLL for that
matter) using any name/extension on the URL.

-- 
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Dave Williams" <dwilliams@law.pace.edu> wrote in message
news:a43bcf3.0410151425.161e3165@posting.google.com...
About a year ago this thread (of which this was the first post)
appeared.  I know some folks who are now in exactly the same
situation.  Does anyone know if there has been a satisfactory
workaround for this, or if Microsoft has added a feature in IIS to
make it possible to run cgi-programs in IIS that DO NOT have a .EXE
extension.?  (I'm a Linux/Unix person myself, and I was pretty
surprised to find that this was a problem in IIS.)
It's these folks-I-know's server provider who says they have to serve
up all cgi-bin files with .EXE extension, versus these folks-I-know's
client who says they cannot and will not let any files with a .EXE
extension through their firewall.
The server provider is also the provider of some
extremely-industry-specific software that is running on this
provider's server (basicaly a really specific-industry-specialized
database) for which these folks-I-know have already shelled out a
great deal of money.  No hope of changing providers as the server, the
service, and the software are all one paid-for package, run by the
provider, but the provider is obviously running IIS.
Any help possible?  It would be greatly appreciated!  (No, it's not me
who has the problem, but these are REALLY good friends of mine!)
Thanks,
Dave Williams
Pace Law Library
> Hi,
> Is it possible to execute a .EXE CGI program on W2K IIS5.0 without the
.exe
> extension?  IOW, http://my.server.com/foo.exe works fine, but the customer
> wants http://my.server.com/foo.  Their firewall blocks all access to URL's
> ending in .exe, but the technology I want to implement is a .exe based
CGI.
> Their firewall rules and security administrators are pretty strict, and I
> don't think I can get clearance even for a single, named .exe CGI.  So, if
> there is any way to put a "wrapper" around the .exe and hide the extension
> somehow, that would be most useful.
> Of course, this would all work fine under Unix :-(
>Thanks,
> Scott


Relevant Pages

  • Executing a .EXE CGI program
    ... make it possible to run cgi-programs in IIS that DO NOT have a .EXE ... It's these folks-I-know's server provider who says they have to serve ... up all cgi-bin files with .EXE extension, ...
    (microsoft.public.inetserver.iis)
  • Re: Remote application lunch and terminate (IIS server)
    ... If the program you are trying to launch is not a real CGI application, ... What you want to do is possible, but really has NOTHING to do with IIS. ... then invoke a command on the server. ... depends on how the EXE is written. ...
    (microsoft.public.inetserver.iis)
  • Re: Cantt download "exe" file because of IIS version
    ... with IIS and can completely alter IIS behavior in arbitrary manners, ... cut out the EXE download and just standardize the installation using your ... As far as I can tell, we are only running Tomcat as an ISAPI application. ...
    (microsoft.public.inetserver.iis)
  • RE: %processor time for specific application
    ... Administering resource usage of Internet Information Server (IIS) 6.0 ... start multiple processes from the same .exe file. ... The name of the application pool that corresponds to the Web site ... You can now create a process-matching criterion that includes the ...
    (microsoft.public.inetserver.iis)
  • Re: Cantt download "exe" file because of IIS version
    ... The default MIME Type in IIS for .exe is application/octet-stream. ... When I looked at the download type it was still set to the MIME type that I just removed. ...
    (microsoft.public.inetserver.iis)