February 2009 Archives

24-02-2009 14:38

Allowing remote access to reverse ssh tunnels

So the logic I applied was if I have a reverse ssh [if you don't know what that is, then search it, you will get loads back on how to set it up] listening on local port I thought I could hit that port from another PC on the network to go back up the tunnel. But no, it never worked. So looking into it I found that by default it only listens on 127.0.0.1. You can check what interfaces/IP its listening on with this command on the server:

netstat -ntl

You will see 127.0.0.1: with the port that you set it up to listen to locally. So I found one needs to added a config to the sshd_config file:

GatewayPorts clientspecified

It can be simply On or Off, but this way the client can stipulate. So how does the client do this? Well you need to say which interface in the command you use to set up the tunnel. So originally I would use:

autossh -2 -fN -M 2000 -R 1234:localhost:22 user@domain.com

I use autossh to keep this alive. So now that will still default to 127.0.0.1 with the "clientspecified" option we have taken. So we need to tell it to listen to an interface an IP is attached to or all interfaces.

autossh -2 -fN -M 2000 -R 0.0.0.0:1234:localhost:22 user@domain.com

You can see where I have added the IP of 0.0.0.0 which means all. You can just put its LAN ip, for example, but then it will not listen on 127.0.0.1 any more.

I hope this helps someone. A lot of this came from this blog here.


Posted by DaveQB | Permanent Link | Categories: IT

24-02-2009 12:00

Apache Proxy

Doing WebDev you sometimes want access to your internal web servers outside of the network. Great tutorial here for setting up Apaches proxy.

http://www.apachetutor.org/admin/reverseproxies

Posted by DaveQB | Permanent Link | Categories: IT

23-02-2009 02:46

yui TabView

If you haven't checked out yui, I strongly suggest you do. A fantastic ready to go library of AJAX wonder. Simply include the js and/or css files you need for the function you want and follow the great documentation in implementing it into your website. http://developer.yahoo.com/yui/

I had some trouble implementing yui's TabView. Look at the basis of TabView below.

<div id="menu" class="yui-navset">
	<ul class="yui-nav">
	<li class="selected"><a href="#tab1"><em>Tab One Label</em></a></li>
	<li><a href="#tab2"><em>Tab Two Label</em></a></li>
	<li><a href="#tab3"><em>Tab Three Label</em></a></li>
	</ul>




	<div class="yui-content">
	<div><p>Tab One Content</p></div>
	<div><p>Tab Two Content</p></div>
	<div><p>Tab Three Content</p></div>
	</div>
</div>

The problem I had was putting the tab labels into the header div and the the content into the place I wanted it in the body div. The problem was when I closed the header div, the div with id "menu" would then be closed and that was the end of the TabView; the contents would all show at once. Finally, I figured out that you simply wrap the header as well, into the menu div block. See below:

<div id="menu" class="yui-navset">

  <div id="header">
    <img src="header graphic.jpg">
    <h1>Some text maybe</h1>


	<ul class="yui-nav">
	<li class="selected"><a href="#tab1"><em>Tab One Label</em></a></li>
	<li><a href="#tab2"><em>Tab Two Label</em></a></li>
	<li><a href="#tab3"><em>Tab Three Label</em></a></li>
	</ul>

  </div> <!-- Close header, but menu still open -->


	<div class="yui-content">
	<div><p>Tab One Content</p></div>
	<div><p>Tab Two Content</p></div>
	<div><p>Tab Three Content</p></div>
	</div>
</div> <!-- now close menu -->

So simple, but had me going for a little bit. Damn yui is so sweet!!


Posted by DaveQB | Permanent Link | Categories: IT