{"id":148,"date":"2016-12-28T11:07:21","date_gmt":"2016-12-28T10:07:21","guid":{"rendered":"http:\/\/xpam.pl\/blog\/?p=148"},"modified":"2024-04-03T00:55:11","modified_gmt":"2024-04-02T22:55:11","slug":"expose-your-dev-machine-to-the-public-via-reverse-ssh-tunnel","status":"publish","type":"post","link":"https:\/\/xpam.pl\/blog\/?p=148","title":{"rendered":"Expose your dev machine to the public via reverse SSH tunnel"},"content":{"rendered":"<p>Scenario: you are creating a REST service which needs to be exposed to the public even in early stage of development due to an upstream provider which sends back feedback data from a webhook API.<\/p>\n<p>You are also behind a NAT so you'd have to port forward yourself out but you can't do that for whatever reason. Or maybe you are behind a firewall and 7 proxies.<\/p>\n<p>All you need is an external server with a public IP. Then, on your machine:<\/p>\n<pre><code class=\"language-bash\">ssh -R 0.0.0.0:8080:localhost:8080 server_user@public_server_ip<\/code><\/pre>\n<p>In the above example, I used port 8080 which my REST service uses when I develop. On your public server, make sure you have<\/p>\n<p><code>GatewayPorts yes<\/code><\/p>\n<p>in <code>\/etc\/ssh\/sshd_config<\/code>. If it is missing, add it.<\/p>\n<p>And that's it.. your local REST service is now publicly accessible via <strong>public_server_ip:8080<\/strong>.<\/p>\n<p>a-m-a-z-i-n-g<\/p>\n<div class=\"wp-post-signature\">\r\n<br \/>\r\n<br \/>\r\n<img src='https:\/\/xpam.pl\/aaaaff.png' title='Moonie' \/> Cen<br \/>\r\n<a href='https:\/\/github.com\/cen1'>GitHub<\/a><br \/>\r\n<a href='https:\/\/eurobattle.net'>Eurobattle.net<\/a><br \/>\r\n<a href='https:\/\/lagabuse.com'>Lagabuse.com<\/a><br \/>\r\n<a href='https:\/\/bnetdocs.org'>Bnetdocs<\/a><br \/>\r\n<\/div>\r\n","protected":false},"excerpt":{"rendered":"<p>Scenario: you are creating a REST service which needs to be exposed to the public even in early stage of development due to an upstream provider which sends back feedback data from a webhook API. You are also behind a NAT so you'd have to port forward yourself out but you can't do that for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-148","post","type-post","status-publish","format-standard","hentry","category-other"],"_links":{"self":[{"href":"https:\/\/xpam.pl\/blog\/index.php?rest_route=\/wp\/v2\/posts\/148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xpam.pl\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xpam.pl\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xpam.pl\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xpam.pl\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=148"}],"version-history":[{"count":3,"href":"https:\/\/xpam.pl\/blog\/index.php?rest_route=\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":546,"href":"https:\/\/xpam.pl\/blog\/index.php?rest_route=\/wp\/v2\/posts\/148\/revisions\/546"}],"wp:attachment":[{"href":"https:\/\/xpam.pl\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xpam.pl\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xpam.pl\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}