In my previous blog I talked about setting up a HTTP tunnel using BoutDuTunnel. To setup the server-side, a command line application was used: BdtServer. BoutDuTunnel also provides a web application solution BdtWebServer which lets you host the application inside a web server. To host BdtWebServer in Ubuntu, BoutDuTunnel recommends to use Apache/mod_mono, however I decided to use an alternative approach.
Configuring BdtWebServer
Mono XSP is a lightweight and simple webserver written in C# which runs run ASP.NET applications.
To install Mono XSP run the following:
$ apt-get install mono-xsp2 $ apt-get install libmono-system-runtime2.0-cil
To ensure that XSP is properly installed you can install the ASP.NET 1.1 and 2.0 demo pages.
$ apt-get install asp.net2-examples $ xsp2 --applications /:/usr/share/asp.net2-demos
When the server has successfully started, point your browser to http://localhost:8080 (the default port for XSP web server is 8080) to display the web page below:
If the following error is encountered:
System.InvalidOperationException: Standard output has not been redirected or process has not been started.
Run the following command to address the issue:
ln -s /usr/bin/gmcs2 /usr/bin/gmcs
Now the BdtWebServer is ready to be started:
xsp2 --port 8080 --nonstop --applications /:/opt/bdt.bin.1.4.3066.mono/BdtWebServer
--nonstop don’t stop the server by pressing enter. Must be used when the server has no controlling terminal.
Configuring BdtClient
Setting up the BdtClient to establish a connection to BdtWebServer is similar to BdtServer with the exception that the name attribute is set to BdtServer.soap in the service tag of the configuration file.
<service name="BdtServer.soap" .../>
Security Issue
When hosting the BdtWebServer application in a web server the BdtServerCfg.xml (which contains the username and passwords) will be exploit when you point the web browser http://my.server:8080/BdtServerCfg.xml.
To address this issue I setup XSP to integrate with Apache/mod_proxy by configuring the following Apache configuration to forbid access to BdtServerCfg.xml
<Location /BdtServerCfg.xml>
Order deny,allow
Deny from all
</Location>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests off
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
Finally, I setup a firewall to block port 8080 from public access.
Related posts:
