Forum

CGI plugin issue

gerald.hild
18 January 2017, 21:37
Hello,
I create a little executable plugin (writen in C).
I develop under windows so I use Hiawatha for windows
I'm a newby in web server setting and I don't understand how to configure Hiawatha to understand to execute my plugin.
The name of my plugin is slt_plugin.exe

The configuration part to declare for CGI part :
# COMMON GATEWAY INTERFACE (CGI) SETTINGS
# These settings can be used to run CGI applications.
#
#CGIhandler = C:\Program Files\PHP5\php-cgi.exe:php
#CGIhandler = INSTALL_DIR\program\ssi-cgi.exe:shtml
CGIhandler = INSTALL_DIR\slat_plugin\slt_plugin.exe:slt
CGIextension = exe

In my Html page, I want to execute slt_plugin and I call in Ajax :
loadXMLDoc("/slt_plugin.slt?portstate.slt", processUpdate, 0);

Can anyone help me please ? I test a lot of solution but my plugin does'nt launch by Hiawatha ?
Thanks for your help
Joe Schmoe
20 January 2017, 01:07
Did you add the following directive as well:
VirtualHost {
...
ExecuteCGI = yes
}

More info: https://www.hiawatha-webserver.org/howto/cgi_and_fastcgi
gerald.hild
23 January 2017, 16:12
Thank you Joe,

I don't use the Virtual Host, I use the default web site zone. I test to use Virtual Host, perhaps this is my error.
When I find the error, I will post the solution for other people.
gerald.hild
23 January 2017, 17:00
Hello,
I test with a virtual host in hiawatha.conf and Hiawatha doesn't want to start my plugin. I give the entire config file :
# Hiawatha main configuration file
#
set INSTALL_DIR = CONFIG_DIR\..


# GENERAL SETTINGS
#
ConnectionsTotal = 150
ConnectionsPerIP = 10
SystemLogfile = INSTALL_DIR\logfiles\system.log
GarbageLogfile = INSTALL_DIR\logfiles\garbage.log
ExploitLogfile = INSTALL_DIR\logfiles\exploit.log
PIDfile = INSTALL_DIR\work\hiawatha.pid
WorkDirectory = INSTALL_DIR\work


# BINDING SETTINGS
# A binding is where a client can connect to.
#
Binding {
Port = 80
# Interface = 127.0.0.1
# MaxKeepAlive = 30
# TimeForRequest = 3,20
}
#
#Binding {
# Port = 443
# Interface = ::1
# MaxKeepAlive = 30
# TimeForRequest = 3,20
# TLScertFile = INSTALL_DIR\config\hiawatha.pem
#}


# BANNING SETTINGS
# Deny service to clients who misbehave.
#
#BanOnGarbage = 300
#BanOnMaxPerIP = 60
#BanOnMaxReqSize = 300
#KickOnBan = yes
#RebanDuringBan = yes


# COMMON GATEWAY INTERFACE (CGI) SETTINGS
# These settings can be used to run CGI applications.
#
#CGIhandler = C:\Program Files\PHP5\php-cgi.exe:php
#CGIhandler = INSTALL_DIR\program\ssi-cgi.exe:shtml
CGIhandler = C:\Hiawatha\slat_plugin\slt_plugin.exe:slt
#CGIextension = exe

#
#FastCGIserver {
# FastCGIid = PHP5
# ConnectTo = 127.0.0.1:2005
# Extension = php
#}


# URL TOOLKIT
# This URL toolkit rule was made for the Banshee PHP framework, which
# can be downloaded from http://www.hiawatha-webserver.org/banshee
#
#UrlToolkit {
# ToolkitID = banshee
# RequestURI isfile Return
# Match ^/(css|files|images|js)/ Return
# Match ^/(favicon.ico|robots.txt|sitemap.xml)$ Return
# Match .*\?(.*) Rewrite /index.php?$1
# Match .* Rewrite /index.php
#}


# DEFAULT WEBSITE
# It is wise to use your IP address as the hostname of the default website
# and give it a blank webpage. By doing so, automated webscanners won't find
# your possible vulnerable website.
#
Hostname = 10.1.3.76
WebsiteRoot = INSTALL_DIR\htdocs
StartFile = index.html
AccessLogfile = INSTALL_DIR\logfiles\access.log
ErrorLogfile = INSTALL_DIR\logfiles\error.log

VirtualHost {
Hostname = 127.0.0.1
WebsiteRoot = INSTALL_DIR\htdocs
AccessLogfile = INSTALL_DIR\logfiles\accessvirtual.log
ErrorLogfile = INSTALL_DIR\logfiles\errorvirtual.log
ExecuteCGI = yes
TimeForCGI = 10
}

In my Html page, I want to execute slt_plugin and I call in Ajax :
loadXMLDoc("/portstate.slt", processUpdate, 0);

It's very strange because I think there is a little problem but I can't solve it myself...
This topic has been closed.