Skip to content

Commit c1e39ad

Browse files
committed
updated kex algorithms to address #3 and #4
1 parent baf011d commit c1e39ad

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,14 @@ curl -sSL akas.io/sshd -o sshd_config
3737
```
3838

3939
It's recommended to use the [ssh-audit](https://github.com/jtesta/ssh-audit) script to check the cryptographic strength of your SSH server after done configuring it.
40+
41+
## Deactivating Short Diffie-Hellman Moduli
42+
43+
Diffie-Hellman moduli used for `diffie-hellman-group-exchange-sha256` should be at lest 3072 bits long according to [Mozilla's OpenSSH server hardening guide](https://infosec.mozilla.org/guidelines/openssh#modern-openssh-67). This can be done with the following commands.
44+
45+
```shell
46+
# find lines with moduli >= 3071 bits and save them to moduli.tmp
47+
awk '$5 >= 3071' /etc/ssh/moduli > /etc/ssh/moduli.tmp
48+
# overwrite original moduli file with the updated one
49+
mv /etc/ssh/moduli.tmp /etc/ssh/moduli
50+
```

sshd_config

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Name: K4YT3X Hardened OpenSSH Configuration
22
# Author: K4YT3X
33
# Date Created: October 5, 2020
4-
# Last Updated: October 10, 2020
4+
# Last Updated: October 15, 2020
55

66
# Licensed under the GNU General Public License Version 3 (GNU GPL v3),
77
# available at: https://www.gnu.org/licenses/gpl-3.0.txt
@@ -98,9 +98,13 @@ PubkeyAuthentication yes
9898
# explicitly define cryptography algorithms to avoid the use of weak algorithms
9999
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
100100
HostKeyAlgorithms rsa-sha2-512,rsa-sha2-256,ssh-ed25519
101-
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256
102101
MACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com
103102

103+
# short moduli should be deactivated before enabling the use of diffie-hellman-group-exchange-sha256
104+
# see this link for more details: https://github.com/k4yt3x/sshd_config#deactivating-short-diffie-hellman-moduli
105+
#KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256
106+
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
107+
104108
########## Connection Preferences ##########
105109

106110
# number of client alive messages sent without client responding

0 commit comments

Comments
 (0)