<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Dangerous Dan's Weblog</title>
	<atom:link href="http://returnofthezombie.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://returnofthezombie.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Thu, 05 Nov 2009 13:38:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='returnofthezombie.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Dangerous Dan's Weblog</title>
		<link>http://returnofthezombie.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://returnofthezombie.wordpress.com/osd.xml" title="Dangerous Dan&#039;s Weblog" />
	<atom:link rel='hub' href='http://returnofthezombie.wordpress.com/?pushpress=hub'/>
		<item>
		<title>SSH Tunneling (and reverse tunneling)</title>
		<link>http://returnofthezombie.wordpress.com/2009/11/05/ssh-tunneling-and-reverse-tunneling/</link>
		<comments>http://returnofthezombie.wordpress.com/2009/11/05/ssh-tunneling-and-reverse-tunneling/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 13:38:47 +0000</pubDate>
		<dc:creator>returnofthezombie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://returnofthezombie.wordpress.com/?p=13</guid>
		<description><![CDATA[SSH Tunneling: In short, SSH tunneling allows unix users to connect to a remote computer (through ssh) and map a local port to the remote computer port. SSH Reverse Tunneling: SSH reverse tunneling allows a unix user to connect to a remote computer and map a port on the remote computer to a port in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=returnofthezombie.wordpress.com&amp;blog=2884967&amp;post=13&amp;subd=returnofthezombie&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="text-align:left;">SSH Tunneling:</h2>
<p style="text-align:left;">In short, SSH tunneling allows unix users to connect to a remote computer (through ssh) and map a local port to the remote computer port.</p>
<h2 style="text-align:left;">SSH Reverse Tunneling:</h2>
<p style="text-align:left;">SSH reverse tunneling allows a unix user to connect to a remote computer and map a port on the remote computer to a port in the local machine.</p>
<h2 style="text-align:left;">Scenario:</h2>
<p style="text-align:left;">We need to test some kind of external service which redirects back to one of our provided service urls. We need a server with a public IP to do it. However, its a pain to always compile, deploy on the public server and test. Instead, it will be much easier to be able to map a remote server port to a port on my local machine so that I can deploy my services locally to which the external service will redirect to.</p>
<p style="text-align:left;">Assume, our external server hostname is mapped to: example.com and we will use sso.example.com to provide Single Sign On (sso) support. From the example site, when the user wants to log in using the SSO service provided by sso.example.com, the user gets redirected to sso.example.com with certain request parameters. Once the user has successfully logged into sso.example.com, he gets redirected back to example.com with some parameters which indicate that the user logged in successfully.</p>
<p style="text-align:left;">Now to test this, we will need to redeploy the services into example.com every time we fix something. Of-course, we can mount a file system on the public server that reads the deployment files from a nfs share which can be mounted to some directory on your machine. But if the public server and your machine are in different networks and your machine do not have a public IP, then its slightly trickier to achieve. SSH reverse tunneling will help us come to a solution. Assume that your machine host name is &#8220;developer&#8221; (it can of-course be an IP).</p>
<p style="text-align:left;">
<strong><em>ssh -f user@example.com -R example.com:8081:developer:8080 -N</em></strong>
</p>
<p style="text-align:left;">What this will do is it will log into the remote server &#8220;example.com&#8221;, open a port &#8220;8081&#8243; and connect it to &#8220;developer:8080&#8243;. So, when anyone logs into &#8220;example.com&#8221; and sends a request to &#8220;http://localhost:8081&#8243;, the request comes to port 8080 on developer.</p>
<p style="text-align:left;">But this is no fun since to make the request, a user has to log into example.com. So to fix that, we can map another port on example.com to forward everything to port &#8220;8081&#8243; which is the reverse tunneling port. To do it, we have to first log into example.com and execute the following command:</p>
<p style="text-align:left;">
<em><strong>ssh -f user@example.com -L example.com:8080:localhost:8081 -N</strong></em>
</p>
<p style="text-align:left;">Once this command is executed, all requests send to example.com:8080 will be forwarded to example.com:8081 which in turn will forward everything to  &#8220;developer:8080&#8243;.</p>
<h2 style="text-align:left;">Why not try this shortcut?</h2>
<p>
<em><strong>ssh -f user@example.com -R example.com:8080:developer:8080 -N</strong></em>
</p>
<p>This does log into example.com and map port 8080 to forward everything to developer:8080.<br />
However, it only works if someone logs into example.com and sends a request to &#8220;localhost:8080&#8243;.<br />
It doesn&#8217;t work if a user simply sends the request to &#8220;example.com:8080&#8243;.<br />
The only way to make the shortcut mentioned above work is to configure the ssh daemon with the <em>GatewayPorts</em> option enabled.<br />
By default, sshd binds the reverse tunneling port to the loop back interface only,<br />
thus preventing remote hosts from using the reverse tunneling port.<br />
The default value for <em>GatewayPorts</em> is <em>no</em> .</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/returnofthezombie.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/returnofthezombie.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/returnofthezombie.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/returnofthezombie.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/returnofthezombie.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/returnofthezombie.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/returnofthezombie.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/returnofthezombie.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/returnofthezombie.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/returnofthezombie.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/returnofthezombie.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/returnofthezombie.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/returnofthezombie.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/returnofthezombie.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=returnofthezombie.wordpress.com&amp;blog=2884967&amp;post=13&amp;subd=returnofthezombie&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://returnofthezombie.wordpress.com/2009/11/05/ssh-tunneling-and-reverse-tunneling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9cb9016fd3042f31bb114354e14acd43?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">returnofthezombie</media:title>
		</media:content>
	</item>
		<item>
		<title>How to see the SQL statements executed on your database</title>
		<link>http://returnofthezombie.wordpress.com/2009/11/05/8/</link>
		<comments>http://returnofthezombie.wordpress.com/2009/11/05/8/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 09:30:41 +0000</pubDate>
		<dc:creator>returnofthezombie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://returnofthezombie.wordpress.com/?p=8</guid>
		<description><![CDATA[Why is it of any interest at all? The application may not log all the SQL statements it is executing. If you are using frameworks/tools that generate SQL statements, then it can be very handy to know how the generated statements look like. Of-course, a lot of the frameworks out there do allow you to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=returnofthezombie.wordpress.com&amp;blog=2884967&amp;post=8&amp;subd=returnofthezombie&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Why is it of any interest at all?</h2>
<p>The application may not log all the SQL statements it is executing. If you are using frameworks/tools that generate SQL statements, then it can be very handy to know how the generated statements look like. Of-course, a lot of the frameworks out there do allow you to configure their logging so that you can see what SQLs are being generated. However for prepared statements, most of them fail to display the final SQL that is executed on your database.</p>
<h2><a name="HowtoseetheSQLstatementsexecutedonyourdatabase-Tools:"></a>Tools:</h2>
<p>One interesting tool to get this job done is: <a rel="nofollow" href="http://jdbclogger.sourceforge.net/">JDBC Logger<sup><img src="http://wiki.escenic.com/images/icons/linkext7.gif" border="0" alt="" width="7" height="7" align="absmiddle" /></sup></a>. Its easy to configure specially if you are already using a connection pool.</p>
<h2><a name="HowtoseetheSQLstatementsexecutedonyourdatabase-Configuration:"></a>Configuration:</h2>
<p>Follow the steps below to configure your connection pool (Tomcat 6.0) to use JDBC Logger:</p>
<ul>
<li>download the binaries and put the jar files in your classpath</li>
<li>configure jdbc to use JDBC Logger&#8217;s driver
<div>
<div>
<pre>&lt;Resource
      name="jdbc/mydb"
      auth="Container"
      type="javax.sql.DataSource"
      ...
      driverClassName="net.sourceforge.jdbclogger.JdbcLoggerDriver"
      url="jdbc:oracle:thin:@localhost:1521:orcl"
   /&gt;</pre>
</div>
</div>
</li>
<li>create a file in the root of your application server classpath: <strong>jdbclogger.properties</strong></li>
<li>add your desired jdbc driver which it should wrap. Example entry: <strong>jdbclogger.driver=oracle.jdbc.driver.OracleDriver</strong></li>
<li>set logging level for JDBC Logger to DEBUG: <strong>log4j.logger.net.sourceforge.jdbclogger=DEBUG</strong></li>
</ul>
<p>Done.</p>
<p>Note that, the amount of SQL statements logged may be a bit too much to have in one log file. In that case, you can configure log4j to let JDBC Logger to log the SQL statements into a separate file.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/returnofthezombie.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/returnofthezombie.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/returnofthezombie.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/returnofthezombie.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/returnofthezombie.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/returnofthezombie.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/returnofthezombie.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/returnofthezombie.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/returnofthezombie.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/returnofthezombie.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/returnofthezombie.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/returnofthezombie.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/returnofthezombie.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/returnofthezombie.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=returnofthezombie.wordpress.com&amp;blog=2884967&amp;post=8&amp;subd=returnofthezombie&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://returnofthezombie.wordpress.com/2009/11/05/8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9cb9016fd3042f31bb114354e14acd43?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">returnofthezombie</media:title>
		</media:content>

		<media:content url="http://wiki.escenic.com/images/icons/linkext7.gif" medium="image" />
	</item>
	</channel>
</rss>
