|
@@ -4260,10 +4260,6 @@ function configure_ssh {
|
4260
|
4260
|
# see https://stribika.github.io/2015/01/04/secure-secure-shell.html
|
4261
|
4261
|
function ssh_remove_small_moduli {
|
4262
|
4262
|
awk '$5 > 2000' /etc/ssh/moduli > ~/moduli
|
4263
|
|
- if [[ $((wc -l ~/moduli | awk -F ' ' '{print $1}')) < 150 ]]; then
|
4264
|
|
- echo 'Not enough moduli > 2000'
|
4265
|
|
- exit 57824
|
4266
|
|
- fi
|
4267
|
4263
|
mv ~/moduli /etc/ssh/moduli
|
4268
|
4264
|
}
|
4269
|
4265
|
|
|
@@ -4271,24 +4267,32 @@ function configure_ssh_client {
|
4271
|
4267
|
if grep -Fxq "configure_ssh_client" $COMPLETION_FILE; then
|
4272
|
4268
|
return
|
4273
|
4269
|
fi
|
4274
|
|
- #sed 's/# PasswordAuthentication.*/ PasswordAuthentication no/g' /etc/ssh/ssh_config
|
4275
|
|
- #sed 's/# ChallengeResponseAuthentication.*/ ChallengeResponseAuthentication no/g' /etc/ssh/ssh_config
|
4276
|
|
- sed "s/# HostKeyAlgorithms.*/ HostKeyAlgorithms $SSH_HOST_KEY_ALGORITHMS/g" /etc/ssh/ssh_config
|
4277
|
|
- sed "s/# Ciphers.*/ Ciphers $SSH_CIPHERS/g" /etc/ssh/ssh_config
|
4278
|
|
- sed "s/# MACs.*/ MACs $SSH_MACS/g" /etc/ssh/ssh_config
|
|
4270
|
+ #sed -i 's/# PasswordAuthentication.*/ PasswordAuthentication no/g' /etc/ssh/ssh_config
|
|
4271
|
+ #sed -i 's/# ChallengeResponseAuthentication.*/ ChallengeResponseAuthentication no/g' /etc/ssh/ssh_config
|
|
4272
|
+ sed -i "s/# HostKeyAlgorithms.*/ HostKeyAlgorithms $SSH_HOST_KEY_ALGORITHMS/g" /etc/ssh/ssh_config
|
|
4273
|
+ sed -i "s/# Ciphers.*/ Ciphers $SSH_CIPHERS/g" /etc/ssh/ssh_config
|
|
4274
|
+ sed -i "s/# MACs.*/ MACs $SSH_MACS/g" /etc/ssh/ssh_config
|
4279
|
4275
|
if ! grep -q "HostKeyAlgorithms" /etc/ssh/ssh_config; then
|
4280
|
4276
|
echo " HostKeyAlgorithms $SSH_HOST_KEY_ALGORITHMS" >> /etc/ssh/ssh_config
|
4281
|
4277
|
fi
|
4282
|
|
- sed "s/Ciphers.*/Ciphers $SSH_CIPHERS/g" /etc/ssh/ssh_config
|
|
4278
|
+ sed -i "s/Ciphers.*/Ciphers $SSH_CIPHERS/g" /etc/ssh/ssh_config
|
4283
|
4279
|
if ! grep -q "Ciphers " /etc/ssh/ssh_config; then
|
4284
|
4280
|
echo " Ciphers $SSH_CIPHERS" >> /etc/ssh/ssh_config
|
4285
|
4281
|
fi
|
4286
|
|
- sed "s/MACs.*/MACs $SSH_MACS/g" /etc/ssh/ssh_config
|
|
4282
|
+ sed -i "s/MACs.*/MACs $SSH_MACS/g" /etc/ssh/ssh_config
|
4287
|
4283
|
if ! grep -q "MACs " /etc/ssh/ssh_config; then
|
4288
|
4284
|
echo " MACs $SSH_MACS" >> /etc/ssh/ssh_config
|
4289
|
4285
|
fi
|
4290
|
|
- ssh-keygen -t ed25519 -o -a 100
|
4291
|
|
- ssh-keygen -t rsa -b 4096 -o -a 100
|
|
4286
|
+
|
|
4287
|
+ # Create ssh keys
|
|
4288
|
+ if [ ! -f ~/.ssh/id_ed25519 ]; then
|
|
4289
|
+ ssh-keygen -t ed25519 -o -a 100
|
|
4290
|
+ fi
|
|
4291
|
+ if [ ! -f ~/.ssh/id_rsa ]; then
|
|
4292
|
+ ssh-keygen -t rsa -b 4096 -o -a 100
|
|
4293
|
+ fi
|
|
4294
|
+
|
|
4295
|
+ ssh_remove_small_moduli
|
4292
|
4296
|
echo 'configure_ssh_client' >> $COMPLETION_FILE
|
4293
|
4297
|
}
|
4294
|
4298
|
|