<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ivan Khramov</title>
    <description>The latest articles on DEV Community by Ivan Khramov (@mastanggt).</description>
    <link>https://dev.to/mastanggt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F48517%2F0e64d614-09b5-433b-ba00-5fb04bbcd721.jpeg</url>
      <title>DEV Community: Ivan Khramov</title>
      <link>https://dev.to/mastanggt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mastanggt"/>
    <language>en</language>
    <item>
      <title>5-minute SSH proxy setup in a container environment</title>
      <dc:creator>Ivan Khramov</dc:creator>
      <pubDate>Thu, 07 Dec 2017 15:33:23 +0000</pubDate>
      <link>https://dev.to/mastanggt/5-minute-ssh-proxy-setup-in-a-container-environment-32p</link>
      <guid>https://dev.to/mastanggt/5-minute-ssh-proxy-setup-in-a-container-environment-32p</guid>
      <description>&lt;p&gt;I’ll tell you how to pull an ssh from Docker Hub to a docker platform and launch proxy using a couple commands. I did this with &lt;a href="https://containerum.com/" rel="noopener noreferrer"&gt;Containerum&lt;/a&gt;, but I believe the process is more or less the same for other docker platforms, too.&lt;/p&gt;

&lt;p&gt;Basically, what you need to do is pull the SSH image from Docker Hub and deploy it in a container. Then you need to expose the SSH and pull proxy from GitHub. And then you just run your proxy from the inside of the SSH container.&lt;/p&gt;

&lt;p&gt;In this tutorial I used Containerum CLI (&lt;a href="https://github.com/containerum/chkit" rel="noopener noreferrer"&gt;&lt;em&gt;https://github.com/containerum/chkit&lt;/em&gt;&lt;/a&gt;) so keep in mind that commands are platform-specific and vary slightly depending on what platform you are using.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, in my case I had to download and install Containerum CLI (chkit). Then login with
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chkit login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a container with Debian image
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chkit run debian --image hklcf/debian-ssh-docker --port 22 --port 8989 --memory 512Mi --cpu 400m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;22 and 8989 are ports here&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbzlokuri441crvcd3lpu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbzlokuri441crvcd3lpu.png" width="800" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expose your debian container and a port for your proxy
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chkit expose deploy debian -p ssh:22:TCP -p proxy:8989:TCP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Check the mapping ports with
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chkit get svc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see, 22 is mapped to 34441. And 8989 is mapped to 27471.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwvm8l6ieubxxwtivtnl3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwvm8l6ieubxxwtivtnl3.png" width="800" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Next - login to SSH. To do so, enter your IP and port of the service - in the case above our IP is x3.containerum.io, SSH port is 34441. The default user and password for this image is “root / password”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update the system and install wget with&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt &lt;span class="nb"&gt;install &lt;/span&gt;wget
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Then install proxy with
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wget &lt;span class="nt"&gt;--no-check-certificate&lt;/span&gt; &lt;span class="nt"&gt;-O&lt;/span&gt; shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x shadowsocks-all.sh &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ./shadowsocks-all.sh 2&amp;gt;&amp;amp;1 | &lt;span class="nb"&gt;tee &lt;/span&gt;shadowsocks-all.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fto2f0nku6nqwnyoxz8jx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fto2f0nku6nqwnyoxz8jx.png" width="800" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally, configure your proxy server and your shadowsocks client and enjoy!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;P.S. If you have any questions or know a better way to launch an SSH proxy server in containers, comment below!&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>beginners</category>
      <category>devops</category>
      <category>docker</category>
    </item>
  </channel>
</rss>
