mirror of
https://github.com/jtesta/ssh-audit.git
synced 2025-02-23 01:45:51 +01:00
Page:
macOS 13 (Ventura) & 14 (Sonoma)
Pages
ArubaOS Switch (AOS S) 16.11
Dropbear 2022.83
Fortinet FortiOS
FreeBSD OpenSSH Hardening Guide ‐ FreeBSD Blog
FreeBSD
Home
Mikrotik RouterOS
OPNsense 20.7 and newer
Proxmox VE 7.3 6
SSH Hardening Guides Index
Synology DSM
Ubuntu 22.04 LTS Client Linux Mint 21 Client
Void Linux
Windows 11
macOS 13 (Ventura) & 14 (Sonoma)
Clone
0
macOS 13 (Ventura) & 14 (Sonoma)
pr3c0g edited this page 2024-08-12 14:27:55 +01:00
Table of Contents
The community has indicated that the following instructions work for macOS 13 (Ventura) and 14 (Sonoma).
Note: all commands below are to be executed as the root user.
- Re-generate the RSA and ED25519 keys
rm /etc/ssh/ssh_host_*
ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N ""
ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ""
- Remove small Diffie-Hellman moduli
awk '$5 >= 3071' /etc/ssh/moduli > /etc/ssh/moduli.safe
mv /etc/ssh/moduli.safe /etc/ssh/moduli
- Enable the RSA and ED25519 HostKey directives in the /etc/ssh/sshd_config file
/usr/bin/sed -i .orig -E 's/^\#(HostKey \/etc\/ssh\/ssh_host_(rsa_key|ed25519_key))/\1/' sshd_config
- Restrict supported key exchange, cipher, and MAC algorithms
[ -d /etc/ssh/sshd_config.d ] || /bin/mkdir etc/ssh/sshd_config.d
echo '
# Restrict key exchange, cipher, and MAC algorithms, as per sshaudit.com
# hardening guide.
KexAlgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha256
Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-128-etm@openssh.com
HostKeyAlgorithms ssh-ed25519,rsa-sha2-512,rsa-sha2-256' > /etc/ssh/sshd_config.d/99_hardening.conf
- Restart OpenSSH server
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd
Validated versions
macOS | ssh-audit |
---|---|
Sonoma 14.0 | master @ 02ab487232de438c0811116f2676cb1c9b5f3d62 |
footer2