<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SSH &#8211; SophieDogg</title>
	<atom:link href="https://sophiedogg.com/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>https://sophiedogg.com</link>
	<description>Dogg of all trades, Master of no one.</description>
	<lastBuildDate>Sat, 09 Oct 2021 12:02:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6</generator>
	<item>
		<title>SSH Proxy Through Multiple Servers</title>
		<link>https://sophiedogg.com/ssh-proxy-through-multiple-servers/</link>
		
		<dc:creator><![CDATA[SophieDogg]]></dc:creator>
		<pubDate>Fri, 30 Aug 2013 17:26:10 +0000</pubDate>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[SSH]]></category>
		<guid isPermaLink="false">http://sophiedogg.com/?p=877</guid>

					<description><![CDATA[Yesterday, a young pup at the pound asked me about hopping a proxy across multiple machines. Well, running a SOCKS5 proxy through multiple SSH servers isn&#8217;t all that hard, and can be fun at the same time! Today we will take a look at how to proxy through one or more SSH servers! First, let&#8217;s [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Yesterday, a young pup at the pound asked me about hopping a proxy across multiple machines.  Well, running a SOCKS5 proxy through multiple SSH servers isn&#8217;t all that hard, and can be fun at the same time!  Today we will take a look at how to proxy through one or more SSH servers! <span id="more-877"></span></p>
<p>First, let&#8217;s check our IP address, so we can verify that our proxy is working later on.  If we go to <a href="https://www.google.com" title="Google" target="_blank" rel="noopener">Google</a> and type &#8220;what is my ip&#8221; the Google will be nice enough to tell us!</p>
<p><a href="https://sophiedogg.com/wp-content/uploads/2013/01/tunnel1.png"><img fetchpriority="high" decoding="async" src="https://sophiedogg.com/wp-content/uploads/2013/01/tunnel1.png" alt="tunnel1" width="800" height="188" class="aligncenter size-full wp-image-879" srcset="https://sophiedogg.com/wp-content/uploads/2013/01/tunnel1.png 800w, https://sophiedogg.com/wp-content/uploads/2013/01/tunnel1-300x70.png 300w" sizes="(max-width: 800px) 100vw, 800px" /></a></p>
<p>Next, you will need access to one or more SSH servers that allow proxying.  You can do a search for <a href="https://www.google.com/search?q=free+ssh+proxy" title="Free SSH Proxy" target="_blank" rel="noopener">free ssh proxy</a> and hopefully get a list of servers that you can use for this exercise.  It is becoming harder to get free SSH proxy&#8217;s, so you might have to make friends with a server admin in order to get an account&#8230;</p>
<p>Let&#8217;s make our initial connection, by running the following command:</p>
<pre>ssh -2 -C -D 55555 -L 55556:127.0.0.1:55556 -L 55557:127.0.0.1:55557 user1@host1.domain-one.tld</pre>
<p>(If you are on a Windows machine using <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" title="Putty" target="_blank" rel="noopener">PuTTY</a>, you can create a shortcut to the putty.exe file with the same flags)<br />
This will create our initial connection with a SOCKS proxy on port 55555, while allowing two more forwards for additional servers.  If you wanted, you could create additional -L PORT:127.0.0.1:PORT combinations to add additional servers.</p>
<p>The first <tt>-D 55555</tt> in the initial connection string above creates our first proxy forward to the first destination server (host1.domain-one.tld in the example above).  The following <tt>-L 55556:127.0.0.1:55556</tt> lets us forward through port 55556.  Similarly, the <tt>-L 55557:127.0.0.1:55557</tt> lets us create another forwarding hop.</p>
<p>If you now use port 55555 in your proxy configuration with the SOCKS host set as localhost, you will be forwarding your traffic through the SOCKS proxy connection we just created!  You can verify this by again going to <a href="https://www.google.com" title="Google" target="_blank" rel="noopener">Google</a> and searching &#8220;what is my ip&#8221;.</p>
<p>Next, from the SSH connection of our first server, we will open a proxy to our second server like this:</p>
<pre>ssh -2 -C -D 55556 -L 55557:127.0.0.1:55557 user2@host2.domain-two.tld</pre>
<p>This will create a SOCKS proxy through our second server on port 55556.  Now, all we have to do is change our SOCKS port to use 55556, and we will be going through two hosts!  Again, you can verify this with <a href="https://www.google.com" title="Google" target="_blank" rel="noopener">Google</a>.</p>
<p>Finally, from this second SSH connection, we will open a third connection, like so:</p>
<pre>ssh -2 -C -D 55557 user3@host3.domain-three.tld</pre>
<p>Using port 55557, we will now have a proxy going through all three servers!  Also, you can simply change the port, and change which server is your exit node.</p>
<p>That was pretty easy!  If you are using Firefox, it is really easy to change the proxy setup within the Options &#8211; Advanced &#8211; Network &#8211; Connection Settings menu.  Just use the manual proxy configuration, with 127.0.0.1 as the SOCKS host, and one of the ports from above.</p>
<p>Finally, here is what the three connection strings look like.  You should be able to figure out how to add extra hops!</p>
<pre>ssh -2 -C -D 55557 -L 55556:127.0.0.1:55556 -L 55555:127.0.0.1:55555 user1@host1.domain-one.tld
ssh -2 -C -D 55556 -L 55555:127.0.0.1:55555 user2@host2.domain-two.tld
ssh -2 -C -D 55555 user3@host3.domain-three.tld</pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Configuring SSH on a New Server</title>
		<link>https://sophiedogg.com/configuring-ssh-on-a-new-server/</link>
					<comments>https://sophiedogg.com/configuring-ssh-on-a-new-server/#comments</comments>
		
		<dc:creator><![CDATA[SophieDogg]]></dc:creator>
		<pubDate>Tue, 12 Apr 2011 17:21:14 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[SSH]]></category>
		<guid isPermaLink="false">http://sophiedogg.com/?p=58</guid>

					<description><![CDATA[I recently showed everyone how to install a new CentOS server, and now that we have a running system, we need to do some basic configuration to SSH to make sure our server is secure. When you install your operating system, you should have created an initial root password. We will use this to log [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I recently showed everyone how to install a new CentOS server, and now that we have a running system, we need to do some basic configuration to SSH to make sure our server is secure.  When you install your operating system, you should have created an initial root password.  We will use this to log in to our system and start configuration.</p>
<p>One of the first things we need to do is <span id="more-58"></span> create a user account for our self.  Whenever we are logged in, we should be a normal user, not a super-user!  This is one of the biggest problems with Windows operating systems; normal users are given administrative privileges by default.  When you download something malicious on a Windows PC, the malicious software can easily wreak havoc on your computer, because you have the permissions necessary to do so!  Under Linux, we are just a normal user, and only request administrative (root) privileges when necessary.  This way, even if I did download a virus on my Linux machine, unless I executed the virus as root, there is very little damage that the virus can do, because my normal user only has a restricted set of privileges.</p>
<p>Create a new user using the <code>useradd</code> command.  This will allow us to add a new user, and then we can create a password for this new user using the <code>passwd</code> command.  So, go ahead and create a new account for yourself, as I am doing below.  Replace [username] with your desired username.  Remember that we have to be an administrative (root) user to run the useradd command.</p>
<pre>[root@machine ~]# useradd [username]
[root@machine ~]# passwd [username]
Changing password for user username.
New UNIX Password:
Retype new UNIX password:
Passwd: all authentication tokens updated successfully.
[root@machine ~]#</pre>
<p>Next, we will need to enable sudo access for our newly created user, so that we will still be able to run commands as root.  To do this, run the <code>visudo</code> command, and add the following line to the bottom of the file, replacing [username] with the username you created above.</p>
<pre>[username]		ALL=(ALL)	ALL</pre>
<p>The <code>visudo</code> command will have you editing the sudoers file with the vi editor.  If you&#8217;re not familiar with vi, here are some basics.  Pressing <code>i</code> will put you into insert mode, where you can make changes much like any other editor.  Pressing <code>esc</code> will take you out of the editor mode.  You can then type <code>:wq!</code> to write your changes and exit, or just <code>:q!</code> to quit without saving.</p>
<p>Now that we have our own user account set up, and our user has sudo access, we want to disable root SSH logins.  Script kiddies will often search for machines configured with weak root passwords, and gain access using a brute-force or dictionary password attack.  I&#8217;ve seen it before; <code>wallpaper</code> isn&#8217;t a very good choice for a root password&#8230;  But for some extra security, lets disable the ability of root logging on via SSH.</p>
<p>First, open <code>/etc/ssh/sshd_config</code> in your favorite text editor, and find the line containing <code>PermitRootLogin</code> and change the entire line to this:</p>
<pre>PermitRootLogin no</pre>
<p>Now, to make our changes to the sshd_config file take effect, we must restart the SSHD service.  Run a simple <code>service sshd restart</code> as root, and you should see something like this:</p>
<pre>[root@machine ~]# service sshd restart
Stopping sshd:								[  OK  ]
Starting sshd:								[  OK  ]
[root@machine ~]#</pre>
<p>Now, before going any further, test that you can log in with the account that you created earlier, and that you can use the <code>sudo -i</code> command to enter an interactive sudo session.  If everything is working, then lets keep going! BARK!</p>
<p>Next, we can optionally change the port that SSH is listening on.  There are some pro&#8217;s and con&#8217;s of changing the port.  We can hopefully avoid some of the script kiddies who are only scanning port 22.  This won&#8217;t keep any determined hacker from finding the port number with a simple <code>nmap</code> command however.  Also, if you change the port, keep the port number below 1024.  Only users in the root group can listen on ports below 1024, so a standard user can&#8217;t replace our SSH daemon with their own, listening to incoming requests, stealing passwords, etc.</p>
<p>To change the SSH listening port, open <code>/etc/ssh/sshd_config</code> in your favorite text editor, find the <code>Port 22</code> line, and change it to look like the line below:</p>
<pre>Port 1000</pre>
<p>This will have our SSHD server listening to port 1000 for SSH connections.  Note that we must again restart the sshd service for our changes to take effect.</p>
<p>That should take care of securing our SSHD configuration.  Next time we can work on configuring our firewall!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sophiedogg.com/configuring-ssh-on-a-new-server/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
