<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>vincentkong.com &#187; Mono</title>
	<atom:link href="http://www.vincentkong.com/tag/mono/feed" rel="self" type="application/rss+xml" />
	<link>http://www.vincentkong.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 25 Dec 2011 01:35:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Installing BoutDuTunnel Server on Mono XSP</title>
		<link>http://www.vincentkong.com/2009/06/installing-boutdutunnel-server-on-mono-xsp</link>
		<comments>http://www.vincentkong.com/2009/06/installing-boutdutunnel-server-on-mono-xsp#comments</comments>
		<pubDate>Fri, 05 Jun 2009 21:43:37 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Tunnel]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.vincentkong.com/?p=865</guid>
		<description><![CDATA[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 &#8230; <a href="http://www.vincentkong.com/2009/06/installing-boutdutunnel-server-on-mono-xsp">Continue reading <span class="meta-nav">&#8594;</span></a>


Related posts:<ol><li><a href='http://www.vincentkong.com/2009/05/http-tunnel-through-isa-server' rel='bookmark' title='HTTP Tunnel Through ISA Server'>HTTP Tunnel Through ISA Server</a></li>
<li><a href='http://www.vincentkong.com/2009/05/building-mono-from-source' rel='bookmark' title='Building Mono from Source'>Building Mono from Source</a></li>
<li><a href='http://www.vincentkong.com/2008/03/ssh-through-http-proxies' rel='bookmark' title='SSH through HTTP Proxies'>SSH through HTTP Proxies</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In my previous blog I talked about setting up a <a href="http://www.vincentkong.com/2009/05/http-tunnel-through-isa-server/">HTTP tunnel using BoutDuTunnel</a>.  To setup the server-side, a command line application was used:  <code>BdtServer</code>.  BoutDuTunnel also provides a web application solution <code>BdtWebServer</code> which lets you host the application inside a web server.  To host BdtWebServer in Ubuntu, BoutDuTunnel recommends to use <code>Apache/mod_mono</code>, however I decided to use an alternative approach.</p>
<h3>Configuring BdtWebServer</h3>
<p>Mono XSP is a lightweight and simple webserver written in C# which runs run ASP.NET applications.</p>
<p>To install Mono XSP run the following:</p>
<pre>$ apt-get install mono-xsp2
$ apt-get install libmono-system-runtime2.0-cil</pre>
<p>To ensure that XSP is properly installed you can install the ASP.NET 1.1 and 2.0 demo pages.</p>
<pre>$ apt-get install asp.net2-examples
$ xsp2 --applications /:/usr/share/asp.net2-demos</pre>
<p>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:</p>
<div id="attachment_887" class="wp-caption alignnone" style="width: 310px"><a href="http://www.vincentkong.com/wp-content/uploads/2009/06/asp_net_examples.png"><img class="size-medium wp-image-887" title="ASP.NET Examples" src="http://www.vincentkong.com/wp-content/uploads/2009/06/asp_net_examples-300x296.png" alt="ASP.NET Examples" width="300" height="296" /></a><p class="wp-caption-text">ASP.NET Examples</p></div>
<p>If the following error is encountered:</p>
<p><code>System.InvalidOperationException: Standard output has not been redirected or process has not been started.</code></p>
<p>Run the following command to address the issue:</p>
<pre>ln -s /usr/bin/gmcs2 /usr/bin/gmcs</pre>
<p>Now the BdtWebServer is ready to be started:</p>
<p><code>xsp2 --port 8080 --nonstop --applications /:/opt/bdt.bin.1.4.3066.mono/BdtWebServer</code></p>
<p><code>--nonstop</code> don&#8217;t stop the server by pressing enter. Must be used when the server has no controlling terminal.</p>
<h3>Configuring BdtClient</h3>
<p>Setting up the BdtClient to establish a connection to BdtWebServer is similar to BdtServer with the exception that the <code>name</code> attribute is set to <code>BdtServer.soap</code> in the <code>service</code> tag of the configuration file.</p>
<pre>&lt;service name="BdtServer.soap" .../&gt;</pre>
<h3>Security Issue</h3>
<p>When hosting the BdtWebServer application in a web server the <code>BdtServerCfg.xml</code> (which contains the username and passwords) will be exploit when you point the web browser http://my.server:8080/BdtServerCfg.xml.</p>
<p>To address this issue I setup XSP to integrate with <code>Apache/mod_proxy</code> by configuring the following Apache configuration to forbid access to <code>BdtServerCfg.xml</code></p>
<pre>    &lt;Location /BdtServerCfg.xml&gt;
        Order deny,allow
        Deny from all
    &lt;/Location&gt;

    &lt;Proxy *&gt;
        Order deny,allow
        Allow from all
    &lt;/Proxy&gt;
    ProxyRequests off
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/</pre>
<p>Finally, I setup a firewall to block port 8080 from public access.</p>


<p>Related posts:<ol><li><a href='http://www.vincentkong.com/2009/05/http-tunnel-through-isa-server' rel='bookmark' title='HTTP Tunnel Through ISA Server'>HTTP Tunnel Through ISA Server</a></li>
<li><a href='http://www.vincentkong.com/2009/05/building-mono-from-source' rel='bookmark' title='Building Mono from Source'>Building Mono from Source</a></li>
<li><a href='http://www.vincentkong.com/2008/03/ssh-through-http-proxies' rel='bookmark' title='SSH through HTTP Proxies'>SSH through HTTP Proxies</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.vincentkong.com/2009/06/installing-boutdutunnel-server-on-mono-xsp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTP Tunnel Through ISA Server</title>
		<link>http://www.vincentkong.com/2009/05/http-tunnel-through-isa-server</link>
		<comments>http://www.vincentkong.com/2009/05/http-tunnel-through-isa-server#comments</comments>
		<pubDate>Mon, 01 Jun 2009 01:57:20 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Mono]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Tunnel]]></category>

		<guid isPermaLink="false">http://www.vincentkong.com/?p=826</guid>
		<description><![CDATA[About a year ago I wrote about creating a HTTP tunnel through a HTTP proxy server using GNU HTTP Tunnel.   Unfortunately if the proxy server was run by a ISA server then GNU HTTP Tunnel would not work since &#8230; <a href="http://www.vincentkong.com/2009/05/http-tunnel-through-isa-server">Continue reading <span class="meta-nav">&#8594;</span></a>


Related posts:<ol><li><a href='http://www.vincentkong.com/2009/06/installing-boutdutunnel-server-on-mono-xsp' rel='bookmark' title='Installing BoutDuTunnel Server on Mono XSP'>Installing BoutDuTunnel Server on Mono XSP</a></li>
<li><a href='http://www.vincentkong.com/2008/03/ssh-through-http-proxies' rel='bookmark' title='SSH through HTTP Proxies'>SSH through HTTP Proxies</a></li>
<li><a href='http://www.vincentkong.com/2008/08/surfing-the-web-using-ssh-tunnel' rel='bookmark' title='Surfing the Web using SSH Tunnel'>Surfing the Web using SSH Tunnel</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>About a year ago I wrote about creating a HTTP tunnel through a HTTP proxy server using <a href="http://www.vincentkong.com/2008/03/ssh-through-http-proxies/">GNU HTTP Tunnel</a>.   Unfortunately if the proxy server was run by a ISA server then GNU HTTP Tunnel would not work since it doesn&#8217;t support NTLM authentication.</p>
<p><a href="http://sebastien.lebreton.free.fr/bdtunnel/"> BoutDuTunnel</a> is an open source project written in C# and is compatible with HTTP proxy servers, even if they use NTLM authentication (like ISA Server) and even if they prohibit the &#8220;connect method&#8221;.</p>
<p>To setup BoutDuTunnel on Ubuntu I had to install Mono.  When using Mono 2.0.1 or 2.4 an error occurred <code>Unexpected binary element: 21</code> when running the <code>BdtClient.exe</code>.  Therefore I <a href="http://www.vincentkong.com/2009/05/building-mono-from-source/">installed Mono 1.9.1 by building it from the source</a>.</p>
<p>Instead of installing the latest version of BoutDuTunnel, I installed 1.4.3066 because an error would occur on the BoutDuTunnel server moments after the BoutDuTunnel client connected to it.</p>
<p><code>Unhandled Exception: System.MethodAccessException: Method `Bdt.Server.Service.TunnelSession:CheckTimeout (Bdt.Shared.Logs.ILogger)' is inaccessible from method `Bdt.Server.Service.TimeoutObject:CheckTimeout (Bdt.Shared.Logs.ILogger,System.Collections.Generic.Dictionary`2)'</code></p>
<h3>Setting Up the HTTP Tunnel</h3>
<h4>Setting Up BdtServer (on the home computer)</h4>
<p>The BdtServer can be setup through the command line or hosted inside Apache/mod_mono.  To setup BdtServer with the command line extract the BoutDuTunnel and modify the BdtServer configuration file.</p>
<p><code>$ unzip bdt.bin.1.4.3066.mono.zip<br />
$ cd bdt.bin.1.4.3066.mono/BdtServer<br />
$ nano BdtServerCfg.xml</code></p>
<p>The configuration file is well commented and should be similar to the following:</p>
<p>Configure binary stream/HTTP as the communication protocol to be used.</p>
<pre>&lt;service
name     = "BdtServer"
protocol = "Bdt.Shared.Protocol.HttpBinaryRemoting"
port     = "8080"
/&gt;</pre>
<p>Require user be authenticated before establishing a communication.</p>
<pre>&lt;users&gt;
&lt;username
enabled  = "true"
password = "password"
/&gt;
&lt;/users&gt;</pre>
<p>To start up BdtServer execute the following:</p>
<p><code>$ cd bdt.bin.1.4.3066.mono/BdtServer/<br />
$ mono BdtServer.exe</code></p>
<h4>Setting Up BdtClient (on the office computer)</h4>
<p>There are two types of client available for BoutDuTunnel:</p>
<ul>
<li>BdtClient run by the command line</li>
<li>BdtGuiClient which provides a GUI interface</li>
</ul>
<p>To setup BdtClient modify the <code>BdtClientCfg.xml</code> configuration file.</p>
<p>Configure hostname and communication protocol for server with BdtServer.</p>
<pre>  &lt;service
    name     = "BdtServer"
    protocol = "Bdt.Shared.Protocol.HttpBinaryRemoting"
    address  = "my.server"
    port     = "8080"
    username = "my.username"
    password = "my.password"
  /&gt;</pre>
<p>Configure the proxy/ISA server to be used.</p>
<pre>  &lt;proxy
    enabled  = "true"&gt;
    &lt;authentification
      auto     = "false"
      username = "proxy.username"
      password = "proxy.password"
      domain   = "proxy.domain"
    /&gt;
    &lt;configuration
      auto     = "false"
      address  = "proxy.hostname"
      port     = "proxy.port"
    /&gt;
  &lt;/proxy&gt;</pre>
<p>Configure the ports to be forwarded.</p>
<pre>  &lt;forward&gt;
    &lt;port22
      shared  = "false"
      enabled = "true"
      address = "my.ssh.server"
      port    = "22"
    /&gt;
  &lt;/forward&gt;</pre>
<p>Run the BoutDuTunnel client to establish a tunnel connection to the BdtServer.</p>
<p><code>C:\bdt.bin.1.4.3066.mono\BdtClient&gt;BdtClient</code></p>
<p>Now a SSH connection can be establish to your home computer by connecting through <code>localhost:22</code></p>


<p>Related posts:<ol><li><a href='http://www.vincentkong.com/2009/06/installing-boutdutunnel-server-on-mono-xsp' rel='bookmark' title='Installing BoutDuTunnel Server on Mono XSP'>Installing BoutDuTunnel Server on Mono XSP</a></li>
<li><a href='http://www.vincentkong.com/2008/03/ssh-through-http-proxies' rel='bookmark' title='SSH through HTTP Proxies'>SSH through HTTP Proxies</a></li>
<li><a href='http://www.vincentkong.com/2008/08/surfing-the-web-using-ssh-tunnel' rel='bookmark' title='Surfing the Web using SSH Tunnel'>Surfing the Web using SSH Tunnel</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.vincentkong.com/2009/05/http-tunnel-through-isa-server/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Building Mono from Source</title>
		<link>http://www.vincentkong.com/2009/05/building-mono-from-source</link>
		<comments>http://www.vincentkong.com/2009/05/building-mono-from-source#comments</comments>
		<pubDate>Sun, 31 May 2009 03:45:18 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.vincentkong.com/?p=792</guid>
		<description><![CDATA[Installing  Mono on Ubuntu is easy: $ apt-get install mono-2.0-devel Unfortunately even the latest version of Ubuntu 9.04 only comes with Mono 2.0.1.  To install a newer (or different) version a solution would be to build Mono from source. Download &#8230; <a href="http://www.vincentkong.com/2009/05/building-mono-from-source">Continue reading <span class="meta-nav">&#8594;</span></a>


Related posts:<ol><li><a href='http://www.vincentkong.com/2009/06/installing-boutdutunnel-server-on-mono-xsp' rel='bookmark' title='Installing BoutDuTunnel Server on Mono XSP'>Installing BoutDuTunnel Server on Mono XSP</a></li>
<li><a href='http://www.vincentkong.com/2009/05/http-tunnel-through-isa-server' rel='bookmark' title='HTTP Tunnel Through ISA Server'>HTTP Tunnel Through ISA Server</a></li>
<li><a href='http://www.vincentkong.com/2008/01/running-windows-application-on-ubuntu' rel='bookmark' title='Running Windows Application on Ubuntu'>Running Windows Application on Ubuntu</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Installing  Mono on Ubuntu is easy:</p>
<p><code>$ apt-get install mono-2.0-devel</code></p>
<p>Unfortunately even the latest version of Ubuntu 9.04 only comes with Mono 2.0.1.  To install a newer (or different) version a solution would be to build Mono from source.</p>
<p>Download the desire version from the <a href="http://www.mono-project.com/">Mono website</a> and extract the packaged file.</p>
<pre>$ wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.4.tar.bz2
$ tar -xf mono-2.4.tar.bz2</pre>
<p>To compile and install Mono execute the following</p>
<pre>$ cd mono-2.4
$ configure --prefix=/opt/mono-2.4</pre>
<p>Where <code>--prefix</code> option indicates which directory to installation should be; for more option run</p>
<pre>$ configure --help</pre>
<p>If anything is missing from the system, <code>configure</code> will throw an error, install the missing package with <code>apt-get</code> and try running it again.  Then execute the compilation and installation to complete the build.</p>
<pre>$ make
$ make install</pre>
<h3>Compiling Error with Mono 1.9.1</h3>
<p>If you are compiling Mono 1.9.1 the following error might be encountered:</p>
<pre>wapi_glob.c: In function 'globextend':
wapi_glob.c:303: error: 'ARG_MAX' undeclared (first use in this function)
wapi_glob.c:303: error: (Each undeclared identifier is reported only once
wapi_glob.c:303: error: for each function it appears in.)</pre>
<p>The problems is due to the newer versions of <code>GLib</code> no longer defines <code>ARG_MAX</code>. To fix this issue, add the following to <code>mono/io-layer/wapi_glob.c</code> in the Mono source directory:</p>
<pre>#include &lt;unistd.h&gt;</pre>
<pre>#if defined(_SC_ARG_MAX)
# if defined(ARG_MAX)
#    undef ARG_MAX
# endif
# define ARG_MAX sysconf (_SC_ARG_MAX)
#endif</pre>
<pre>#include "wapi_glob.h"</pre>


<p>Related posts:<ol><li><a href='http://www.vincentkong.com/2009/06/installing-boutdutunnel-server-on-mono-xsp' rel='bookmark' title='Installing BoutDuTunnel Server on Mono XSP'>Installing BoutDuTunnel Server on Mono XSP</a></li>
<li><a href='http://www.vincentkong.com/2009/05/http-tunnel-through-isa-server' rel='bookmark' title='HTTP Tunnel Through ISA Server'>HTTP Tunnel Through ISA Server</a></li>
<li><a href='http://www.vincentkong.com/2008/01/running-windows-application-on-ubuntu' rel='bookmark' title='Running Windows Application on Ubuntu'>Running Windows Application on Ubuntu</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.vincentkong.com/2009/05/building-mono-from-source/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

