mirror of
https://github.com/tommytran732/Linux-Setup-Scripts
synced 2024-11-22 09:31:34 -05:00
Update SSH Hardening
This commit is contained in:
parent
ff6e6a57e9
commit
e0d02f1c72
@ -21,7 +21,10 @@ sudo ufw allow OpenSSH
|
|||||||
echo 'GSSAPIAuthentication no
|
echo 'GSSAPIAuthentication no
|
||||||
VerifyHostKeyDNS yes' | sudo tee /etc/ssh/ssh_config.d/10-custom.conf
|
VerifyHostKeyDNS yes' | sudo tee /etc/ssh/ssh_config.d/10-custom.conf
|
||||||
sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
||||||
sudo sed -i 's/#GSSAPIAuthentication no/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
|
echo 'PasswordAuthentication no
|
||||||
|
KerberosAuthentication no
|
||||||
|
GSSAPIAuthentication no' | sudo tee /etc/ssh/sshd_config.d/10-custom.conf
|
||||||
|
sudo chmod 644 /etc/ssh/sshd_config.d/10-custom.conf
|
||||||
sudo mkdir -p /etc/systemd/system/ssh.service.d
|
sudo mkdir -p /etc/systemd/system/ssh.service.d
|
||||||
sudo curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/systemd/system/sshd.service.d/local.conf -o /etc/systemd/system/ssh.service.d/override.conf
|
sudo curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/systemd/system/sshd.service.d/local.conf -o /etc/systemd/system/ssh.service.d/override.conf
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
|
@ -11,8 +11,10 @@ systemctl restart chronyd
|
|||||||
echo 'GSSAPIAuthentication no
|
echo 'GSSAPIAuthentication no
|
||||||
VerifyHostKeyDNS yes' | tee /etc/ssh/ssh_config.d/10-custom.conf
|
VerifyHostKeyDNS yes' | tee /etc/ssh/ssh_config.d/10-custom.conf
|
||||||
sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
||||||
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
|
echo 'PasswordAuthentication no
|
||||||
sed -i 's/#GSSAPIAuthentication no/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
|
KerberosAuthentication no
|
||||||
|
GSSAPIAuthentication no' | sudo tee /etc/ssh/sshd_config.d/10-custom.conf
|
||||||
|
sudo chmod 644 /etc/ssh/sshd_config.d/10-custom.conf
|
||||||
mkdir -p /etc/systemd/system/ssh.service.d
|
mkdir -p /etc/systemd/system/ssh.service.d
|
||||||
curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/systemd/system/sshd.service.d/local.conf -o /etc/systemd/system/ssh.service.d/override.conf
|
curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/systemd/system/sshd.service.d/local.conf -o /etc/systemd/system/ssh.service.d/override.conf
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
@ -19,9 +19,17 @@ mkdir -p /etc/ssh/ssh_config.d /etc/ssh/sshd_config.d
|
|||||||
echo 'GSSAPIAuthentication no
|
echo 'GSSAPIAuthentication no
|
||||||
VerifyHostKeyDNS yes' | sudo tee /etc/ssh/ssh_config.d/10-custom.conf
|
VerifyHostKeyDNS yes' | sudo tee /etc/ssh/ssh_config.d/10-custom.conf
|
||||||
sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
||||||
echo 'X11Forwarding no
|
echo 'HostKey /etc/ssh/ssh_host_ed25519_key
|
||||||
GSSAPIAuthentication no
|
HostKeyAlgorithms ssh-ed25519
|
||||||
PasswordAuthentication no' | sudo tee /etc/ssh/sshd_config.d/10-custom.conf
|
#KexAlgorithms sntrup761x25519-sha512@openssh.com
|
||||||
|
PubkeyAcceptedKeyTypes ssh-ed25519
|
||||||
|
Ciphers aes256-gcm@openssh.com
|
||||||
|
MACs -*
|
||||||
|
PasswordAuthentication no
|
||||||
|
PermitRootLogin no
|
||||||
|
KerberosAuthentication no
|
||||||
|
GSSAPIAuthentication no' | sudo tee /etc/ssh/sshd_config.d/10-custom.conf
|
||||||
|
sudo chmod 644 /etc/ssh/sshd_config.d/10-custom.conf
|
||||||
sudo curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/systemd/system/sshd.service.d/local.conf -o /etc/systemd/system/sshd.service.d/override.conf
|
sudo curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/systemd/system/sshd.service.d/local.conf -o /etc/systemd/system/sshd.service.d/override.conf
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl restart sshd
|
sudo systemctl restart sshd
|
||||||
|
@ -31,6 +31,17 @@ sudo ufw allow OpenSSH
|
|||||||
echo 'GSSAPIAuthentication no
|
echo 'GSSAPIAuthentication no
|
||||||
VerifyHostKeyDNS yes' | sudo tee /etc/ssh/ssh_config.d/10-custom.conf
|
VerifyHostKeyDNS yes' | sudo tee /etc/ssh/ssh_config.d/10-custom.conf
|
||||||
sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
sudo chmod 644 /etc/ssh/ssh_config.d/10-custom.conf
|
||||||
|
echo 'HostKey /etc/ssh/ssh_host_ed25519_key
|
||||||
|
HostKeyAlgorithms ssh-ed25519
|
||||||
|
#KexAlgorithms sntrup761x25519-sha512@openssh.com
|
||||||
|
PubkeyAcceptedKeyTypes ssh-ed25519
|
||||||
|
Ciphers aes256-gcm@openssh.com
|
||||||
|
MACs -*
|
||||||
|
PasswordAuthentication no
|
||||||
|
PermitRootLogin no
|
||||||
|
KerberosAuthentication no
|
||||||
|
GSSAPIAuthentication no' | sudo tee /etc/ssh/sshd_config.d/10-custom.conf
|
||||||
|
sudo chmod 644 /etc/ssh/sshd_config.d/10-custom.conf
|
||||||
sudo mkdir -p /etc/systemd/system/ssh.service.d
|
sudo mkdir -p /etc/systemd/system/ssh.service.d
|
||||||
sudo curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/systemd/system/sshd.service.d/local.conf -o /etc/systemd/system/ssh.service.d/override.conf
|
sudo curl https://raw.githubusercontent.com/GrapheneOS/infrastructure/main/systemd/system/sshd.service.d/local.conf -o /etc/systemd/system/ssh.service.d/override.conf
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
|
Loading…
Reference in New Issue
Block a user