{"id":223,"date":"2009-01-27T21:29:53","date_gmt":"2009-01-27T19:29:53","guid":{"rendered":"http:\/\/glandium.org\/blog\/?p=223"},"modified":"2010-01-27T08:52:25","modified_gmt":"2010-01-27T07:52:25","slug":"ssh-using-a-socks-or-http-proxy","status":"publish","type":"post","link":"https:\/\/glandium.org\/blog\/?p=223","title":{"rendered":"SSH using a SOCKS or HTTP proxy"},"content":{"rendered":"<p>If you follow <a href=\"http:\/\/planet.debian.org\/\">planet debian<\/a>, you may already know about the <code>ProxyCommand<\/code> directive in <code>$HOME\/.ssh\/config<\/code>. It allows OpenSSH to connect to a remote host through a given command.<\/p>\n<p>One setup that I use a lot is to have connections be established through a SOCKS proxy. Until today, I was using <a href=\"http:\/\/packages.debian.org\/connect-proxy\">connect<\/a>, a small tool written by Shun-ichi Got\u00c3\u00b4. The typical setup I used is:<\/p>\n<blockquote><p><code>Host *.mydomain.com<br \/>\nProxyCommand connect -S socksserver:1080 %h %p<\/code><\/p><\/blockquote>\n<p>I also use jump hosts occasionally, with a setup like this:<\/p>\n<blockquote><p><code>Host somehost.mydomain.com<br \/>\nProxyCommand ssh otherhost.mydomain.com nc -w1 %h %p<\/code><\/p><\/blockquote>\n<p>And today I discovered that <a href=\"http:\/\/packages.debian.org\/netcat-openbsd\">netcat-openbsd<\/a> does support connexions through a proxy, either SOCKS or HTTP. Why keep using two different tools when you can use one? ;) So I changed my setup to:<\/p>\n<blockquote><p><code>Host *.mydomain.com<br \/>\nProxyCommand nc -xsocksserver:1080 -w1 %h %p<\/code><\/p><\/blockquote>\n<p>The default is to use SOCKS 5, add <code>-X4<\/code> for SOCKS 4 and <code>-Xconnect<\/code> for HTTP CONNECT proxies. Note that it doesn't support choosing which end does the name resolutions like connect does with the <code>-R<\/code> option.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you follow planet debian, you may already know about the ProxyCommand directive in $HOME\/.ssh\/config. It allows OpenSSH to connect to a remote host through a given command. One setup that I use a lot is to have connections be established through a SOCKS proxy. Until today, I was using connect, a small tool written [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[23],"class_list":["post-223","post","type-post","status-publish","format-standard","hentry","category-pdo","tag-en"],"_links":{"self":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=223"}],"version-history":[{"count":4,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/223\/revisions"}],"predecessor-version":[{"id":656,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/223\/revisions\/656"}],"wp:attachment":[{"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/glandium.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}