{"id":134,"date":"2005-05-03T19:24:23","date_gmt":"2005-05-03T19:24:23","guid":{"rendered":"http:\/\/www.lucas-nussbaum.net\/blog\/?p=134"},"modified":"2005-05-03T19:24:23","modified_gmt":"2005-05-03T19:24:23","slug":"rebondir-avec-ssh","status":"publish","type":"post","link":"https:\/\/www.lucas-nussbaum.net\/blog\/?p=134","title":{"rendered":"Rebondir avec SSH"},"content":{"rendered":"<p>Apr\u00e8s GCC et les trampolines, voici les rebonds avec SSH. Ou alors, la super-astuce du jour.<\/p>\n<p>Supposez que vous ayez une machine (passerelle, frontal de grappe, etc), avec des machines derri\u00e8re. Plusieurs fois par jour, vous faites :<\/p>\n<pre>ssh frontal ssh node38-01<\/pre>\n<p>Un peu plus tard :<\/p>\n<pre>ssh frontal ssh node38-02<\/pre>\n<p>Pas pratique, hein ?<\/p>\n<p>Heureusement, Nicolas C. m&#8217;a donn\u00e9 la solution qui tue.<\/p>\n<p><b>Acte 1 :<\/b> l&#8217;option ProxyCommand de SSH<\/p>\n<pre>     ProxyCommand              Specifies the command to use to connect to the server.  The com-              mand string extends to the end of the line, and is executed with              \/bin\/sh.  In the command string, '%h' will be substituted by the              host name to connect and '%p' by the port.  The command can be              basically anything, and should read from its standard input and              write to its standard output.  It should eventually connect an              sshd(8) server running on some machine, or execute sshd -i some-              where.  Host key management will be done using the HostName of              the host being connected (defaulting to the name typed by the              user).  Setting the command to ``none'' disables this option              entirely.  Note that CheckHostIP is not available for connects              with a proxy command.<\/pre>\n<p>Vous l&#8217;aviez compris, vous pouvez faire qqchose comme \u00e7a dans votre <b>.ssh\/config<\/b> :<\/p>\n<pre>Host node01         ProxyCommand ssh login@frontal \"nc node38-01 22\"<\/pre>\n<p>Un <b>ssh node01<\/b> fait ce \u00e0 quoi vous vous attendiez.<\/p>\n<p>C&#8217;est pas mal, mais \u00e7a passe pas tr\u00e8s bien \u00e0 l&#8217;\u00e9chelle. Car derri\u00e8re <i>frontal<\/i>, forc\u00e9ment, vous avez tout plein de noeuds ! Ca serait mieux d&#8217;avoir un truc plus &#8230;g\u00e9n\u00e9rique.<\/p>\n<p><b>Acte 2 :<\/b> l\u00e0 o\u00f9 vous direz &#8220;ouahhh&#8221;<\/p>\n<p>Je vous donne la solution directement :<\/p>\n<pre>Host *.frontal         ProxyCommand ssh login@frontal \"nc \\$(basename %h .frontal) %p\"<\/pre>\n<p>Comme vous l&#8217;aviez devin\u00e9, suffit de faire un ssh node38-01.frontal pour se connecter \u00e0 node38-01 en rebondissant sur le frontal. Ou un ssh node38-02.frontal pour se connecter \u00e0 node38-02. Etc.<\/p>\n<p>Je pr\u00e9cise que ce n&#8217;est pas moi qui l&#8217;ai trouv\u00e9. Vous connaissiez ?<\/p>\n<p>Pr\u00e9cision pour les gens comme A. L. : Mettre un masque qui veut dire qqchose (par exemple *.imag.fr), c&#8217;est une mauvaise id\u00e9e. Regardez par exemple :<\/p>\n<pre>Host *.imag.fr         ProxyCommand ssh login@passerelle.imag.fr \"nc \\$(basename %h .imag.fr) %p\"<\/pre>\n<p>Pourquoi est-ce que \u00e7a ne marche pas comme on s&#8217;y attend ? Quel sera l&#8217;effet vu du client ? Vu du serveur ?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apr\u00e8s GCC et les trampolines, voici les rebonds avec SSH. Ou alors, la super-astuce du jour. Supposez que vous ayez une machine (passerelle, frontal de grappe, etc), avec des machines derri\u00e8re. Plusieurs fois par jour, vous faites : ssh frontal ssh node38-01 Un peu plus tard : ssh frontal ssh node38-02 Pas pratique, hein ? [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"0","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-134","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=134"}],"version-history":[{"count":0,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/134\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}