Skip to content

Commit fe87a44

Browse files
committed
Disable ssh password authentication
1 parent 79a4c84 commit fe87a44

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

scripts/install.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,41 @@ EOF
6868
sudo supervisorctl reread
6969
sudo supervisorctl update
7070

71+
# harden ssh
72+
sudo tee '/etc/ssh/sshd_config' > /dev/null << EOF
73+
Port 22
74+
Protocol 2
75+
HostKey /etc/ssh/ssh_host_rsa_key
76+
HostKey /etc/ssh/ssh_host_dsa_key
77+
HostKey /etc/ssh/ssh_host_ecdsa_key
78+
HostKey /etc/ssh/ssh_host_ed25519_key
79+
UsePrivilegeSeparation yes
80+
KeyRegenerationInterval 3600
81+
ServerKeyBits 1024
82+
SyslogFacility AUTH
83+
LogLevel INFO
84+
LoginGraceTime 120
85+
PermitRootLogin no
86+
StrictModes yes
87+
RSAAuthentication yes
88+
PubkeyAuthentication yes
89+
IgnoreRhosts yes
90+
RhostsRSAAuthentication no
91+
HostbasedAuthentication no
92+
PermitEmptyPasswords no
93+
ChallengeResponseAuthentication no
94+
PasswordAuthentication no
95+
X11Forwarding yes
96+
X11DisplayOffset 10
97+
PrintMotd no
98+
PrintLastLog yes
99+
TCPKeepAlive yes
100+
AcceptEnv LANG LC_*
101+
Subsystem sftp /usr/lib/openssh/sftp-server
102+
UsePAM no
103+
EOF
104+
sudo systemctl reload ssh
105+
71106
# cleanup
72107
sudo apt-get remove -y ${build_dependencies} > /dev/null
73108
sudo apt-get autoremove -y > /dev/null

0 commit comments

Comments
 (0)