77#
88# Version: v1.1.2
99# License: MIT License
10- # Copyright (c) 2020-2023 Hunter T. (StrangeRanger)
10+ # Copyright (c) 2020-2024 Hunter T. (StrangeRanger)
1111#
1212# #######################################################################################
13- # ### [ Variables ]
13+ # ###[ Script Wide Variables ]###########################################################
1414
1515
1616config_file_bak=" /etc/ssh/sshd_config.bak"
@@ -21,27 +21,25 @@ red="$(printf '\033[1;31m')"
2121nc=" $( printf ' \033[0m' ) "
2222
2323
24- # ### End of [ Variables ]
25- # #######################################################################################
26- # ### [ Functions ]
24+ # ###[ Functions ]#######################################################################
2725
2826
29- # #######
27+ # ###
3028# Cleanly exit the script.
3129#
3230# Arguments:
33- # $1 - required
34- # Exit status code.
35- # #######
31+ # - $1: exit_code (Required)
32+ # - Description: The exit code to exit the script with .
33+ # ###
3634clean_up () {
35+ local exit_code=" $1 "
36+
3737 echo -e " \nExiting..."
38- exit " $1 "
38+ exit " $exit_code "
3939}
4040
4141
42- # ### End of [ Functions ]
43- # #######################################################################################
44- # ### [ Prepping ]
42+ # ###[ Prepping ]########################################################################
4543
4644
4745# # Check if the script was executed with root privilege.
@@ -58,9 +56,7 @@ if [[ ! -f $config_file ]]; then
5856fi
5957
6058
61- # ### End of [ Prepping ]
62- # #######################################################################################
63- # ### [ Main ]
59+ # ###[ Main ]###########################################################################
6460
6561
6662read -rp " We will now harden sshd. Press [Enter] to continue."
@@ -244,7 +240,3 @@ echo -e "${cyan}It is highly recommended to manually:
2442401) Change the default sshd port (22)
2452412) Disable PasswordAuthentication in favor of PubkeyAuthentication
2462423) Add 'AllowUsers [your username]' to the bottom of 'sshd_config'${nc} "
247-
248-
249- # ### End of [ Main ]
250- # #######################################################################################
0 commit comments