<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pessinurmi.com/index.php?action=history&amp;feed=atom&amp;title=SSH-Harden</id>
	<title>SSH-Harden - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pessinurmi.com/index.php?action=history&amp;feed=atom&amp;title=SSH-Harden"/>
	<link rel="alternate" type="text/html" href="https://wiki.pessinurmi.com/index.php?title=SSH-Harden&amp;action=history"/>
	<updated>2026-06-06T11:56:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.pessinurmi.com/index.php?title=SSH-Harden&amp;diff=369&amp;oldid=prev</id>
		<title>Exf at 07:18, 17 October 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.pessinurmi.com/index.php?title=SSH-Harden&amp;diff=369&amp;oldid=prev"/>
		<updated>2022-10-17T07:18:43Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 07:18, 17 October 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l43&quot;&gt;Line 43:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 43:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*PermitRootLogin no&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*PermitRootLogin no&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Then restart ssh &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pavelu &lt;/del&gt;&amp;lt;code&amp;gt;sudo service ssh restart&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Then restart ssh &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;service &lt;/ins&gt;&amp;lt;code&amp;gt;sudo service ssh restart&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You can then submit the task for evaluation.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You can then submit the task for evaluation.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-358:rev-369:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Exf</name></author>
	</entry>
	<entry>
		<id>https://wiki.pessinurmi.com/index.php?title=SSH-Harden&amp;diff=358&amp;oldid=prev</id>
		<title>Exf at 15:17, 13 October 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.pessinurmi.com/index.php?title=SSH-Harden&amp;diff=358&amp;oldid=prev"/>
		<updated>2022-10-13T15:17:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:17, 13 October 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Ssh-Task.PNG|thumb|SSH Task]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Ssh-wget.PNG|thumb|wget]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Ssh-copy-id.PNG|thumb|ssh-copy-id]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Chmod-and-connection.PNG|thumb|chmod and connecting without password]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Sshd config.PNG|thumb|sshd_cofig]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Description===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Description===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;During regular system audits, it was dicovered that one of the systems does not meet the organization security baseline.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;During regular system audits, it was dicovered that one of the systems does not meet the organization security baseline.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-352:rev-358:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Exf</name></author>
	</entry>
	<entry>
		<id>https://wiki.pessinurmi.com/index.php?title=SSH-Harden&amp;diff=352&amp;oldid=prev</id>
		<title>Exf: Created page with &quot;===Description=== During regular system audits, it was dicovered that one of the systems does not meet the organization security baseline. Thereforce this system must be hardened.  200pts ===Question=== Harden the SSH configuration so that it meets the baseline.  *Make sure that root login is disabled *Disable password authentication  Add this [public key] so that the user: sysadmin is able to log in with their [private key] ===Solution=== To be on the safe side, I initi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.pessinurmi.com/index.php?title=SSH-Harden&amp;diff=352&amp;oldid=prev"/>
		<updated>2022-10-13T15:13:05Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;===Description=== During regular system audits, it was dicovered that one of the systems does not meet the organization security baseline. Thereforce this system must be hardened.  200pts ===Question=== Harden the SSH configuration so that it meets the baseline.  *Make sure that root login is disabled *Disable password authentication  Add this [public key] so that the user: sysadmin is able to log in with their [private key] ===Solution=== To be on the safe side, I initi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;===Description===&lt;br /&gt;
During regular system audits, it was dicovered that one of the systems does not meet the organization security baseline.&lt;br /&gt;
Thereforce this system must be hardened.&lt;br /&gt;
&lt;br /&gt;
200pts&lt;br /&gt;
===Question===&lt;br /&gt;
Harden the SSH configuration so that it meets the baseline.&lt;br /&gt;
&lt;br /&gt;
*Make sure that root login is disabled&lt;br /&gt;
*Disable password authentication&lt;br /&gt;
&lt;br /&gt;
Add this [public key] so that the user: sysadmin is able to log in with their [private key]&lt;br /&gt;
===Solution===&lt;br /&gt;
To be on the safe side, I initially opened two ssh connections, because especially when you make changes to the ssh server settings, you can accidentally log yourself out of the whole server.&lt;br /&gt;
&lt;br /&gt;
Next, I downloaded both the private key and the public key to the .ssh folder on the local machine. Next, I used &amp;lt;code&amp;gt;ssh-copy-ip -i /root/.ssh/id_rsa.pub -p2224 sysadmin@env002.target02&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Before you can connect to the server you need to change the permissions on the private key. &amp;lt;code&amp;gt;chmod 600 id_rsa&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, you can try connecting to the server without a password with &amp;lt;code&amp;gt;ssh sysadmin@env002.target02 -p2224&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have connected to the server you can start changing the ssh service settings. The first thing to do is to copy the original configuration file, so that the incorrectly configured settings can be restored if necessary.&lt;br /&gt;
&lt;br /&gt;
The server ssh configuration can be found at&amp;lt;code&amp;gt;/etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, you can try connecting to the server without a password with &amp;lt;code&amp;gt;ssh sysadmin@env002.target02 -p2224&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have connected to the server you can start changing the ssh service settings. The first thing to do is to copy the original configuration file, so that the incorrectly configured settings can be restored if necessary.&lt;br /&gt;
&lt;br /&gt;
The server ssh configuration can be found at&amp;lt;code&amp;gt;/etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make a copy of the file, then edit the sshd_config file.&lt;br /&gt;
&lt;br /&gt;
Add the following settings to the file&lt;br /&gt;
*PasswordAuthentication no&lt;br /&gt;
*UsePAM no&lt;br /&gt;
*PermitRootLogin no&lt;br /&gt;
&lt;br /&gt;
Then restart ssh pavelu &amp;lt;code&amp;gt;sudo service ssh restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can then submit the task for evaluation.&lt;br /&gt;
===Tools===&lt;br /&gt;
*ssh&lt;br /&gt;
*nano&lt;br /&gt;
*cp&lt;br /&gt;
*ssh-copy-id&lt;br /&gt;
===Flag===&lt;br /&gt;
&lt;br /&gt;
===Links===&lt;br /&gt;
*[[CTF Challenges | Back to CTF Challenges page]]&lt;/div&gt;</summary>
		<author><name>Exf</name></author>
	</entry>
</feed>