Scripting Example in comments. Learn to validate entries supplied to a BASH shell script file that can be used to make entries in your SSHD_CONFIG. You will want to use mixed -case entries on the config and will need to convert the case to lowercase to compare against the output of sshd -T
#!/bin/bash
valid_keys=($(sudo sshd -T | awk '{print $1}' | sort -u))
key=$1
key_matched=false
for valid_key in "${valid_keys[@]}"; do
if [ "${key,,}" == $valid_key ]; then
key_matched=true
break
fi
done
if [ $key_matched == true ] ; then
echo "$key is valid"
else
echo "$key is invalid"
fi
Additionally you can find my video courses on Pluralsight: http://pluralsight.com/training/Autho... and take time to see my own site http://www.theurbanpenguin.com
00:00 Introduction
01:48 Validate SSHD Keys
02:18 Print Key Names
02:49 Remove Duplicates
03:10 BASH Array
04:07 Read Array Entries
04:47 Convert Case
06:51 Create Script
On this page of the site you can watch the video online Validate Entries Using BASH Shell Scripting and Convert Case with a duration of hours minute second in good quality, which was uploaded by the user theurbanpenguin 08 March 2024, share the link with friends and acquaintances, this video has already been watched 1,097 times on youtube and it was liked by 70 viewers. Enjoy your viewing!