<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.fsinf.at/index.php?action=history&amp;feed=atom&amp;title=SSH-Hardening</id>
	<title>SSH-Hardening - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.fsinf.at/index.php?action=history&amp;feed=atom&amp;title=SSH-Hardening"/>
	<link rel="alternate" type="text/html" href="https://wiki.fsinf.at/index.php?title=SSH-Hardening&amp;action=history"/>
	<updated>2026-05-10T17:34:25Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://wiki.fsinf.at/index.php?title=SSH-Hardening&amp;diff=1345&amp;oldid=prev</id>
		<title>Someone am 7. Februar 2023 um 17:47 Uhr</title>
		<link rel="alternate" type="text/html" href="https://wiki.fsinf.at/index.php?title=SSH-Hardening&amp;diff=1345&amp;oldid=prev"/>
		<updated>2023-02-07T17:47:51Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Based on https://stribika.github.io/2015/01/04/secure-secure-shell.html (with a stripped down list of Ciphers and MACs)&lt;br /&gt;
&lt;br /&gt;
=== Server configuration ===&lt;br /&gt;
&lt;br /&gt;
Remove all &amp;lt;code&amp;gt;HostKey&amp;lt;/code&amp;gt; directives in &amp;lt;code&amp;gt;/etc/ssh/sshd_config&amp;lt;/code&amp;gt;, then append at the bottom:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# SSH hardening, see https://wiki.fsinf.at/wiki/SSH-Hardening&lt;br /&gt;
&lt;br /&gt;
# Disable SSHv1&lt;br /&gt;
Protocol 2&lt;br /&gt;
&lt;br /&gt;
# Only allow Public Key Authentication&lt;br /&gt;
PubkeyAuthentication yes&lt;br /&gt;
PasswordAuthentication no&lt;br /&gt;
ChallengeResponseAuthentication no&lt;br /&gt;
&lt;br /&gt;
# Only allow users in the &amp;quot;users&amp;quot; group (no system users!).&lt;br /&gt;
# NOTE: See /etc/adduser.conf (EXTRA_GROUPS and ADD_EXTRA_GROUPS) to &lt;br /&gt;
# automatically add new non-system users to a group.&lt;br /&gt;
AllowGroups users&lt;br /&gt;
 &lt;br /&gt;
# Don&amp;#039;t forget to remove HostKey directives above&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
HostKey /etc/ssh/ssh_host_ed25519_key&lt;br /&gt;
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256&lt;br /&gt;
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr&lt;br /&gt;
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
... and execute:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/ssh/&lt;br /&gt;
 rm ssh_host_*&lt;br /&gt;
 ssh-keygen -t rsa -b 4096 -f ssh_host_rsa_key -N &amp;quot;&amp;quot;&lt;br /&gt;
 ssh-keygen -t ed25519 -f ssh_host_ed25519_key -N &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===== restart server =====&lt;br /&gt;
&lt;br /&gt;
When restarting, current session is not affected, make sure you keep it open, in case you&amp;#039;ve done something wrong:&lt;br /&gt;
&lt;br /&gt;
 systemctl restart sshd&lt;br /&gt;
&lt;br /&gt;
=== Client configuration ===&lt;br /&gt;
&lt;br /&gt;
On top of your &amp;lt;code&amp;gt;~/.ssh/config&amp;lt;/code&amp;gt;, add:&lt;br /&gt;
&lt;br /&gt;
 Host *&lt;br /&gt;
 KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1&lt;br /&gt;
 Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr&lt;br /&gt;
 MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160&lt;br /&gt;
&lt;br /&gt;
Note that we add diffie-hellman-group-exchange-sha256 in comparison to the server config - this is for comparability with Ubuntu 12.04 (remove it if you don&amp;#039;t care).&lt;br /&gt;
&lt;br /&gt;
If possible, you can also regenerate your own SSH keys:&lt;br /&gt;
&lt;br /&gt;
 ssh-keygen -t ed25519 -o -a 100&lt;br /&gt;
 ssh-keygen -t rsa -b 4096 -o -a 100&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;WARNING:&amp;#039;&amp;#039;&amp;#039; This overwrites your old keys if you&amp;#039;re not careful. If you don&amp;#039;t add a new key to your servers before removing the old ones, you&amp;#039;re locked out.&lt;br /&gt;
&lt;br /&gt;
=== Sources ===&lt;br /&gt;
* https://cipherli.st/&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;old, from 2015:&amp;#039;&amp;#039;&amp;#039; https://stribika.github.io/2015/01/04/secure-secure-shell.html&lt;br /&gt;
&lt;br /&gt;
[[Kategorie:FOSS]]&lt;br /&gt;
[[Kategorie:Linux]]&lt;/div&gt;</summary>
		<author><name>Someone</name></author>
	</entry>
</feed>