{"id":1212,"date":"2006-05-23T12:45:00","date_gmt":"2006-05-23T07:45:00","guid":{"rendered":"http:\/\/chris.dwan.org\/?p=1212"},"modified":"2006-05-23T12:45:00","modified_gmt":"2006-05-23T07:45:00","slug":"ssh-hackery","status":"publish","type":"post","link":"https:\/\/chris.dwan.org\/?p=1212","title":{"rendered":"SSH hackery"},"content":{"rendered":"<p>This one goes out to my geek homies:<\/p>\n<p><!--more waaaaaay too geeky to be anywhere except under a cut--><br \/>\nI have a customer who opened up their firewall in the dead minimal manner to allow me access.  They gave me port 22 (ssh) inbound from a particular IP (our corporate server).  This meant that I could get in and poke around, but web access was denied me.  Normally in such situations, I use a single ssh redirection, like so:<\/p>\n<p><code>ssh -L 8080:their.server:80 my.server<\/code><\/p>\n<p>This sets up a tunnel from port 8080 on my laptop to port 80 (the web port) on their server.  I go to http:\/\/localhost:8080, and I see their web server.  Their firewall allows this because they only ever see inbound requests from my corporate server, on port 80.  It&#8217;s all nice and secure, because I still need an account on my.server to set up the connection.<\/p>\n<p>However, in this case, I needed to take another step.  Their firewall was blocking port 80 across the board.  So, I set up a chain of tunnels:<\/p>\n<p><code>ssh -L 8080:my.server:8081 my.server<br \/>\nssh -L 8081:their.server:80 their.server<\/code><\/p>\n<p>The first line sets up a tunnel to port 8081 on my server.  So, I go http:\/\/localhost:8080 and it goes to a non-used port on my corporate server.  The second line forwards that, via ssh to port 80 on their server.  It gets past their firewall, because I&#8217;m connecting through port 22.  Their webserver sees the requests coming from *itself*, which is totally cool.  Again, still all nice and secure, since I&#8217;m connecting through ssh.<\/p>\n<p>I feel that this is ninja.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This one goes out to my geek homies:<\/p>\n<p> <span style=\"color:#777\"> . . . &rarr; Read More: <a href=\"https:\/\/chris.dwan.org\/?p=1212\">SSH hackery<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/chris.dwan.org\/index.php?rest_route=\/wp\/v2\/posts\/1212"}],"collection":[{"href":"https:\/\/chris.dwan.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chris.dwan.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chris.dwan.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chris.dwan.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1212"}],"version-history":[{"count":0,"href":"https:\/\/chris.dwan.org\/index.php?rest_route=\/wp\/v2\/posts\/1212\/revisions"}],"wp:attachment":[{"href":"https:\/\/chris.dwan.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chris.dwan.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chris.dwan.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}