|
@@ -263,6 +263,11 @@ SSL_PROTOCOLS="TLSv1 TLSv1.1 TLSv1.2"
|
263
|
263
|
# list of ciphers to use. See bettercrypto.org recommendations
|
264
|
264
|
SSL_CIPHERS="EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA"
|
265
|
265
|
|
|
266
|
+# ssh ciphers
|
|
267
|
+SSH_CIPHERS="Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr"
|
|
268
|
+SSH_MACS="MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160"
|
|
269
|
+SSH_KEX="KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1"
|
|
270
|
+
|
266
|
271
|
# the default email address
|
267
|
272
|
MY_EMAIL_ADDRESS=$MY_USERNAME@$DOMAIN_NAME
|
268
|
273
|
|
|
@@ -3155,18 +3160,39 @@ function configure_ssh {
|
3155
|
3160
|
if grep -Fxq "configure_ssh" $COMPLETION_FILE; then
|
3156
|
3161
|
return
|
3157
|
3162
|
fi
|
3158
|
|
- sed -i "s/Port 22/Port $SSH_PORT/g" /etc/ssh/sshd_config
|
3159
|
|
- sed -i 's/PermitRootLogin without-password/PermitRootLogin no/g' /etc/ssh/sshd_config
|
3160
|
|
- sed -i 's/X11Forwarding yes/X11Forwarding no/g' /etc/ssh/sshd_config
|
3161
|
|
- sed -i 's/ServerKeyBits 1024/ServerKeyBits 4096/g' /etc/ssh/sshd_config
|
3162
|
|
- sed -i 's/TCPKeepAlive yes/TCPKeepAlive no/g' /etc/ssh/sshd_config
|
|
3163
|
+ sed -i "s/Port .*/Port $SSH_PORT/g" /etc/ssh/sshd_config
|
|
3164
|
+ sed -i 's/PermitRootLogin.*/PermitRootLogin no/g' /etc/ssh/sshd_config
|
|
3165
|
+ sed -i 's/X11Forwarding.*/X11Forwarding no/g' /etc/ssh/sshd_config
|
|
3166
|
+ sed -i 's/ServerKeyBits.*/ServerKeyBits 4096/g' /etc/ssh/sshd_config
|
|
3167
|
+ sed -i 's/TCPKeepAlive.*/TCPKeepAlive no/g' /etc/ssh/sshd_config
|
3163
|
3168
|
sed -i 's|HostKey /etc/ssh/ssh_host_dsa_key|#HostKey /etc/ssh/ssh_host_dsa_key|g' /etc/ssh/sshd_config
|
3164
|
3169
|
sed -i 's|HostKey /etc/ssh/ssh_host_ecdsa_key|#HostKey /etc/ssh/ssh_host_ecdsa_key|g' /etc/ssh/sshd_config
|
3165
|
|
- echo 'ClientAliveInterval 60' >> /etc/ssh/sshd_config
|
3166
|
|
- echo 'ClientAliveCountMax 3' >> /etc/ssh/sshd_config
|
3167
|
|
- echo 'Ciphers aes256-ctr,aes128-ctr' >> /etc/ssh/sshd_config
|
3168
|
|
- echo 'MACs hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
|
3169
|
|
- KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1' >> /etc/ssh/sshd_config
|
|
3170
|
+ if grep -q 'ClientAliveInterval' /etc/ssh/sshd_config; then
|
|
3171
|
+ sed -i 's/ClientAliveInterval.*/ClientAliveInterval 60/g' /etc/ssh/sshd_config
|
|
3172
|
+ else
|
|
3173
|
+ echo 'ClientAliveInterval 60' >> /etc/ssh/sshd_config
|
|
3174
|
+ fi
|
|
3175
|
+ if grep -q 'ClientAliveCountMax' /etc/ssh/sshd_config; then
|
|
3176
|
+ sed -i 's/ClientAliveCountMax.*/ClientAliveCountMax 3/g' /etc/ssh/sshd_config
|
|
3177
|
+ else
|
|
3178
|
+ echo 'ClientAliveCountMax 3' >> /etc/ssh/sshd_config
|
|
3179
|
+ fi
|
|
3180
|
+ if grep -q 'Ciphers' /etc/ssh/sshd_config; then
|
|
3181
|
+ sed -i "s|Ciphers.*|Ciphers $SSH_CIPHERS|g" /etc/ssh/sshd_config
|
|
3182
|
+ else
|
|
3183
|
+ echo "Ciphers $SSH_CIPHERS" >> /etc/ssh/sshd_config
|
|
3184
|
+ fi
|
|
3185
|
+ if grep -q 'MACs' /etc/ssh/sshd_config; then
|
|
3186
|
+ sed -i "s|MACs.*|MACs $SSH_MACS|g" /etc/ssh/sshd_config
|
|
3187
|
+ else
|
|
3188
|
+ echo "MACs $SSH_MACS" >> /etc/ssh/sshd_config
|
|
3189
|
+ fi
|
|
3190
|
+ if grep -q 'KexAlgorithms' /etc/ssh/sshd_config; then
|
|
3191
|
+ sed -i "s|KexAlgorithms.*|KexAlgorithms $SSH_KEX|g" /etc/ssh/sshd_config
|
|
3192
|
+ else
|
|
3193
|
+ echo "KexAlgorithms $SSH_KEX" >> /etc/ssh/sshd_config
|
|
3194
|
+ fi
|
|
3195
|
+
|
3170
|
3196
|
apt-get -y --force-yes install fail2ban
|
3171
|
3197
|
echo 'configure_ssh' >> $COMPLETION_FILE
|
3172
|
3198
|
# Don't reboot if installing within docker
|