Created
May 7, 2022 18:24
-
-
Save suominen/b78a212ceaf61aed378681f7957f75f5 to your computer and use it in GitHub Desktop.
Harden sshd algorithms (EdgeOS 2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Harden sshd algorithms | |
# | |
# EdgeOS 2: | |
# Copy this file to /config/scripts/post-config.d/10-ssh-config | |
# and make sure it is executable (chmod a+rx). | |
# | |
# Auditing ssh servers: https://github.com/jtesta/ssh-audit/ | |
# | |
# 20220507 Kimmo Suominen | |
# | |
cfg=/etc/ssh/sshd_config | |
grep -q '^HostKeyAlgorithms' "${cfg}" || sed -i -e ' | |
/^$/ { | |
i \ | |
HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519\ | |
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512\ | |
MACs umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com | |
} | |
' "${cfg}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment